/* ============================================================
   NOCTURNE — misty forest cinematic ambience
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --void-0: #02030a;
  --void-1: #050810;
  --void-2: #0a121a;
  --teal-dim:#1e3a44;
  --teal-mid:#3d6878;
  --pale:    #c8d2e0;
  --pale-warm:#d8d2c6;
  --ink:     #d6dce8;
  --ink-dim: #6e7a8a;
}

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background: #03050a;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ============================================================
   SCENE STACK
   ============================================================ */
.scene {
  position: fixed; inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 50% 35%, #6b7e8a 0%, #4a5d6a 20%, #2a3a46 45%, #0e1820 70%, #050810 90%, #02040a 100%);
}

.sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 30%, rgba(190,210,225,0.4), transparent 60%),
    radial-gradient(ellipse 60% 35% at 50% 20%, rgba(220,230,240,0.25), transparent 70%);
  pointer-events: none;
}

.upper-glow {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 70%;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(220,232,242,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 40% 30% at 50% 15%, rgba(240,245,250,0.15) 0%, transparent 70%);
  pointer-events: none;
  animation: skyBreath 14s ease-in-out infinite;
}
@keyframes skyBreath {
  0%,100% { opacity: 0.85; }
  50%     { opacity: 1; }
}

/* ============================================================
   STARFIELD
   ============================================================ */
.starfield { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.star {
  position: absolute;
  width: 1px; height: 1px;
  background: #d4dcea;
  border-radius: 50%;
  opacity: 0.5;
  box-shadow: 0 0 4px rgba(220,230,245,0.4);
  animation: twinkle var(--dur,5s) ease-in-out infinite;
  animation-delay: var(--delay,0s);
}
.star.big { width: 2px; height: 2px; box-shadow: 0 0 6px rgba(220,230,245,0.6); }
@keyframes twinkle {
  0%,100% { opacity: 0.15; }
  50%     { opacity: 0.7; }
}

/* ============================================================
   MOON — visible only in .scene-moonrise
   ============================================================ */
.moon-stage {
  position: absolute;
  top: 6%; left: 70%;
  width: 130px; height: 130px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 2.2s ease;
  pointer-events: none;
  z-index: 3;
}
@media (max-width: 880px) {
  .moon-stage { top: 4%; left: 78%; width: 90px; height: 90px; }
}
.scene-moonrise .moon-stage { opacity: 1; }

.moon-halo {
  position: absolute;
  inset: -120px;
  background: radial-gradient(circle at center,
    rgba(220,228,240,0.30) 0%,
    rgba(180,200,220,0.16) 18%,
    rgba(140,170,195,0.06) 35%,
    transparent 60%);
  filter: blur(8px);
  animation: haloPulse 9s ease-in-out infinite;
}
@keyframes haloPulse {
  0%,100% { opacity: 0.9; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.05); }
}
.moon {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%,
    #f4f1ea 0%,
    #d8d2c6 30%,
    #a8a8b4 55%,
    #6e7280 80%,
    #3a3e48 100%);
  box-shadow: 0 0 60px rgba(220,228,240,0.25),
              inset -20px -20px 50px rgba(0,0,0,0.55);
}
.moon-crater { position: absolute; border-radius: 50%; background: rgba(60,60,72,0.4); }
.moon-crater.c1 { width: 22px; height: 22px; top: 30%; left: 55%; }
.moon-crater.c2 { width: 14px; height: 14px; top: 56%; left: 40%; }
.moon-crater.c3 { width: 10px; height: 10px; top: 22%; left: 28%; }

/* ============================================================
   MOUNTAINS / FAR TREES
   ============================================================ */
.trees-deep {
  position: absolute;
  left: 0; right: 0; bottom: 32%;
  width: 100%; height: 18%;
  opacity: 0.7;
  pointer-events: none;
  filter: blur(0.8px);
  z-index: 4;
}
.trees-mid {
  position: absolute;
  left: 0; right: 0; bottom: 28%;
  width: 100%; height: 42%;
  pointer-events: none;
  z-index: 5;
}

/* foreground framing trees */
.tree-frame {
  position: absolute;
  bottom: 0;
  width: 26vw;
  max-width: 360px;
  height: 88%;
  pointer-events: none;
  z-index: 7;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.6));
}
.tree-left  { left: -2vw;  }
.tree-right { right: -2vw; transform: scaleX(-1); }

/* gentle sway */
.tree-frame { animation: sway 9s ease-in-out infinite; transform-origin: 50% 100%; }
.tree-right { animation: swayR 11s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway  { 0%,100% { transform: rotate(-0.4deg); } 50% { transform: rotate(0.5deg); } }
@keyframes swayR { 0%,100% { transform: scaleX(-1) rotate(-0.4deg); } 50% { transform: scaleX(-1) rotate(0.5deg); } }

/* ============================================================
   FOG / MIST LAYERS  — the soul of the scene
   ============================================================ */
.fog {
  position: absolute;
  left: -30%; right: -30%;
  width: 160%;
  pointer-events: none;
  background-repeat: repeat-x;
  background-position: 0 0;
  background-image: radial-gradient(ellipse 900px 140px at 50% 50%, rgba(210,225,235,0.42), transparent 70%),
                    radial-gradient(ellipse 700px 110px at 25% 60%, rgba(195,215,228,0.32), transparent 70%),
                    radial-gradient(ellipse 800px 120px at 75% 40%, rgba(205,222,234,0.38), transparent 70%);
  background-size: 1800px 240px, 1400px 200px, 1600px 220px;
  background-color: transparent;
  filter: blur(8px);
  mix-blend-mode: screen;
}
.fog-back {
  bottom: 35%;
  height: 36%;
  opacity: 1;
  filter: blur(14px);
  animation: fogDrift 90s linear infinite;
  z-index: 4;
}
.fog-mid {
  bottom: 28%;
  height: 28%;
  opacity: 0.95;
  filter: blur(10px);
  animation: fogDrift 60s linear infinite reverse;
  z-index: 6;
}
.fog-front {
  bottom: 20%;
  height: 22%;
  opacity: 0.9;
  filter: blur(14px);
  animation: fogDrift 45s linear infinite;
  z-index: 8;
}
.fog-low {
  bottom: 12%;
  height: 18%;
  opacity: 0.85;
  filter: blur(20px);
  background-image: radial-gradient(ellipse 1000px 140px at 50% 50%, rgba(195,215,228,0.5), transparent 70%);
  background-size: 2000px 260px;
  animation: fogDrift 72s linear infinite reverse;
  z-index: 9;
}
@keyframes fogDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(-30%); }
}

/* atmosphere wash over the whole scene */
.atmosphere {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(170,195,210,0.10), transparent 70%),
    linear-gradient(to bottom, transparent 0%, rgba(120,150,170,0.06) 40%, transparent 70%);
  z-index: 12;
}

/* ============================================================
   FALLEN LOGS
   ============================================================ */
.logs {
  position: absolute;
  left: 0; right: 0;
  bottom: 12%;
  width: 100%; height: 14%;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.7));
}

/* ============================================================
   FIGURE — only visible in .scene-wanderer
   ============================================================ */
.figure {
  position: absolute;
  left: 50%; bottom: 24%;
  width: 72px; height: 150px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 2.2s ease;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.8));
  z-index: 8;
  animation: figureBreath 6s ease-in-out infinite;
}
.scene-wanderer .figure { opacity: 1; }
@keyframes figureBreath {
  0%,100% { filter: drop-shadow(0 0 8px rgba(0,0,0,0.7)) brightness(1); }
  50%     { filter: drop-shadow(0 0 12px rgba(0,0,0,0.85)) brightness(1.05); }
}
.figure svg { width: 100%; height: auto; display: block; }

/* ============================================================
   WATER
   ============================================================ */
.water {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22%;
  background:
    linear-gradient(to bottom,
      rgba(8,16,22,0.0) 0%,
      rgba(8,16,22,0.4) 20%,
      rgba(4,8,12,0.85) 60%,
      #020408 100%);
  overflow: hidden;
  z-index: 11;
}
.water-shimmer {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(to right,
      transparent 0px,
      transparent 4px,
      rgba(180,200,215,0.07) 4px,
      rgba(180,200,215,0.07) 5px);
  mix-blend-mode: screen;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(0); }
  to   { transform: translateX(-40px); }
}

.water-ripple {
  position: absolute;
  border: 1px solid rgba(200,215,225,0.18);
  border-radius: 50%;
  opacity: 0;
  animation: rippleOut var(--d, 7s) ease-out infinite;
  animation-delay: var(--del, 0s);
}
.water-ripple.r1 { left: 30%; top: 50%; width: 30px; height: 6px; --d: 7s;  --del: 0s; }
.water-ripple.r2 { left: 60%; top: 70%; width: 22px; height: 4px; --d: 9s;  --del: 3s; }
.water-ripple.r3 { left: 78%; top: 45%; width: 26px; height: 5px; --d: 8s;  --del: 5s; }
@keyframes rippleOut {
  0%   { transform: scale(0.2); opacity: 0; }
  20%  { opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

/* reflections in water — gradient gleams */
.water-reflection {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.2s ease;
}
.moon-reflection {
  left: 50%;
  top: 0;
  width: 200px; height: 100%;
  margin-left: -100px;
  background: radial-gradient(ellipse 80% 100% at 50% 0%,
    rgba(220,228,240,0.35) 0%,
    rgba(180,200,220,0.15) 30%,
    transparent 70%);
  filter: blur(5px);
  mix-blend-mode: screen;
  animation: reflectShimmer 6s ease-in-out infinite;
}
.scene-moonrise .moon-reflection { opacity: 1; }

.figure-reflection {
  left: 50%;
  top: 0;
  width: 24px; height: 70%;
  margin-left: -12px;
  background: linear-gradient(to bottom, rgba(20,28,38,0.7) 0%, transparent 80%);
  filter: blur(2px);
}
.scene-wanderer .figure-reflection { opacity: 0.8; }

.tree-reflection {
  /* faint smudges where trees touch water */
  left: 0; right: 0;
  top: 0;
  height: 40%;
  background:
    radial-gradient(ellipse 60px 40px at 6%  0%, rgba(0,0,0,0.6), transparent 70%),
    radial-gradient(ellipse 50px 30px at 94% 0%, rgba(0,0,0,0.6), transparent 70%);
  filter: blur(3px);
  opacity: 0.8;
}

@keyframes reflectShimmer {
  0%,100% { transform: translateY(0)   scaleY(1); }
  50%     { transform: translateY(2px) scaleY(0.97); }
}

/* ============================================================
   ORBS / DUST
   ============================================================ */
.orbs {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 13;
}
.orbs span {
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(220,230,245,0.7);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(180,210,230,0.6);
  bottom: 20%;
  opacity: 0;
  animation: orbRise var(--d, 14s) linear infinite;
  animation-delay: var(--del, 0s);
}
.orbs span:nth-child(1)  { left: 10%; --d: 14s; --del: 0s;   }
.orbs span:nth-child(2)  { left: 18%; --d: 18s; --del: 1.5s; }
.orbs span:nth-child(3)  { left: 26%; --d: 12s; --del: 3s;   }
.orbs span:nth-child(4)  { left: 34%; --d: 16s; --del: 4.5s; }
.orbs span:nth-child(5)  { left: 42%; --d: 13s; --del: 6s;   }
.orbs span:nth-child(6)  { left: 50%; --d: 17s; --del: 7.5s; }
.orbs span:nth-child(7)  { left: 58%; --d: 15s; --del: 2s;   }
.orbs span:nth-child(8)  { left: 66%; --d: 19s; --del: 3.5s; }
.orbs span:nth-child(9)  { left: 74%; --d: 11s; --del: 5s;   }
.orbs span:nth-child(10) { left: 82%; --d: 14s; --del: 6.5s; }
.orbs span:nth-child(11) { left: 88%; --d: 16s; --del: 1s;   }
.orbs span:nth-child(12) { left: 14%; --d: 18s; --del: 8s;   width:1px; height:1px; opacity:0.5; }
.orbs span:nth-child(13) { left: 30%; --d: 15s; --del: 9.5s; width:1px; height:1px; opacity:0.5; }
.orbs span:nth-child(14) { left: 54%; --d: 17s; --del: 11s;  width:1px; height:1px; opacity:0.5; }
.orbs span:nth-child(15) { left: 70%; --d: 14s; --del: 12s;  width:1px; height:1px; opacity:0.5; }

@keyframes orbRise {
  0%   { transform: translate(0, 0)  scale(1); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.6; }
  100% { transform: translate(var(--x, -20px), -85vh) scale(0.5); opacity: 0; }
}

/* ============================================================
   VIGNETTE
   ============================================================ */
.vignette {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 50% 60%, transparent 40%, rgba(0,0,0,0.55) 90%);
  pointer-events: none;
  z-index: 20;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 22px; height: 22px;
  filter: drop-shadow(0 0 6px rgba(212,216,232,0.4));
}
.brand-name {
  font-family: 'Cormorant Garamond', serif;
  text-transform: none;
  font-size: 22px;
  letter-spacing: 0.04em;
  font-weight: 300;
}
.meta { display: flex; align-items: center; gap: 14px; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--pale); box-shadow: 0 0 6px var(--pale); }
.meta-link {
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}
.meta-link:hover { color: var(--ink); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: fixed;
  top: 13%; left: 0; right: 0;
  z-index: 25;
  text-align: center;
  pointer-events: none;
}
.title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(34px, 5vw, 78px);
  line-height: 1;
  margin: 0;
  letter-spacing: 0;
  text-shadow: 0 4px 30px rgba(0,0,0,0.7);
}
.title span { display: block; }
.title em {
  font-style: italic;
  color: var(--pale);
  text-shadow: 0 0 30px rgba(200,215,230,0.35);
}
.subtitle {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ============================================================
   DOCK
   ============================================================ */
.dock {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: rgba(10, 16, 22, 0.55);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid rgba(180,200,220,0.10);
  border-radius: 22px;
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,0.85),
    0 0 0 1px rgba(255,255,255,0.02) inset;
  max-width: calc(100vw - 40px);
  flex-wrap: wrap;
  justify-content: center;
}

.play {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px 14px 18px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: #0a1218;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #e8eef5 0%, #b8c5d2 60%, #8fa0b0 100%);
  box-shadow:
    0 10px 24px -8px rgba(180,200,220,0.4),
    0 0 0 1px rgba(255,255,255,0.25) inset,
    0 0 24px rgba(180,200,220,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.play:hover { transform: translateY(-1px); }
.play:active { transform: translateY(0); }
.play svg { width: 18px; height: 18px; }
.play .icon-pause { display: none; }
.play.playing .icon-play { display: none; }
.play.playing .icon-pause { display: block; }

.slider-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 110px;
}
.slider-group label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 110px; height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8eef5, #b8c5d2);
  box-shadow: 0 0 10px rgba(180,210,230,0.5), 0 2px 4px rgba(0,0,0,0.4);
  border: 2px solid #0a1218;
  cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8eef5, #b8c5d2);
  border: 2px solid #0a1218;
}

.variations {
  display: flex; gap: 4px;
  padding: 4px;
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
}
.var-btn {
  padding: 8px 14px;
  background: transparent;
  color: var(--ink-dim);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: all 0.2s ease;
}
.var-btn:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.var-btn.active {
  color: #0a1218;
  background: linear-gradient(135deg, rgba(232,238,245,0.95), rgba(184,197,210,0.95));
  box-shadow: 0 0 12px rgba(180,200,220,0.3);
}

/* footer */
.footer {
  position: fixed;
  bottom: 6px; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(168,178,196,0.4);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 30;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .hero { top: 10%; }
  .title { font-size: 38px; }
  .subtitle { font-size: 11px; padding: 0 24px; }
  .dock { gap: 12px; padding: 14px 16px; }
  .slider-group { min-width: 90px; }
  input[type=range] { width: 80px; }
  .topbar { padding: 16px 20px; font-size: 11px; }
  .tree-frame { width: 28vw; }
}
@media (max-width: 540px) {
  .meta-item:last-child { display: none; }
  .variations { order: 99; width: 100%; justify-content: center; }
  .var-btn { padding: 6px 10px; font-size: 10px; }
  .fog { filter: blur(6px); }
  .fog-front { filter: blur(8px); }
}

/* ============================================================
   RENDER MODE — clean composition for video capture
   ============================================================ */
.render-mode .topbar,
.render-mode .hero,
.render-mode .dock,
.render-mode .footer { display: none !important; }
.render-mode .vignette {
  background: radial-gradient(ellipse at 50% 55%, transparent 50%, rgba(0,0,0,0.5) 95%);
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fog, .orbs span, .water-shimmer, .water-ripple, .moon-halo,
  .upper-glow, .tree-frame, .figure, .star, .water-reflection {
    animation: none !important;
  }
}
