/* fiberbelly.app — one stylesheet for every page.
   Colors and font come from the app (constants/app-theme.ts in the fiberbelly repo). */

@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-500.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-700.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-800.woff") format("woff");
  font-weight: 800;
  font-display: swap;
}

:root {
  /* Color */
  --mist: #f6f8f7;
  --white: #ffffff;
  --line: #e3e9e6;
  --ink: #1d2a33;
  --ink-soft: #5f6f67;
  --leaf: #14785a;
  --leaf-deep: #0f5e46;
  --mint: #def6ec;
  --sun: #ffc857;

  /* Type scale (roles) */
  --t-display: 800 clamp(2.5rem, 5.6vw, 4.25rem) / 1.02 "Manrope", system-ui, sans-serif; /* page hero */
  --t-title: 800 clamp(1.75rem, 3.4vw, 2.5rem) / 1.1 "Manrope", system-ui, sans-serif;     /* section title */
  --t-heading: 800 1.25rem / 1.3 "Manrope", system-ui, sans-serif;                          /* step / tile title */
  --t-body-lg: 500 1.1875rem / 1.55 "Manrope", system-ui, sans-serif;                       /* hero lead */
  --t-body: 500 1rem / 1.6 "Manrope", system-ui, sans-serif;                                /* body */
  --t-small: 700 0.875rem / 1.4 "Manrope", system-ui, sans-serif;                           /* chips, labels, nav */
  --t-caption: 500 0.8125rem / 1.45 "Manrope", system-ui, sans-serif;                       /* footer, notes */
  --t-stat: 800 clamp(3rem, 7vw, 4.5rem) / 1 "Manrope", system-ui, sans-serif;              /* gram counters */

  /* Shape */
  --r-panel: 40px;
  --r-media: 28px;
  --control-h: 44px;
  --control-r: 999px;

  --page: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--mist);
  color: var(--ink);
  font: var(--t-body);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
  border-radius: 6px;
}

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

/* ── Top bar (sticky) ────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 248, 247, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font: 800 1.375rem/1 "Manrope", system-ui, sans-serif;
  letter-spacing: -0.03em;
  color: var(--leaf);
}

.wordmark img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  padding: 0 16px;
  border-radius: var(--control-r);
  font: var(--t-small);
  text-decoration: none;
  color: var(--ink);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  background: var(--mint);
  color: var(--leaf);
}

/* Store badges in the top bar: one smaller fixed height for both. */
.nav-store a { display: block; border-radius: 8px; }

.nav-store img { height: 36px; width: auto; }

.nav-store:first-of-type { margin-left: 8px; }

/* ── Buttons ─────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-h);
  padding: 0 22px;
  border-radius: var(--control-r);
  border: 0;
  font: var(--t-small);
  text-decoration: none;
  cursor: pointer;
  background: var(--leaf);
  color: var(--white);
  transition: background 0.15s;
}

.btn:hover { background: var(--leaf-deep); }

.btn-light {
  background: var(--white);
  color: var(--leaf);
}

.btn-light:hover { background: var(--mint); }

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Official store badges: always the same height, on every page and screen size. */
.stores a { display: block; border-radius: 10px; }

.stores img { height: 48px; width: auto; }

/* ── Hero ────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(24px, 5vw, 64px) clamp(64px, 9vw, 120px);
}

.display {
  font: var(--t-display);
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lead {
  font: var(--t-body-lg);
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 24px 0 32px;
}

/* ── Feed demo (hero panel) ──────────────────── */

.feed {
  background: var(--leaf);
  color: var(--white);
  border-radius: var(--r-panel);
  padding: 28px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-count {
  font: var(--t-stat);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.feed-of {
  font: var(--t-heading);
  letter-spacing: -0.02em;
  opacity: 0.7;
}

/* Hidden at 0 g, but always takes its space so nothing moves. */
.feed-reset {
  visibility: hidden;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--control-r);
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  font: var(--t-small);
  cursor: pointer;
}

.feed-reset.is-on { visibility: visible; }

.feed-reset:hover { background: rgba(255, 255, 255, 0.26); }

.feed-bar {
  height: 14px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--leaf-deep);
  overflow: hidden;
}

.feed-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--sun);
  transition: width 0.35s ease;
}

.feed-stage {
  position: relative;
  height: 280px;
  margin: 16px 0 20px;
}

/* Moods swap instantly: fading two transparent images over each other ghosts. */
.feed-stage img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 280px;
  height: 280px;
  margin-left: -140px;
  visibility: hidden;
}

.feed-stage img.is-on { visibility: visible; }

.feed-stage.is-fed img.is-on { animation: hop 0.4s ease; }

@keyframes hop {
  35% { transform: translateY(-14px) scale(1.03); }
  70% { transform: translateY(0) scale(0.98, 1.02); }
}

.feed-say {
  position: absolute;
  top: 8px;
  right: 0;
  z-index: 1;
  max-width: 46%;
  padding: 10px 16px;
  border-radius: 20px 20px 20px 6px;
  background: var(--white);
  color: var(--ink);
  font: var(--t-small);
}

.feed-stage.is-done .feed-say { background: var(--sun); }

.feed-foods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.food {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-content: center;
  height: 60px;
  padding: 0 10px;
  border: 0;
  border-radius: 20px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}

.food:hover { background: var(--mint); }

.food:active { transform: scale(0.96); }

.food-emoji {
  grid-row: span 2;
  align-self: center;
  font-size: 1.5rem;
  line-height: 1;
}

.food-name {
  font: var(--t-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-g {
  font: var(--t-caption);
  font-weight: 700;
  color: var(--leaf);
}

/* ── Sections ────────────────────────────────── */

.section { padding-block: clamp(56px, 8vw, 104px); }

.title {
  font: var(--t-title);
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 20ch;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
  margin-top: 48px;
  list-style: none;
  counter-reset: step;
}

.step img {
  width: 160px;
  height: 160px;
  margin-bottom: 16px;
}

.step h3 {
  font: var(--t-heading);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.step h3::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font: var(--t-small);
  vertical-align: 2px;
}

.step p { color: var(--ink-soft); max-width: 30ch; }

/* Step mascots move like the app's onboarding: a slow breath (PosedMascot in
   components/onboarding/mascot-stage.tsx) plus each pose's move once when it scrolls into view. */
.step img {
  transform-origin: 50% 92%;
  animation: breathe 3.4s ease-in-out infinite;
}

.step:nth-child(2) img { animation-delay: -1.1s; }
.step:nth-child(3) img { animation-delay: -2.3s; }

/* The move is listed last so it wins over the breath while it plays; the breath keeps running underneath. */
.steps.is-in .step:nth-child(1) img { animation: breathe 3.4s ease-in-out infinite, pop-twice 0.86s ease-in-out 0.2s; }
.steps.is-in .step:nth-child(2) img { animation: breathe 3.4s ease-in-out -1.1s infinite, hop 0.5s ease 0.6s; }
.steps.is-in .step:nth-child(3) img { animation: breathe 3.4s ease-in-out -2.3s infinite, push-shake 1.2s ease-in-out 1s; }

@keyframes breathe {
  50% { transform: scaleY(0.988); }
}

@keyframes pop-twice {
  28% { transform: translateY(-2%) scale(1.06); }
  47% { transform: none; }
  70% { transform: translateY(-1%) scale(1.035); }
}

@keyframes push-shake {
  22% { transform: translateY(-2%) scale(1.07) rotate(0); }
  31% { transform: translateY(-2%) scale(1.07) rotate(4deg); }
  40% { transform: translateY(-2%) scale(1.07) rotate(-4deg); }
  49% { transform: translateY(-2%) scale(1.07) rotate(4deg); }
  58% { transform: translateY(-2%) scale(1.07) rotate(-4deg); }
  70% { transform: translateY(-2%) scale(1.07) rotate(0); }
}

/* Screenshots band */

.band-mint { background: var(--mint); }

.shots {
  display: flex;
  gap: 20px;
  margin-top: 40px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.shots::-webkit-scrollbar { display: none; }

.shots img {
  flex: 0 0 auto;
  width: clamp(200px, 22vw, 248px);
  height: auto;
  aspect-ratio: 720 / 1558;
  border-radius: var(--r-media);
  scroll-snap-align: start;
}

/* Calculator teaser */

.teaser {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.teaser img { width: 200px; height: 200px; }

.teaser p {
  color: var(--ink-soft);
  margin: 12px 0 24px;
  max-width: 44ch;
}

/* Closing download band */

.get {
  background: var(--leaf);
  color: var(--white);
  border-radius: var(--r-panel);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 24px;
  padding-inline: clamp(24px, 5vw, 56px);
  margin-bottom: clamp(56px, 8vw, 104px);
  overflow: hidden;
}

.get .title { margin-bottom: 24px; }

.get-copy { padding-block: clamp(32px, 5vw, 56px); }

/* The mascot peeks up from the band's bottom edge, feet cropped, phone beside the badges. */
.get-mascot {
  align-self: end;
  width: 260px;
  height: 260px;
  margin: 16px 0 -52px;
  transform-origin: 50% 92%;
  animation: breathe 3.4s ease-in-out infinite;
}

/* ── Page header (inner pages) ───────────────── */

.page-head { padding-block: clamp(24px, 5vw, 56px) 32px; }

.page-head .lead { margin-bottom: 0; }

/* Tools index */

.tool-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  padding-bottom: clamp(56px, 8vw, 104px);
}

.tool {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 20px 24px 20px 16px;
  background: var(--white);
  border-radius: var(--r-media);
  text-decoration: none;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.tool:hover { border-color: var(--leaf); }

.tool img { width: 96px; height: 96px; }

.tool h2 { font: var(--t-heading); letter-spacing: -0.02em; }

.tool p { color: var(--ink-soft); margin-top: 4px; }

/* ── Fiber calculator ────────────────────────── */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 20px;
  margin-bottom: 24px;
}

.calc-inputs {
  background: var(--white);
  border-radius: var(--r-panel);
  padding: clamp(24px, 4vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.field { border: 0; min-width: 0; }

.field legend {
  font: var(--t-heading);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip { position: relative; }

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  padding: 0 18px;
  border-radius: var(--control-r);
  background: var(--mist);
  font: var(--t-small);
  transition: background 0.15s, color 0.15s;
}

.chip:hover span { background: var(--mint); }

.chip input:checked + span {
  background: var(--leaf);
  color: var(--white);
}

.chip input:focus-visible + span {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.calc-result {
  background: var(--leaf);
  color: var(--white);
  border-radius: var(--r-panel);
  padding: clamp(24px, 4vw, 36px) clamp(24px, 4vw, 36px) 0;
  display: flex;
  flex-direction: column;
}

.calc-result-label { font: var(--t-small); opacity: 0.8; }

.calc-grams {
  font: var(--t-stat);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}

.calc-plan {
  font: var(--t-body);
  margin-top: 12px;
  min-height: 3.2em; /* two lines reserved, so the panel never changes height */
}

.calc-result img {
  width: 200px;
  height: 200px;
  margin: auto auto 0;
}

.notes {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 16px 0 clamp(56px, 8vw, 88px);
}

.notes h2 {
  font: var(--t-heading);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.notes p { color: var(--ink-soft); }

/* ── Footer ──────────────────────────────────── */

.footer {
  border-top: 1px solid var(--line);
  padding-block: 28px 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font: var(--t-caption);
  color: var(--ink-soft);
}

.footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
}

.footer a { text-decoration: none; }

.footer a:hover { color: var(--leaf); }

/* ── Responsive ──────────────────────────────── */

@media (max-width: 900px) {
  .nav-store { display: none; }
  .hero,
  .calc { grid-template-columns: minmax(0, 1fr); }
  .steps,
  .notes { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .step { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; }
  .step img { width: 112px; height: 112px; margin: 0; }
  .get { grid-template-columns: minmax(0, 1fr); position: relative; }
  .get-mascot { position: absolute; right: 16px; bottom: -24px; width: 124px; height: 124px; margin: 0; }
}

@media (max-width: 600px) {
  .nav { height: 64px; }
  .nav-link { padding: 0 12px; }
  .teaser { grid-template-columns: minmax(0, 1fr); }
  .teaser img { width: 140px; height: 140px; }
  .feed { padding: 20px; border-radius: 32px; }
  .feed-stage { height: 220px; }
  .feed-stage img { width: 220px; height: 220px; margin-left: -110px; }
}

@media (max-width: 360px) {
  .get-mascot { display: none; }
}

@media (max-width: 440px) {
  .feed-foods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* ── Legal pages ─────────────────────────────── */

.prose {
  max-width: 68ch;
  padding-block: clamp(24px, 5vw, 56px) clamp(56px, 8vw, 104px);
}

.prose-meta {
  font: var(--t-caption);
  color: var(--ink-soft);
  margin: 12px 0 8px;
}

.prose h2 {
  font: var(--t-heading);
  letter-spacing: -0.02em;
  margin: 36px 0 10px;
}

.prose p,
.prose li { color: var(--ink-soft); }

.prose p + p,
.prose ul + p,
.prose p + ul { margin-top: 12px; }

.prose ul { padding-left: 20px; }

.prose li + li { margin-top: 6px; }

.prose strong { color: var(--ink); }

.prose a { color: var(--leaf); }

/* ── Contact form ────────────────────────────── */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: start;
  padding-bottom: clamp(56px, 8vw, 104px);
}

.contact-card {
  background: var(--white);
  border-radius: var(--r-panel);
  padding: clamp(24px, 4vw, 36px);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-label {
  display: block;
  font: var(--t-small);
  margin-bottom: 8px;
}

.input {
  display: block;
  width: 100%;
  height: var(--control-h);
  padding: 0 18px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--mist);
  color: var(--ink);
  font: var(--t-body);
  transition: border-color 0.15s, background 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--leaf);
  background: var(--white);
}

textarea.input {
  height: 200px;
  padding: 14px 18px;
  resize: vertical;
}

/* Spam trap: hidden from people, filled in by bots. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn:disabled { opacity: 0.6; cursor: default; }

.form-error {
  font: var(--t-small);
  color: #c2412d;
  min-height: 1.4em; /* space reserved so the form never moves */
}

.contact-sent {
  display: none;
  text-align: center;
  padding: 24px 0;
}

.contact-sent img {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
}

.contact-sent h2 { font: var(--t-title); letter-spacing: -0.035em; }

.contact-sent p { color: var(--ink-soft); margin-top: 8px; }

.is-sent .contact-form { display: none; }

.is-sent .contact-sent { display: block; }

.contact-side img { width: 240px; height: 240px; }

@media (max-width: 900px) {
  .contact { grid-template-columns: minmax(0, 1fr); }
  .contact-side { display: none; }
}

/* ── FAQ ─────────────────────────────────────── */

.faq {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq details {
  background: var(--white);
  border-radius: 24px;
}

.faq summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  font: var(--t-heading);
  letter-spacing: -0.02em;
  cursor: pointer;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex: 0 0 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--leaf);
  font: 800 1.25rem/1 "Manrope", system-ui, sans-serif;
  transition: transform 0.2s;
}

.faq details[open] summary::after { transform: rotate(45deg); }

.faq details p {
  padding: 0 24px 22px;
  color: var(--ink-soft);
  max-width: 62ch;
}

.faq a,
.faq-more a { color: var(--leaf); }

.faq-more {
  padding: 32px 0 clamp(56px, 8vw, 104px);
  color: var(--ink-soft);
}

/* ── 404 ─────────────────────────────────────── */

.lost {
  text-align: center;
  padding-block: clamp(48px, 8vw, 96px);
}

.lost img { width: 200px; height: 200px; margin: 0 auto 24px; }

.lost .lead { margin: 16px auto 28px; }

.is-sent .contact-side { visibility: hidden; }
