/* =========================================================
   Schöpferhaus – gemeinsame Bühne für die Bilder-Seiten
   Jede Seite ist ein gemaltes Bild. Alle Positionen werden
   in Pixeln der Xara-Vorlage angegeben (z. B. 1000 × 700)
   und mit --px auf jede Bildschirmgröße umgerechnet.
   ========================================================= */

@font-face {
  font-family: "Architects Daughter";
  src: url("schriften/architects-daughter.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "ABeeZee";
  src: url("schriften/abeezee.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --grund: #b7dcb0;
  --weiss: #ffffff;
  --text: #4c4c4c;
  --kasten: rgba(229, 229, 229, 0.95);
  --schatten: rgba(30, 60, 40, 0.28);
  --hand: "Architects Daughter", "Comic Sans MS", "Segoe Print", cursive;
  --lese: "ABeeZee", "Trebuchet MS", "Segoe UI", sans-serif;
  color-scheme: light;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--grund);
  font-family: var(--hand);
  display: grid;
  place-items: center;
  min-height: 100%;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  overflow-x: hidden;
}
body::after {
  content: "";
  position: fixed; inset: -60px;
  background: var(--unschaerfe, none) center / cover;
  filter: blur(40px) saturate(1.1);
  opacity: .7;
  z-index: -1;
}

/* ---------- Bühne ---------- */
.stage {
  --vw: var(--dw); --vh: var(--dh);
  --px: calc(100cqw / var(--vw));
  position: relative;
  aspect-ratio: var(--vw) / var(--vh);
  width: min(100%, calc((100svh - 32px) * var(--vw) / var(--vh)), 1400px);
  max-width: 100%;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 18px 50px var(--schatten);
  background: #e5e5e5;
}
.ansicht { position: absolute; inset: 0; }
.ansicht.handy { display: none; }
@media (max-aspect-ratio: 4/5) {
  .stage { --vw: var(--mw); --vh: var(--mh); }
  .ansicht.desktop { display: none; }
  .ansicht.handy { display: block; }
}

/* ---------- Bildebenen ---------- */
.ebene { position: absolute; display: block; pointer-events: none; }
.ebene img { display: block; width: 100%; height: 100%; max-width: none; }
.ebene.aktiv { pointer-events: auto; cursor: pointer; }
a.ebene, button.ebene { border: 0; padding: 0; background: none; }
.ebene.aktiv:focus-visible { outline: 3px solid var(--weiss); outline-offset: 2px; border-radius: 4px; }

/* Hover-Effekte (wie in Xara: einmal abspielen beim Drüberfahren) */
.ebene.aktiv:hover img,
.ebene.aktiv:focus-visible img,
.ebene.aktiv.offen img {
  animation-name: var(--effekt, none);
  animation-duration: var(--dauer, 1s);
  animation-fill-mode: both;
}
.ebene[data-effekt="swing"] img { transform-origin: top center; }

/* Erscheint erst nach einer Weile (z. B. der Schmetterling) */
.ebene.spaeter { animation: hereinflattern 2.4s ease-out both; animation-delay: var(--verzoegerung, 2s); }
@keyframes hereinflattern {
  from { opacity: 0; transform: translate(calc(var(--px) * -60), calc(var(--px) * 40)) rotate(-12deg) scale(.6); }
  to   { opacity: 1; transform: none; }
}

/* Flieger (z. B. Schmetterling): linker Flügel, rechter Flügel und Körper
   als drei Ebenen – die Bewegung steuert szene.js */
.flieger { position: absolute; inset: 0; display: block; will-change: transform; }
.flieger img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none;
  backface-visibility: visible;
}

/* ---------- Info-Kästen (Popups) ---------- */
.kasten {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  padding: calc(var(--px) * 10);
  background: var(--kasten);
  color: var(--text);
  font-family: var(--lese);
  font-size: calc(var(--px) * 11.4);
  line-height: 1.38;
  box-shadow: 0 6px 22px var(--schatten);
  border-radius: calc(var(--px) * 3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(var(--px) * 6));
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
.kasten.offen {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .25s ease, transform .25s ease, visibility 0s;
}
.handy .kasten { font-size: calc(var(--px) * 11.4); }
.kasten h2 {
  margin: 0 0 .25em;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.85em;
  line-height: 1.15;
  text-wrap: balance;
}
.kasten p { margin: 0 0 .45em; text-align: justify; hyphens: auto; }
.kasten p.zitat { font-style: italic; text-align: left; }
.kasten p.kurz { margin: 0; text-align: left; }
.kasten img { display: block; width: 100%; height: auto; max-width: none; margin-bottom: .5em; }
.kasten a {
  display: inline-block;
  margin-top: .2em;
  font-family: var(--hand);
  font-size: 1.24em;
  color: var(--text);
  text-underline-offset: 3px;
}
.kasten a:hover, .kasten a:focus-visible { color: #000; }

/* Kasten mit Bild links und Text rechts (z. B. Bücher) */
.kasten.mitbild > .inhalt, .kasten .mitbild {
  display: grid; grid-template-columns: var(--bildbreite, 28%) 1fr; gap: 0 calc(var(--px) * 14); align-items: start;
}
.kasten .mitbild > img { margin: 0; }
.kasten .mitbild > div { min-width: 0; }
.kasten .mitbild a[data-gross] { display: block; margin: 0; }
.kasten .mitbild a[data-gross] img { margin: 0; cursor: zoom-in; }
.kasten.serif, .kasten .serif { font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-size: 1.06em; }

/* Am Handy: Info-Kästen immer oben, volle Breite, gut lesbar */
@media (max-aspect-ratio: 4/5) {
  .handy .kasten {
    left: 4% !important; width: 92% !important; top: 3% !important;
    max-height: 84%; overflow-y: auto;
    font-size: max(13px, calc(var(--px) * 11.4));
  }
  .handy .kasten p { text-align: left; hyphens: auto; }
  .handy .kasten .mitbild { grid-template-columns: 1fr; }
  .handy .kasten .mitbild > img, .handy .kasten .mitbild > a[data-gross] { width: 34%; margin-bottom: .6em; }
}

/* ---------- kleine Beschriftungen, Licht, Video ---------- */
.beschriftung { font-family: var(--hand); color: var(--text); line-height: 1; white-space: nowrap; }
.ebene.licht { opacity: 0; transition: opacity .45s ease; mix-blend-mode: screen; z-index: 12; }
.ebene.licht.an { opacity: 1; }
.ebene.video { pointer-events: auto; background: #1b1b22; overflow: hidden; z-index: 5; }
.ebene.video iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-start {
  width: 100%; height: 100%; border: 0; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: calc(var(--px) * 6);
  background: radial-gradient(circle at 50% 45%, #3a3550, #16151d);
  color: #fff; font-family: var(--hand); font-size: max(11px, calc(var(--px) * 12));
}
.video-start .play {
  width: calc(var(--px) * 44); height: calc(var(--px) * 30);
  border-radius: calc(var(--px) * 8); background: #e33;
  position: relative;
}
.video-start .play::after {
  content: ""; position: absolute; left: 40%; top: 28%;
  border-left: calc(var(--px) * 12) solid #fff;
  border-top: calc(var(--px) * 7) solid transparent; border-bottom: calc(var(--px) * 7) solid transparent;
}
.video-start:hover .play, .video-start:focus-visible .play { transform: scale(1.08); }
.video-start:focus-visible { outline: 3px solid var(--weiss); outline-offset: -3px; }

/* ---------- Großansicht ---------- */
dialog.leuchtkasten {
  border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 90svh; overflow: visible;
}
dialog.leuchtkasten::backdrop { background: rgba(20, 20, 40, .7); }
dialog.leuchtkasten img { display: block; max-width: 92vw; max-height: 88svh; width: auto; height: auto; box-shadow: 0 10px 40px rgba(0,0,0,.5); cursor: zoom-out; }
dialog.leuchtkasten .zu {
  position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #fff; background: #333; color: #fff; font: 22px/1 system-ui, sans-serif; cursor: pointer;
}

/* ---------- Fußzeile ---------- */
.fuss {
  position: absolute; z-index: 15;
  left: calc(var(--px) * 610); top: calc(var(--px) * 650);
  display: flex; gap: calc(var(--px) * 37);
  font-size: max(12px, calc(var(--px) * 15.8));
}
.fuss a { color: var(--weiss); text-decoration: none; text-shadow: 0 1px 4px rgba(0, 50, 0, .55); }
.fuss a:hover, .fuss a:focus-visible { text-decoration: underline; }
@media (max-aspect-ratio: 4/5) {
  .fuss { left: 0; width: 100%; top: auto; bottom: calc(var(--px) * 6); justify-content: center; gap: calc(var(--px) * 26); font-size: max(12px, calc(var(--px) * 12)); }
}

/* ---------- Effekte aus animate.css (MIT-Lizenz) ---------- */
@keyframes pulse { from { transform: scale3d(1,1,1); } 50% { transform: scale3d(1.15,1.15,1.15); } to { transform: scale3d(1,1,1); } }
@keyframes flash { from, 50%, to { opacity: 1; } 25%, 75% { opacity: 0; } }
@keyframes shake {
  from, to { transform: translate3d(0,0,0); }
  10%, 30%, 50%, 70%, 90% { transform: translate3d(-10px,0,0); }
  20%, 40%, 60%, 80% { transform: translate3d(10px,0,0); }
}
@keyframes swing {
  20% { transform: rotate3d(0,0,1,15deg); } 40% { transform: rotate3d(0,0,1,-10deg); }
  60% { transform: rotate3d(0,0,1,5deg); } 80% { transform: rotate3d(0,0,1,-5deg); }
  to { transform: rotate3d(0,0,1,0deg); }
}
@keyframes tada {
  from { transform: scale3d(1,1,1); }
  10%, 20% { transform: scale3d(.9,.9,.9) rotate3d(0,0,1,-3deg); }
  30%, 50%, 70%, 90% { transform: scale3d(1.1,1.1,1.1) rotate3d(0,0,1,3deg); }
  40%, 60%, 80% { transform: scale3d(1.1,1.1,1.1) rotate3d(0,0,1,-3deg); }
  to { transform: scale3d(1,1,1); }
}

@media (prefers-reduced-motion: reduce) {
  .ebene.aktiv:hover img, .ebene.aktiv:focus-visible img, .ebene.aktiv.offen img { animation: none; }
  .ebene.spaeter { animation: none; }
  .kasten, .kasten.offen { transition: none; transform: none; }
}

/* nur für Suchmaschinen und Vorleseprogramme sichtbar */
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Abspieler (Stereoanlage) ---------- */
.ebene.abspieler { pointer-events: auto; }
.ebene.abspieler > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.abspieler-knopf {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; padding: 0; background: none; cursor: pointer; z-index: 2;
}
.abspieler-knopf:focus-visible { outline: 3px solid var(--weiss); outline-offset: 2px; border-radius: 4px; }
.abspieler-anzeige {
  position: absolute; left: 16.8%; top: 9%; width: 66%; height: 35.5%;
  background: #14202a; color: #7fd6ff;
  font-family: ui-monospace, "Consolas", monospace; font-size: max(7px, calc(var(--px) * 8));
  line-height: 1.25; padding: 2% 3%; box-sizing: border-box; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  box-shadow: inset 0 0 6px rgba(0,0,0,.8);
  transition: color .3s, text-shadow .3s;
  z-index: 3;
}
.abspieler.laeuft .abspieler-anzeige { color: #aef0ff; text-shadow: 0 0 4px #4fc8ff; }
.abspieler-anzeige .lauftext { white-space: nowrap; overflow: hidden; pointer-events: none; }
.abspieler-anzeige .lauftext span { display: inline-block; padding-left: 25%; animation: lauftext 9s linear infinite; }
.abspieler:not(.laeuft) .lauftext span { animation-play-state: paused; padding-left: 0; }
@keyframes lauftext { to { transform: translateX(-100%); } }
.abspieler-anzeige .zeile { display: flex; justify-content: space-between; align-items: baseline; gap: .6em; pointer-events: none; min-width: 0; }
.abspieler-anzeige .lauftext { flex: 1; min-width: 0; }
.abspieler-anzeige .spur { flex: none; height: calc(var(--px) * 4); background: #24394a; border-radius: 2px; cursor: pointer; position: relative; z-index: 4; }
.abspieler-anzeige .balken { height: 100%; width: 0; background: #4fc8ff; border-radius: 2px; }
.abspieler-anzeige { pointer-events: none; }
.abspieler-anzeige .spur { pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .abspieler-anzeige .lauftext span { animation: none; padding-left: 0; } }
.abspieler .lauftext { display: none; }
.abspieler.laeuft .lauftext { display: block; }
.abspieler.laeuft .zeile .status { display: none; }
.abspieler:not(.laeuft) .zeile .zeit:empty { display: none; }

/* ---------- Kaffee: Kanne, Tasse, Strahl, Dampf ---------- */
.ebene.kanne img, .ebene.tasse img { position: absolute; inset: 0; width: 100%; height: 100%; }
.ebene.tasse .t-voll { opacity: 0; transition: opacity .4s ease; }
.ebene.tasse.voll .t-voll { opacity: 1; }
.ebene.tasse.fuellt .t-voll { transition: opacity 1.4s ease-in; }
.strahl-ebene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 14; overflow: visible; }
.strahl { fill: none; stroke: #5a3517; stroke-width: 2.4; stroke-linecap: round; opacity: .95; }
.ebene.dampf { z-index: 13; }
.ebene.dampf path { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 1.6; stroke-linecap: round; opacity: 0; animation: dampf 3.2s ease-out infinite; }
.ebene.dampf path:nth-child(2) { animation-delay: .9s; }
.ebene.dampf path:nth-child(3) { animation-delay: 1.8s; }
@keyframes dampf { 0% { opacity: 0; transform: translateY(20%) scaleY(.6); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-25%) scaleY(1.1); } }
@media (prefers-reduced-motion: reduce) { .ebene.dampf path { animation: none; opacity: .5; } }

/* Schließen-Knopf im Info-Kasten (vor allem fürs Handy) */
.kasten { position: absolute; }
.kasten-zu {
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(76, 76, 76, .12); color: var(--text);
  font: 20px/1 system-ui, sans-serif; cursor: pointer;
}
.kasten-zu:hover, .kasten-zu:focus-visible { background: rgba(76, 76, 76, .25); }
.kasten h2 { padding-right: 30px; }
@media (hover: hover) and (pointer: fine) { .desktop .kasten-zu { display: none; } }
