/* tempolo.app design system. Tokens mirror TempoEngine/Sources/TempoShared/Theme.swift.
   Light palette on :root; dark palette follows the viewer's system setting
   (the app's default "System" appearance). No JavaScript anywhere. */

:root {
  color-scheme: light dark;
  --bg: #F4F5F7;
  --panel: #FFFFFF;
  --surface: #ECEEF1;
  --surface2: #E2E5EA;
  --line: #D8DCE2;
  --primary: #16181B;
  --secondary: #555C66;
  --tertiary: #8A919B;
  --accent: #1B6E33;
  --neutral: #6B7480;
  --amber: #9A6B00;
  --coral: #C03A2E;
  --accent-fill: #32A951;
  --on-accent: #06180C;
  --grad-lo: #32A951;
  --grad-hi: #8FE1A4;
  --shadow: 0 18px 50px -24px rgba(22, 24, 27, .28);
  --font-body: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-brand: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius-card: 22px;
  --radius-widget: 20px;
  --pad-screen: 26px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08090B;
    --panel: #101216;
    --surface: #15181D;
    --surface2: #1C2027;
    --line: #242932;
    --primary: #F2F4F7;
    --secondary: #8B929C;
    --tertiary: #5A616B;
    --accent: #8FE1A4;
    --neutral: #7C8794;
    --amber: #FFB020;
    --coral: #FF6B5E;
    --shadow: 0 18px 50px -24px rgba(0, 0, 0, .8);
  }
}

@font-face {
  font-family: "Space Grotesk";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/SpaceGrotesk-Medium.v1.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/SpaceGrotesk-Bold.v1.woff2") format("woff2");
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--primary);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.12;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5.6vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); }
h3 { font-size: 1.2rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
ul { padding-left: 1.25em; }
li { margin-bottom: .45em; }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
img, svg { max-width: 100%; height: auto; }
.num, .today-num, .tile-num, .la-steps, .row-delta {
  font-family: var(--font-brand);
  font-weight: 500;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.label.as-is { text-transform: none; letter-spacing: .01em; font-size: .8125rem; }
.label {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: .6875rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--tertiary);
}
.lede { font-size: 1.25rem; color: var(--secondary); text-wrap: pretty; }
.muted { color: var(--secondary); }
.fine { color: var(--tertiary); font-size: .875rem; }
.small { font-size: .9375rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--panel); color: var(--primary); padding: 10px 14px;
  border-radius: 10px; border: 1px solid var(--line);
}
.skip:focus { top: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 40px); }
.narrow { max-width: 720px; }

/* ---------- header / footer ---------- */
.site-header { padding: 22px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--primary); text-decoration: none;
  font-family: var(--font-brand); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em;
}
.brand .mark { width: 30px; height: 30px; color: var(--primary); flex: none; }
.mark { fill: currentColor; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--secondary); text-decoration: none; border-radius: 10px; font-weight: 500;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--primary); background: var(--surface); }

.site-footer { border-top: 1px solid var(--line); margin-top: 96px; padding: 40px 0 56px; color: var(--secondary); font-size: .9375rem; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: flex-start; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 4px; }
.site-footer li { margin: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin-left: -10px; text-decoration: none; color: var(--secondary); border-radius: 8px; }
.site-footer li a:hover { color: var(--primary); background: var(--surface); }
.site-footer .legal { margin-top: 28px; font-size: .8125rem; color: var(--tertiary); max-width: 760px; }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 9vw, 104px) 0 0; }
.section-head { max-width: 640px; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head p { color: var(--secondary); font-size: 1.125rem; text-wrap: pretty; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 680px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 26px;
}
.card h3 { margin-top: 6px; }
.card p { color: var(--secondary); }
.card .icon { width: 28px; height: 28px; color: var(--primary); display: block; margin-bottom: 14px; }

/* ---------- hero ---------- */
.hero { padding: clamp(24px, 5vw, 64px) 0 0; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } .hero-art { order: 2; } }
.hero-copy .kicker { margin-bottom: 18px; display: inline-flex; align-items: center; gap: 8px; }
.hero-copy .kicker .mark { width: 16px; height: 16px; }
.hero-copy .lede { margin: 18px 0 26px; max-width: 34rem; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.soon {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px;
  border-radius: 999px; background: var(--surface); color: var(--primary); font-weight: 600;
  border: 1px solid var(--line);
}
.soon .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.cta-row .link { display: inline-flex; align-items: center; min-height: 44px; }
.hero-art { display: flex; justify-content: center; min-width: 0; }

/* ---------- Today surface (chrome-free app mockup) ---------- */
.today {
  width: min(100%, 380px); min-width: 0; margin: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 34px;
  padding: 30px var(--pad-screen) 26px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.today-num { font-size: 66px; line-height: .95; letter-spacing: -.045em; color: var(--primary); }
.today-expected { margin-top: 6px; font-size: .8125rem; color: var(--secondary); font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; height: 38px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); font-size: .875rem; font-weight: 500; color: var(--primary);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.today-msg { margin: 10px 0 0; font-size: .875rem; font-weight: 500; color: var(--secondary); }
.chart-panel { width: 100%; min-width: 0; margin-top: 22px; padding: 14px; background: var(--panel); border-radius: var(--radius-card); }
.chart-panel .ticks { display: flex; justify-content: space-between; margin-top: 8px; font-size: .75rem; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.today-bottom { margin-top: 18px; font-size: .9375rem; line-height: 1.5; }
.today-bottom .num { display: block; }
.today-bottom .sec { color: var(--secondary); }

/* status colors: green only when earned (rule 2) */
.is-ahead .today-num, .is-done .today-num, .is-ahead .tile-num, .is-done .tile-num { color: var(--accent); }
.is-ahead .badge, .is-done .badge { color: var(--accent); }
.is-ahead .badge .dot, .is-done .badge .dot { background: var(--accent); }
.is-ahead .today-msg, .is-done .today-msg { color: var(--accent); }
.is-slightly .badge { color: var(--amber); }
.is-slightly .badge .dot { background: var(--amber); }
.is-slightly .today-msg { color: var(--amber); }
.is-behind .badge { color: var(--coral); }
.is-behind .badge .dot { background: var(--coral); }
.is-behind .today-msg { color: var(--coral); }

/* ---------- curves (inline SVG generated by tools/build-curves.mjs) ---------- */
.curve { display: block; width: 100%; height: auto; overflow: visible; }
.c-band { fill: var(--surface2); opacity: .7; }
.c-expected { fill: none; stroke: var(--tertiary); stroke-width: 1.5; stroke-dasharray: 4 4; }
.c-goal { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.c-goal-label { fill: var(--tertiary); font: 500 11px var(--font-brand); font-feature-settings: "tnum"; }
.c-now { stroke: var(--secondary); stroke-width: 1; opacity: .5; }
.c-actual { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.c-actual.earned { stroke: url(#accentGradient); }
.c-linear { fill: none; stroke: var(--neutral); stroke-width: 1.25; stroke-dasharray: 2 4; }
.c-rhythm { fill: none; stroke: url(#accentGradient); stroke-width: 2.5; stroke-linecap: round; }
.c-end { fill: var(--primary); }
.earned + .c-end, .c-end.earned { fill: var(--accent-fill); }
.mini .c-expected { stroke-width: 1; stroke-dasharray: 3 3; }
.mini .c-actual { stroke-width: 2; }
.draw .c-actual { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .7s cubic-bezier(.4, 0, .2, 1) .25s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .draw .c-actual { animation: none; stroke-dashoffset: 0; }
  *, *::before, *::after { transition: none !important; }
}

/* ---------- day narrative ---------- */
.scene { display: flex; flex-direction: column; gap: 14px; }
.scene .when { display: flex; justify-content: space-between; align-items: baseline; }
.scene .when .num { font-size: 1.375rem; color: var(--primary); }
.scene .when .status { font-size: .8125rem; font-weight: 500; color: var(--neutral); }
.scene.is-slightly .when .status { color: var(--amber); }
.scene.is-done .when .status, .scene.is-done .when .num { color: var(--accent); }
.scene .art { background: var(--surface); border-radius: 16px; padding: 12px; min-width: 0; }
.scene p { margin: 0; color: var(--secondary); }
.scene .say { color: var(--primary); font-weight: 500; }
.quiet { margin-top: 22px; padding: 18px 22px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--secondary); }
.quiet strong { color: var(--primary); }

/* ---------- widgets ---------- */
.widgets { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 860px) { .widgets { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-widget);
  padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.tile.small { width: 158px; height: 158px; }
.tile.medium { width: 338px; max-width: 100%; height: 158px; flex-direction: row; gap: 12px; }
.tile.medium .col { display: flex; flex-direction: column; gap: 2px; min-width: 112px; }
.tile.medium .curve-box { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; }
.tile .mini { flex: 1; min-height: 0; }
.tile-num { font-size: 26px; line-height: 1.05; letter-spacing: -.03em; color: var(--primary); }
.tile-expected { font-size: .6875rem; color: var(--secondary); font-variant-numeric: tabular-nums; }
.stamp { display: flex; align-items: center; gap: 5px; font-size: .6875rem; color: var(--tertiary); font-variant-numeric: tabular-nums; margin-top: auto; }
.stamp svg { width: 11px; height: 11px; }
.lock-row {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface); font-size: .9375rem;
}
.lock-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.lock-row .row-delta { color: var(--primary); font-size: 1.125rem; }
.lock-row .fine { margin-left: 4px; }
.la {
  background: var(--bg); border: 1px solid var(--line); border-radius: 22px; padding: 16px;
  box-shadow: var(--shadow); max-width: 380px; display: flex; flex-direction: column; gap: 8px;
}
.la .top { display: flex; align-items: baseline; gap: 10px; }
.la-steps { font-size: 30px; line-height: 1; letter-spacing: -.03em; color: var(--primary); }
.la .delta { font-family: var(--font-brand); font-weight: 500; font-feature-settings: "tnum"; color: var(--amber); }
.la .top .fine { margin-left: auto; }
.la .msg { color: var(--secondary); font-size: .9375rem; }
.la .bar { display: block; width: 100%; height: 4px; }
.la .bar .track { fill: var(--surface2); }
.la .bar .fill { fill: var(--amber); }
.island {
  display: inline-flex; align-items: center; gap: 12px; height: 37px; padding: 0 16px; border-radius: 999px;
  background: #000; color: #FFB020; font-family: var(--font-brand); font-weight: 500; font-size: .8125rem; font-feature-settings: "tnum";
}
.island .dot { width: 8px; height: 8px; border-radius: 50%; background: #FFB020; }
.island .gap { width: 78px; }
.widget-notes { display: flex; flex-direction: column; gap: 14px; }
.widget-notes p { color: var(--secondary); margin: 0; }
.widget-notes .row { display: flex; gap: 14px; align-items: flex-start; }
.widget-notes .row .label { padding-top: 4px; min-width: 96px; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.stack > * { max-width: 100%; }

/* ---------- rhythm card ---------- */
.rhythm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
@media (max-width: 860px) { .rhythm { grid-template-columns: minmax(0, 1fr); } }
.rhythm .art { min-width: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: .8125rem; color: var(--secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 0; border-top: 2px solid var(--neutral); }
.legend i.dashed { border-top-style: dashed; }
.legend i.grad { border: 0; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--grad-lo), var(--grad-hi)); }

/* ---------- privacy block ---------- */
.privacy-block { background: var(--panel); border: 1px solid var(--line); border-radius: 28px; padding: clamp(28px, 4vw, 44px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; }
@media (max-width: 860px) { .privacy-block { grid-template-columns: minmax(0, 1fr); } }
.privacy-block h2 { margin-bottom: .4em; }
.privacy-block p { color: var(--secondary); }
.nots { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.nots li { display: flex; gap: 12px; align-items: baseline; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); }
.nots li b { font-family: var(--font-brand); font-weight: 700; color: var(--primary); }
.nots li span { color: var(--secondary); font-size: .9375rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 720px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 4px; font-weight: 600; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-brand); font-size: 1.4rem; color: var(--tertiary); flex: none; width: 24px; text-align: center; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--secondary); padding: 0 4px 20px; max-width: 62ch; }

/* ---------- maker note ---------- */
.maker { border-left: 3px solid var(--accent-fill); padding: 6px 0 6px 22px; max-width: 640px; color: var(--secondary); font-size: 1.125rem; }
.maker strong { color: var(--primary); }

/* ---------- document pages (privacy, terms, support) ---------- */
.doc { padding-top: clamp(20px, 4vw, 48px); }
.doc h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
.doc .date { color: var(--tertiary); font-size: .9375rem; margin-bottom: 32px; }
.doc h2 { font-size: 1.4rem; margin: 2em 0 .5em; }
.doc h3 { font-size: 1.1rem; margin: 1.6em 0 .4em; }
.doc .callout { border-left: 3px solid var(--accent-fill); padding: 14px 18px; background: var(--panel); border-radius: 0 12px 12px 0; }
.doc .contact { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; margin: 8px 0 28px; }
.doc .contact .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; background: var(--accent-fill); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.doc .contact .btn:hover { filter: brightness(1.05); }
.doc .contact code { font: 500 .9375rem var(--font-brand); color: var(--primary); background: var(--surface); padding: 6px 10px; border-radius: 8px; user-select: all; }
.doc dl { margin: 0; }
.doc dt { font-weight: 600; margin-top: 1.1em; }
.doc dd { margin: .3em 0 0; color: var(--secondary); }
.doc table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.doc th, .doc td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--tertiary); font-weight: 600; font-size: .8125rem; }
.doc .toc { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 0 0 8px; list-style: none; }
.doc .toc a { display: inline-flex; min-height: 36px; align-items: center; font-size: .9375rem; }

/* ---------- 404 ---------- */
.lost { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; padding: 48px 0; }
.lost .today-num { font-size: 96px; color: var(--tertiary); }
