/* NBN dropouts. Values come from claude/nbn-dropouts-handoff/docs/02–03 and tokens/. */

/* ---------- Fonts (self-hosted, Latin subset, variable weight; SIL OFL, see fonts/OFL.txt) ---------- */
@font-face {
  font-family: Geist; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geist-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/geist-mono-latin.woff2) format("woff2");
}

/* ---------- Tokens ---------- */
:root, [data-theme="dark"] {
  --bg: #0E0F11; --surface: #16181B; --line: #25282D; --text: #ECEDEE;
  --muted: #8B9098; --guide: #3A3E44; --axis: #3A3E44; --dot: #2E3136;
  --future: #121417; --ok: #3DD68C; --warn: #F5A524;
  --accent: var(--text); --bar-rest-opacity: 0.28;
  --col-active: rgba(255, 255, 255, 0.04);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #FAFAFA; --surface: #FFFFFF; --line: #E4E4E7; --text: #18181B;
  --muted: #6B6B73; --guide: #C4C4CA; --axis: #18181B; --dot: #D4D4D8;
  --future: #F2F2F4; --ok: #16A34A; --warn: #B45309;
  --accent: var(--text); --bar-rest-opacity: 0.22;
  --col-active: rgba(24, 24, 27, 0.04);
  --shadow: 0 8px 24px rgba(24, 24, 27, 0.10);
  color-scheme: light;
}
:root {
  --font-sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --plot-h: 216px; --bar-max-w: 24px; --col-gap: 10px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 64px 80px; display: flex; flex-direction: column; gap: 48px; }
#content { display: flex; flex-direction: column; gap: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.hdr { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px 24px; }
.eyebrow { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.title { margin: 6px 0 0; font-weight: 600; font-size: 32px; letter-spacing: -0.02em; line-height: 1.15; }
.hdr-right { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.updated { font-size: 14px; color: var(--muted); }
.updated.is-stale { color: var(--warn); }
.pill { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; white-space: nowrap; }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill.is-backup .pill-dot { background: var(--warn); }
.pill.is-unknown .pill-dot { background: var(--muted); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: border-color 120ms var(--ease), background-color 120ms var(--ease); }
.icon-btn:hover { border-color: var(--guide); }
.icon-btn:focus { outline: none; }
.icon-btn:focus-visible, .col:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-moon, [data-theme="light"] .icon-sun { display: none; }

/* ---------- Hero ---------- */
.hero { display: flex; align-items: stretch; gap: 64px; padding-bottom: 48px; border-bottom: 1px solid var(--line); }
.hero-main { display: flex; align-items: flex-end; gap: 24px; flex-shrink: 0; }
.big { font-size: 144px; font-weight: 600; letter-spacing: -0.06em; line-height: 0.8; color: var(--accent); }
.big.is-loading { color: var(--dot); }
.hero-copy { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.hero-label { font-size: 22px; font-weight: 500; }
.hero-sub { font-size: 15px; color: var(--muted); }
.stats { flex-grow: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 0 32px; border-left: 1px solid var(--line); }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-val { font-size: 40px; font-weight: 500; line-height: 1; }
.stat-unit { font-size: 16px; font-family: var(--font-sans); font-weight: 400; color: var(--muted); }
.stat-sub { font-size: 14px; color: var(--muted); }
.stat-sub.is-up { color: var(--accent); font-weight: 500; }

/* ---------- Sections ---------- */
.sec { display: flex; flex-direction: column; gap: 20px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
.sec-title { margin: 0; font-size: 18px; font-weight: 600; }
.sec-note { font-size: 14px; color: var(--muted); }

/* ---------- Chart ---------- */
.plot { position: relative; height: var(--plot-h); }
.avg-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--guide); pointer-events: none; }
.avg-label { position: absolute; left: 0; font-size: 12px; color: var(--muted); background: var(--bg); padding-right: 8px; pointer-events: none; transition: background-color 200ms var(--ease); }
/* Where the record begins (product/5-done/PRD-tracked-days.md §4.3): the plot's top 27px is never reached by a bar or count. */
.start { position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--muted); pointer-events: none; }
.start-label { position: absolute; left: 10px; top: 0; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--text); white-space: nowrap; pointer-events: none; }
.start-when { font-weight: 400; color: var(--muted); }
.plot.has-start .avg-label { left: 10px; }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: var(--col-gap); border-bottom: 1px solid var(--axis); }
/* Long periods and phones (product/5-done/PRD-periods.md §6): narrow columns get a 2px gap, narrower ones lose their counts. */
.bars.is-compact, .xlabels.is-compact { gap: 2px; }
.bars.is-dense .count { display: none; }
.col, .xl { flex: 1 1 0; min-width: 0; }
.col { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding: 0; margin: 0; border: 0; border-radius: 4px 4px 0 0; background: transparent; color: inherit; font: inherit; cursor: default; -webkit-tap-highlight-color: transparent; transition: background-color 120ms var(--ease); }
.col.is-active { background: var(--col-active); }
.count { font-size: 12px; color: var(--muted); }
/* 24px at 30 columns as before, wider (up to 40px) when there are few (product/5-done/PRD-tracked-days.md §4.3). */
.bar { width: 40%; min-width: min(var(--bar-max-w), 100%); max-width: 40px; background: var(--accent); opacity: var(--bar-rest-opacity); border-radius: 3px 3px 0 0; transition: opacity 120ms var(--ease); }
.zero { width: 6px; height: 6px; border-radius: 50%; background: var(--dot); margin-bottom: 6px; }
.col.is-em .bar { opacity: 1; }
.col.is-em .count { color: var(--accent); font-weight: 600; }
.col.is-active .count { color: var(--text); }
.col.is-active .zero { background: var(--muted); }
.xlabels { display: flex; gap: var(--col-gap); margin-top: -8px; }
.xl { font-size: 12px; color: var(--muted); white-space: nowrap; min-height: 15px; display: flex; justify-content: center; }
.xl:last-child { justify-content: flex-end; }
.xlabels.is-daily .xl:last-child { justify-content: center; }   /* every column labelled: Today sits under its column */
.xl.is-start { justify-content: flex-start; }   /* a week label that would run past the plot's left edge */
.xl.is-active { color: var(--text); font-weight: 500; }
.xl.is-suppressed { visibility: hidden; }

/* Period control (product/5-done/PRD-periods.md §5) */
.sec-head.has-control { align-items: center; gap: 12px 16px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.seg-btn { height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color 120ms var(--ease), background-color 120ms var(--ease); }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg-btn:focus { outline: none; }
.seg-btn:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }
.range-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.step-btn { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: border-color 120ms var(--ease); }
.step-btn svg { width: 18px; height: 18px; }
.step-btn:hover:not(:disabled) { border-color: var(--guide); }
.step-btn:disabled { opacity: 0.35; cursor: default; }
.step-btn:focus { outline: none; }
.step-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.range-text { font-size: 14px; font-weight: 500; min-width: 128px; text-align: center; }
.range-text.is-alone { min-width: 0; text-align: left; }
.range-sum { font-size: 14px; color: var(--muted); }
.latest { height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.latest:focus { outline: none; }
.latest:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 2px; }

/* Tooltip */
.tip { position: absolute; top: 0; z-index: 5; width: 168px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); text-align: left; pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
/* 8px beside the column; beside a column wider than 40px (few columns), 8px beyond the widest
   bar (20px from the centre) instead, so it stays by its bar (2026-10-10, docs/03). */
.tip.to-right { left: min(calc(100% + 8px), calc(50% + 28px)); }
.tip.to-left { right: min(calc(100% + 8px), calc(50% + 28px)); }
.tip-date { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tip-count { font-size: 15px; font-weight: 600; }
.tip-down { font-size: 13px; color: var(--muted); }

/* ---------- Today timeline ---------- */
.track { position: relative; height: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.future { position: absolute; top: 0; bottom: 0; right: 0; background: var(--future); }
.mark { position: absolute; top: 6px; bottom: 6px; min-width: 4px; background: var(--accent); border-radius: 2px; }
.mark.is-ongoing { background: var(--warn); }
.now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.hours { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card-time { font-size: 20px; font-weight: 500; }
.card-body { display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: 14px; font-weight: 500; }
.card-note { font-size: 13px; color: var(--muted); }
.card.is-ongoing { border-color: var(--warn); }
.card.is-ongoing .card-title { color: var(--warn); }
.empty { font-size: 14px; color: var(--muted); padding: 16px 20px; border: 1px dashed var(--line); border-radius: 8px; }

/* ---------- Earlier (product/5-done/PRD-history.md §5) ---------- */
.groups { display: flex; flex-direction: column; gap: 24px; }
.group { display: flex; flex-direction: column; gap: 10px; }
.day-h { margin: 0; font-size: 11px; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); width: fit-content; }
.day-h .day-date { color: var(--text); font-weight: 500; }
.day-h:focus { outline: none; }
.day-h:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 2px; }
.show-all { width: 100%; height: 44px; padding: 0 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: border-color 120ms var(--ease); }
.show-all:hover { border-color: var(--guide); }
.show-all:focus { outline: none; }
.show-all:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* The end of the record (product/5-done/PRD-tracked-days.md §4.5) */
.record-start { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.record-start .day-date { color: var(--text); font-weight: 500; }

/* ---------- Error ---------- */
.error { padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.error strong { font-size: 16px; }
.error span { font-size: 14px; color: var(--muted); }

/* ---------- Responsive ---------- */
.only-sm { display: none; }
@media (max-width: 1100px) {
  .hero { flex-direction: column; gap: 40px; }
  .stat:first-child { padding-left: 0; border-left: 0; }
}
@media (max-width: 820px) {
  .page { padding: 40px 24px 48px; gap: 40px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  :root { --col-gap: 6px; }
}
@media (max-width: 640px) {
  .page { padding: 24px 16px 40px; gap: 32px; }
  .title { font-size: 26px; }
  .updated:not(.is-stale) { display: none; }   /* shown only while stale (owner decision 2026-10-09) */
  .only-sm { display: inline; } .only-lg { display: none; }
  .hero { gap: 28px; padding-bottom: 32px; }
  .hero-main { gap: 16px; }
  .big { font-size: 104px; }
  .hero-label { font-size: 18px; } .hero-sub { font-size: 14px; }
  .stat { padding: 0 12px; gap: 6px; }
  .stat-label, .stat-sub { font-size: 12px; }
  .stat-val { font-size: 28px; } .stat-unit { font-size: 13px; }
  .sec-title { font-size: 16px; } .sec-note { font-size: 13px; }
  :root { --col-gap: 5px; }
  .card { padding: 14px 16px; }
  .tip { width: 148px; }
  .avg-label { display: none; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 0; min-width: 0; padding: 0 6px; }
  .range-bar { gap: 12px; }
  .stepper { width: 100%; justify-content: space-between; }
  .range-text { min-width: 0; }
  .range-sum { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
