/* ==========================================================================
   Scroll scene: "The garden" (#garden)
   Everything here is scoped to .garden.

   Default rules = the still version: a normal section showing the grown
   garden, the arch and the three lines as a list. It is what a visitor gets
   with JavaScript off, with reduced motion, or if GSAP does not load.

   .garden.is-live (added by scene.js once GSAP is ready) = the tall section
   with a sticky stage that the scroll position drives.

   Unit: --u is one "scene unit". Stems, arch and sun are sized in it so the
   whole picture scales together (by viewport height on wide screens, by
   width on narrow ones).
   ========================================================================== */

.garden {
  --g-sky-top: #FFFDF8;
  --g-sky-mid: #FEF7E8;
  --g-sky-low: #FAEBC8;
  --g-earth: #E9CF98;
  --g-earth-low: #F2E0B9;
  --g-gold-ink: #A9761C;
  --u: min(.72vw, 10px);
  --H: calc(66 * var(--u));          /* height of the picture */
  --gy: calc(56 * var(--u));         /* ground line, measured from the top of the picture */
  --arch-w: 34;
  --sun-R: 164vw;                    /* radius of the sun's path */
  --sun-cx: 91.5%;                   /* where the path peaks */
  --sun-up: 46;                      /* height of that peak above the ground, in units */
  --sun-a0: -29.8;                   /* where the sun starts on the path, degrees (read by scene.js) */
  position: relative;
  z-index: 7;
  background: var(--g-sky-top);
  color: var(--ink);
  border-bottom: 1px solid rgba(200, 144, 48, .6);
}

.garden__stage {
  position: relative;
  overflow: hidden;
  padding-top: var(--sec-y);
  text-align: center;
  background: linear-gradient(180deg, var(--g-sky-top) 0%, var(--g-sky-mid) 42%, var(--g-sky-low) 100%);
}

/* ---------- words ---------- */
.garden__copy { position: relative; z-index: 6; width: min(100% - 2 * var(--gutter), 96rem); margin-inline: auto; }
.garden__eyebrow { margin-bottom: 1.1rem; }
.garden__h { font-size: clamp(2.25rem, 4vw, 3.5rem); margin-bottom: 1.6rem; }
.garden__lines { display: grid; gap: .3em; font-family: var(--serif); font-size: clamp(1.625rem, 2.7vw, 2.25rem); line-height: 1.2; letter-spacing: -.008em; color: var(--purple); }
.garden__line { text-wrap: balance; }
.garden__key { color: var(--g-gold-ink); }
.garden .gw { display: inline-block; overflow: hidden; vertical-align: top; padding: .1em 0 .18em; margin: -.1em 0 -.18em; }
.garden .gw > span { display: inline-block; }
.garden__cta { position: relative; z-index: 6; display: flex; justify-content: center; margin-top: 2.25rem; padding-inline: var(--gutter); }

/* ---------- sky ---------- */
.garden__sky { position: absolute; left: 0; right: 0; bottom: 0; height: var(--H); pointer-events: none; }
.garden__veil { display: none; position: absolute; inset: 0; background: var(--g-sky-top); }
.garden__haze { position: absolute; left: 0; right: 0; top: calc(var(--gy) - 30 * var(--u)); height: calc(30 * var(--u)); background: linear-gradient(180deg, rgba(232, 181, 82, 0) 0%, rgba(232, 181, 82, .12) 55%, rgba(232, 181, 82, .34) 100%); }
.garden__arc { position: absolute; left: calc(var(--sun-cx) - var(--sun-R)); top: calc(var(--gy) - var(--sun-up) * var(--u)); width: calc(2 * var(--sun-R)); height: calc(2 * var(--sun-R)); border-radius: 50%; border: 1px solid rgba(200, 144, 48, .55); }
.garden__arm { position: absolute; left: var(--sun-cx); top: calc(var(--gy) - var(--sun-up) * var(--u) + var(--sun-R)); width: 0; height: 0; transform-origin: 0 0; }
.garden__sun { position: absolute; left: 0; top: calc(-1 * var(--sun-R)); width: calc(8.4 * var(--u)); height: calc(8.4 * var(--u)); margin: calc(-4.2 * var(--u)) 0 0 calc(-4.2 * var(--u)); border-radius: 50%; background: radial-gradient(circle at 42% 38%, #F8DC9A 0%, #EFC56C 55%, #E8B552 100%); box-shadow: 0 0 0 calc(1.1 * var(--u)) rgba(232, 181, 82, .2), 0 0 0 calc(2.6 * var(--u)) rgba(232, 181, 82, .1), 0 0 calc(9 * var(--u)) calc(3 * var(--u)) rgba(240, 200, 110, .34); }

/* ---------- the picture ---------- */
.garden__cam { position: relative; height: var(--H); margin-top: clamp(.5rem, 2vw, 1.5rem); transform-origin: 50% var(--gy); }
.garden__earth { position: absolute; left: -6%; right: -6%; top: var(--gy); bottom: -14%; background: linear-gradient(180deg, #E2C383 0, var(--g-earth) calc(1.6 * var(--u)), var(--g-earth-low) calc(13 * var(--u))); }
.garden__ground { position: absolute; left: 0; right: 0; top: var(--gy); height: 2px; margin-top: -1px; z-index: 5; background: linear-gradient(90deg, rgba(200, 144, 48, 0) 0%, var(--gold) 9%, var(--gold) 91%, rgba(200, 144, 48, 0) 100%); }
.garden__bed { position: absolute; left: 0; right: 0; top: 0; height: var(--gy); clip-path: inset(-60% -20% 0 -20%); }
.garden__row { position: absolute; inset: 0; transform-origin: 50% 100%; }
.garden__row--back { z-index: 1; opacity: .86; }
.garden__row--front { z-index: 3; }

/* stems: --x where the stalk meets the ground (percent of the width), --h full height of the
   cut-out, --b how much of it is buried, --r lean, --ox where the stalk sits in the image,
   --hd where the bloom ends (0 = no separate bloom) */
.gstem { position: absolute; left: calc(var(--x) * 1%); bottom: calc(var(--h) * var(--b) * var(--u) * -1); height: calc(var(--h) * var(--u)); transform-origin: calc(var(--ox) * 100%) 100%; transform: translateX(calc(var(--ox) * -100%)) rotate(var(--r, 0deg)) scaleX(var(--flip, 1)); pointer-events: none; user-select: none; }
.gstem__in, .gstem__sway, .gstem__clip { height: 100%; }
.gstem__in, .gstem__sway { transform-origin: calc(var(--ox) * 100%) calc((1 - var(--b)) * 100%); }
.gstem img { display: block; height: 100%; width: auto; max-width: none; }
.gstem__stalk { clip-path: inset(calc(var(--hd) * 100% - 1px) -30% 0 -30%); }
.gstem--plain .gstem__stalk { clip-path: none; }
.gstem__bloom { position: absolute; left: 0; top: 0; clip-path: inset(-10% -30% calc((1 - var(--hd)) * 100%) -30%); transform-origin: calc(var(--ox) * 100%) calc(var(--hd) * 100%); }

.gf-rose { --ox: .44; --hd: .25; }
.gf-iris { --ox: .5; --hd: .33; }
.gf-sunflower { --ox: .56; --hd: .31; }
.gf-lavender { --ox: .5; --hd: .39; }
.gf-peony { --ox: .49; --hd: .37; }
.gf-lisianthus { --ox: .46; --hd: .33; }
.gf-ranunculus { --ox: .49; --hd: .23; }
.gf-gerbera { --ox: .51; --hd: .33; }
.gf-eucalyptus { --ox: .5; --hd: 0; }
.gf-fern { --ox: .49; --hd: 0; }

/* wide screens: thirteen stems, tall on the left, lower on the right where the sun arrives */
.gs-1 { --x: 2.5; --h: 60; --b: .12; --r: -9deg; }
.gs-2 { --x: 7.5; --h: 46; --b: .06; --r: 3deg; }
.gs-3 { --x: 12.5; --h: 62; --b: .3; --r: -3deg; }
.gs-4 { --x: 35.2; --h: 40; --b: .1; --r: -2deg; }
.gs-6 { --x: 20; --h: 46; --b: .16; --r: -2deg; }
.gs-5 { --x: 24.5; --h: 54; --b: .34; --r: 4deg; }
.gs-7 { --x: 30.5; --h: 52; --b: .4; --r: -4deg; }
.gs-8 { --x: 65.6; --h: 46; --b: .4; --r: 3deg; }
.gs-11 { --x: 72; --h: 42; --b: .08; --r: -3deg; --flip: -1; }
.gs-10 { --x: 76.5; --h: 58; --b: .36; --r: -3deg; }
.gs-9 { --x: 81.5; --h: 42; --b: .1; --r: 2deg; --flip: -1; }
.gs-12 { --x: 86; --h: 50; --b: .2; --r: 3deg; }
.gs-13 { --x: 96; --h: 48; --b: .1; --r: 13deg; --flip: -1; }

/* low golden light where the stems meet the ground, kept clear of the arch */
.garden__mist { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: calc(10 * var(--u)); pointer-events: none; background: linear-gradient(180deg, rgba(245, 222, 170, 0) 0%, rgba(243, 217, 160, .55) 60%, rgba(240, 211, 150, .92) 100%); -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 33%, transparent 38.5%, transparent 61.5%, #000 67%, #000 100%); mask-image: linear-gradient(90deg, #000 0%, #000 33%, transparent 38.5%, transparent 61.5%, #000 67%, #000 100%); }

/* the arch window */
.garden__archwrap { position: absolute; z-index: 2; left: 50%; bottom: 0; width: calc(var(--arch-w) * var(--u)); transform: translateX(-50%); }
.garden .arch { background: var(--cream-2); }
.garden .arch > img { object-position: 56% 50%; }
.garden .arch::after { box-shadow: inset 0 0 0 1px rgba(200, 144, 48, .95), inset 0 -70px 60px -56px rgba(78, 26, 88, .4); }

/* petals */
.garden__petals { position: absolute; inset: 0; z-index: 5; }
.gpetal { position: absolute; left: calc(var(--x) * 1%); bottom: calc(var(--y) * var(--pk, 1) * var(--u)); width: calc(1.5 * var(--u)); height: calc(1.05 * var(--u)); min-width: 9px; min-height: 6px; border-radius: 100% 0 100% 0; background: var(--c, var(--gold-light)); opacity: .9; rotate: var(--r, 0deg); }
.gp-1 { --x: 35; --y: 30; --r: 24deg; }
.gp-2 { --x: 38.5; --y: 42; --r: -38deg; }
.gp-3 { --x: 44.5; --y: 49.5; --r: 62deg; }
.gp-4 { --x: 57; --y: 48; --r: -14deg; }
.gp-5 { --x: 62.5; --y: 36; --r: 48deg; }
.gp-6 { --x: 66; --y: 45; --r: -56deg; }
.gp-7 { --x: 32.5; --y: 46.5; --r: 8deg; }

/* progress marker: only in the live scene */
.garden__progress { display: none; }

/* ---------- narrower screens: seven stems, a smaller arch ---------- */
@media (max-width: 899px) {
  .garden {
    --u: min(1.9vw, 10px);
    --H: calc(62 * var(--u));
    --gy: calc(52 * var(--u));
    --arch-w: 28;
    --sun-R: 120vw;
    --sun-cx: 86%;
    --sun-up: 45;
    --sun-a0: -40.5;
  }
  .gs-2, .gs-6, .gs-8, .gs-9, .gs-12, .gs-13 { display: none; }
  .gs-1 { --x: 2; --h: 46; --b: .1; --r: -11deg; }
  .gs-4 { --x: 9.5; --h: 38; --b: .1; --r: 3deg; }
  .gs-3 { --x: 14; --h: 46; --b: .32; --r: -4deg; }
  .gs-5 { --x: 16.5; --h: 30; --b: .32; --r: 7deg; }
  .gs-7 { --x: 85; --h: 31; --b: .38; --r: -6deg; }
  .gs-10 { --x: 91; --h: 46; --b: .32; --r: 3deg; }
  .gs-11 { --x: 98; --h: 46; --b: .08; --r: 9deg; }
  .garden__mist { -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 17%, transparent 24%, transparent 76%, #000 83%, #000 100%); mask-image: linear-gradient(90deg, #000 0%, #000 17%, transparent 24%, transparent 76%, #000 83%, #000 100%); }
  .gp-1 { --x: 26; --y: 41; }
  .gp-2 { --x: 40; --y: 44; }
  .gp-3 { --x: 50; --y: 46.5; }
  .gp-4 { --x: 62; --y: 42.5; }
  .gp-5 { --x: 75; --y: 39.5; }
  .gp-6 { --x: 82; --y: 33; }
  .gp-7 { --x: 17; --y: 36; }
  .garden__lines { font-size: clamp(1.5rem, 6.4vw, 2rem); }
  .garden__cta .btn { width: min(100%, 24rem); }
}

/* ==========================================================================
   Live scene
   ========================================================================== */
.garden.is-live { height: 240vh; --u: min(1vh, .72vw); --H: 100vh; --gy: 82vh; }
.garden.is-live .garden__stage { position: sticky; top: 0; height: 100vh; padding-top: calc(var(--header-h) + 3.4 * var(--u)); }
@supports (height: 100svh) {
  .garden.is-live { --u: min(1svh, .72vw); --H: 100svh; --gy: 82svh; }
  .garden.is-live .garden__stage { height: 100svh; }
}
.garden.is-live .garden__veil { display: block; }
.garden.is-live .garden__sky { top: 0; height: auto; }
.garden.is-live .garden__cam { position: absolute; left: 0; right: 0; top: 0; margin: 0; will-change: transform; }
.garden.is-live .garden__arm { will-change: transform; }
.garden.is-live .garden__eyebrow { margin-bottom: calc(1.1 * var(--u)); }
.garden.is-live .garden__h { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.garden.is-live .garden__lines { gap: 0; font-size: min(8.4 * var(--u), 5.2vw, 5.5rem); line-height: 1.06; letter-spacing: -.014em; }
.garden.is-live .garden__line { grid-area: 1 / 1; }
@media (min-width: 900px) { .garden.is-live .garden__line { white-space: nowrap; } }
.garden.is-live .garden__cta { position: absolute; left: 0; right: 0; top: calc(var(--gy) + 2.6 * var(--u)); margin: 0; }

.garden.is-live .garden__progress { display: block; position: absolute; z-index: 6; right: clamp(1.1rem, 2.1vw, 2.25rem); top: calc(var(--header-h) + 3.5 * var(--u)); width: 2px; height: calc(19 * var(--u)); pointer-events: none; }
.garden__progress i, .garden__progress b { position: absolute; inset: 0; border-radius: 2px; }
.garden__progress i { background: rgba(200, 144, 48, .28); }
.garden__progress b { background: var(--gold); transform-origin: 50% 100%; }
.garden__leaf { position: absolute; left: 1px; bottom: var(--at); width: 1.15rem; height: 1.4rem; color: var(--gold); transform-origin: 0 100%; transform: scale(.2) rotate(-50deg); opacity: 0; transition: transform 700ms var(--ease-spring), opacity 300ms ease; }
.garden__leaf svg { width: 100%; height: 100%; overflow: visible; }
.garden__leaf--l { left: auto; right: 1px; transform-origin: 100% 100%; transform: scale(.2) rotate(50deg); }
.garden__leaf--l svg { transform: scaleX(-1); }
.garden__leaf.in { transform: none; opacity: 1; }

/* idle sway and float: only while the scene is on screen */
.garden.is-live .gstem__sway { animation: g-sway 9s ease-in-out infinite alternate paused; }
.garden.is-live .gstem:nth-child(3n) .gstem__sway { animation-duration: 11.5s; animation-delay: -4s; }
.garden.is-live .gstem:nth-child(3n+1) .gstem__sway { animation-duration: 7.5s; animation-delay: -2s; }
.garden.is-live .gpetal i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--c, var(--gold-light)); animation: g-float 6s ease-in-out infinite alternate paused; }
.garden.is-live .gpetal:nth-child(even) i { animation-duration: 7.6s; animation-delay: -3s; }
.garden.is-live .gpetal { background: none; }
.garden.is-live.is-on .gstem__sway, .garden.is-live.is-on .gpetal i { animation-play-state: running; }
@keyframes g-sway { from { transform: rotate(-1.1deg); } to { transform: rotate(1.3deg); } }
@keyframes g-float { from { transform: translate(-18%, 22%) rotate(-10deg); } to { transform: translate(22%, -26%) rotate(14deg); } }

@media (max-width: 899px) {
  .garden.is-live { height: 200vh; --u: min(1vh, 1.9vw); --gy: 76vh; }
  .garden.is-live .garden__lines { font-size: clamp(2.125rem, 9.6vw, 2.5rem); line-height: 1.1; }
  .garden.is-live .garden__copy { width: min(100% - 2.5rem, 44rem); }
  .garden.is-live .garden__progress { display: none; }
  @supports (height: 100svh) {
    .garden.is-live { --u: min(1svh, 1.9vw); --gy: 76svh; }
  }
}

/* tablets: a larger line of type */
@media (min-width: 560px) and (max-width: 899px) {
  .garden.is-live .garden__lines { font-size: min(6.1vw, 3.4rem); }
}
/* short phones: the sun rests beside the arch instead of above it, petals stay below the words */
@media (max-width: 899px) and (max-height: 740px) {
  .garden.is-live { --arch-w: 26; --sun-up: 33; --sun-cx: 91%; --pk: .76; }
}

/* short laptop screens: a slightly smaller arch so the line of type keeps its air */
@media (min-width: 900px) and (max-height: 780px) {
  .garden.is-live { --arch-w: 30; }
  .garden.is-live .garden__stage { padding-top: calc(var(--header-h) + 2.2 * var(--u)); }
}

/* the floating plan pill steps aside while this scene shows its own button (wide screens only) */
@media (min-width: 900px) {
  .dock.has-plan.is-shown.is-under-garden { transform: translate(-50%, 160%); opacity: 0; visibility: hidden; transition: transform 500ms var(--ease-out), opacity 300ms ease, visibility 0s linear 500ms; }
}

/* reduced motion never gets the live scene (scene.js does not start it); belt and braces */
@media (prefers-reduced-motion: reduce) {
  .garden .gstem__sway, .garden .gpetal i { animation: none !important; }
}
