/* THE VERDICT — editorial broadsheet. Tokens mirror shared/design-tokens.json. */
:root {
  --page: #d8d4ca;
  --paper: #ece7dc;
  --ink: #17140f;
  --ink-2: #3a352d;
  --muted: #6b6459;
  --faint: #8a8377;
  --accent: #ff3d17;
  --positive: #1f8f5f;
  --hairline: rgba(23, 20, 15, 0.18);
  --dotted: rgba(23, 20, 15, 0.3);
  --track: rgba(23, 20, 15, 0.07);
  --guide: #c9b7a0;
}

/* the dark observatory — same editorial voice, nautical-instrument-at-night mood */
html[data-mood="dark"] {
  --page: #0b0a09;
  --paper: #16140f;
  --ink: #e9e3d3;
  --ink-2: #cbc4b2;
  --muted: #948c7c;
  --faint: #6e675b;
  --accent: #ff4a22;
  --positive: #35b377;
  --hairline: rgba(233, 227, 211, 0.16);
  --dotted: rgba(233, 227, 211, 0.32);
  --track: rgba(233, 227, 211, 0.09);
  --guide: #4a443a;
}
html[data-mood="dark"] .sheet { box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65); }
html[data-mood="dark"] .orbit-svg { filter: drop-shadow(0 0 26px rgba(255, 74, 34, 0.13)); }
html[data-mood="dark"] #tt { background: var(--ink); color: #16140f; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 48px 20px 80px;
}
.mono { font-family: "IBM Plex Mono", monospace; }

.sheet {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
  padding: 44px 48px 40px;
}

/* masthead */
.masthead {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 16px; border-bottom: 2px solid var(--ink);
  gap: 12px; flex-wrap: wrap;
}
.mast-title { font: 600 12px "IBM Plex Mono", monospace; letter-spacing: 0.18em; }
.mast-date { font: 400 12px "IBM Plex Mono", monospace; letter-spacing: 0.08em; color: var(--muted); }

.section { padding: 26px 0 22px; border-bottom: 1px solid var(--hairline); }
.section:last-of-type { border-bottom: none; }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.sec-label { font: 600 12px "IBM Plex Mono", monospace; letter-spacing: 0.16em; }
.sec-label .dim { color: var(--faint); font-weight: 400; }
.sec-side { font: 400 11px "IBM Plex Mono", monospace; color: var(--muted); }
.sec-side b { color: var(--ink); }

/* hero */
.hero { display: grid; grid-template-columns: 1.55fr 0.95fr; gap: 44px; padding: 34px 0 30px; border-bottom: 1px solid var(--hairline); }
.kicker { font: 400 12px "IBM Plex Mono", monospace; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 14px; }
.verdict { font-size: 104px; line-height: 0.86; font-weight: 700; letter-spacing: -0.03em; }
.verdict .tone-go { color: var(--positive); }
.verdict .tone-steady, .verdict .tone-ease { color: var(--accent); }
.verdict .tone-rest { color: var(--ink-2); }
.lede { font-size: 19px; line-height: 1.5; max-width: 440px; margin: 22px 0 0; color: var(--ink-2); }

.scorecol { display: flex; flex-direction: column; border-left: 1px solid var(--hairline); padding-left: 32px; }
.scorerow { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; border-bottom: 1px dotted var(--dotted); }
.scorerow:last-child { border-bottom: none; }
.score-num { font-size: 52px; font-weight: 700; line-height: 1; }
.score-label { font: 400 11px "IBM Plex Mono", monospace; letter-spacing: 0.12em; color: var(--muted); margin-top: 2px; }
.score-delta { font: 600 14px "IBM Plex Mono", monospace; color: var(--ink-2); }
.score-delta.bad { color: var(--accent); }
.score-delta.good { color: var(--positive); }

/* charts + axes */
.chart { display: block; width: 100%; height: auto; }
.axisrow { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }
.svglabel { font: 600 10px "IBM Plex Mono", monospace; letter-spacing: 0.08em; fill: var(--faint); }
.nodata { font: 400 12px "IBM Plex Mono", monospace; color: var(--faint); padding: 18px 0; }

/* two-up grids */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.grid2 > div { min-width: 0; }
.bignum { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.bignum .v { font-size: 40px; font-weight: 700; }
.bignum .u { font: 400 13px "IBM Plex Mono", monospace; color: var(--muted); }

/* tags */
.tagrows { display: flex; flex-direction: column; gap: 11px; }
.tagrow { display: grid; grid-template-columns: 168px 1fr 46px; align-items: center; gap: 12px; }
.tag-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.tag-track { height: 12px; background: var(--track); border-radius: 3px; position: relative; overflow: hidden; }
.tag-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.tag-num { font-size: 14px; font-weight: 600; text-align: right; }
.tag-empty { font-size: 12px; color: var(--faint); line-height: 1.7; max-width: 420px; }

/* activity strip */
.activity { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 44px; align-items: end; }
.weekbars { display: flex; align-items: flex-end; gap: 14px; height: 96px; }
.wb-cell { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.wb-bar { width: 100%; border-radius: 3px 3px 0 0; }
.wb-day { font-size: 11px; color: var(--faint); }
.statrow { display: flex; border-left: 1px solid var(--hairline); padding-left: 32px; }
.statrow > div { flex: 1; }
.stat-v { font-size: 34px; font-weight: 700; line-height: 1; }
.stat-l { font: 400 10px "IBM Plex Mono", monospace; letter-spacing: 0.1em; color: var(--muted); margin-top: 3px; }

/* sleep facts */
.sleepfacts { display: flex; gap: 0; border-left: 1px solid var(--hairline); padding-left: 32px; flex-direction: column; justify-content: center; }
.sleepfact { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px dotted var(--dotted); }
.sleepfact:last-child { border-bottom: none; }
.sleepfact .k { font: 400 11px "IBM Plex Mono", monospace; letter-spacing: 0.1em; color: var(--muted); }
.sleepfact .v { font-size: 18px; font-weight: 600; }
.nightgrid { display: grid; grid-template-columns: 1.55fr 0.95fr; gap: 44px; }

/* tooltip */
#tt {
  display: none; position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font: 400 11px "IBM Plex Mono", monospace; line-height: 1.6;
  padding: 7px 10px; border-radius: 6px; max-width: 260px;
}
#tt .tt-val { font-weight: 600; font-size: 13px; }

/* landing */
.landing-hero { padding: 60px 0 40px; }
.landing-hero .verdict { font-size: 92px; }
.cta-row { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font: 600 13px "IBM Plex Mono", monospace; letter-spacing: 0.08em;
  padding: 14px 22px; border-radius: 8px; border: 2px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.note { font: 400 12px "IBM Plex Mono", monospace; color: var(--accent); margin-top: 18px; }

/* footer */
.foot { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; gap: 12px; flex-wrap: wrap; }
.foot .mono { font-size: 11px; color: var(--faint); }
.foot a { color: var(--muted); text-decoration: none; font: 600 11px "IBM Plex Mono", monospace; letter-spacing: 0.06em; }
.foot a:hover { color: var(--accent); }
.badge-demo {
  font: 600 10px "IBM Plex Mono", monospace; letter-spacing: 0.1em;
  background: var(--accent); color: var(--paper); border-radius: 5px; padding: 3px 8px;
}
.keybox { font: 400 11px "IBM Plex Mono", monospace; word-break: break-all; background: var(--track); border-radius: 6px; padding: 10px 12px; margin-top: 10px; user-select: all; }

.hidden { display: none !important; }

/* today's orbit hero */
.hero-orbit { grid-template-columns: 1.05fr 0.95fr; align-items: center; }
.orbit-wrap { max-width: 560px; margin: 0 auto; width: 100%; }
.verdict-sm { font-size: 68px; }
.scorecol-row { border-left: none; padding-left: 0; flex-direction: row; gap: 26px; margin-top: 24px; border-top: 1px solid var(--hairline); padding-top: 16px; }
.scorecol-row .scorerow { flex-direction: column; align-items: flex-start; border-bottom: none; padding: 0; gap: 4px; flex: 1; }
.scorecol-row .score-num { font-size: 38px; }
.pulse-ring { transform-box: fill-box; transform-origin: center; animation: obPulse 1.2s ease-out infinite; }
@keyframes obPulse {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(1.16); opacity: 0; }
  100% { transform: scale(1.16); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .pulse-ring { animation: none; opacity: 0.5; } }

/* body-signals banner */
.signals {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; margin-top: 16px; border: 1.5px solid var(--hairline); border-radius: 8px;
}
.signals.tone-alert { border-color: var(--accent); background: rgba(255, 61, 23, 0.05); }
.signals.tone-watch { border-color: rgba(23, 20, 15, 0.4); }
.sig-label { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; color: var(--muted); }
.sig-status { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; }
.tone-alert .sig-status { color: var(--accent); }
.tone-watch .sig-status { color: var(--ink); }
.tone-all_clear .sig-status { color: var(--positive); }
.sig-body { font-size: 14px; color: var(--ink-2); }

.mast-link { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; }
.mast-link:hover { color: var(--accent); }

/* records */
.records { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 28px; }
.rec .stat-v { font-size: 28px; }
.rec .rec-day { font: 400 10px "IBM Plex Mono", monospace; color: var(--faint); margin-top: 2px; }

.finePrint { font-size: 11px; color: var(--faint); margin: 8px 0 0; line-height: 1.6; }

/* sunday grades */
.grade-num { font-size: 52px; font-weight: 700; line-height: 1; }
.grade-sub { font: 400 12px "IBM Plex Mono", monospace; color: var(--muted); }

@media (max-width: 900px) {
  .records { grid-template-columns: repeat(2, 1fr); }
}

/* legend line-keys */
.legend { display: flex; gap: 18px; align-items: center; }
.legend .key { display: flex; gap: 7px; align-items: center; font: 400 11px "IBM Plex Mono", monospace; color: var(--muted); }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; }

@media (max-width: 900px) {
  body { padding: 16px 8px 40px; }
  .sheet { padding: 26px 20px 24px; }
  .hero, .nightgrid { grid-template-columns: 1fr; gap: 24px; }
  .verdict, .landing-hero .verdict { font-size: 64px; }
  .lede { font-size: 16px; }
  .scorecol { border-left: none; padding-left: 0; flex-direction: row; gap: 18px; }
  .scorerow { flex-direction: column; border-bottom: none; flex: 1; gap: 4px; }
  .score-num { font-size: 40px; }
  .grid2, .activity { grid-template-columns: 1fr; gap: 28px; }
  .statrow, .sleepfacts { border-left: none; padding-left: 0; }
  .tagrow { grid-template-columns: 100px 1fr 42px; }
}

/* ============ TODAY'S DIAL — turning/zooming hero instrument ============ */
.sheet { position: relative; overflow: hidden; }
.hero-dial { grid-template-columns: 1.05fr 0.95fr; align-items: center; }

.dial-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.dial-perspective { perspective: 1700px; width: 100%; max-width: 420px; }
.dial {
  position: relative; width: 100%; aspect-ratio: 1/1; transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.62, 0, 0.2, 1); cursor: pointer; border-radius: 50%; outline: none;
}
.dial:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.dial-face { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.dial-face.back { transform: rotateY(180deg); }
.dial-svg { display: block; width: 100%; height: 100%; overflow: visible; }

.dial-camrot, .dial-camzoom { transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1); transform-box: view-box; transform-origin: 320px 320px; }
.dial-hlabel { transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1); transform-box: fill-box; transform-origin: center; }
.dial-grp { transition: opacity 0.7s ease; }
.dial-oring { transition: stroke-dashoffset 0.95s cubic-bezier(0.4, 0, 0.2, 1); }

.dial-fc { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; text-align: center; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dfc-label { font: 600 15px "IBM Plex Mono", monospace; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.dfc-hero { font-size: 84px; font-weight: 700; line-height: 0.9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dfc-hero.small { font-size: 64px; }
.dfc-sub { font: 600 16px "IBM Plex Mono", monospace; letter-spacing: 0.06em; color: var(--ink-2); margin-top: 3px; }
.dfc-cap { font: 400 12px "IBM Plex Mono", monospace; letter-spacing: 0.1em; color: var(--faint); text-transform: uppercase; margin-top: 3px; }

.dial-rail { min-width: 0; }
.dial-fade { transition: opacity 0.32s ease, transform 0.32s ease; }
.dial-fade.out { opacity: 0; transform: translateY(6px); }
.dial-rail-kicker { font: 400 12px "IBM Plex Mono", monospace; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 12px; }
.dial-rail-head { font-size: 60px; line-height: 0.9; font-weight: 700; letter-spacing: -0.03em; margin: 0; }
.dial-rail-head .tone-go { color: var(--positive); }
.dial-rail-head .tone-steady, .dial-rail-head .tone-ease { color: var(--accent); }
.dial-rail-head .tone-rest { color: var(--ink-2); }
.dial-rail-line { font-size: 28px; line-height: 1.14; font-weight: 700; letter-spacing: -0.01em; margin: 0; text-wrap: balance; max-width: 24ch; }
.dial-rail-body { font-size: 16px; line-height: 1.5; color: var(--ink-2); margin: 16px 0 0; max-width: 42ch; }
.dial-chips { display: flex; gap: 26px; margin-top: 20px; border-top: 1px solid var(--hairline); padding-top: 16px; }
.dial-chip { display: flex; flex-direction: column; gap: 2px; }
.dchip-num { font-size: 34px; font-weight: 700; line-height: 1; }
.dchip-lab { font: 400 10px "IBM Plex Mono", monospace; letter-spacing: 0.12em; color: var(--muted); }
.dchip-delta { font: 600 12px "IBM Plex Mono", monospace; color: var(--ink-2); }
.dchip-delta.bad { color: var(--accent); }
.dchip-delta.good { color: var(--positive); }
.dial-rail-facts { display: flex; flex-direction: column; margin-top: 20px; border-top: 1px solid var(--hairline); }
.dial-rail-fact { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px dotted var(--dotted); }
.dial-rail-fact:last-child { border-bottom: none; }
.dial-rail-fact .k { font: 400 11px "IBM Plex Mono", monospace; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.dial-rail-fact .vv { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.dial-controls { display: flex; align-items: center; gap: 16px; }
.dial-dots { display: flex; gap: 9px; }
.dial-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--faint); background: transparent; cursor: pointer; padding: 0; transition: all 0.25s ease; }
.dial-dot.active { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.dial-navbtn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--hairline); background: transparent; color: var(--ink); cursor: pointer; font-size: 15px; display: grid; place-items: center; line-height: 1; }
.dial-navbtn:hover { border-color: var(--accent); color: var(--accent); }
.dial-playbtn { font: 600 10px "IBM Plex Mono", monospace; letter-spacing: 0.1em; padding: 0 12px; width: auto; border-radius: 17px; }
.dial-hint { font: 400 11px "IBM Plex Mono", monospace; color: var(--faint); letter-spacing: 0.04em; }

.dial-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; z-index: 200; }
.dial-scrim.open { opacity: 1; pointer-events: auto; }
.dial-detail {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 720px; z-index: 201; background: var(--paper);
  border: 2px solid var(--ink); border-bottom: none; border-radius: 18px 18px 0 0; padding: 26px 40px 40px;
  transform: translateY(105%); transition: transform 0.42s cubic-bezier(0.4, 0, 0.15, 1); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.32);
  max-height: 85vh; overflow-y: auto;
}
.dial-detail.open { transform: translateY(0); }
.dial-detail-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--hairline); padding-bottom: 12px; }
.dial-detail-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.dial-detail-close { font: 600 11px "IBM Plex Mono", monospace; letter-spacing: 0.1em; background: transparent; border: 1px solid var(--hairline); border-radius: 6px; padding: 7px 12px; cursor: pointer; color: var(--ink); }
.dial-detail-close:hover { border-color: var(--accent); color: var(--accent); }
.dial-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 28px; margin-top: 22px; }
.dial-detail-cell .ddv { font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.dial-detail-cell .ddl { font: 400 10px "IBM Plex Mono", monospace; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
.dial-detail-note { font: 400 12px "IBM Plex Mono", monospace; color: var(--accent); margin-top: 24px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .dial, .dial-camrot, .dial-camzoom, .dial-hlabel, .dial-grp, .dial-oring, .dial-detail, .dial-fade { transition: none; }
}
@media (max-width: 900px) {
  .dial-perspective { max-width: 320px; }
  .dial-rail-head { font-size: 44px; }
  .dial-rail-line { font-size: 24px; }
  .dial-detail { padding: 22px 20px 28px; }
  .dial-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

/* landing footer: privacy / terms / contact */
.landing-legal { margin-top: 30px; font: 400 11px "IBM Plex Mono", monospace; letter-spacing: 0.08em; color: var(--muted); }
.landing-legal a { color: var(--ink-2); text-decoration: none; }
.landing-legal a:hover { color: var(--accent); }
.landing-legal .dim { color: var(--faint); }
