/* ==========================================================================
   FiberMaxxing — Design Tokens
   Archetype: Soft Structuralism (consumer/health) — off-white ground,
   bold grotesk display type, airy double-bezel cards, moss + honey accents.
   Signature element: the "fiber meter" — a horizontal fill gauge reused
   in the calculator, on every food card, and as a scroll-progress rail.
   ========================================================================== */

:root {
  --bg: #F5F6F1;
  --bg-raised: #FFFFFF;
  --bg-sage: #EAF0E6;
  --ink: #12201A;
  --ink-soft: #4B564D;
  --line: rgba(18, 32, 26, 0.09);
  --moss: #2F5233;
  --moss-deep: #223D27;
  --honey: #C98A3E;
  --honey-soft: #F4E4C8;
  --rust: #A94A38;
  --rust-soft: #F3DED8;

  --font-display: 'Cabinet Grotesk', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-data: 'IBM Plex Mono', ui-monospace, monospace;

  --radius-lg: 2rem;
  --radius-md: 1.25rem;
  --radius-sm: 0.75rem;

  --shadow-ambient: 0 30px 60px -30px rgba(18, 32, 26, 0.18);
  --shadow-soft: 0 12px 30px -18px rgba(18, 32, 26, 0.16);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
main { display: block; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 5.4vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 3rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
p { margin: 0; color: var(--ink-soft); }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 62ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-data);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--moss);
  background: var(--bg-sage);
  border-radius: 999px;
  padding: 0.45em 0.95em;
}

/* ---------- Nav: floating glass pill ---------- */
.nav-shell { position: sticky; top: 0; z-index: 40; padding: 18px 20px 0; }
.nav {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(18, 32, 26, 0.08);
  border-radius: 999px;
  padding: 10px 10px 10px 22px;
  box-shadow: var(--shadow-soft);
}
.nav-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.nav-logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--moss); }
.nav-links { display: none; gap: 26px; font-size: 0.92rem; font-weight: 500; }
.nav-cta {
  background: var(--moss);
  color: #fff;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 500ms var(--ease-spring), background 400ms;
}
.nav-cta .icon-circle {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  transition: transform 500ms var(--ease-spring);
}
.nav-cta:hover { transform: scale(0.97); }
.nav-cta:hover .icon-circle { transform: translate(2px, -1px); }
@media (min-width: 860px) { .nav-links { display: flex; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 15px 26px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 500ms var(--ease-spring);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--moss); color: #fff; }
.btn-secondary { background: var(--bg-raised); color: var(--ink); border: 1px solid var(--line); }
.btn .icon-circle {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  transition: transform 500ms var(--ease-spring);
}
.btn-secondary .icon-circle { background: var(--bg-sage); }
.btn:hover .icon-circle { transform: translate(2px, -1px) scale(1.05); }

/* ---------- Double-bezel card ---------- */
.bezel {
  background: rgba(18, 32, 26, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 8px;
}
.bezel-inner {
  background: var(--bg-raised);
  border-radius: calc(var(--radius-lg) - 8px);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6);
  padding: 28px;
}

/* ---------- Fiber meter (signature element) ---------- */
.fiber-meter {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-sage);
  overflow: hidden;
}
.fiber-meter-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--honey), var(--moss));
  transition: width 1200ms var(--ease-spring);
}
.fiber-meter-row { display: flex; align-items: center; gap: 14px; }
.fiber-meter-label { font-family: var(--font-data); font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
.fiber-meter-big { height: 16px; }

/* ---------- Sections ---------- */
section { padding: 88px 0; }
.section-tight { padding: 56px 0; }
.hero { padding: 64px 0 88px; }
.hero-inner { max-width: 900px; margin: 0 auto; text-align: center; }
.hero-eyebrow { margin-bottom: 22px; }
.hero h1 { margin: 0 0 22px; }
.hero .lede { margin: 0 auto 34px; }
.hero-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ---------- Gapless bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-flow: dense;
  gap: 18px;
  margin-top: 48px;
}
.bento .span-4 { grid-column: span 4; }
.bento .span-2 { grid-column: span 2; }
.bento .span-3 { grid-column: span 3; }
.bento .span-6 { grid-column: span 6; }
@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .bento > * { grid-column: span 1 !important; }
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: var(--shadow-soft);
  transition: transform 600ms var(--ease-spring);
}
.card:hover { transform: translateY(-4px); }
.card h3 { margin-bottom: 10px; }
.card p { font-size: 0.95rem; }
.card-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--bg-sage); display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px; font-size: 1.2rem;
}

/* ---------- Food grid & food detail ---------- */
.food-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
@media (max-width: 860px) { .food-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .food-grid { grid-template-columns: 1fr; } }

.food-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; transition: transform 600ms var(--ease-spring), box-shadow 600ms; }
.food-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.food-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.food-card-fiber { font-family: var(--font-data); font-weight: 600; color: var(--moss); font-size: 1.05rem; white-space: nowrap; }
.food-card-serving { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 12px; }

.food-hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: start; margin-top: 40px; }
@media (max-width: 900px) { .food-hero { grid-template-columns: 1fr; } }
.stat-row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--ink-soft); font-size: 0.92rem; }
.stat-value { font-family: var(--font-data); font-weight: 600; }

/* ---------- Calculator ---------- */
.calc-shell { max-width: 720px; margin: 40px auto 0; }
.calc-field { margin-bottom: 20px; }
.calc-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.calc-toggle { display: flex; gap: 8px; background: var(--bg-sage); border-radius: 999px; padding: 5px; }
.calc-toggle button {
  flex: 1; border: none; background: transparent; padding: 10px 0; border-radius: 999px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); cursor: pointer;
  transition: background 400ms, color 400ms;
}
.calc-toggle button.active { background: var(--bg-raised); color: var(--moss); box-shadow: var(--shadow-soft); }
.calc-input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  font-family: var(--font-data); font-size: 1rem; background: var(--bg-raised); color: var(--ink);
}
.calc-result { margin-top: 32px; text-align: center; }
.calc-result-number { font-family: var(--font-display); font-size: clamp(2.6rem, 8vw, 4rem); font-weight: 700; color: var(--moss); }
.calc-result-sub { color: var(--ink-soft); font-size: 0.95rem; margin-top: 6px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 64px 0 40px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); margin-bottom: 16px; }
.footer-col a { display: block; font-size: 0.92rem; padding: 6px 0; color: var(--ink); }
.footer-bottom { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; color: var(--ink-soft); }

/* ---------- Reveal-on-scroll (paired with GSAP in main.js) ---------- */
.reveal { opacity: 0; transform: translateY(28px); }

.card-photo { position: relative; width: calc(100% + 52px); margin: -26px -26px 20px; border-radius: var(--radius-md) var(--radius-md) 0 0; overflow: hidden; aspect-ratio: 16/9; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-spring); }
.card:hover .card-photo img { transform: scale(1.05); }
.card-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,32,26,0) 55%, rgba(18,32,26,0.35) 100%); }

.cat-banner { position: relative; width: 100%; aspect-ratio: 21/9; border-radius: var(--radius-lg); overflow: hidden; margin-top: 32px; }
.cat-banner img { width: 100%; height: 100%; object-fit: cover; }
.cat-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,32,26,0) 40%, rgba(18,32,26,0.45) 100%); }

.hero-photo { position: relative; width: 100%; max-width: 1040px; margin: 0 auto; aspect-ratio: 21/9; border-radius: var(--radius-lg); overflow: hidden; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.book-cover { width: 100%; max-width: 280px; aspect-ratio: 2/3; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-ambient); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.callout { border-left: 3px solid var(--honey); background: var(--honey-soft); border-radius: 0 14px 14px 0; padding: 18px 22px; margin: 28px 0; font-size: 0.95rem; color: var(--ink); }
.callout-safety { border-left-color: var(--rust); background: var(--rust-soft); }

.prose p + p { margin-top: 18px; }
.prose { max-width: 72ch; }

.pill-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.pill { background: var(--bg-sage); color: var(--moss-deep); font-size: 0.85rem; font-weight: 600; padding: 8px 16px; border-radius: 999px; }
