/* =========================================================================
   Fainto — Material 3 "Rally" design system, web edition.
   Tokens mirror the app's core/designsystem source of truth:
   Color.kt (dark container ladder, WHITE chrome primary, data accents),
   Shape.kt (crisp 0dp data containers, 28dp pills/panels),
   MotionTokens.kt (M3 emphasized easings, 150/220/300ms),
   Type.kt (Lexend app-wide).
   Doctrine: figures never count up; movement only for things being drawn
   or physically moved by the user; static state is the default state.
   Minimalist cut: two sections only — hero + closing CTA.
   ========================================================================= */
:root {
  /* Surfaces — Color.kt dark container ladder; page sits lowest, cards step UP */
  --bg: #27272F;             /* surfaceContainerLowest */
  --surface: #2E2E37;        /* surfaceContainerLow */
  --surface-3: #3F3F49;      /* surfaceContainerHigh */
  --surface-4: #474751;      /* surfaceContainerHighest */

  /* Chrome — Rally monochrome white primary */
  --primary: #FFFFFF;
  --on-primary: #2A2931;

  /* Data accents — DataAccents.kt bright ramp (dark surfaces) */
  --green: #36F0AB;
  --amber: #FFCF44;
  --coral: #FF6859;

  --text: #FFFFFF;
  --muted: #AEAEB1;
  --muted-2: #ABABB5;
  --line: rgba(174, 174, 177, 0.20);
  --outline: #8F8F99;
  --mask-on: #000;           /* opaque sentinel for alpha masks (RGB irrelevant) */

  /* Type — Lexend everywhere, like the app */
  --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-h1: clamp(2.35rem, 5.4vw, 3.9rem);
  --fs-h2: clamp(1.7rem, 3.4vw, 2.5rem);
  --fs-lede: clamp(1.05rem, 1.7vw, 1.2rem);
  --fs-label: 0.74rem;
  --track: 0.14em;
  --nums: lining-nums tabular-nums;

  /* Shape — Shape.kt: 28dp panels/sheets; pills */
  --r-panel: 28px;
  --r-pill: 999px;
  --r-tile: 7px;      /* icon tiles, brand mark */

  /* Space */
  --wrap: 1160px;
  --gutter: clamp(20px, 5vw, 32px);
  --sect: clamp(30px, 4.6vw, 56px);

  /* Elevation — restrained M3 dark shadows, never glows */
  --el-1: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --el-2: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15);

  /* Motion — MotionTokens.kt */
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 150ms;
  --dur-med: 220ms;
}

/* Registered so the hero ring can transition its sweep; harmless if unsupported */
@property --sweep {
  syntax: "<number>";
  inherits: false;
  initial-value: 100;
}

/* ------------------------------ base ------------------------------ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
p { margin: 0; }
strong { font-weight: 500; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--r-pill);
}
.skip-link:focus { top: 12px; }

/* --------------------------- shared bits --------------------------- */
.section { padding: calc(var(--sect) / 2) 0; }

/* M3 filled button — white chrome pill, state-layer hover, no movement */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: 0;
  border-radius: var(--r-pill);
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: var(--el-1);
  transition: background var(--dur-fast) var(--ease-std), box-shadow var(--dur-fast) var(--ease-std);
}
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 92%, var(--on-primary)); box-shadow: var(--el-2); }
.btn-primary:active { background: color-mix(in srgb, var(--primary) 88%, var(--on-primary)); box-shadow: var(--el-1); }

.glyph { width: 22px; height: 22px; flex: none; }

.btn-store { padding: 10px 22px 10px 16px; text-align: left; }
.btn-store-text { display: flex; flex-direction: column; line-height: 1.15; }
.btn-store-text small {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.btn-store-text strong { font-size: 1rem; font-weight: 600; }

/* App Store — honest "coming soon" pill, visibly not a live button */
.store-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px 11px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}
.store-note .glyph { width: 18px; height: 18px; opacity: 0.7; }

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }

.trio {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 16px 0 0;
  padding: 0;
}
.trio li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
}
.trio li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* contained tonal panel */
.band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: clamp(24px, 3.5vw, 44px);
  box-shadow: var(--el-1);
}

/* ------------------------------ navbar ------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--dur-fast) var(--ease-std);
}
.nav.is-scrolled { box-shadow: var(--el-2); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 600; }
.brand img { border-radius: var(--r-tile); }
.brand-name { font-size: 1.12rem; letter-spacing: -0.02em; }
.nav-cta { padding: 9px 20px; }

/* ------------------------------- hero ------------------------------- */
.hero { padding: clamp(40px, 7vw, 88px) 0 var(--sect); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero-copy .lede {
  font-size: var(--fs-lede);
  color: var(--muted);
  margin-top: 16px;
  max-width: 46ch;
}

/* the ring — the app's signature donut, drawn in CSS */
.hero-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ring-stage {
  position: relative;
  width: clamp(230px, 22vw, 310px);
  aspect-ratio: 1;
}
.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  --sweep: 100;
  --ring-color: var(--green);
  background: conic-gradient(var(--ring-color) calc(var(--sweep) * 1%), var(--surface-3) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 16px), var(--mask-on) calc(100% - 15px));
  mask: radial-gradient(closest-side, transparent calc(100% - 16px), var(--mask-on) calc(100% - 15px));
  transition: --sweep 900ms var(--ease-std), background-color var(--dur-med) var(--ease-std);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 18%;
}
.ring-num {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: var(--nums);
  transition: opacity var(--dur-med) ease;
}
.ring-cap {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity var(--dur-med) ease;
}
.ring.is-swapping ~ .ring-center .ring-num,
.ring.is-swapping ~ .ring-center .ring-cap { opacity: 0; }

/* segmented control — the app's dark full-pill control, selected fill + check */
.seg {
  display: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--outline);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.js .seg { display: inline-flex; }
.seg:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
.seg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-left: 1px solid var(--outline);
  transition: background var(--dur-med) var(--ease-std);
}
.seg-btn:first-of-type { border-left: 0; }
.seg-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.seg-check {
  width: 15px; height: 15px;
  flex: none;
  display: none;
}
.seg-btn:has(input:checked) { background: var(--surface-4); }
.seg-btn:has(input:checked) .seg-check { display: inline; }
.seg-btn:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -2px; }
.seg-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.seg-btn:has(input:checked):hover { background: var(--surface-4); }

.sample-tag {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ------------------------------ closing CTA ------------------------------ */
.cta-band {
  position: relative;
  text-align: center;
  overflow: hidden;
  scroll-margin-top: 84px;
}
.cta-band .cta-row { justify-content: center; }
.cta-arc {
  position: absolute;
  top: -40%;
  left: 50%;
  translate: -50% 0;
  width: 560px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--amber) 78%, transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 14px), var(--mask-on) calc(100% - 13px));
  mask: radial-gradient(closest-side, transparent calc(100% - 14px), var(--mask-on) calc(100% - 13px));
  opacity: 0.08;
  pointer-events: none;
}

/* -------------------------------- footer -------------------------------- */
.footer-wrap { margin-top: calc(var(--sect) / 2.5); border-top: 1px solid var(--line); }
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-block: clamp(22px, 3vw, 32px);
}
.footer .brand-name { font-size: 1rem; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.78rem;
  color: var(--muted-2);
}
.footer-meta a { font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.footer-meta a:hover { color: var(--text); }
.footer-meta span[aria-hidden] { color: var(--outline); }

/* ------------------------- motion (JS-gated) ------------------------- */
/* JS adds .js-motion to <html> only when allowed; static is the default. */
.js-motion .reveal { opacity: 0; translate: 0 12px; transition: opacity 400ms ease-out, translate 400ms ease-out; }
.js-motion .reveal.in { opacity: 1; translate: 0 0; }
.js-motion .ring.is-pending { --sweep: 0; }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-copy .lede { margin-inline: auto; }
  .cta-row, .trio { justify-content: center; }
  .hero-ring { order: 2; }
}
@media (max-width: 720px) {
  .footer { justify-content: center; text-align: center; }
}
@media (max-width: 560px) {
  .seg-btn { padding: 9px 13px; font-size: 0.8rem; }
  .ring-stage { width: min(260px, 78vw); }
  .cta-row { flex-direction: column; }
}

/* --------------------------- reduced motion --------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
