/*
home.css — The styles of the site's pages: the landing page, the privacy notice, and the sync waitlist page.

The pages are static and share no build with the app, so the tokens below are
copies of the app's theme (src/styles/tailwind.css): the ink ground, cream,
marigold, the tally colours, and the hop curve. Change both when one changes.
The fonts are the app's own files, which scripts/copy-site.mjs copies to
/fonts/, because the CSP's font-src 'self' allows no other host.

Layout: one column on a phone (headline, action, card, claims, install
steps). From 880px the headline and the card sit side by side.

Marigold marks the install button and nothing else (the visual identity
spec, Decision 8). The card's colour is the current tally's colour, --tc,
which home.js sets on the root element at each flip.

The text pages (privacy.html and waitlist.html) use the same shell, header,
and footer, with their text in <main class="doc">. The waitlist page's
"Join the waitlist" button is the .btn form of the install button: on that
page it is the one thing to do.
*/

@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/fredoka-600-latin.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/nunito-400-800-latin.woff2) format('woff2'); }

:root {
  color-scheme: dark;
  --ink-950: #14131F;
  --ink-900: #1E1C2F;
  --ink-800: #2A2840;
  --cream: #FFF8EC;
  --muted: #A9A5BF;
  --marigold-400: #FFB824;
  --marigold-300: #FFC84D;
  --chip-ground: #3A3020;
  --chip-text: #FFDB85;
  --tc: #60A5FA;
  --font-display: 'Fredoka', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-sans: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --ease-hop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ink-950); color: var(--cream); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; overflow-x: hidden; }
a { color: var(--marigold-300); }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }

.page { max-width: 1080px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 40px; }
main { display: flex; flex-direction: column; gap: 48px; }
.brand img { display: block; height: 44px; width: auto; }

/* The hero */
.hero { display: grid; gap: 32px; align-items: center; }
.hero > * { min-width: 0; }
h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(44px, 13vw, 92px); line-height: 1.05; }
.lead { display: block; }
.flap { display: block; position: relative; height: 1.3em; margin-top: 0.08em; width: fit-content; max-width: 100%; transition: width 0.22s ease; perspective: 700px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.flap::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--ink-950); z-index: 5; }
.sizer, .half { white-space: nowrap; padding: 0 0.24em; }
.sizer { display: inline-block; visibility: hidden; line-height: 1.3; }
.js .sizer { position: absolute; left: 0; top: 0; }
.half { position: absolute; inset: 0; display: flex; align-items: center; color: var(--tc); background: var(--ink-900); border-radius: 0.16em; backface-visibility: hidden; overflow: hidden; }
.half.top { clip-path: inset(0 0 50% 0); }
.half.bot { clip-path: inset(50% 0 0 0); }
.half.c, .half.d { z-index: 2; }
.hook { margin: 18px 0 0; font-size: clamp(18px, 4.6vw, 22px); font-weight: 700; }
/* The dots. Each has its tally's colour in --dot, set by home.js. The row
   is only as wide as the dots, so the hover area ends at the last one. Under
   the hover class (a mouse over the row, or keyboard focus in it) the row
   zooms from its left edge, every dot lights in its colour, and the current
   one gets a ring. The zoom is a transform, so nothing below moves. */
.dots { display: flex; width: fit-content; max-width: 100%; gap: 8px; margin-top: 12px; padding-block: 6px; flex-wrap: wrap; min-height: 24px; transform-origin: left center; transition: transform 0.25s var(--ease-hop); }
.dots button { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; background: var(--ink-800); cursor: pointer; transition: background 0.3s, transform 0.3s var(--ease-hop), box-shadow 0.2s; }
.dots button.on { background: var(--dot); transform: scale(1.35); }
.dots.hover { transform: scale(1.3); }
.dots.hover button { background: var(--dot); }
.dots.hover button:hover { transform: scale(1.5); }
.dots.hover button.on { box-shadow: 0 0 0 2px var(--ink-950), 0 0 0 3.5px var(--cream); }
.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 28px; }
.install-btn, .btn { display: inline-flex; align-items: center; justify-content: center; height: 56px; padding: 0 28px; border: 0; border-radius: 999px; background: var(--marigold-400); color: var(--ink-950); font-family: var(--font-sans); font-weight: 800; font-size: 18px; text-decoration: none; cursor: pointer; }
.install-btn:active, .btn:active { transform: scale(0.97); }
.cta small { color: var(--muted); font-size: 13px; }

/* The tally card */
.stage { position: relative; perspective: 900px; padding-bottom: 56px; }
.glow { position: absolute; inset: 8% 4% 22%; background: var(--tc); opacity: 0.28; filter: blur(60px); border-radius: 50%; transition: background 0.4s; pointer-events: none; }
.card { position: relative; background: var(--ink-900); border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.row { display: flex; align-items: center; gap: 14px; }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg.r { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--ink-800); stroke-width: 6; }
.ring .prog { fill: none; stroke: var(--tc); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.5s var(--ease-hop); }
.ring .ico { position: absolute; inset: 11px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); }
.ring .ico svg { width: 22px; height: 22px; }
.ico svg, svg.inl { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.info { flex: 1; min-width: 0; }
.name { margin: 0; font-weight: 700; font-size: 15px; color: var(--muted); }
.value { margin: 0; font-size: clamp(26px, 7.5vw, 34px); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.value span { display: inline-block; }
.sub { margin: 0; font-size: 14px; color: var(--muted); }
.act { flex: none; min-width: 4.75rem; height: 48px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--ink-800); color: var(--marigold-300); font: 800 16px var(--font-sans); cursor: pointer; transition: transform 0.1s; }
.act:active, .chip:active { transform: scale(0.94); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--chip-ground); color: var(--chip-text); font: 700 15px var(--font-sans); cursor: pointer; transition: transform 0.1s; }
/* The chart. The bars are divs, so a log animates their height. The line,
   the area, and the dotted goal line are an SVG laid over them (.plot),
   which home.js draws in pixels; its column gap must match .chart's gap. A
   line or area chart hides the bars (.plotted). */
.chart { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 96px; }
.bar { background: var(--tc); opacity: 0.4; border-radius: 6px 6px 2px 2px; min-height: 3px; transition: height 0.45s var(--ease-hop); }
.bar.today { opacity: 1; }
.chart.plotted .bar { visibility: hidden; }
.plot { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.plot .line { fill: none; stroke: var(--tc); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.plot .area { fill: var(--tc); fill-opacity: 0.2; }
.plot .pt { fill: var(--ink-900); stroke: var(--tc); stroke-width: 2.5; }
.plot .pt.today { fill: var(--tc); }
.plot .goal { stroke: var(--cream); stroke-opacity: 0.75; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0 7; }
.plot .cal path { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.plot .cal.hit circle { fill: var(--tc); }
.plot .cal.hit path { stroke: var(--ink-950); }
.plot .cal.miss circle { fill: var(--ink-800); }
.plot .cal.miss path { stroke: var(--muted); stroke-width: 2; }
.plot .cal.due circle { fill: none; stroke: var(--tc); stroke-width: 2; stroke-dasharray: 3 3; }
.plot .cal.pop { transform-box: fill-box; transform-origin: center; animation: pop 0.4s var(--ease-hop) both; }
@keyframes pop { from { transform: scale(1.6); } to { transform: scale(1); } }
.plot .goal-label { fill: var(--cream); font: 700 12px var(--font-sans); paint-order: stroke; stroke: var(--ink-900); stroke-width: 4px; stroke-linejoin: round; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: -12px; font-size: 12px; color: var(--muted); text-align: center; }
.days .today { color: var(--cream); font-weight: 700; }
.toast { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 14px; background: var(--ink-800); border-radius: 999px; padding: 8px 8px 8px 18px; font-weight: 700; font-size: 14px; white-space: nowrap; transition: opacity 0.2s, transform 0.3s var(--ease-hop); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: transparent; color: var(--marigold-300); font: 800 14px var(--font-sans); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
@keyframes land { from { transform: scale(1.12); } to { transform: scale(1); } }
.land { animation: land 0.35s var(--ease-hop) both; }

/* The claims */
.claims { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border-top: 1px solid var(--ink-800); padding-top: 32px; }
h2 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.claims p { margin: 0; color: var(--muted); max-width: 34ch; }

/* The install steps */
.install { border-top: 1px solid var(--ink-800); padding-top: 32px; display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 16px; }
.install > h2 { font-size: 28px; margin: 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--ink-900); color: var(--muted); font: 700 15px var(--font-sans); cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--ink-800); color: var(--cream); }
.steps { display: flex; flex-direction: column; gap: 12px; max-width: 62ch; }
.steps h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--muted); }
.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 14px; background: var(--ink-900); border-radius: 18px; padding: 14px 16px; font-size: 17px; }
.steps li::before { content: counter(step); flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-800); font-weight: 800; }
svg.inl { width: 20px; height: 20px; vertical-align: -4px; }
.warn { margin: 0; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--ink-800); color: var(--cream); max-width: 62ch; }
.qr { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr img { display: block; border-radius: 14px; background: var(--cream); padding: 10px; }
.qr div { flex: 1; min-width: 220px; }
.qr p { margin: 0 0 8px; }

footer { color: var(--muted); font-size: 14px; }
footer p { margin: 0; }

/* The text pages */
.brand a { display: inline-block; border-radius: 8px; }
main.doc { display: block; max-width: 68ch; }
.doc h1 { font-size: clamp(40px, 10vw, 60px); }
.doc .updated { margin: 12px 0 0; color: var(--muted); }
.doc h2 { margin: 40px 0 0; font-size: 24px; }
.doc p, .doc ul, .doc address { margin: 14px 0 0; }
.doc ul { padding-left: 1.25em; }
.doc li { margin-top: 8px; }
.doc li::marker { color: var(--muted); }
.doc address { font-style: normal; }
.doc a { text-underline-offset: 2px; }
.doc code { font-size: 0.9em; background: var(--ink-900); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.doc .note { color: var(--muted); font-size: 15px; }

/* The waitlist form */
.signup { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.signup label { font-weight: 700; }
.signup .field { display: flex; flex-wrap: wrap; gap: 12px; }
.signup input[type="email"] { flex: 1 1 240px; min-width: 0; height: 56px; padding: 0 22px; border: 1px solid var(--ink-800); border-radius: 999px; background: var(--ink-900); color: var(--cream); font: 600 17px var(--font-sans); }
.signup input[type="email"]:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.signup .btn { flex: none; }

@media (min-width: 880px) {
  .hero { grid-template-columns: 1.1fr 0.9fr; gap: 56px; }
  h1 { font-size: clamp(64px, 7.4vw, 92px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flap, .bar, .ring .prog, .toast, .dots, .dots button, .glow { transition: none; }
  .install-btn:active, .btn:active { transform: none; }
  .land, .plot .cal.pop { animation: none; }
}
