@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&display=swap');

:root { --sw: max(100vw, 130svh); color-scheme: dark; font-family: 'DM Sans', sans-serif; background: #1a0f12; color: #f6e6d2; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a0f12; }

.scene { position: fixed; inset: 0; overflow: hidden; }
.layer { position: absolute; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; will-change: transform; }

/* z0 — sky, oversized slightly so parallax never shows an edge */
.bg { z-index: 0; inset: -4%; width: 108%; height: 108%; object-fit: cover; object-position: 50% 60%; filter: brightness(.45)
  transform: translate3d(calc(var(--px, 0) * -10px), calc(var(--py, 0) * -6px), 0); }

/* z1 — back cloud bank, behind the storm (same z, earlier in the DOM); a touch blurrier/dimmer since it's farther */
.clouds-back { z-index: 1; left: calc(var(--sw) * -.02); bottom: calc(var(--sw) * .19); width: calc(var(--sw) * .5); height: auto; opacity: .85; filter: blur(0.7px) brightness(.65);
  transform: translate3d(calc(var(--px, 0) * -12px), calc(var(--py, 0) * -7px), 0); }

/* z1 — distant storm, placed in swamp-width units so it always sits on the same stretch of horizon */
.storm { z-index: 1; left: calc(var(--sw) * -.012); bottom: calc(var(--sw) * .17); width: calc(var(--sw) * .32); height: auto; opacity: .9; filter: blur(0.7px) brightness(.65);
  transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -8px), 0); }

/* z2 — swamp + windmill: pinned bottom-center, never moves, so the windmill stays centered */
.swamp { z-index: 2; left: 50%; bottom: -4px; filter: blur(0.6px) brightness(.58); width: var(--sw); height: auto; transform: translateX(-50%); will-change: auto; }

/* z2 — vignette over sky, clouds and swamp (same z as swamp, later in the DOM); cattails stay crisp above it.
   Edges get darker and blurrier while the windmill area stays clear. */
.vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 75% 40% at 50% 62%, transparent 40%, rgba(8, 3, 6, .45) 65%, rgba(8, 3, 6, .85) 100%);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 62%, transparent 35%, #000 85%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 62%, transparent 35%, #000 85%); }

/* z3 — cattails, anchored to the bottom corners */
.fg { z-index: 3; bottom: -2%; height: auto; filter: brightness(.8); }
.fg-left { left: -4%; width: 46vw; transform-origin: 0 100%;
  transform: translate3d(calc(var(--px, 0) * 22px), calc(var(--py, 0) * 10px), 0); }
.fg-right { right: -4%; width: 46vw; transform-origin: 100% 100%;
  transform: translate3d(calc(var(--px, 0) * 22px), calc(var(--py, 0) * 10px), 0); }

footer { position: fixed; z-index: 5; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom)); display: flex; justify-content: center; align-items: center; gap: 8px;
  color: rgba(255, 241, 220, .78); font-size: 10px; letter-spacing: .08em; text-shadow: 0 1px 3px #000; }
footer span { color: #e0904a; }
footer a { color: inherit; text-underline-offset: 3px; text-decoration-color: rgba(224, 144, 74, .65); }
footer a:hover, footer a:focus-visible { color: #fff1dc; text-decoration-color: #e0904a; }

/* z4 — fireflies (positioned by script.js) */
.fireflies { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.firefly { position: absolute; left: 0; top: 0; width: var(--size, 5px); height: var(--size, 5px); margin: calc(var(--size, 5px) / -2);
  border-radius: 50%; background: radial-gradient(circle, #fffde0 0 25%, #eaff8a 45%, rgba(200, 255, 90, 0) 72%);
  box-shadow: 0 0 6px 2px rgba(220, 255, 120, .55), 0 0 20px 7px rgba(170, 255, 70, .22);
  opacity: 0; will-change: transform, opacity; animation: glow var(--blink, 3s) ease-in-out infinite; }
@keyframes glow {
  0%, 100% { opacity: .05; }
  35% { opacity: 1; }
  50% { opacity: .85; }
  70% { opacity: .1; }
}
@media (prefers-reduced-motion: reduce) { .firefly { animation-duration: 8s; } }

/* mobile: cattails grow so they frame the windmill instead of shrinking into the corners */
@media (max-width: 600px) {
  .fg-left, .fg-right { width: 78vw; }
  .fg-left { left: -18%; }
  .fg-right { right: -18%; }
  /* storm slides in behind the windmill so it stays on screen */
  .storm { left: calc(50% - var(--sw) * .3); width: calc(var(--sw) * .4); }
  .clouds-back { left: calc(50% - var(--sw) * .34); bottom: calc(var(--sw) * .2); width: calc(var(--sw) * .55); }
}

@media (prefers-reduced-motion: reduce) {
  .bg, .clouds-back, .storm, .fg-left, .fg-right { transform: none; }
}
