[data-living-forest] { isolation: isolate; }
[data-living-forest]::after { display: none; }

.forest-viewport {
  position: absolute;
  inset: 0;
  container-type: size;
  pointer-events: none;
}

.forest-plane {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Match the centered object-fit: cover crop on the original 1448 × 1086 image. */
  width: max(100%, 133.333333cqh);
  aspect-ratio: 4 / 3;
  transform: translate(-50%, -50%);
}

.forest-light {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 24% 26%, rgb(255 222 119 / 32%), transparent 53%);
}

.forest-rays {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(53deg, transparent 30%, #ffde92 44%, transparent 52%, #ffe6a6 61%, transparent 70%);
  mask-image: radial-gradient(ellipse at 26% 19%, #000, transparent 45%);
}

[data-living-forest] .forest-bough {
  position: absolute;
  top: 10%;
  left: 56%;
  width: 18%;
  height: auto;
  transform-origin: 95% 0;
}

.forest-mote {
  position: absolute;
  left: var(--mote-x);
  top: var(--mote-y);
  width: 5%;
  aspect-ratio: 1;
  opacity: 0;
}

.forest-mote::before {
  position: absolute;
  width: var(--mote-size);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--mote-color);
  box-shadow: 0 0 5px var(--mote-color);
  content: '';
}

.forest-toggle {
  position: absolute;
  z-index: 1;
  right: .65rem;
  bottom: .65rem;
  min-height: 44px;
  padding: .4rem .75rem;
  border: 1px solid #fff6df;
  border-radius: 4px;
  background: #233d31;
  color: #fff6df;
  cursor: pointer;
  font: 700 .875rem/1.25 var(--sans, system-ui);
}

.forest-toggle:hover { background: #345d48; }
.forest-toggle:focus-visible { outline: 3px solid #ffe197; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .forest-viewport, .forest-toggle { display: none; }
}
.forest-patch, .forest-fairy {
  position: absolute;
  left: var(--sprite-x);
  top: var(--sprite-y);
  width: var(--sprite-width);
  height: var(--sprite-height);
}

[data-living-forest] .forest-patch { width: var(--sprite-width); height: var(--sprite-height); }
.forest-fairy { transform-origin: 62% 48%; }
.forest-fairy .forest-mote { width: 30%; }
