:root {
  color-scheme: dark;
  --image-ratio: 1.7768331562;
  --crop-shift-x: 0px;
  --crop-shift-y: 0px;
  --parallax-back-x: 0px;
  --parallax-back-y: 0px;
  --parallax-mid-x: 0px;
  --parallax-mid-y: 0px;
  --parallax-front-x: 0px;
  --parallax-front-y: 0px;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #202515;
}

body {
  min-height: 100dvh;
  font-family: Georgia, "Times New Roman", serif;
}

.meadow {
  position: relative;
  isolation: isolate;
  width: 100vw;
  min-height: 100dvh;
  overflow: hidden;
  background: #202515;
}

.image-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, calc(100dvh * var(--image-ratio)));
  height: max(100dvh, calc(100vw / var(--image-ratio)));
  overflow: hidden;
  transform: translate(calc(-50% + var(--crop-shift-x)), calc(-50% + var(--crop-shift-y)));
  transform-origin: center;
  background: #202515;
}

.garden-base,
.patch-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.garden-base {
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.motion-patch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}

.patch-image {
  background: url("../assets/images/garden-v6.png") center / 100% 100% no-repeat;
  transform-origin: var(--origin, 50% 50%);
  will-change: transform;
}

.layer-background { transform: translate3d(var(--parallax-back-x), var(--parallax-back-y), 0); }
.layer-middle { transform: translate3d(var(--parallax-mid-x), var(--parallax-mid-y), 0); }
.layer-foreground { transform: translate3d(var(--parallax-front-x), var(--parallax-front-y), 0); }

.patch-roses {
  --origin: 6% 15%;
  -webkit-mask-image: radial-gradient(ellipse 9% 22% at 5% 15%, #000 42%, rgba(0, 0, 0, .75) 60%, transparent 82%);
  mask-image: radial-gradient(ellipse 9% 22% at 5% 15%, #000 42%, rgba(0, 0, 0, .75) 60%, transparent 82%);
}

.patch-hollyhocks {
  --origin: 10% 31%;
  -webkit-mask-image: radial-gradient(ellipse 8% 23% at 10% 29%, #000 38%, rgba(0, 0, 0, .72) 59%, transparent 82%);
  mask-image: radial-gradient(ellipse 8% 23% at 10% 29%, #000 38%, rgba(0, 0, 0, .72) 59%, transparent 82%);
}

.patch-hydrangeas {
  --origin: 35% 42%;
  -webkit-mask-image: radial-gradient(ellipse 12% 14% at 35% 41%, #000 36%, rgba(0, 0, 0, .68) 59%, transparent 82%);
  mask-image: radial-gradient(ellipse 12% 14% at 35% 41%, #000 36%, rgba(0, 0, 0, .68) 59%, transparent 82%);
}

.patch-lupines {
  --origin: 68% 29%;
  -webkit-mask-image: radial-gradient(ellipse 17% 30% at 69% 21%, #000 36%, rgba(0, 0, 0, .72) 61%, transparent 82%);
  mask-image: radial-gradient(ellipse 17% 30% at 69% 21%, #000 36%, rgba(0, 0, 0, .72) 61%, transparent 82%);
}

.patch-coneflowers {
  --origin: 85% 63%;
  -webkit-mask-image: radial-gradient(ellipse 13% 18% at 85% 59%, #000 38%, rgba(0, 0, 0, .72) 61%, transparent 83%);
  mask-image: radial-gradient(ellipse 13% 18% at 85% 59%, #000 38%, rgba(0, 0, 0, .72) 61%, transparent 83%);
}

.patch-tulips {
  --origin: 10% 92%;
  -webkit-mask-image: radial-gradient(ellipse 15% 24% at 10% 82%, #000 38%, rgba(0, 0, 0, .74) 61%, transparent 84%);
  mask-image: radial-gradient(ellipse 15% 24% at 10% 82%, #000 38%, rgba(0, 0, 0, .74) 61%, transparent 84%);
}

.patch-marigolds {
  --origin: 60% 93%;
  -webkit-mask-image: radial-gradient(ellipse 14% 20% at 60% 79%, #000 40%, rgba(0, 0, 0, .72) 62%, transparent 84%);
  mask-image: radial-gradient(ellipse 14% 20% at 60% 79%, #000 40%, rgba(0, 0, 0, .72) 62%, transparent 84%);
}

.patch-peonies {
  --origin: 91% 97%;
  -webkit-mask-image: radial-gradient(ellipse 13% 18% at 91% 88%, #000 42%, rgba(0, 0, 0, .74) 63%, transparent 86%);
  mask-image: radial-gradient(ellipse 13% 18% at 91% 88%, #000 42%, rgba(0, 0, 0, .74) 63%, transparent 86%);
}

.patch-bill-high {
  --origin: 77% 19%;
  -webkit-mask-image: radial-gradient(ellipse 11% 8% at 77% 21%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
  mask-image: radial-gradient(ellipse 11% 8% at 77% 21%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
}

.patch-bill-middle {
  --origin: 66% 33%;
  -webkit-mask-image: radial-gradient(ellipse 12% 9% at 66% 32%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
  mask-image: radial-gradient(ellipse 12% 9% at 66% 32%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
}

.patch-bill-low {
  --origin: 61% 53%;
  -webkit-mask-image: radial-gradient(ellipse 13% 10% at 61% 51%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
  mask-image: radial-gradient(ellipse 13% 10% at 61% 51%, #000 36%, rgba(0, 0, 0, .7) 61%, transparent 84%);
}

.motion-patch.is-nodding .patch-image { animation: flower-nod 3.4s cubic-bezier(.3, .02, .25, 1) both; }
.motion-patch.is-trembling .patch-image { animation: leaf-tremble 2.15s cubic-bezier(.36, .02, .32, 1) both; }
.motion-patch.is-breathing .patch-image { animation: cluster-breathe 4.8s cubic-bezier(.35, .04, .28, 1) both; }
.motion-patch.is-lifting .patch-image { animation: bill-lift 3.7s cubic-bezier(.26, .04, .31, 1) both; }

.coin-glint {
  position: absolute;
  width: clamp(8px, .9vw, 17px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-24deg) scale(.45);
  background: linear-gradient(115deg, transparent 20%, rgba(255, 248, 205, .96) 48%, rgba(255, 255, 255, .98) 53%, transparent 77%);
  filter: blur(.15px);
  mix-blend-mode: screen;
}

.coin-glint::after {
  position: absolute;
  top: 47%;
  left: -55%;
  width: 210%;
  height: 1px;
  content: "";
  background: rgba(255, 246, 197, .82);
  box-shadow: 0 0 4px rgba(255, 231, 148, .55);
}

.coin-glint-path-high { left: 34.8%; top: 61.6%; }
.coin-glint-path-low { left: 40.9%; top: 86.2%; }
.coin-glint-large { left: 41.1%; top: 64.5%; width: clamp(10px, 1.2vw, 21px); }
.coin-glint-bank { left: 70.4%; top: 21.4%; }
.coin-glint.is-active { animation: coin-flash 1.45s ease-out both; }

.ambient-event {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
}

.butterfly { top: 33%; left: -3%; width: 15px; height: 12px; }

.butterfly i {
  position: absolute;
  top: 2px;
  width: 8px;
  height: 9px;
  border: 1px solid rgba(45, 35, 24, .84);
  background: rgba(211, 144, 71, .88);
}

.butterfly i:first-child { left: 0; border-radius: 90% 18% 75% 24%; transform-origin: right center; }
.butterfly i:last-child { right: 0; border-radius: 18% 90% 24% 75%; transform-origin: left center; }
.butterfly.is-active { animation: butterfly-cross 9.5s cubic-bezier(.25, .5, .42, .9) both; }
.butterfly.is-active i:first-child { animation: wing-left .34s ease-in-out infinite alternate; }
.butterfly.is-active i:last-child { animation: wing-right .34s ease-in-out infinite alternate; }

.drifting-seed {
  top: 37%;
  left: 47%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(244, 235, 205, .82);
  filter: blur(.15px);
}

.drifting-seed i {
  position: absolute;
  top: -5px;
  left: 2px;
  width: 1px;
  height: 8px;
  background: rgba(242, 235, 211, .68);
  transform-origin: bottom;
}

.drifting-seed i:nth-child(1) { transform: rotate(-48deg); }
.drifting-seed i:nth-child(2) { transform: rotate(0deg); }
.drifting-seed i:nth-child(3) { transform: rotate(47deg); }
.drifting-seed.is-active { animation: seed-drift 7s cubic-bezier(.26, .5, .42, .9) both; }

.falling-leaf {
  top: 10%;
  left: 72%;
  width: 9px;
  height: 14px;
  border-radius: 90% 10% 90% 10%;
  background: #6d6f25;
  box-shadow: inset 1px 0 rgba(232, 195, 79, .38);
}

.falling-leaf.is-active { animation: leaf-fall 8s cubic-bezier(.28, .44, .44, .89) both; }

.distant-insect {
  top: 27%;
  left: 45%;
  width: 4px;
  height: 3px;
  border-radius: 50%;
  background: rgba(38, 35, 20, .78);
  filter: blur(.3px);
}

.distant-insect.is-active { animation: insect-pass 6.8s cubic-bezier(.38, .14, .45, .88) both; }

.hotspot-layer,
.hotspot { position: absolute; }
.hotspot-layer { inset: 0; pointer-events: none; }

.hotspot {
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.edge-shade {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(17, 19, 11, .13), transparent 16%, transparent 81%, rgba(13, 16, 8, .18)),
    linear-gradient(90deg, rgba(18, 21, 12, .13), transparent 8%, transparent 92%, rgba(18, 21, 12, .13));
}

.title {
  position: fixed;
  right: clamp(15px, 2.1vw, 34px);
  bottom: clamp(13px, 2vw, 30px);
  z-index: 10;
  margin: 0;
  color: rgba(255, 250, 232, .84);
  font-size: clamp(.82rem, 1.15vw, 1.12rem);
  font-weight: 400;
  letter-spacing: .025em;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(22, 25, 13, .82);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes flower-nod {
  0%, 100% { transform: rotate(0deg) translate3d(0, 0, 0); }
  33% { transform: rotate(.42deg) translate3d(1px, 1px, 0); }
  65% { transform: rotate(-.15deg) translate3d(-.3px, 0, 0); }
}

@keyframes leaf-tremble {
  0%, 100% { transform: rotate(0deg) translate3d(0, 0, 0); }
  22% { transform: rotate(.18deg) translate3d(.8px, -.3px, 0); }
  43% { transform: rotate(-.12deg) translate3d(-.5px, .4px, 0); }
  68% { transform: rotate(.11deg) translate3d(.4px, 0, 0); }
}

@keyframes cluster-breathe {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  47% { transform: translate3d(1px, -.7px, 0) scale(1.0015); }
}

@keyframes bill-lift {
  0%, 100% { transform: perspective(1200px) rotateX(0deg) rotateZ(0deg) translate3d(0, 0, 0); filter: brightness(1); }
  42% { transform: perspective(1200px) rotateX(.6deg) rotateZ(.12deg) translate3d(.3px, -1px, 0); filter: brightness(1.025); }
  70% { transform: perspective(1200px) rotateX(.16deg) rotateZ(-.05deg) translate3d(0, -.25px, 0); filter: brightness(1.008); }
}

@keyframes coin-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-24deg) scale(.35); }
  35% { opacity: .95; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
  66% { opacity: .46; transform: translate(-50%, -50%) rotate(4deg) scale(.74); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(11deg) scale(.25); }
}

@keyframes butterfly-cross {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(-8deg) scale(.72); }
  11% { opacity: .74; }
  34% { transform: translate3d(34vw, -5vh, 0) rotate(7deg) scale(.82); }
  67% { opacity: .67; transform: translate3d(69vw, 6vh, 0) rotate(-6deg) scale(.7); }
  100% { opacity: 0; transform: translate3d(108vw, -11vh, 0) rotate(3deg) scale(.58); }
}

@keyframes wing-left { to { transform: rotateY(67deg); } }
@keyframes wing-right { to { transform: rotateY(-67deg); } }

@keyframes seed-drift {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  16% { opacity: .7; }
  58% { opacity: .64; transform: translate3d(8vw, 12vh, 0) rotate(138deg); }
  100% { opacity: 0; transform: translate3d(3vw, 31vh, 0) rotate(286deg); }
}

@keyframes leaf-fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  13% { opacity: .76; }
  48% { transform: translate3d(-3vw, 23vh, 0) rotate(168deg); }
  76% { opacity: .67; transform: translate3d(2vw, 43vh, 0) rotate(291deg); }
  100% { opacity: 0; transform: translate3d(-1vw, 62vh, 0) rotate(430deg); }
}

@keyframes insect-pass {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  14% { opacity: .66; }
  42% { transform: translate3d(8vw, -2vh, 0); }
  66% { transform: translate3d(13vw, 2vh, 0); }
  100% { opacity: 0; transform: translate3d(21vw, -4vh, 0); }
}

@media (max-aspect-ratio: 3 / 4) {
  :root { --crop-shift-x: -6%; }
  .title { right: 14px; bottom: 14px; font-size: .78rem; }
  .patch-roses,
  .patch-hollyhocks,
  .patch-peonies { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .motion-patch,
  .patch-image,
  .coin-glint,
  .ambient-event {
    animation: none !important;
    transform: none !important;
  }

  .motion-patch,
  .coin-glint,
  .ambient-event { display: none; }
}
