/* Spin home. Brand palette and the iOS system face, so the page and the app read as one thing.
   Interface fragments carry data-ui and keep the app's own conventions inside them. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }

:root {
  --bg: #f5f8f6;
  --surface: #e6eee9;
  --ink: #142019;
  --muted: #4a5a51;
  --accent: #0B4F36;
  --on-accent: #ffffff;
  --field: #0f1a15;
  --on-field: #eef4f0;
  --mint: #8AD3AB;

  --font: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-display: system-ui, -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;

  --margin: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --gap-section: clamp(120px, 14vw, 200px);
  --radius: 999px;
  --inset: max(var(--margin), calc((100vw - var(--max)) / 2 + var(--margin)));

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
  --t-reveal: 800ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1512; --surface: #18221d; --ink: #e8f0eb; --muted: #a3b3aa;
    --accent: #8AD3AB; --on-accent: #0b2a1e; --field: #070b09; --on-field: #e8f0eb;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1512; --surface: #18221d; --ink: #e8f0eb; --muted: #a3b3aa;
  --accent: #8AD3AB; --on-accent: #0b2a1e; --field: #070b09; --on-field: #e8f0eb;
  color-scheme: dark;
}

body {
  background: var(--bg); color: var(--ink);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

h1, h2, .split-word {
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: -0.035em; line-height: 0.98; text-wrap: balance;
}
h3 { font: 600 20px/1.3 var(--font-display); letter-spacing: -0.01em; }

/* Controls */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 17px; text-decoration: none; cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.button:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.button:active { transform: scale(0.97); }
.button-small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.button-wide { width: 100%; }
.text-link {
  display: inline-flex; gap: 6px; align-items: center; min-height: 44px;
  font-weight: 600; text-decoration: none; color: var(--ink);
}
.text-link span { transition: transform var(--t-ui) var(--ease-out); }
.text-link:hover span { transform: translateX(4px); }

/* Top bar: wordmark, three plain links, one action. */
.bar {
  max-width: var(--max); margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--margin) 0;
  display: flex; align-items: center; gap: 32px;
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 20px/1 var(--font-display); letter-spacing: -0.02em; }
.wordmark img { border-radius: 8px; }
.bar nav { display: flex; gap: 28px; margin-left: auto; font-size: 15px; }
.bar nav a { text-decoration: none; color: var(--muted); transition: color var(--t-hover) ease; }
.bar nav a:hover { color: var(--ink); }

main > section { max-width: var(--max); margin: 0 auto; padding-inline: var(--margin); }

/* Hero */
.hero {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
  align-items: center; min-height: min(100svh, 980px);
  padding-block: 48px 32px;
}
.hero-copy { grid-column: 1 / span 7; }
.hero h1 { font-size: clamp(44px, 5.6vw, 84px); }
.hero-lede { margin-top: 36px; font-size: 20px; max-width: 32rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 36px; }
.hero-note { margin-top: 28px; color: var(--muted); font-size: 15px; }
.hero-stage { grid-column: 9 / span 4; justify-self: end; display: grid; justify-items: center; gap: 20px; max-width: 100%; }
.hero-stage .phone { --w: min(380px, 82vw, calc((100svh - 190px) * 9 / 19)); }

/* The phone screen: a crop of the real camera screen, not a device frame. */
.phone {
  --w: min(380px, 82vw);
  position: relative; width: min(var(--w), 100%); aspect-ratio: 9 / 19;
  border-radius: calc(var(--w) * 0.13); overflow: hidden; isolation: isolate;
  background: #1c1f1d; color: #fff;
  font-family: var(--font); -webkit-font-smoothing: antialiased;
}
.phone-photos img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.2s var(--ease-in-out);
}
.phone-photos img.is-active { opacity: 1; }
.phone-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(rgba(0,0,0,.62), rgba(0,0,0,0) 34%, rgba(0,0,0,0) 54%, rgba(0,0,0,.78)); /* taste-skill-ignore: scrim over the camera photo inside data-ui */
}
.phone-ui { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 8% 6.5% 7%; }
.phone-head { display: flex; justify-content: space-between; gap: 12px; }
.phone-head b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.phone-head span { font-size: 15px; color: rgba(255,255,255,.78); }
.phone-icons { display: flex; gap: 18px; padding-top: 4px; }
.phone-metric { margin-top: 9%; display: grid; justify-items: center; }
.metric-value {
  display: block; height: 1em; overflow: hidden;
  font: 700 clamp(64px, 20vw, 88px)/1 ui-rounded, "SF Pro Rounded", var(--font);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.digits { display: block; }
.metric-unit { font-size: 15px; margin-top: 2px; }
.phone-foot { margin-top: auto; display: grid; gap: 12px; }
.cue {
  display: grid; gap: 6px; padding: 16px 18px; border-radius: 20px;
  background: rgba(0,0,0,.82); color: #fff;
}
.cue b { font-size: 17px; font-weight: 700; line-height: 1.25; }
.cue span { font-size: 15px; line-height: 1.35; color: rgba(255,255,255,.8); }
.phone-button {
  display: grid; place-items: center; min-height: 50px; border-radius: 999px;
  background: #0B4F36; color: #fff; font-weight: 600; font-size: 16px;
}

/* The live thing: pick the exercise the screen shows. */
.switch { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); }
.switch button {
  border: 0; background: transparent; min-height: 40px; padding: 0 16px; border-radius: 999px;
  font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: background-color var(--t-ui) var(--ease-out), color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.switch button:hover { color: var(--ink); }
.switch button:active { transform: scale(0.96); }
.switch button[aria-pressed="true"] { background: var(--bg); color: var(--ink); font-weight: 600; }

/* Showcase: what the camera sees, and what Spin keeps. */
main > section.split {
  max-width: none; padding: 0; margin-top: clamp(72px, 8vw, 120px);
  display: grid; grid-template-columns: 1fr 1fr; min-height: 90svh;
}
.split-in, .split-out {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  gap: 48px; padding: clamp(40px, 6vw, 88px) var(--inset) 32px;
}
.split-in { background: var(--field); color: var(--on-field); align-items: flex-start; }
.split-out { background: var(--surface); }
.split-photo { width: min(300px, 70%); aspect-ratio: 3 / 4; overflow: hidden; border-radius: 24px; }
.split-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 72%; }
.split-word { font-size: clamp(40px, 4.4vw, 64px); max-width: 9ch; }
.split-out .split-word { order: 2; align-self: flex-end; text-align: right; }

.result {
  order: 1; align-self: flex-start; width: min(460px, 100%);
  background: var(--bg); color: var(--ink); border-radius: 28px; padding: 28px;
  font-size: 15px;
}
.result-head { display: flex; justify-content: space-between; color: var(--accent); }
.result-head img { border-radius: 7px; }
.result-title { margin-top: 16px; font: 700 28px/1.15 var(--font-display); letter-spacing: -0.02em; }
.result-sub { color: var(--muted); }
.result-stats { display: flex; gap: 32px; margin-top: 20px; }
.result-stats div { display: flex; flex-direction: column-reverse; }
.result-stats dd { font: 700 28px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.result-stats dt { color: var(--muted); font-size: 15px; }
.result-rows { margin-top: 20px; }
.result-rows li { display: grid; padding: 12px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); } /* taste-skill-ignore: app row separator inside data-ui */
.result-rows b { font-weight: 600; font-size: 16px; }
.result-rows span { color: var(--muted); }
.result-note { margin-top: 12px; color: var(--muted); font-size: 15px; }

/* Features: a small true fragment beside each claim. */
.features { margin-top: var(--gap-section); padding-left: max(var(--margin), 12vw) !important; }
.features h2 { font-size: clamp(40px, 4.4vw, 64px); margin-bottom: 72px; }
.feature { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 340px); gap: 32px; align-items: start; }
.feature + .feature { margin-top: 112px; }
.feature-text p { margin-top: 10px; }
.panel { border-radius: 20px; background: var(--surface); padding: 20px; min-height: 140px; display: grid; align-content: center; }
.panel-dark { background: var(--field); color: #fff; }
.panel-tall { min-height: 220px; }
.cue-static { background: rgba(255,255,255,.08); }
.mini-metric { display: grid; justify-items: center; }
.mini-metric span { font: 700 88px/1 ui-rounded, "SF Pro Rounded", var(--font); letter-spacing: -0.02em; }
.mini-metric small { font-size: 15px; color: rgba(255,255,255,.8); }
.mini-note { margin-top: 18px; justify-self: center; font-size: 15px; padding: 6px 14px; border-radius: 999px; background: #0B4F36; color: #fff; font-weight: 600; }
.list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 11px 4px; font-size: 16px;
}
.list li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); } /* taste-skill-ignore: app row separator inside data-ui */
.list small { color: var(--muted); font-size: 15px; }
.rest { display: grid; justify-items: start; gap: 2px; padding: 4px; }
.rest b { font: 700 20px/1.2 var(--font-display); }
.rest-time {
  font: 700 64px/1 ui-rounded, "SF Pro Rounded", var(--font); font-variant-numeric: tabular-nums;
  color: var(--accent); margin: 6px 0;
}
.rest small { color: var(--muted); font-size: 15px; }

/* How it works: the phone holds still while three steps change it. */
.how {
  margin-top: var(--gap-section);
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
}
.how-steps { grid-column: 1 / span 6; }
.how h2 { font-size: clamp(40px, 4.4vw, 64px); }
.step { min-height: 52svh; display: flex; flex-direction: column; justify-content: center; max-width: 30rem; }
.step:first-of-type { min-height: 44svh; }
.step:last-child { min-height: 40svh; }
.step h3 { font: 700 28px/1.15 var(--font-display); letter-spacing: -0.02em; color: var(--muted); transition: color var(--t-ui) ease; }
.step p { margin-top: 12px; color: var(--muted); }
.step.is-active h3 { color: var(--ink); }
.step.is-active p { color: var(--ink); }
.how-stage { grid-column: 8 / span 5; }
.how-stage .phone { position: sticky; top: 12svh; margin-inline: auto; --w: min(340px, 80vw); }
.how-guide {
  position: absolute; left: 50%; top: 24%; width: 34%; height: 42%; translate: -50% 0;
  border: 2px dashed rgba(255,255,255,.8); border-radius: 999px;
  transition: opacity var(--t-ui) ease, border-color var(--t-ui) ease, scale var(--t-ui) var(--ease-out);
}
.phone[data-state="1"] .how-guide { border-style: solid; border-color: var(--mint); scale: 1.02; }
.phone[data-state="2"] .how-guide { opacity: 0; }
.how-live { opacity: 0; transition: opacity var(--t-ui) ease; }
.phone[data-state="2"] .how-live { opacity: 1; }
.how-cue { grid-area: 1 / 1; opacity: 0; transition: opacity var(--t-ui) ease; }
.phone-foot { grid-template-areas: "cue" "btn"; }
.phone[data-state="0"] .how-cue[data-for="0"],
.phone[data-state="1"] .how-cue[data-for="1"],
.phone[data-state="2"] .how-cue[data-for="2"] { opacity: 1; }
.how-stage .phone-button { transition: opacity var(--t-ui) ease; }
.phone[data-state="0"] .phone-button { opacity: .45; }
.phone[data-state="2"] .phone-button { opacity: 0; }

/* Privacy */
.private { margin-top: var(--gap-section); display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 40px; }
.private h2 { grid-column: 1 / span 6; font-size: clamp(40px, 4.4vw, 64px); }
.private-list { grid-column: 7 / span 6; display: grid; gap: 36px; font-size: 20px; }
.private-list b { display: block; font: 700 28px/1.2 var(--font-display); letter-spacing: -0.015em; margin-bottom: 6px; }
.private > p { grid-column: 7 / span 6; }

/* Beta: the request, already open. */
main > section.beta {
  max-width: none; margin-top: clamp(96px, 10vw, 150px);
  background: var(--accent); color: var(--on-accent);
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
  min-height: 86svh; padding: clamp(56px, 8vw, 112px) var(--inset);
  align-items: center;
}
.beta-copy { grid-column: 1 / span 6; align-self: end; }
.beta h2 { font-size: clamp(44px, 6vw, 92px); line-height: 0.95; max-width: 8ch; }
.beta-copy p { margin-top: 28px; font-size: 20px; max-width: 26rem; }
.sheet {
  grid-column: 8 / span 4; width: 100%; max-width: 440px; justify-self: end;
  background: var(--bg); color: var(--ink); border-radius: 28px; padding: 28px;
  display: grid; gap: 10px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); /* taste-skill-ignore: dialog floats over the field */
}
.sheet-title { font: 700 28px/1.2 var(--font-display); letter-spacing: -0.02em; margin-bottom: 8px; }
.sheet label[for], .sheet-label { font-size: 15px; color: var(--muted); }
.sheet input[type="text"] {
  min-height: 50px; padding: 0 16px; border-radius: 14px; font-size: 17px;
  border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); background: var(--surface);
  transition: border-color var(--t-hover) ease;
}
.sheet input[type="text"]:focus { outline: none; border-color: var(--accent); }
.sheet-label { margin-top: 8px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface); margin-bottom: 14px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: grid; place-items: center; min-height: 44px; border-radius: 10px; padding: 0 8px; text-align: center;
  font-size: 15px; font-weight: 500; color: var(--muted);
  transition: background-color var(--t-ui) var(--ease-out), color var(--t-hover) ease;
}
.segmented input:checked + span { background: var(--bg); color: var(--ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet .button { background: #0B4F36; color: #fff; }

/* Footer: one quiet line. */
.foot {
  max-width: var(--max); margin: 0 auto; padding: 56px var(--margin) max(32px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: baseline;
  font-size: 15px; color: var(--muted);
}
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-links { display: flex; gap: 24px; }
.foot-end { text-align: right; }

/* Entrances: only when script runs, so nothing stays hidden without it. */
.js .reveal { opacity: 0; transform: translateY(24px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--t-reveal) var(--ease-expo), transform var(--t-reveal) var(--ease-expo);
  transition-delay: var(--delay, 0ms);
}

/* The rep tick: the old number leaves upward, the new one rises in. */
.digits.is-out { transform: translateY(-40%); opacity: 0; transition: transform 160ms var(--ease-out), opacity 120ms ease; }
.digits.is-in { animation: digit-in 260ms var(--ease-out); }
@keyframes digit-in { from { transform: translateY(45%); opacity: 0; } to { transform: none; opacity: 1; } }
.cue.is-swap { animation: cue-swap 320ms var(--ease-out); }
@keyframes cue-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal.is-in { transition: opacity 200ms ease; }
  .digits.is-out, .digits.is-in, .cue.is-swap { animation: none; transition: none; transform: none; opacity: 1; }
  .phone-photos img { transition: opacity 200ms ease; }
  .button:active, .switch button:active { transform: none; }
}

/* Tablet */
@media (max-width: 1024px) {
  .hero-copy { grid-column: 1 / span 7; }
  .hero-stage { grid-column: 9 / span 4; }
  .hero h1 { font-size: clamp(44px, 7vw, 72px); }
  .sheet { grid-column: 7 / span 6; }
  .hero-stage { grid-column: 8 / span 5; justify-self: stretch; }
  .private { display: block; }
  .private h2 { margin-bottom: 40px; }
  .private > p { margin-top: 32px; }
}

/* Phone */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .bar { gap: 16px; }
  .bar nav { display: none; }
  .bar .button-small { margin-left: auto; }
  .hero { display: block; min-height: 0; padding-block: 48px 0; }
  .hero h1 { font-size: clamp(40px, 11.5vw, 56px); }
  .hero-lede { margin-top: 24px; }
  .hero-stage { margin-top: 56px; }
  main > section.split { grid-template-columns: 1fr; min-height: 0; }
  .split-in, .split-out { min-height: 62svh; padding: 40px var(--margin); }
  .split-word { font-size: 40px; }
  .split-in .split-word { order: 2; }
  .split-out .split-word { order: 0; align-self: flex-start; text-align: left; }
  .features { padding-left: var(--margin) !important; }
  .features h2 { margin-bottom: 48px; }
  .feature { grid-template-columns: 1fr; gap: 16px; }
  .feature + .feature { margin-top: 64px; }
  .how { display: flex; flex-direction: column; }
  .how-steps { display: contents; }
  .how h2 { order: 0; margin-bottom: 24px; }
  .how-stage { order: 1; margin-bottom: 24px; }
  .how-stage .phone { position: relative; top: auto; --w: min(260px, 66vw); }
  .step { order: 2; min-height: 0; padding-block: 28px; }
  .step:first-of-type { min-height: 0; }
  .step:last-child { min-height: 0; }
  .step h3, .step p { color: var(--ink); }
  .step h3 { font-size: 24px; }
  .private { display: block; }
  .private h2 { margin-bottom: 40px; }
  .private-list { font-size: 17px; }
  .private h2 { font-size: 34px; }
  .private-list b { font-size: 20px; }
  .hero-stage { justify-self: center; }
  .hero-stage .phone { --w: min(340px, 86vw); }
  .private > p { margin-top: 32px; }
  main > section.beta { display: flex; flex-direction: column; align-items: stretch; gap: 48px; min-height: 84svh; }
  .beta-copy { align-self: auto; }
  .beta h2 { font-size: 48px; }
  .sheet { max-width: none; padding: 22px; }
  .foot { grid-template-columns: 1fr; gap: 8px; padding-top: 20svh; }
  .foot-end { text-align: left; }
}
