/* The endeavor pages. Everything else is in style.css. */
.page { display: grid; gap: 20px; }
.page > *, .level > *, .endeavors > * { min-width: 0; }
:where(.page ul, .page dl, .page dd) { margin: 0; padding: 0; list-style: none; }
.page-head { display: flex; align-items: center; gap: 4px 10px; min-height: 44px; }
.page-head .button { margin-left: auto; }
.page-head .back { margin: 0 -2px 0 -12px; }
/* The label moves below the name if they do not fit side by side. */
.page-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.page-title { min-width: 0; font-size: 26px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.box-title { font-size: 18px; letter-spacing: -.01em; overflow-wrap: anywhere; }
h4 { margin: 0; color: var(--soft); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.page small { color: var(--soft); font-size: 13px; }
.good { color: var(--good); }
.bad { color: var(--danger); }
.none { color: var(--soft); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.section-head > :first-child { min-width: 0; }
.section-head .buttons { flex: none; }
.section-head + h4 { margin-top: 8px; }
.section-head .icon-button { margin-right: -8px; }
.buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page .button.small { font-size: 14px; }
.more { margin-top: 12px; }
.rows + .more { margin-top: 20px; }
.level { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 20px; }
/* One across, or two on a computer. An odd one at the end fills its row, so there is never an empty half. */
.two-across { display: grid; grid-template-columns: minmax(0, 1fr); }
.task-cards { gap: 10px; margin-top: 12px; }

/* Rows */
.rows { margin: 8px 0 -8px; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.top-row { align-items: flex-start; }
.row .icon-button { margin-right: -8px; }
.row-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-title { display: block; font-weight: 600; }
.row.done .row-title { color: var(--soft); font-weight: 500; text-decoration: line-through; }
.note { padding: 9px 0; white-space: pre-wrap; }
.link { display: flex; align-items: center; gap: 10px; min-height: 40px; color: var(--accent); font-weight: 600; }
.link span { min-width: 0; }
.amount { font-weight: 700; white-space: nowrap; }
.tick {
  position: relative; display: grid; place-items: center; flex: none; width: 24px; height: 24px;
  border: 2px solid var(--field-line); border-radius: 7px; color: transparent;
}
.tick::after { content: ""; position: absolute; inset: -10px; }
.tick[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--card); }
/* The date moves below the title if that would leave the title too narrow. */
.due-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.due-row > :first-child { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
.goal { display: grid; grid-template-columns: auto minmax(60px, 1fr); align-items: center; gap: 12px; margin-top: 4px; color: var(--soft); font-size: 14px; }
.goal-bar { height: 8px; overflow: hidden; border-radius: 3px; background: var(--track); }
.goal-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* Home */
.endeavors { gap: 20px; }
.endeavor { position: relative; display: flex; flex-direction: column; gap: 18px; }
.endeavor h3 { font-size: 22px; }
.endeavor h4 { margin-bottom: 4px; }
.endeavor section .due-row > :first-child { font-weight: 600; }
.endeavor-link { text-decoration: none; }
/* Makes the whole card open its page. */
.endeavor-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.endeavor-link:focus-visible { outline: 0; }
.endeavor-link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 2px; }
.endeavor .icon-button { position: relative; z-index: 1; }
.goals { display: grid; gap: 12px; }
.endeavor-money { margin-top: auto; }
@media (hover: hover) { .endeavor:hover { border-color: var(--field-line); } }

/* Money */
/* Equal widths, but an amount that needs more room moves to a new line whole. */
.tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.tile { flex: 1 1 90px; min-width: max-content; padding: 10px 14px; border-radius: 10px; background: var(--inset); }
.tile dt, .facts dt { color: var(--soft); font-size: 13px; font-weight: 600; }
.tile dd { font-size: 20px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.money-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 40px; margin-top: 24px; }
.money-lists.single { grid-template-columns: minmax(0, 1fr); }
.money-lists small { display: block; }
.scroll { overflow-x: auto; }
.table { width: 100%; margin-top: 8px; border-collapse: collapse; }
.table th, .table td { height: 44px; padding: 4px 0 4px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table th:first-child { padding-left: 0; text-align: left; }
.table thead th { height: 36px; border-top: 0; color: var(--soft); font-size: 13px; font-weight: 600; }
.table tbody th { font-weight: 600; }
.table td:last-child { font-weight: 700; }

/* Numbers */
.numbers { gap: 16px; margin-top: 12px; }
.number { display: flex; flex-direction: column; min-width: 0; padding: 12px 16px 16px; border-radius: 10px; background: var(--inset); }
.number .big { font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.number .since { color: var(--soft); font-size: 14px; }
.number > .buttons { margin-top: auto; padding-top: 16px; }
.number .button { background: var(--card); }
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; margin: 22px 6px 0 0; color: var(--soft); font-size: 12px; }
.ticks { position: relative; text-align: right; }
.ticks b { display: block; height: 0; overflow: hidden; font-weight: inherit; }
.ticks span { position: absolute; right: 0; transform: translateY(-50%); }
.plot { position: relative; height: 110px; border-radius: 2px; touch-action: pan-y; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plot polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--grid); }
.cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--field-line); }
.dot {
  position: absolute; width: 12px; height: 12px; margin: -6px; border: 2px solid var(--inset);
  border-radius: 50%; background: var(--accent);
}
.tip {
  position: absolute; z-index: 2; bottom: calc(100% + 4px); display: flex; gap: 8px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); white-space: nowrap; pointer-events: none;
}
.tip strong { color: var(--ink); }
.days { grid-column: 2; display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }

/* Automatic data */
.facts { display: flex; flex-wrap: wrap; gap: 14px 48px; margin-top: 8px; }
.facts dd { font-weight: 700; }
.status { display: flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.problems { margin: 8px 0 -10px; }
.problems summary { width: max-content; padding: 10px 0; border-radius: 6px; font-weight: 600; cursor: pointer; }
.problems li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--soft); font-size: 14px; overflow-wrap: anywhere; }
.failed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.videos { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; margin-top: 10px; }
.videos a { display: grid; gap: 2px; border-radius: var(--radius-small); text-decoration: none; }
.videos img { display: block; width: 100%; height: auto; margin-bottom: 6px; border-radius: var(--radius-small); background: var(--inset); }
.videos strong { font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
@media (hover: hover) { .videos a:hover strong { text-decoration: underline; } }

@media (min-width: 900px) {
  .page .box:not(.card) { padding: 20px; }
  .two-across { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-across > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 1099px) {
  .money-lists { grid-template-columns: minmax(0, 1fr); }
  .videos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
  .page { gap: 16px; }
  .level { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .endeavors { gap: 16px; }
  .section-head:has(.buttons) { flex-wrap: wrap; }
  .section-head .buttons { flex: 0 1 auto; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { gap: 8px; }
  .tile { padding: 10px; }
  .tile dd { font-size: 16px; }
  .table th, .table td { font-size: 14px; }
}
