@font-face {
  font-family: "BB Inter";
  src: url("./assets/fonts/inter-latin-500-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "BB Inter";
  src: url("./assets/fonts/inter-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "BB Inter";
  src: url("./assets/fonts/inter-latin-800-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

/* Stone & Garnet on paper: sibling to Mike's Stone & Tide. One ground, ink, hairlines, Garnet accent, Inter. */
:root {
  color-scheme: light;
  --paper: #f4f5f6;
  --surface: #ffffff;
  --sunken: #eceef0;
  --ink: #111417;
  --ink-hover: #2a2f34;
  --muted-ink: #565d63;
  --subtle-ink: #8a9197;
  --rule: rgb(17 20 23 / 0.14);
  --accent: #a3243b;
  --accent-soft: #f7e8eb;
  --good: #1f7a5c;
  --good-soft: #e3f2ec;
  --neutral: #6f777d;
  --neutral-soft: #eceef0;
  --limit: #b26a0b;
  --limit-soft: #fbf0df;
  --mike: #0a6c74;
  --mike-soft: #e3f1f2;
  --validation: #a3243b;
  --sans: "BB Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --side: clamp(20px, 4.3vw, 64px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-tile: cubic-bezier(0.2, 0.8, 0.2, 1);
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--ink); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-ink);
  font-variant-numeric: tabular-nums;
}

.shell {
  width: min(100%, 1180px);
  margin-inline: auto;
  padding-inline: var(--side);
}

.skip-signup {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: var(--side);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-signup:focus { transform: none; }

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.top-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

.top-links a:hover { text-decoration-color: var(--accent); }

.top-links a.nav-cta {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  text-decoration: none;
  transition: background-color 150ms, transform 150ms;
}
.top-links a.nav-cta:hover { background: var(--ink-hover); }
.top-links a.nav-cta:active { transform: scale(0.98); }

/* ---------- Editorial beats ---------- */
.story-stage {
  position: relative;
  width: min(100%, 1180px);
  margin-inline: auto;
  padding: 0 var(--side) 64px;
}

.beat {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: 32px 56px;
  padding: clamp(44px, 7.5vw, 96px) 0;
  border-top: 1px solid var(--rule);
}

.beat[data-beat="0"] {
  border-top: 0;
  padding-top: clamp(20px, 4.5vw, 56px);
}

.beat--stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

.beat h1, .beat h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.95;
  text-wrap: balance;
}

.beat h1 { font-size: clamp(46px, 6.4vw, 98px); }
.beat h2 { font-size: clamp(34px, 4.6vw, 72px); }
.beat em { color: var(--accent); font-style: normal; }
.beat em.mike-em { color: var(--mike); }

.beat-copy > p:not(.label) {
  max-width: 42ch;
  margin: 20px 0 0;
  color: var(--muted-ink);
  font-size: clamp(16px, 1.45vw, 19px);
  line-height: 1.55;
  text-wrap: pretty;
}

.beat-copy > .eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 26px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 150ms, transform 150ms;
}
.btn-primary:hover { background: var(--ink-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
}
.btn-link:hover { text-decoration-color: var(--accent); }

/* ---------- Beat 0: Blood-type hero stage (mirrors iOS WelcomeView) ---------- */
.type-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 360px;
  padding: 36px 24px 28px;
  border: 1px solid var(--rule);
  border-radius: 24px;
  background: var(--surface);
  overflow: hidden;
}

.type-stage::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  top: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(163 36 59 / 0.14) 0%, rgb(163 36 59 / 0.04) 55%, transparent 72%);
  pointer-events: none;
}

.type-hero-glyph {
  position: relative;
  margin: 0;
  font-size: clamp(92px, 11vw, 138px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: opacity 280ms var(--ease-out), transform 280ms var(--ease-out);
}

.type-hero-glyph.is-swapping {
  opacity: 0;
  transform: translateY(-10px);
}

.type-hero-caption {
  position: relative;
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted-ink);
  transition: opacity 240ms ease;
}

.type-strip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 26px;
}

.type-pill {
  min-width: 44px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--subtle-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms;
}

.type-pill:hover { color: var(--ink); background: var(--sunken); }

.type-pill[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: rgb(163 36 59 / 0.22);
  color: var(--accent);
}

/* ---------- Beat 1: Interactive Food Fit Tile Grid (inspired by Mike's 28-nutrient grid) ---------- */
.grid-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}

.abo-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--sunken);
  border: 1px solid var(--rule);
}

.abo-tab {
  min-width: 64px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-ink);
  font-size: 14px;
  font-weight: 700;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.abo-tab:hover { color: var(--ink); }

.abo-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--surface);
}

.fit-summary {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
}

.fit-summary-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.fit-summary-title {
  font-size: 15px;
  font-weight: 700;
}

.fit-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-ink);
  font-variant-numeric: tabular-nums;
}

.fit-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fit-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.fit-bar-track {
  display: flex;
  height: 10px;
  gap: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sunken);
}

.fit-seg {
  height: 100%;
  border-radius: 999px;
  transition: width 420ms var(--ease-out);
}
.fit-seg--good { background: var(--good); }
.fit-seg--neutral { background: var(--neutral); }
.fit-seg--limit { background: var(--limit); }

.food-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ft {
  --ft-c: var(--good);
  --ft-bg: var(--good-soft);
  --ft-fill: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-height: 92px;
  padding: 12px 13px 11px;
  border-radius: 14px;
  background: var(--ft-bg);
  transition: background-color 280ms var(--ease-tile), transform 220ms var(--ease-tile);
}

.ft[data-fit="good"] { --ft-c: var(--good); --ft-bg: color-mix(in srgb, var(--good) 12%, var(--surface)); --ft-fill: 100%; }
.ft[data-fit="neutral"] { --ft-c: var(--neutral); --ft-bg: color-mix(in srgb, var(--neutral) 10%, var(--surface)); --ft-fill: 58%; }
.ft[data-fit="limit"] { --ft-c: var(--limit); --ft-bg: color-mix(in srgb, var(--limit) 14%, var(--surface)); --ft-fill: 24%; }

.ft-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.ft-status {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ft-c);
}

.ft-bar {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ft-c) 22%, transparent);
}

.ft-fill {
  display: block;
  width: var(--ft-fill);
  height: 100%;
  border-radius: 2px;
  background: var(--ft-c);
  transition: width 360ms var(--ease-tile), background-color 280ms var(--ease-tile);
}

/* ---------- Beat 2: Mike Sync Bridge ---------- */
.sync-card {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--surface);
}

.sync-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-block: 8px;
}

.sync-badge {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.sync-badge--mike {
  background: var(--mike-soft);
  border-color: rgb(10 108 116 / 0.22);
}

.sync-badge img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sync-arrows {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 700;
}

.sync-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.sync-rows li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.45;
}

.sync-rows li:last-child { border-bottom: 0; padding-bottom: 0; }
.sync-rows strong { font-weight: 700; color: var(--ink); }
.sync-rows span { color: var(--muted-ink); }

.sources-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted-ink);
}

/* ---------- Beat 3: Daily Note & Weight Drivers Preview ---------- */
.insight-stack {
  display: grid;
  gap: 14px;
}

.note-card {
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--surface);
}

.note-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.note-card h3 {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.note-actions {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.note-actions li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
}

.note-actions li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-2px);
}

.note-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--subtle-ink);
}

.driver-card {
  padding: 18px 22px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--surface);
}

.driver-row {
  display: grid;
  gap: 6px;
  padding-block: 8px;
}

.driver-row + .driver-row { border-top: 1px solid var(--rule); }

.driver-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

.driver-val { color: var(--accent); font-variant-numeric: tabular-nums; }
.driver-val--muted { color: var(--muted-ink); }

.driver-track {
  position: relative;
  height: 10px;
}

.driver-zero {
  position: absolute;
  left: 34%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

.driver-ci {
  position: absolute;
  top: 3px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.driver-dot {
  position: absolute;
  top: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

/* ---------- Beat 4: Meet Buddy ---------- */
.beat-mascot {
  display: flex;
  justify-content: center;
  margin: 0;
}

.beat-mascot img {
  width: clamp(160px, 21vw, 240px);
  height: auto;
  filter: drop-shadow(0 18px 32px rgb(163 36 59 / 0.14));
}

/* ---------- Beat 5: Signup Tile (directly inspired by Mike's #beta-signup-card) ---------- */
.tile-slot { width: min(100%, 480px); justify-self: end; }

.signup-tile {
  --tile-c: var(--accent);
  display: grid;
  gap: 16px;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tile-c) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tile-c) 18%, transparent);
}

.signup-tile:focus { outline: none; }

.signup-tile .tile-label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tile-bar {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--tile-c) 22%, transparent);
}

.tile-bar-fill {
  display: block;
  width: var(--tile-fill, 0%);
  height: 100%;
  border-radius: 2px;
  background: var(--tile-c);
  transition: width 420ms var(--ease-tile);
}

.signup-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.signup-fields input, .signup-button { min-height: 48px; }

.signup-fields input {
  width: 100%;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1.5px solid #5f6a70;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  caret-color: var(--accent);
}

.signup-fields input:focus { outline: none; border-bottom-color: var(--accent); }
.signup-fields input::placeholder { color: var(--muted-ink); }
.signup-fields input[aria-invalid="true"] { border-bottom-color: var(--validation); }

.signup-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms, transform 150ms;
}

.signup-button:hover { background: var(--ink-hover); }
.signup-button:active { transform: scale(0.98); }
.signup-button:disabled { opacity: 0.72; }

.signup-extras {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.signup-type-group {
  display: grid;
  gap: 8px;
}

.signup-type-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-ink);
}

.signup-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bt-chip {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}

.bt-chip:hover { border-color: var(--ink); }
.bt-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.mike-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.mike-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.signup-error {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--validation);
}

.signup-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted-ink);
}

.signup-complete {
  display: grid;
  gap: 14px;
  font-size: 14px;
}

.signup-confirmation strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
}

.signup-confirmation p {
  margin: 4px 0 0;
  color: var(--muted-ink);
}

.signup-complete-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.signup-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.signup-secondary:hover { text-decoration-color: var(--accent); }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 28px calc(32px + env(safe-area-inset-bottom, 0px));
  color: var(--muted-ink);
  font-size: 13.5px;
}

.site-foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.site-foot a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.site-foot a:hover { text-decoration-color: var(--accent); }

.site-disclaimer {
  margin: 14px 0 0;
  max-width: 78ch;
  font-size: 12px;
  line-height: 1.5;
  color: var(--subtle-ink);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .beat {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .tile-slot { justify-self: stretch; width: 100%; }
  .food-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .signup-fields { grid-template-columns: minmax(0, 1fr); }
  .signup-fields .signup-button { width: 100%; }
  .sync-rows li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .top-links { gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .type-hero-glyph, .ft, .ft-fill, .fit-seg, .tile-bar-fill { transition: none; }
}
