/* Design tokens, shared by the app (imported by index.css) and the website on the bare domain
   (served by the API, see backend/src/site). Components reference these and never hard-code colours. */
:root {
  --bg: #0b0c0f;
  --surface: #14161b;
  --surface-2: #1b1e25;
  --line: rgba(255, 255, 255, 0.1);
  --ink: #eceef2;
  --muted: #9198a3;
  --faint: #5d636d;
  --low: #ff5c8a;
  --lens: #e9e3d6;
  /* Each lens's accent */
  --accent-today: #ffe7b4;
  --accent-explore: #ff5cb3;
  --accent-field: #9fe3ff;
  --accent-focus: #ff7a59;
  --bar-h: 54px;
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

/* The website on the bare domain. Served after the app's tokens (frontend/src/tokens.css), so the
   site and the demo read as one place; only what the site adds is defined here. */
:root {
  --line-2: rgba(255, 255, 255, 0.18);
  --font-stage: "Bodoni 72", Didot, "Libre Bodoni", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--lens); outline-offset: 2px; border-radius: 3px; }

/* ---------- the top bar, as in the app ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; min-height: var(--bar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.app-mark { flex: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; text-decoration: none; white-space: nowrap; }
.app-mark svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; }
.app-mark svg path { fill: none; opacity: 0.55; }
.app-mark svg .lit { fill: var(--lens); stroke: none; }
.app-mark .beta { margin-left: 2px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 999px; font: 500 9.5px/1.6 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.site-nav { display: flex; align-self: stretch; }
.site-nav a { position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--lens); }
.bar-demo { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 13px; text-decoration: none; white-space: nowrap; }
.bar-demo:hover { border-color: var(--line-2); }
.bar-demo i { width: 7px; height: 7px; border-radius: 50%; background: var(--lens); }

/* ---------- page frame ---------- */
.wrap { max-width: 1152px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 792px; }
.kicker { margin: 0 0 14px; font: 11px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: clamp(34px, 5.4vw, 62px); line-height: 1.04; font-weight: 650; letter-spacing: -0.022em; }
h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.12; font-weight: 620; letter-spacing: -0.015em; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 620; }
.lede { max-width: 62ch; margin: 18px 0 0; font-size: 18px; line-height: 1.6; color: var(--muted); }
.lede b { color: var(--ink); font-weight: 600; }
.sec { padding-top: 72px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 26px; }
.sec-head p { margin: 8px 0 0; max-width: 60ch; color: var(--muted); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* ---------- hero ---------- */
.hero { padding-top: 88px; }

/* ---------- the demo: its label, its day's numbers and the four views, in one panel ---------- */
.demo-panel { padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, var(--surface), var(--bg) 70%); }
.demo-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 40px; margin-bottom: 22px; }
.demo-head h2 { margin-top: 10px; }
.demo-head .sub { margin: 8px 0 0; color: var(--muted); }
/* On a narrow screen the label wraps; the date stays whole and the dot stays on the first line */
.live-tag { display: inline-flex; align-items: baseline; gap: 7px; margin: 0; font: 10.5px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--lens); }
.live-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lens); }
/* Each number reads after its label but shows above it */
.nums { display: flex; gap: 28px; margin: 0; }
.nums div { display: flex; flex-direction: column-reverse; }
.nums dd { margin: 0; font-size: 26px; font-weight: 620; line-height: 1.15; font-variant-numeric: tabular-nums; }
.nums dt { font: 10px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.demo-panel .view { background: var(--bg); }
.views { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.view { --accent: var(--lens); display: flex; flex-direction: column; border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: 10px; overflow: hidden; background: var(--surface); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.view:hover { border-color: var(--accent); transform: translateY(-2px); }
/* height: auto, or the img's height attribute (there to reserve space while loading) beats aspect-ratio. */
.view img { aspect-ratio: 16 / 11; width: 100%; height: auto; object-fit: cover; object-position: left top; border-bottom: 1px solid var(--line); }
.view .body { padding: 14px 16px 16px; }
.view h3 { display: flex; align-items: baseline; gap: 8px; }
.view h3 small { font: 10px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.view p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.view .go { display: inline-block; margin-top: 10px; font: 12px var(--font-mono); color: var(--accent); }
.view.today { --accent: var(--accent-today); }
.view.explore { --accent: var(--accent-explore); }
.view.field { --accent: var(--accent-field); }
.view.focus { --accent: var(--accent-focus); }

/* ---------- reasons ---------- */
.reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.reason { --accent: var(--lens); padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.reason.won { --accent: var(--accent-today); }
.reason.out { --accent: var(--accent-explore); }
.reason .tag { font: 10.5px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.reason .area { margin-top: 12px; font: 11.5px var(--font-mono); color: var(--muted); }
.reason h3 { margin-top: 4px; font-family: var(--font-stage); font-style: italic; font-weight: 500; font-size: 21px; line-height: 1.25; }
.reason ul { margin: 14px 0 0; padding: 0; list-style: none; }
.reason li { position: relative; padding: 7px 0 7px 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.reason li::before { content: ""; position: absolute; left: 0; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.reason li b { color: var(--ink); font-weight: 600; }
.meter { display: flex; align-items: center; gap: 10px; margin-top: 12px; font: 12px var(--font-mono); color: var(--muted); }
.meter span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter span i { display: block; height: 100%; background: var(--accent); }
.caption { margin: 14px 0 0; font-size: 13.5px; color: var(--faint); }

/* ---------- goals ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.split p { color: var(--muted); }
.goals { margin: 0; padding: 8px 18px; list-style: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.goals li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.goals li:first-child { border-top: 0; }
.switch { flex: none; position: relative; width: 30px; height: 17px; border-radius: 9px; background: var(--accent-today); }
.switch::after { content: ""; position: absolute; top: 3px; left: 16px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); }
.goals li.off .switch { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.goals li.off .switch::after { left: 3px; background: var(--faint); }
.goals li.off .g { color: var(--faint); }
.goals .g { font-size: 14.5px; }
.goals .g small { display: block; font: 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-today); opacity: 0.8; }
.goals li.off .g small { color: var(--faint); }

/* ---------- facts list ---------- */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.facts li { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.facts h3 { font-size: 15.5px; }
.facts p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

.contact { margin-top: 72px; padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, var(--surface), var(--bg)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.contact p { margin: 6px 0 0; max-width: 58ch; color: var(--muted); }
.contact a.mail { font: 15px var(--font-mono); color: var(--lens); }

/* ---------- prose pages ---------- */
.page { padding-top: 72px; }
.prose h2 { margin: 48px 0 12px; font-size: 22px; }
.prose p, .prose li { color: var(--muted); font-size: 16px; line-height: 1.7; }
.prose p b, .prose li b { color: var(--ink); font-weight: 600; }
.prose ul { padding-left: 20px; }
.prose li { margin: 6px 0; }
.updated { margin-top: 14px; font: 12px var(--font-mono); color: var(--faint); }

/* How it works: the run as a timeline */
.steps { margin: 40px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 0 20px; padding: 22px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(step, decimal-leading-zero); grid-row: span 2; font: 600 28px/1 var(--font-mono); color: var(--faint); }
.steps h3 { font-size: 19px; }
.steps h3 small { margin-left: 8px; font: 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.steps p { margin: 6px 0 0; max-width: 64ch; color: var(--muted); }
.steps li.yours::before { content: "→"; color: var(--lens); }

/* ---------- footer ---------- */
.foot { margin-top: 96px; border-top: 1px solid var(--line); }
.foot .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-top: 26px; padding-bottom: 40px; font-size: 13.5px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot .yr { margin-left: auto; font: 12px var(--font-mono); color: var(--faint); }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .views { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .split, .reasons { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .split { gap: 24px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 0 8px; padding-top: 10px; }
  .app-mark .beta { padding: 1px 5px; }
  .bar-demo { padding: 0 10px; }
  .site-nav { order: 3; width: 100%; height: 40px; margin-left: -12px; }
  .hero { padding-top: 48px; }
  .demo-panel { padding: 16px; }
  .nums { flex-wrap: wrap; gap: 14px 24px; }
  .views { grid-template-columns: minmax(0, 1fr); }
  .steps li { grid-template-columns: 44px minmax(0, 1fr); gap: 0 12px; }
  .steps li::before { font-size: 20px; }
  .foot .yr { margin-left: 0; }
}
@media (max-width: 370px) {
  .bar-demo i { display: none; }
}
