/* ============================================================
   BEANLEAF — HERO
   Full-bleed sunlit sky. The WebGL scene (js/hero-scene.js)
   paints on .hero-canvas; the CSS gradient underneath matches
   it stop-for-stop so there is no flash before first paint.

   Layers:  1  .hero-canvas   (WebGL sky, clouds, the two cups)
            2  .hero-fallback (CSS-only composition, no-WebGL)
            3  .hero-inner    (the copy column)
            4  .hero-scroll

   Colour: tokens everywhere except the sky ramp's two intermediate
   stops and the rgba() gradient stops, which need an alpha channel.
   Those rgba triples are tokens spelled out:
     255,255,255 --porcelain   252,251,248 --paper
     247,243,236 --linen       243,247,242 --mist
     233,239,225 --tea-wash     30, 42, 34 --ink
   ============================================================ */

.hero {
  /* Local stops. These are the ONLY literal colours in this file:
     the sky ramp has to match the canvas gradient exactly, and the
     intermediate blends have no token of their own. */
  --sky-1: var(--air);        /* #EEF4F4 pale sky            */
  --sky-2: #F1F6F4;           /* air → mist blend            */
  --sky-3: #F9FBF9;           /* mist → white blend          */
  --sky-4: var(--porcelain);  /* the bright band             */
  --sky-5: var(--paper);
  --sky-6: var(--linen);      /* warm floor                  */

  /* The nav is fixed at the top; sections.css may publish --nav-h. */
  --hero-nav: var(--nav-h, 76px);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;

  display: flex;
  align-items: center;

  padding-top: var(--hero-nav);
  padding-bottom: clamp(4.75rem, 9vh, 7.25rem);

  background:
    linear-gradient(180deg,
      var(--sky-1) 0%,
      var(--sky-2) 24%,
      var(--sky-3) 46%,
      var(--sky-4) 62%,
      var(--sky-5) 82%,
      var(--sky-6) 100%);
  color: var(--ink-2);
}

/* A hairline of warm light where the hero meets the page below. */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(70px, 12vh, 140px);
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(247, 243, 236, 0) 0%,
    rgba(250, 247, 241, .50) 58%,
    rgba(253, 252, 250, .90) 100%);
}

/* ---- The WebGL surface ------------------------------------- */

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  pointer-events: auto;
  touch-action: pan-y pinch-zoom;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.hero--live .hero-canvas { opacity: 1; }
.hero.no-webgl .hero-canvas { display: none; }

.hero--cup-hover { cursor: pointer; }
.hero-clink {
  position: absolute;
  z-index: 4;
  transform: translateX(-50%);
  padding: .65rem .95rem;
  border: 1px solid rgba(88, 113, 64, .2);
  border-radius: 30px;
  background: rgba(252, 251, 248, .66);
  color: var(--olive);
  font-family: inherit;
  font-size: .75rem;
  letter-spacing: .06em;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  min-height: 44px;
}
.hero-clink span { margin-right: .25rem; }
.hero-clink:hover { background: var(--paper); border-color: var(--olive); }
.hero-clink:focus-visible { outline: 2px solid var(--olive); outline-offset: 4px; }
.hero-clink-status {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -100%);
  pointer-events: none;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.25;
  white-space: nowrap;
  color: var(--olive);
  opacity: 0;
  transition: opacity .18s;
}
.hero--clink .hero-clink-status { opacity: 1; }
.hero.no-webgl .hero-clink,
.hero.no-webgl .hero-clink-status { display: none; }

/* ============================================================
   NO-WEBGL COMPOSITION
   Layered radial gradients as clouds + the two drink cut-outs.
   It has to read as the intended artwork, not as a fallback.
   ============================================================ */

.hero-fallback {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero.no-webgl .hero-fallback {
  display: block;
  background-image:
    radial-gradient(44% 30% at 16% 20%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 72%),
    radial-gradient(34% 22% at 68% 10%, rgba(255, 255, 255, .82), rgba(255, 255, 255, 0) 74%),
    radial-gradient(48% 28% at 92% 30%, rgba(243, 247, 242, .90), rgba(243, 247, 242, 0) 72%),
    radial-gradient(38% 24% at 44% 34%, rgba(255, 255, 255, .70), rgba(255, 255, 255, 0) 76%),
    radial-gradient(64% 32% at 38% 80%, rgba(247, 243, 236, .78), rgba(247, 243, 236, 0) 74%),
    radial-gradient(52% 26% at 86% 66%, rgba(233, 239, 225, .55), rgba(233, 239, 225, 0) 76%);
  /* transform-only, so the whole cloud bed breathes on the compositor
     instead of repainting six radial gradients every frame */
  animation: heroSkyBreathe 34s ease-in-out infinite alternate;
  will-change: transform;
}

.hero.no-webgl .hero-fallback::before,
.hero.no-webgl .hero-fallback::after {
  content: "";
  position: absolute;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  filter: drop-shadow(0 34px 44px rgba(30, 42, 34, .17));
  animation: heroFloat 9.5s var(--ease-soft) infinite;
  will-change: transform;
}

/* Matcha — the taller of the two, slightly further forward. */
.hero.no-webgl .hero-fallback::before {
  background-image: url("../images/drink-matcha-hero.png");
  background-image: image-set(url("../images/web/drink-matcha-hero-480.webp") 1x, url("../images/web/drink-matcha-hero-900.webp") 2x);
  right: 22%;
  bottom: 15%;
  width: min(31vw, 350px);
  height: min(58vh, 540px);
  z-index: 2;
}

/* Cold brew — set back and down, so the pair reads as a group. */
.hero.no-webgl .hero-fallback::after {
  background-image: url("../images/drink-coldbrew-hero.png");
  background-image: image-set(url("../images/web/drink-coldbrew-hero-480.webp") 1x, url("../images/web/drink-coldbrew-hero-900.webp") 2x);
  right: 5%;
  bottom: 9%;
  width: min(27vw, 305px);
  height: min(50vh, 470px);
  opacity: .94;
  animation-delay: -4.6s;
  z-index: 1;
}

@keyframes heroFloat {
  0%   { transform: translate3d(0, 0, 0)     rotate(-.5deg); }
  50%  { transform: translate3d(0, -18px, 0) rotate(.6deg); }
  100% { transform: translate3d(0, 0, 0)     rotate(-.5deg); }
}

@keyframes heroSkyBreathe {
  from { transform: scale(1)    translate3d(0, 0, 0); }
  to   { transform: scale(1.05) translate3d(-1.4%, .7%, 0); }
}

/* ============================================================
   THE COPY COLUMN
   ============================================================ */

.hero-inner {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 640px);
  justify-content: start;
  align-content: center;
  row-gap: clamp(1.05rem, 2.1vh, 1.7rem);
  padding-block: clamp(1rem, 3vh, 2.5rem);
}

/* Grid items default to min-width:auto; without this a long word
   in the display face can push the column past the viewport. */
.hero-inner > * { min-width: 0; }

.hero-eyebrow {
  color: var(--olive);
  flex-wrap: wrap;
}

.hero-title {
  margin-block: clamp(.15rem, .8vh, .6rem);
  letter-spacing: -.026em;
  line-height: .96;
  overflow-wrap: break-word;
}

.hero-title .hero-line {
  display: block;
}

.hero-line--em {
  color: var(--forest);
  padding-left: .06em;
}
.hero-line--em em {
  font-style: italic;
  font-weight: 300;
}

.hero-lede {
  max-width: 44ch;
  color: var(--ink-2);
}

.hero-script {
  font-family: var(--script);
  font-size: clamp(1.6rem, 2.4vw, 2.4rem);
  line-height: 1.25;
  color: var(--olive);
  margin-top: clamp(-.2rem, 0vh, .2rem);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin-top: clamp(.35rem, 1.2vh, .9rem);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.6rem;
  margin-top: clamp(.5rem, 1.6vh, 1.1rem);
  font-size: var(--fs-small);
  color: var(--ink-3);
  letter-spacing: .012em;
}
.hero-meta li {
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.hero-meta .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--leaf);
  flex: none;
}

/* ============================================================
   SCROLL CUE
   ============================================================ */

.hero-scroll {
  position: absolute;
  z-index: 4;
  left: var(--gutter);
  bottom: clamp(1.4rem, 3.6vh, 2.6rem);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  color: var(--ink-3);
  transition: color var(--t-fast) var(--ease);
}
.hero-scroll:hover { color: var(--olive); }

.hero-scroll-line {
  position: relative;
  display: block;
  width: 1px;
  height: clamp(38px, 6vh, 56px);
  overflow: hidden;
  background: var(--line);
}
.hero-scroll-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 42%;
  background: var(--olive);
  transform: translateY(-130%);
  animation: heroScrollRun 2.6s var(--ease-soft) infinite;
}
.hero-scroll:hover .hero-scroll-line { background: var(--line-soft); }

.hero-scroll-word {
  font-size: var(--fs-eyebrow);
  letter-spacing: .28em;
  text-transform: uppercase;
  line-height: 1;
}

@keyframes heroScrollRun {
  0%   { transform: translateY(-130%); }
  100% { transform: translateY(268%); }
}

/* ============================================================
   ENTRANCE — staggered mask + translate reveal on load
   ============================================================ */

.hero-title .hero-line {
  opacity: 0;
  clip-path: inset(0 0 108% 0);
  transform: translateY(.18em);
  animation: heroLineIn .95s var(--ease) forwards;
  will-change: clip-path, transform, opacity;
}
.hero-title .hero-line:nth-child(1) { animation-delay: .18s; }
.hero-title .hero-line:nth-child(2) { animation-delay: .34s; }

@keyframes heroLineIn {
  to {
    opacity: 1;
    clip-path: inset(-16% 0 -16% 0);
    transform: translateY(0);
  }
}

.hero-eyebrow,
.hero-lede,
.hero-script,
.hero-cta,
.hero-meta,
.hero-scroll {
  opacity: 0;
  transform: translateY(15px);
  animation: heroRise .9s var(--ease) forwards;
}
.hero-eyebrow { animation-delay: .06s; }
.hero-lede    { animation-delay: .52s; }
.hero-script  { animation-delay: .64s; }
.hero-cta     { animation-delay: .74s; }
.hero-meta    { animation-delay: .84s; }
.hero-scroll  { animation-delay: 1.05s; }

@keyframes heroRise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroRiseCentred {
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .hero-inner {
    grid-template-columns: minmax(0, 560px);
  }
  .hero-lede { max-width: 40ch; }
  .hero-meta { gap: .45rem 1.25rem; }
}

/* At this width the drinks move behind and below the copy, so the
   copy centres and sits on a very soft veil to hold contrast. */
@media (max-width: 980px) {
  .hero {
    align-items: flex-start;
    padding-bottom: clamp(9rem, 26vh, 15rem);
  }

  .hero-inner {
    grid-template-columns: minmax(0, 46ch);
    justify-content: center;
    justify-items: center;
    text-align: center;
    padding-block: clamp(2rem, 7vh, 4.5rem) 0;
    row-gap: clamp(.95rem, 1.8vh, 1.4rem);
  }

  /* The veil: a gradient, never a flat panel. */
  .hero-inner::before {
    content: "";
    position: absolute;
    inset: -14% -8% -22%;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(70% 52% at 50% 40%,
        rgba(252, 251, 248, .94) 0%,
        rgba(252, 251, 248, .78) 42%,
        rgba(252, 251, 248, .34) 68%,
        rgba(252, 251, 248, 0) 84%);
  }

  .hero-eyebrow { justify-content: center; }
  .hero-lede { max-width: 42ch; }
  .hero-cta { justify-content: center; }
  .hero-meta { justify-content: center; gap: .4rem 1.15rem; }

  /* Centred cue needs its own keyframes so the entrance animation
     does not discard the -50% centring offset when it lands. */
  .hero-scroll {
    left: 50%;
    transform: translateX(-50%) translateY(15px);
    bottom: clamp(1.1rem, 2.6vh, 1.9rem);
    animation-name: heroRiseCentred;
  }

  /* Keep the pair readable when the copy stacks above them. */
  .hero.no-webgl .hero-fallback::before {
    right: auto;
    left: 50%;
    margin-left: -21vw;
    bottom: 4%;
    width: min(38vw, 250px);
    height: min(34vh, 330px);
  }
  .hero.no-webgl .hero-fallback::after {
    right: auto;
    left: 50%;
    margin-left: -8vw;
    bottom: 2%;
    width: min(33vw, 215px);
    height: min(29vh, 285px);
  }
}

@media (max-width: 520px) {
  .hero { padding-bottom: clamp(8rem, 24vh, 12rem); }

  .hero-eyebrow {
    font-size: .625rem;
    letter-spacing: .14em;
    line-height: 1.7;
  }
  .hero-eyebrow::before { width: 18px; }

  .hero-title {
    font-size: clamp(2.35rem, 11.6vw, 3.4rem);
    line-height: 1;
    letter-spacing: -.02em;
  }

  .hero-lede {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 36ch;
  }

  .hero-script { font-size: clamp(1.35rem, 6vw, 1.7rem); }

  .hero-cta {
    width: 100%;
    gap: .6rem;
  }
  .hero-cta .btn {
    flex: 1 1 13rem;
    padding-inline: 1.2em;
    letter-spacing: .16em;
  }

  .hero-meta {
    flex-direction: column;
    align-items: center;
    gap: .38rem;
    font-size: .8125rem;
  }

  .hero-scroll { gap: .55rem; }
  .hero-scroll-line { height: 32px; }
  .hero-scroll-word { font-size: .625rem; letter-spacing: .22em; }
}

/* Short landscape phones: never let the copy push the cue off. */
@media (max-height: 620px) and (min-width: 981px) {
  .hero { padding-bottom: clamp(3rem, 7vh, 5rem); }
  .hero-inner { row-gap: .8rem; }
  .hero-title { font-size: clamp(2.6rem, 6vw, 4.4rem); }
}

/* ============================================================
   REDUCED MOTION — every hero animation resolves instantly
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .hero-canvas {
    opacity: 1;
    transition: none;
  }

  .hero-title .hero-line,
  .hero-eyebrow,
  .hero-lede,
  .hero-script,
  .hero-cta,
  .hero-meta,
  .hero-scroll {
    animation: none;
    opacity: 1;
    transform: none;
    clip-path: none;
  }

  .hero-scroll-line::after { animation: none; transform: translateY(0); }

  .hero.no-webgl .hero-fallback,
  .hero.no-webgl .hero-fallback::before,
  .hero.no-webgl .hero-fallback::after {
    animation: none;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 980px) {
  .hero-scroll { transform: translateX(-50%); }
}

/* Keep the same cup size in the photographic fallback as well. */
.hero.no-webgl .hero-fallback::before,
.hero.no-webgl .hero-fallback::after {
  width: min(25vw, 330px);
  height: min(52vh, 470px);
  bottom: 21%;
}
.hero.no-webgl .hero-fallback::before { right: 25%; }
.hero.no-webgl .hero-fallback::after { right: 2%; }

@media (max-width: 980px) {
  /* Match the extra 2.5rem reserved above the cups in hero-runtime.js. */
  .hero { padding-bottom: calc(clamp(370px, 82vw, 470px) + 2.5rem); }
  .hero.no-webgl .hero-fallback::before,
  .hero.no-webgl .hero-fallback::after {
    width: min(43vw, 250px);
    height: min(52vw, 310px);
    bottom: 95px;
    right: auto;
    left: 50%;
  }
  .hero.no-webgl .hero-fallback::before { margin-left: calc(-1 * min(43vw, 250px) - 2vw); }
  .hero.no-webgl .hero-fallback::after { margin-left: 2vw; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-clink, .hero-clink-status { transition: none; }
}
