/* ---------- Farben & Schrift (hier zentral änderbar) ---------- */
:root {
  --night:  #0b0a10;
  --bone:   #e8dfcf;
  --blood:  #8e1b1f;
  --ember:  #c4363b;
  --mist:   #b9afc9;
  --font: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--bone);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--night);
}

/* Bewegung durch Maus (Werte --px / --py setzt js/main.js, Bereich -1 bis 1) */
.layer { position: absolute; will-change: transform; }

/* ---------- Bild-Ebene ----------
   Die "Bühne" hat immer das Seitenverhältnis des Bildes (16:9) und deckt den
   Bildschirm ab. Alles darauf (Lichter) wird in Prozent des Bildes platziert,
   bleibt also auf jedem Gerät genau an der richtigen Stelle. */
.stage {
  --w: max(100vw, calc(100svh * 1.7768));
  position: absolute;
  top: 50%;
  width: var(--w);
  aspect-ratio: 1672 / 941;
  transform: translateY(-50%);
  /* Am Handy bleibt das Schloss (bei ca. 62 % des Bildes) im Blick */
  left: clamp(calc(100vw - var(--w)), calc(50vw - var(--w) * .62), 0px);
}
.layer--scene {
  inset: 0;
  transform: translate3d(calc(var(--px, 0) * -12px), calc(var(--py, 0) * -7px), 0) scale(1.05);
}
.scene__img { display: block; width: 100%; height: 100%; }

/* ---------- Flackernde Lichter ---------- */
.glow {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
}
.glow--win {
  background: radial-gradient(circle, rgba(255,170,70,.85) 0%, rgba(255,120,40,.35) 35%, rgba(255,100,30,0) 70%);
  animation: candle 3.4s ease-in-out infinite alternate;
}
.w2 { animation-duration: 2.3s; animation-delay: -1.1s; }
.w3 { animation-duration: 4.1s; animation-delay: -2s; }
.w4 { animation-duration: 2.8s; animation-delay: -.6s; }
.w5 { animation-duration: 3.7s; animation-delay: -1.7s; }
@keyframes candle {
  0%   { opacity: .35; transform: translate(-50%,-50%) scale(.9); }
  30%  { opacity: 1;   transform: translate(-50%,-50%) scale(1.1); }
  55%  { opacity: .55; transform: translate(-50%,-50%) scale(.95); }
  100% { opacity: .9;  transform: translate(-50%,-50%) scale(1.05); }
}
.glow--castle {
  --x: 66%; --y: 38%; --s: 34%;
  background: radial-gradient(circle, rgba(255,120,50,.22), rgba(255,90,30,0) 65%);
  animation: breathe 6s ease-in-out infinite alternate;
}
.glow--moon {
  --x: 72.5%; --y: 7.4%; --s: 16%;
  background: radial-gradient(circle, rgba(220,225,255,.3), rgba(220,225,255,0) 65%);
  animation: breathe 9s ease-in-out infinite alternate;
}
@keyframes breathe { from { opacity: .45; } to { opacity: 1; } }

/* ---------- Funken & Blitz ---------- */
.embers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; }
.flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 68% 12%, rgba(215,225,255,.95) 0%, rgba(150,170,255,.4) 45%, rgba(120,140,255,0) 80%);
}
.flash.on { animation: lightning .9s linear; }
@keyframes lightning {
  0% { opacity: 0; } 6% { opacity: .95; } 14% { opacity: .15; } 22% { opacity: .75; }
  34% { opacity: .1; } 100% { opacity: 0; }
}

/* ---------- Fledermäuse ---------- */
.layer--bats {
  inset: 0;
  pointer-events: none;
  transform: translate3d(calc(var(--px, 0) * -30px), calc(var(--py, 0) * -16px), 0);
}
.flyer { position: absolute; left: 0; animation: fly-r 17s linear infinite; }
.bat { display: block; width: 44px; height: 18px; fill: #040307; opacity: .92;
       transform-origin: 50% 70%; animation: flap .3s ease-in-out infinite alternate; }
.f1 { top: 9%; animation-delay: -4s; }
.f2 { top: 21%; animation-name: fly-l; animation-duration: 22s; animation-delay: -9s; }
.f2 .bat { width: 32px; height: 13px; animation-duration: .24s; }
.f3 { top: 5%;  animation-duration: 26s; animation-delay: -15s; }
.f3 .bat { width: 26px; height: 11px; animation-duration: .22s; }
.f4 { top: 31%; animation-name: fly-l; animation-duration: 15s; animation-delay: -2s; }
.f4 .bat { width: 58px; height: 24px; }

@keyframes fly-r {
  0%   { transform: translate(-12vw, 0); }
  25%  { transform: translate(22vw, -26px); }
  50%  { transform: translate(50vw, 18px); }
  75%  { transform: translate(80vw, -22px); }
  100% { transform: translate(112vw, 6px); }
}
@keyframes fly-l {
  0%   { transform: translate(112vw, 0); }
  25%  { transform: translate(80vw, 24px); }
  50%  { transform: translate(50vw, -18px); }
  75%  { transform: translate(22vw, 20px); }
  100% { transform: translate(-12vw, -6px); }
}
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.3); } }

/* ---------- Nebel (zwei Schichten, gegenläufig) ---------- */
.layer--fog {
  left: -3%; right: -3%; bottom: 0;
  height: 62%;
  pointer-events: none;
  transform: translate3d(calc(var(--px, 0) * -26px), calc(var(--py, 0) * -10px), 0);
}
.fog {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 200%;
  background: url("../assets/fog.webp") repeat-x;
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 30%, transparent 100%);
          mask-image: linear-gradient(to top, #000 0%, #000 30%, transparent 100%);
}
.fog--a { background-size: 50% 100%; opacity: .5; animation: drift 110s linear infinite; }
.fog--b { background-size: 25% 90%;  opacity: .38; top: 18%; animation: drift 65s linear infinite reverse; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Abdunkelung: Rand + Textbereich ---------- */
.shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 62% 38%, rgba(0,0,0,0) 45%, rgba(0,0,0,.6) 100%),
    linear-gradient(to top, rgba(8,6,10,.94) 0%, rgba(8,6,10,.55) 32%, rgba(8,6,10,0) 58%);
}

/* ---------- Inhalt ---------- */
.hero__content {
  position: absolute;
  z-index: 5;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 38rem);
  padding: 2rem 1.5rem 3rem;
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(2.6rem, 10vw, 5.2rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .06em;
  text-shadow: 0 0 28px rgba(142,27,31,.8), 0 2px 0 #000, 0 4px 18px #000;
  animation: rise 1.4s cubic-bezier(.2,.7,.2,1) both;
}
.subtitle {
  margin: .6rem 0 1.4rem;
  font-size: clamp(1.1rem, 3.6vw, 1.5rem);
  font-style: italic;
  letter-spacing: .08em;
  color: var(--mist);
  text-shadow: 0 2px 10px #000;
  animation: fade .9s ease-out .5s both;
}
.greeting {
  margin: 0 auto 2rem;
  max-width: 32rem;
  font-size: clamp(1rem, 3.2vw, 1.15rem);
  text-shadow: 0 1px 8px #000, 0 0 2px #000;
  animation: fade .9s ease-out .9s both;
}

.enter {
  display: inline-block;
  padding: .95rem 2.4rem;
  font-family: inherit;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  letter-spacing: .1em;
  color: var(--bone);
  text-decoration: none;
  background: var(--blood);
  border: 1px solid #d9a3a5;
  border-radius: 2px;
  box-shadow: 0 0 0 4px rgba(142,27,31,.25), 0 8px 30px rgba(142,27,31,.45);
  transition: background .25s, box-shadow .25s;
  animation: fade .9s ease-out 1.3s both;
}
.enter:hover {
  background: var(--ember);
  box-shadow: 0 0 0 4px rgba(196,54,59,.35), 0 8px 36px rgba(196,54,59,.6);
}
.enter:focus-visible { outline: 3px solid var(--bone); outline-offset: 5px; }
.notice { margin: 1.4rem auto 0; max-width: 28rem; font-size: .95rem; color: #f0b4b6; text-shadow: 0 1px 6px #000; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); letter-spacing: .14em; }
  to   { opacity: 1; transform: none;               letter-spacing: .06em; }
}
@keyframes fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Sitzung, Links, Sound-Button ---------- */
.session {
  margin: 1.5rem 0 0;
  font-style: italic;
  letter-spacing: .04em;
  color: var(--mist);
  text-shadow: 0 1px 8px #000;
  animation: fade .9s ease-out 1.7s both;
}
.links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem;
  margin-top: .9rem;
  animation: fade .9s ease-out 1.9s both;
}
.links a {
  color: var(--bone); text-decoration: underline; text-decoration-color: rgba(232,223,207,.4);
  text-underline-offset: .3em; text-shadow: 0 1px 8px #000;
}
.links a:hover { color: #fff; text-decoration-color: var(--ember); }
.links a:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }

.sound {
  position: absolute; z-index: 6; top: max(1rem, env(safe-area-inset-top)); right: 1rem;
  width: 2.8rem; height: 2.8rem; display: grid; place-items: center;
  color: var(--bone); background: rgba(11,10,16,.55);
  border: 1px solid rgba(232,223,207,.35); border-radius: 50%; cursor: pointer;
  backdrop-filter: blur(4px); transition: background .25s, border-color .25s;
}
.sound:hover { background: rgba(142,27,31,.6); border-color: var(--bone); }
.sound:focus-visible { outline: 3px solid var(--bone); outline-offset: 3px; }
.sound .waves { display: none; }
.sound[aria-pressed="true"] .waves { display: block; }
.sound[aria-pressed="true"] .slash { display: none; }

/* ---------- Desktop: Text unten links (Schloss bleibt frei) ---------- */
@media (min-width: 900px) {
  .hero__content {
    left: clamp(2rem, 6vw, 6rem);
    bottom: 9vh;
    transform: none;
    width: min(32rem, 40vw);
    padding: 0;
    text-align: left;
  }
  .greeting { margin-left: 0; }
  .links { justify-content: flex-start; }
  .shade {
    background:
      radial-gradient(ellipse at 62% 38%, rgba(0,0,0,0) 45%, rgba(0,0,0,.55) 100%),
      linear-gradient(to right, rgba(8,6,10,.82) 0%, rgba(8,6,10,.45) 30%, rgba(8,6,10,0) 55%),
      linear-gradient(to top, rgba(8,6,10,.8) 0%, rgba(8,6,10,0) 40%);
  }
}

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  .glow, .fog, .flyer, .bat, .title, .subtitle, .greeting, .enter, .session, .links { animation: none; }
  .embers, .flash { display: none; }
  .layer--bats { display: none; }
  .enter { transition: none; }
}
