/* forest.ws homepage: the dawn forest scene and section layout.
   Layers are pre-rendered PNG tiles moved only with transform. One ground line, one horizon:
   every tile is 480x300 source px with the ground band in rows 240-300, scaled by --px. */
:root { --scene-h: 580px; --veil: 520px; }
@media (max-width: 880px) { :root { --scene-h: 280px; } }
@media (min-width: 2000px) { :root { --scene-h: 800px; } }

/* ---------- hero ---------- */
.hero { position: relative; background: var(--forest-900); color: var(--on-forest); overflow: hidden; isolation: isolate; }
.hero .site-header { color: var(--on-forest); }
.hero-copy { position: relative; z-index: 3; padding-top: clamp(28px, 5vw, 56px); min-height: calc(var(--scene-h) + 250px); display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.hero-copy h1 { max-width: 20ch; font-size: clamp(2.5rem, 1.4rem + 3.6vw, 4.25rem); }
.hero-copy .lede { margin-top: var(--s-6); color: var(--mist-100); max-width: 46ch; }
.hero-copy .actions { margin-top: var(--s-8); }
.hero-copy .wink { margin-top: var(--s-6); }
.hero-note { margin-top: var(--s-4); font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .04em; color: var(--on-forest-muted); }
@media (max-width: 880px) { .hero-copy { min-height: 0; padding-bottom: var(--s-6); } }

/* the scene box: bottom of the hero; height fixed per breakpoint so the ground line is predictable */
.scene { position: absolute; inset: 0; overflow: hidden; z-index: 1; pointer-events: none; background: var(--forest-900); }
.layer-sky { height: var(--scene-h); }
.layer-glow { height: var(--scene-h); background: radial-gradient(ellipse 38% 34% at 68% 59%, rgba(246, 228, 172, .9) 0%, rgba(246, 228, 172, .5) 32%, rgba(246, 228, 172, 0) 70%); }
.layer-veil { top: 0; bottom: auto; height: 100%; z-index: 2; background: linear-gradient(to bottom, var(--forest-900) var(--veil), rgba(15, 42, 32, 0) calc(var(--veil) + 160px)); }
@media (max-width: 880px) { .hero { padding-bottom: var(--scene-h); } .layer-veil, .layer-rays { display: none; } }
@media (max-width: 600px) {
  :root { --scene-h: 160px; }
  .scene { --px: 1; --tile-w: 480px; --tile-h: 300px; }
  .scene .giant { display: none; }
}
.layer[data-p] { will-change: transform; }
.layer-sun { left: auto; right: calc(32% - 32px * var(--px)); bottom: calc(50px * var(--px)); width: calc(64px * var(--px)); height: calc(64px * var(--px)); background: url(/assets/scene/sun.png) no-repeat; background-size: 100% 100%; }
/* mist: the inner strip is one tile wider than the viewport and drifts exactly one tile, so the loop is seamless */
.drift { position: absolute; left: 0; bottom: 0; height: var(--tile-h); width: calc(100% + var(--tile-w)); background-repeat: repeat-x; background-position: 0 100%; background-size: var(--tile-w) var(--tile-h); image-rendering: pixelated; will-change: transform; }
.drift-a { background-image: url(/assets/scene/mist-a.png); animation: drift-left 160s linear infinite; }
.drift-b { background-image: url(/assets/scene/mist-b.png); left: auto; right: 0; animation: drift-right 220s linear infinite; }
@keyframes drift-left { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(calc(var(--tile-w) * -1), 0, 0); } }
@keyframes drift-right { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--tile-w), 0, 0); } }
.layer-rays { animation: breathe 9s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: .7; } to { opacity: 1; } }
.is-off .drift, .is-off .layer-rays, .is-hidden .drift, .is-hidden .layer-rays { animation-play-state: paused; }
/* edge giants: sprites, not tiles */
.giant { left: 0; right: auto; width: calc(200px * var(--px)); background-repeat: no-repeat; background-size: 100% 100%; }
.giant-l { background-image: url(/assets/scene/giant-left.png); }
.giant-r { left: auto; right: 0; width: calc(210px * var(--px)); background-image: url(/assets/scene/giant-right.png); }
.giant-l { left: calc(-104px * var(--px)); }
@media (max-width: 880px) { .giant-l { display: none; } }
/* bottom fade into the page, like a mist floor */
.layer-fade { height: calc(var(--scene-h) * .42); background: linear-gradient(to bottom, transparent, var(--surface-2) 92%); z-index: 3; }
.features { background: linear-gradient(to bottom, var(--surface-2), var(--bg) 220px); }

/* ---------- features (three illustrated cards, like the reference) ---------- */
.features { padding-top: clamp(40px, 6vw, 72px); }
.features .caption { display: flex; justify-content: space-between; gap: var(--s-2); }

/* ---------- how it will work ---------- */
.how { position: relative; }
.how-grid { display: grid; gap: var(--s-8); grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
.how-steps { display: grid; gap: var(--s-4); list-style: none; padding: 0; counter-reset: none; }
.how-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-5) var(--s-5) var(--s-5) var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.how-steps img { width: 24px; height: 24px; margin-top: 2px; }
.how-steps h3 { font-size: var(--t-lg); }
.how-steps p { color: var(--muted); font-size: var(--t-sm); margin-top: var(--s-1); }
.panel { position: relative; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--forest-900); }
.panel-scene { position: relative; height: 300px; overflow: hidden; --px: 2; --tile-w: calc(480px * var(--px)); --tile-h: calc(300px * var(--px)); background: linear-gradient(to bottom, var(--forest-900) 0%, #15382c 22%, #2a5a4a 38%, #5e8272 46%, #b9bfa6 51%, #e2d9b6 55%, #a4b4a7 64%, #8ea598 100%); }
.panel-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--forest-900); color: var(--on-forest); font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .04em; }
.panel-bar .dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--on-forest-muted); vertical-align: middle; }
.panel-label { margin-bottom: var(--s-2); }
@media (max-width: 880px) { .how-grid { grid-template-columns: 1fr; } .panel-scene { height: 220px; } }

/* ---------- dark band: what is coming ---------- */
.coming { position: relative; overflow: hidden; }
.coming-grid { display: grid; gap: var(--s-10); grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
.coming .rows { border-top-color: var(--on-forest-line); }
.coming .row { border-bottom-color: var(--on-forest-line); }
.coming .row p { color: var(--on-forest-muted); }
@media (max-width: 880px) { .coming-grid { grid-template-columns: 1fr; } }

/* ---------- final CTA: the same forest, deeper in the day ---------- */
.cta-band { background: var(--forest-950); color: var(--on-forest); isolation: isolate; }
.cta-scene { position: absolute; inset: 0; overflow: hidden; opacity: .55; }
.cta-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, var(--forest-950) 0%, rgba(10, 25, 18, .7) 45%, rgba(10, 25, 18, .2) 100%); }
.cta-band .lede { color: var(--on-forest-muted); }

/* ---------- motifs around the sections: each one stands on a real edge ---------- */
.has-motifs, .panel-wrap, .rows, .faq { position: relative; }
.motif-woodpecker { left: auto; right: calc(48px * var(--px)); bottom: calc(70px * var(--px)); width: 40px; height: 48px; z-index: 2; animation: peck 1.1s steps(2) infinite; }
.motif-deer { right: 28px; top: -76px; width: 96px; height: 76px; animation: graze 7s ease-in-out infinite alternate; }
.motif-owl { right: 36px; top: -56px; width: 48px; height: 60px; animation: sway 6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.motif-lantern { left: calc(var(--gutter) + 10px); top: -4px; width: 40px; height: 64px; animation: glow 3.5s ease-in-out infinite alternate; }
.motif-fox { right: 10%; top: -40px; width: 80px; height: 40px; }
.motif-mushroom { left: calc(var(--gutter) + 6px); bottom: 0; width: 48px; height: 40px; }
.motif-fern { left: calc(var(--gutter) + 58px); bottom: -4px; width: 80px; height: 48px; animation: sway 5s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes graze { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, 2px, 0); } }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
@keyframes glow { from { opacity: .8; } to { opacity: 1; } }
@keyframes peck { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-2px, 1px, 0); } }
.is-hidden .motif { animation-play-state: paused; }
@media (max-width: 880px) { .motif-woodpecker, .motif-deer { display: none; } }

/* Reveal only on entry. Unobserved content stays readable, including without JS. */
.reveal { opacity: 1; transform: none; transition: none; }
.reveal-ready .reveal.is-in { animation: reveal-in var(--slow) var(--ease); }
.reveal-ready .reveal.is-initial { animation: none; }
@keyframes reveal-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .drift, .layer-rays, .motif, .reveal-ready .reveal { animation: none !important; }
}
