/* ───────────────────────── HERO (animated card demo) ───────────────────────── */
#hero {
  position: relative; min-height: 100vh;
  padding: 124px 24px 64px;
  display: flex; flex-direction: column; justify-content: center;
  /* Clip the animated demo SVG streams and absolutely-positioned recipe cards
     so they never push the viewport width beyond 100vw on mobile. */
  overflow: hidden;
}
.hero-inner { max-width: 1240px; margin: 0 auto; width: 100%; }
.hero-head { text-align: center; max-width: 760px; margin: 0 auto 46px; }
.hero-eyebrow {
  display: inline-block; font-size: 13px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--green-soft);
  margin-bottom: 16px;
}
.hero-h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(36px, 5vw, 68px); line-height: 0.98; letter-spacing: -0.03em;
}
.hero-h1 .dim { color: var(--ink-faint); }
.hero-sub {
  margin: 20px auto 0; max-width: 520px;
  font-size: clamp(16px, 1.6vw, 19px); color: var(--ink-soft); font-weight: 500; line-height: 1.5;
}

/* three-part demo grid */
.hero-demo {
  position: relative;
  display: grid; grid-template-columns: 1fr 300px 1fr;
  gap: 56px; align-items: center;
}

/* flowing connectors */
.hero-stream { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero-stream .stream-base { stroke: var(--line-2); stroke-width: 2; fill: none; }
.hero-stream .stream-flow {
  stroke: var(--green-bright); stroke-width: 2.4; fill: none;
  stroke-dasharray: 2 11; stroke-linecap: round;
  animation: streamFlow 1.1s linear infinite;
}
.hero-stream .stream-flow.d2 { stroke: var(--butter-deep); animation-duration: 1.3s; }
.hero-stream .stream-dot { fill: var(--green-bright); filter: drop-shadow(0 0 5px rgba(69,176,125,.7)); }
.hero-stream .stream-dot.b { fill: var(--butter); filter: drop-shadow(0 0 5px rgba(244,198,87,.7)); }
@keyframes streamFlow { to { stroke-dashoffset: -13; } }

/* LEFT — floating recipe carousel */
.recipe-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
}
.recipe-viewport { position: relative; width: 100%; max-width: 540px; height: 416px; overflow: hidden; }
.recipe-track { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; }
.recipe-track.dragging { cursor: grabbing; }
.recipe-track.dragging .recipe-card { transition: none; }
.recipe-nav { display: flex; align-items: center; gap: 9px; }
.recipe-nav button {
  appearance: none; border: none; cursor: pointer; padding: 0;
  width: 9px; height: 9px; border-radius: 100px;
  background: var(--line-2); transition: width .35s cubic-bezier(.2,.8,.2,1), background .35s;
}
.recipe-nav button:hover { background: var(--ink-faint); }
.recipe-nav button.active { width: 30px; background: var(--green); }
.recipe-card {
  position: absolute; top: 50%; left: 50%;
  width: 282px; height: 376px; margin: -188px 0 0 -141px;
  border-radius: 26px; overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 24px 56px rgba(27,23,18,.22);
  transform-origin: 50% 50%; will-change: transform, opacity;
  transition: transform var(--rc-dur, .6s) cubic-bezier(.22,.8,.2,1), opacity calc(var(--rc-dur, .6s) - .05s) ease;
}
.recipe-card.is-front { box-shadow: 0 34px 72px rgba(27,23,18,.30); }
.recipe-card:not(.is-front) { cursor: pointer; }
.recipe-card .rc-photo {
  position: absolute; inset: 0; z-index: 1;
  background-size: cover; background-position: center;
}
.recipe-card .rc-ph {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
}
.recipe-card .rc-ph::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 30%, rgba(255,255,255,.16), transparent 60%);
}
.recipe-card .rc-glyph { width: 96px; height: 96px; color: rgba(255,255,255,.92); }
.recipe-card .rc-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 28px 24px 22px;
  background: linear-gradient(transparent, rgba(18,14,9,.20) 30%, rgba(12,9,5,.88));
  color: var(--paper); pointer-events: none;
}
.rc-name { font-family: var(--serif); font-size: 30px; line-height: 1.0; letter-spacing: -0.01em; }
.rc-meta {
  margin-top: 10px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em; opacity: .92;
}
.rc-meta .ic { display: inline-flex; align-items: center; gap: 5px; }
.rc-meta .ic svg { width: 13px; height: 13px; }
.rc-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

/* per-dish tone gradients (recipe card faces + grocery-card thumbnail) */
.recipe-card.t-clay, .gc-thumb.t-clay     { background: linear-gradient(150deg,#E8A47E,#C9744A 70%,#A85636); }
.recipe-card.t-red, .gc-thumb.t-red       { background: linear-gradient(150deg,#CF6B5C,#B0473A 70%,#8C3328); }
.recipe-card.t-butter, .gc-thumb.t-butter { background: linear-gradient(150deg,#F4C657,#E8A11E 75%,#C9831A); }
.recipe-card.t-green, .gc-thumb.t-green   { background: linear-gradient(150deg,#5FA982,#3C7D58 75%,#2A5C40); }
.recipe-card.t-blue, .gc-thumb.t-blue     { background: linear-gradient(150deg,#7FAAC6,#5B8FB0 75%,#406F8E); }
.recipe-card.t-violet, .gc-thumb.t-violet { background: linear-gradient(150deg,#9B82C4,#6E54A6 75%,#4E3A82); }

/* CENTER — processing flow */
.flow { position: relative; z-index: 1; height: 472px; display: flex; align-items: center; justify-content: center; }
.flow-steps { position: relative; display: flex; flex-direction: column; gap: 34px; }
.flow-rail { position: absolute; left: 12px; top: 12px; bottom: 12px; width: 2px; background: var(--line-2); border-radius: 2px; }
.flow-rail .fill { position: absolute; top: 0; left: 0; width: 100%; height: 0; background: var(--green-bright); border-radius: 2px; transition: height .6s cubic-bezier(.4,0,.2,1); }
.fstep { position: relative; display: flex; align-items: flex-start; gap: 14px; }
.fdot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line-2); background: var(--paper);
  display: grid; place-items: center; z-index: 1;
  transition: border-color .4s, background .4s, transform .4s, box-shadow .4s;
}
.fdot .tick { width: 13px; height: 13px; color: var(--paper); opacity: 0; transform: scale(.5); transition: opacity .3s, transform .3s; }
.ftext { font-size: 14px; font-weight: 600; color: var(--ink-faint); line-height: 1.32; white-space: normal; padding-top: 3px; transition: color .4s; }
.fstep.on .fdot { border-color: var(--green-bright); background: var(--green-bright); box-shadow: 0 0 0 5px rgba(69,176,125,.16); transform: scale(1.06); }
.fstep.on .fdot .tick { opacity: 1; transform: scale(1); }
.fstep.on .ftext { color: var(--ink); }
.fstep.pulse .fdot { animation: dotPulse .7s ease; }
@keyframes dotPulse { 0%,100% { box-shadow: 0 0 0 5px rgba(69,176,125,.16); } 45% { box-shadow: 0 0 0 11px rgba(69,176,125,.05); } }

/* RIGHT — live grocery card */
.grocery-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 384px; margin: 0 auto; min-height: 452px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 30px; box-shadow: 0 28px 64px rgba(27,23,18,.16);
  padding: 24px 24px 20px; display: flex; flex-direction: column;
}
.gc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.gc-thumb { width: 54px; height: 54px; flex-shrink: 0; display: block; border-radius: 14px; overflow: hidden; }
.gc-title { font-family: var(--serif); font-size: 25px; line-height: 1.0; letter-spacing: -0.01em; }
.gc-sub { margin-top: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.gc-body { padding-top: 20px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.gc-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green-soft); margin-bottom: 12px; }
.gc-list { list-style: none; }
.gc-list.ingredients { display: flex; flex-wrap: wrap; gap: 8px; }
.gc-list.grocery { display: flex; flex-direction: column; gap: 8px; }
/* A11Y FIX: visibility:hidden removes elements from the accessibility tree so
   axe does not evaluate colour contrast on items that are not yet visible.
   opacity:0 keeps elements in the a11y tree and axe flags them against the
   page background (not the chip background), causing false contrast failures. */
.gc-list li { visibility: hidden; opacity: 0; transform: translateY(9px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.2,1), visibility 0s .5s; transition-delay: calc(var(--i) * 0.07s); }
.gc-list.show li { visibility: visible; opacity: 1; transform: none; transition-delay: calc(var(--i) * 0.07s), calc(var(--i) * 0.07s), 0s; }
.ing-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 100px; background: var(--paper-sunk); font-weight: 600; font-size: 14px; }
.ing-chip .ck { width: 14px; height: 14px; color: var(--green-soft); flex-shrink: 0; }
.gro-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: 15px; background: var(--paper); border: 1px solid var(--line); }
.gro-row .gl { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.gro-row .ck { width: 16px; height: 16px; color: var(--green-bright); flex-shrink: 0; }
.gro-row .qty { font-weight: 700; font-size: 13px; color: var(--ink-soft); background: var(--paper-sunk); padding: 4px 11px; border-radius: 100px; white-space: nowrap; }
.gc-foot {
  margin-top: 18px; display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; border-radius: 17px; background: var(--green); color: var(--paper);
  opacity: 0; transform: translateY(9px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.2,1);
}
.gc-foot.show { opacity: 1; transform: none; }
.gc-send { width: 30px; height: 30px; border-radius: 50%; background: var(--butter); display: grid; place-items: center; flex-shrink: 0; }
.gc-send svg { width: 17px; height: 17px; }

.hero-cta { margin-top: 48px; display: flex; gap: 12px; justify-content: center; }

/* ── Tablet (769px–1000px) — 2-col: carousel | grocery card, steps below ── */
@media (max-width: 1000px) {
  .hero-demo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "carousel grocery"
      "steps    steps";
    gap: 24px 20px;
    align-items: start;
  }
  .hero-stream { display: none; }

  .recipe-stage { grid-area: carousel; height: auto; align-items: center; }
  .grocery-card { grid-area: grocery; max-width: 100%; min-height: 0; align-self: start; }
  .flow         { grid-area: steps; height: auto; padding: 12px 0; justify-content: center; }

  .flow-steps { flex-direction: column; align-items: flex-start; gap: 16px; width: fit-content; max-width: 480px; margin: 0 auto; }
  .fstep { gap: 12px; }

  /* Always show grocery card contents — timed reveal is for desktop 3-col viewport only */
  .gc-list li { visibility: visible; opacity: 1; transform: none; transition: none; }
  .gc-foot { opacity: 1; transform: none; transition: none; margin-top: 16px; }
  .gc-body { flex: none; }
}

/* ── Mobile phones (≤768px) — stack vertically: carousel → grocery card → steps ── */
@media (max-width: 768px) {
  #hero { padding: 104px 18px 80px; } /* extra bottom padding clears sticky banner */
  .hero-demo {
    grid-template-columns: 1fr;
    grid-template-areas:
      "carousel"
      "grocery"
      "steps";
    gap: 24px;
  }
  .recipe-stage { align-items: center; }
  .recipe-viewport { height: 380px; max-width: 380px; margin: 0 auto; }
  .recipe-card { width: 260px; height: 348px; margin: -174px 0 0 -130px; }

  .grocery-card {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 18px;
  }

  .flow { justify-content: flex-start; padding: 4px 0; }
  .flow-steps { max-width: 100%; margin: 0; }
}

/* ── Small phones (≤480px) ── */
@media (max-width: 480px) {
  #hero { padding: 96px 16px 80px; }
  .recipe-viewport { height: 320px; max-width: calc(100vw - 32px); }
  .recipe-card { width: 230px; height: 308px; margin: -154px 0 0 -115px; }
  .grocery-card { max-width: 100%; border-radius: 20px; padding: 16px 14px; }
  .hero-cta { flex-direction: column; align-items: center; gap: 10px; }
}
