/* Szene „Horizont“ (partials/szene-horizont.ejs, erzeugt von docs/marke-belege/horizont/werkzeug/szene.js): Anmeldeseite, später Leerzustände und Fehlerseiten.
   Aufbau: Bildfläche mit zwei Zuschnitten nach Breite des Platzes (Containerabfrage: breit 960 x 420, unter 500 px Handy 390 x 270), feste Seitenverhältnisse,
   damit Figur und Blickziel in jeder Breite auf Felsen und Schiff sitzen. Satz „Ruhig am Horizont.“ oben links im Himmel (Marine auf Dämmerungsblau, Kontrast über 7:1),
   Begleiter (partials/begleiter.ejs, szene: true) auf dem Felsen links, sein Gruß als Zeile unter dem Bild.
   Bewegung nur transform und opacity, nur bei prefers-reduced-motion: no-preference; lange, weiche Zyklen (Wellen 45 bis 70 s, Schiff 7,2 s).
   Ruhe: data-ruhe (60 s ohne Eingabe oder verborgener Tab, /js/szene-horizont.js) hält alle Schleifen an. */

.hz {
  container: hz / inline-size;
  position: relative;
  min-width: 0;
}
/* Maße je Zuschnitt in Containerbreite (cqw): Bildhöhe, Figur (Breite, Mitte, Fußlinie auf dem Felsen), Blickziel. Breit: Ansicht 960 x 420. */
.hz > * {
  --hz-h: 43.75cqw;
  --hz-tw: 14.6cqw;
  --hz-tx: 16.67cqw;
  --hz-fuss: 34.69cqw;
  --hz-zx: 69.5cqw;
  --hz-zy: 17.7cqw;
}
.hz[data-zuschnitt="alle"] .hz-m { display: none; }
@container hz (max-width: 499px) {
  /* Handy-Zuschnitt: Ansicht 390 x 270, eigene Komposition (Schiff größer, Horizont bei 52 %) */
  .hz > * { --hz-h: 69.23cqw; --hz-tw: 19.5cqw; --hz-tx: 17.69cqw; --hz-fuss: 58.2cqw; --hz-zx: 68.2cqw; --hz-zy: 26.7cqw; }
  .hz[data-zuschnitt="alle"] .hz-d { display: none; }
  .hz[data-zuschnitt="alle"] .hz-m { display: block; }
  .hz-satz { left: 16px; top: 10px; font-size: 14px; }
}
.hz-bild {
  position: relative;
  height: var(--hz-h);
  overflow: hidden;
  border-radius: 12px;
  background: #c6cefb;
  isolation: isolate;
}
.hz-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.hz-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.hz-satz {
  position: absolute;
  left: 20px;
  top: 14px;
  margin: 0;
  color: #101334;
  font: 600 15px/24px var(--sans, Inter, system-ui, sans-serif);
  letter-spacing: 0.005em;
  pointer-events: none;
}

/* Blickziel (begleiter.js): unsichtbarer Punkt auf dem Schiff */
.hz-ziel { position: absolute; left: var(--hz-zx); top: var(--hz-zy); width: 1px; height: 1px; pointer-events: none; }

/* Laterne am Heck: nur in der Variante „aufmerksam“ (Prüfung läuft, Fehlerseiten) */
.hz-laterne { opacity: 0; }
.hz[data-variante="aufmerksam"] .hz-laterne { opacity: 1; }

/* ---------- Begleiter in der Szene: Figur auf dem Felsen, Gruß als Zeile unter dem Bild ---------- */
.hz .begl-szene {
  position: static;
  display: block;
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
.hz .begl-szene:focus { outline: none; }
.hz .begl-szene .begl-figur {
  position: absolute;
  z-index: 1;
  left: calc(var(--hz-tx) - var(--hz-tw) / 2);
  top: calc(var(--hz-fuss) - var(--hz-tw) * 129 / 120);
  padding: 0;
  line-height: 0;
}
.hz .begl-szene .begl-figur { transform: rotate(3deg); transform-origin: 50% 100%; }   /* hält Ausschau: leicht zum Horizont geneigt */
.hz .begl-szene:is([data-zustand="warnend"], [data-zustand="zeigen"], [data-zustand="laden"], [data-zustand="schlafend"]) .begl-figur { transform: none; }
.hz .begl-szene .tr { width: var(--hz-tw); height: calc(var(--hz-tw) * 140 / 120); }
.hz .begl-szene .begl-gruss { margin: 12px 0 0; max-width: 60ch; color: var(--muted, #505575); font-size: 14px; line-height: 1.5; }
.hz .begl-szene .begl-wer { display: inline; margin: 0; color: var(--ink, #101334); font-size: 14px; }

/* ---------- Bewegung ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hz-bild { animation: hz-ein 600ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hz-schiff { transform-box: fill-box; transform-origin: 50% 92%; animation: hz-schiff 7.2s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate; }
  .hz-segel { transform-box: fill-box; transform-origin: 50% 100%; animation: hz-segel 7.2s cubic-bezier(0.37, 0, 0.63, 1) -1.4s infinite alternate; }
  .hz-d .hz-drift-1 { animation: hz-d1 70s linear infinite; }
  .hz-d .hz-drift-2 { animation: hz-d2 55s linear infinite; }
  .hz-d .hz-drift-3 { animation: hz-d3 45s linear infinite; }
  .hz-m .hz-drift-1 { animation: hz-m1 70s linear infinite; }
  .hz-m .hz-drift-2 { animation: hz-m2 55s linear infinite; }
  .hz-m .hz-drift-3 { animation: hz-m3 45s linear infinite; }
  .hz-mondglanz { animation: hz-atmen 9s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate; }
  .hz-spur path { animation: hz-schimmer 5.2s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate; }
  .hz-spur .hz-spur-1 { animation-delay: -1.3s; animation-duration: 6.1s; }
  .hz-spur .hz-spur-2 { animation-delay: -2.9s; animation-duration: 4.7s; }
  .hz-spur .hz-spur-3 { animation-delay: -4.1s; animation-duration: 5.8s; }
  .hz-stern-0 { animation: hz-funkeln 13s linear -3s infinite; }
  .hz-stern-1 { animation: hz-funkeln 17s linear -9s infinite; }
  .hz .begl-szene .begl-figur { transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1); }
  .hz-laterne { transition: opacity 600ms cubic-bezier(0.22, 1, 0.36, 1); }
  .hz[data-ruhe] .hz-bild, .hz[data-ruhe] .hz-bild * { animation-play-state: paused; }
}
@keyframes hz-ein { from { opacity: 0; } to { opacity: 1; } }
@keyframes hz-schiff { from { transform: translateY(-1px) rotate(-1.2deg); } to { transform: translateY(1.2px) rotate(1.2deg); } }
@keyframes hz-segel { from { transform: rotate(-0.5deg); } to { transform: rotate(0.5deg); } }
@keyframes hz-d1 { to { transform: translateX(-120px); } }
@keyframes hz-d2 { to { transform: translateX(160px); } }
@keyframes hz-d3 { to { transform: translateX(-240px); } }
@keyframes hz-m1 { to { transform: translateX(-70px); } }
@keyframes hz-m2 { to { transform: translateX(100px); } }
@keyframes hz-m3 { to { transform: translateX(-130px); } }
@keyframes hz-atmen { from { opacity: 0.78; } to { opacity: 1; } }
@keyframes hz-schimmer { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes hz-funkeln { 0%, 86%, 100% { opacity: 1; } 92% { opacity: 0.25; } }
