/* ==========================================================================
   Shared winter night scene: sky, moon, stars, hills and falling snow.
   ========================================================================== */

:root {
  --sky-top: #070d22;
  --sky-mid: #13204a;
  --sky-low: #2a3a6c;
  --horizon: #3b4a7a;
  --sky-glow: rgba(150, 170, 230, 0.18);
  --hill-far-a: #5b6c9b;
  --hill-far-b: #43507c;
  --hill-trees: #2c3a5e;
  --hill-mid-a: #9aa9cc;
  --hill-mid-b: #7484ac;
  --hill-near-a: #d4deef;
  --hill-near-b: #bccbe3;
  --hill-near-c: #a3b3d2;
  --snow: #dbe5f3;
  --snow-shade: #aebcd6;
  --snow-deep: #8090b4;
  --gold: #ffc766;
  --gold-soft: #ffdf9e;
  --ink: #f6efe2;
  --ink-soft: #c9cfe3;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--sky-top);
  -webkit-font-smoothing: antialiased;
}

.scene-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 78% 14%, var(--sky-glow), transparent 70%),
    linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 48%, var(--sky-low) 78%, var(--horizon) 100%);
}

/* Hill colors come from CSS variables so themes can recolor the SVG. */
.hf-a { stop-color: var(--hill-far-a); }
.hf-b { stop-color: var(--hill-far-b); }
.hm-a { stop-color: var(--hill-mid-a); }
.hm-b { stop-color: var(--hill-mid-b); }
.hn-a { stop-color: var(--hill-near-a); }
.hn-b { stop-color: var(--hill-near-b); }
.hn-c { stop-color: var(--hill-near-c); }
.hill-trees { fill: var(--hill-trees); }

/* ------------------------------------------------------------ Themes --- */

/* Abenddämmerung: violet dusk with a warm afterglow on the horizon */
.theme-dusk {
  --sky-top: #120b2a;
  --sky-mid: #3a2155;
  --sky-low: #8a4469;
  --horizon: #e48a6c;
  --sky-glow: rgba(255, 170, 140, 0.16);
  --hill-far-a: #6e5a8c;
  --hill-far-b: #4d3c68;
  --hill-trees: #2f2442;
  --hill-mid-a: #b3a2c8;
  --hill-mid-b: #8a78a6;
  --hill-near-a: #ebdfee;
  --hill-near-b: #d4c4dd;
  --hill-near-c: #b8a6c6;
}

/* Nordlicht: deep teal night with dancing aurora */
.theme-aurora {
  --sky-top: #020c14;
  --sky-mid: #062433;
  --sky-low: #0d3d4a;
  --horizon: #1b5a5e;
  --sky-glow: rgba(110, 255, 200, 0.08);
  --hill-far-a: #3c6a72;
  --hill-far-b: #284d56;
  --hill-trees: #143238;
  --hill-mid-a: #8fb6b8;
  --hill-mid-b: #6a9399;
  --hill-near-a: #d6ebea;
  --hill-near-b: #bcd8d8;
  --hill-near-c: #9fc1c3;
}

.scene-aurora {
  display: none;
  position: absolute;
  left: -20%;
  right: -20%;
  top: 0;
  height: 65%;
  pointer-events: none;
  filter: blur(28px);
  opacity: 0.75;
}

.theme-aurora .scene-aurora { display: block; }

.scene-aurora span {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: aurora-drift 18s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

.scene-aurora span:nth-child(1) {
  left: 5%; top: 8%; width: 60%; height: 26%;
  background: radial-gradient(ellipse at center, rgba(80, 255, 170, 0.55), transparent 70%);
  transform: rotate(-8deg);
}
.scene-aurora span:nth-child(2) {
  left: 35%; top: 18%; width: 55%; height: 22%;
  background: radial-gradient(ellipse at center, rgba(60, 220, 255, 0.45), transparent 70%);
  transform: rotate(6deg);
  animation-duration: 23s;
  animation-delay: -6s;
}
.scene-aurora span:nth-child(3) {
  left: 20%; top: 2%; width: 45%; height: 18%;
  background: radial-gradient(ellipse at center, rgba(180, 120, 255, 0.35), transparent 70%);
  animation-duration: 27s;
  animation-delay: -12s;
}

@keyframes aurora-drift {
  0% { transform: translateX(-4%) rotate(-6deg) scaleY(0.9); opacity: 0.6; }
  50% { opacity: 1; }
  100% { transform: translateX(6%) rotate(5deg) scaleY(1.15); opacity: 0.7; }
}

.scene-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.twinkle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.6);
  animation: twinkle var(--dur, 4s) ease-in-out var(--delay, 0s) infinite;
  will-change: opacity, transform;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.15); }
}

.scene-moon {
  position: absolute;
  top: 7vh;
  right: 11vw;
  width: clamp(54px, 8vmin, 110px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 34%, #fffdf3 0%, #f4efd9 45%, #d9d3b8 100%);
  box-shadow:
    0 0 40px 12px rgba(245, 240, 210, 0.28),
    0 0 140px 50px rgba(160, 180, 255, 0.14);
}

.scene-moon::before,
.scene-moon::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(170, 160, 130, 0.28);
}
.scene-moon::before { width: 22%; height: 22%; top: 28%; left: 52%; }
.scene-moon::after { width: 14%; height: 14%; top: 60%; left: 30%; }

.scene-hills {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 42vh;
}

.scene-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 30;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .twinkle { animation: none; opacity: 0.7; }
  .scene-aurora span { animation: none; }
}

/* Utility */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
