/* ==========================================================================
   Deck: Bühne, Folien-Grundlayout, Bedienelemente, Druck
   ========================================================================== */

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--letterbox);
  color: var(--navy);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* --- Bühne: 1920 × 1080, per JS auf das Fenster skaliert --- */
.viewport { position: fixed; inset: 0; cursor: default; }
.viewport.is-idle { cursor: none; }

.stage {
  --scale: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--scale));
  background: var(--cream);
}

/* --- Folie --- */
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding: 104px 128px 128px;
  overflow: hidden;
  font-size: 40px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
}
.slide.is-active {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-slide) var(--ease-out);
}
/* Die verlassene Folie bleibt deckend darunter, bis die neue ganz da ist.
   So gibt es beim Überblenden keinen Helligkeitseinbruch. */
.slide.is-leaving { z-index: 1; opacity: 1; visibility: visible; }

.theme-light { background: var(--cream); color: var(--navy); }
.theme-dark { background: var(--navy); color: var(--cream); }

.notes { display: none; }

/* --- Typografie-Grundlagen --- */
:where(.slide) :where(h1, h2, h3, p, blockquote, figure, ol, ul) { margin: 0; }

.title {
  font: 700 72px/1.1 var(--font-serif);
  color: var(--navy);
}
.eyebrow {
  font-weight: 800;
  font-size: 32px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}
.foot {
  position: absolute;
  left: 128px;
  right: 128px;
  bottom: 48px;
  font-size: 28px;
  line-height: 1.3;
  color: var(--ink-muted);
}
.theme-dark .foot { color: var(--mist-2); }

/* --- Kapitel-Tracker (roter Faden), Inhalt wird per JS aus der Agenda erzeugt --- */
.tracker {
  position: absolute;
  top: 40px;
  left: 128px;
  display: flex;
  gap: 44px;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #a7a197;
}
.tr-item { display: inline-flex; align-items: center; gap: 12px; position: relative; padding-bottom: 12px; }
.tr-item b { display: inline-block; font: 700 24px/1 var(--font-serif); }
.tr-item > span[data-morph] { display: inline-block; }
.tr-item.is-done { color: var(--ink-muted); }
.tr-item.is-current { color: var(--el-ink); }
.tr-item.is-current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
}
.tr-dots { display: inline-flex; gap: 6px; margin-left: 4px; }
.tr-dots i { display: block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.tr-dots i.is-done, .tr-dots i.is-current { background: currentColor; }
.tr-dots i.is-done { opacity: .45; }

/* --- Morph-Ebene: Geister-Elemente während Folienwechseln --- */
.morph-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }

/* --- Teams-Standout-Hilfe (Taste S) --- */
.safezone {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: var(--safe-w);
  height: var(--safe-h);
  display: grid;
  place-items: center;
  padding: 32px;
  border: 6px dashed rgba(164, 78, 42, .9);
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 40px;
  background: rgba(164, 78, 42, .12);
  color: var(--el-ink);
  font: 800 30px/1.3 var(--font-sans);
  text-align: center;
  pointer-events: none;
}
.safezone[hidden] { display: none; }

/* --- Bedienoberfläche ausserhalb der Bühne --- */
.hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px 12px;
  color: #c9d3dd;
  font: 600 13px/1 var(--font-sans);
  background: linear-gradient(transparent, rgba(13, 20, 28, .85));
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}
.hud.is-visible { opacity: 1; }
.hud-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.hud-fill { height: 100%; width: 0; background: var(--gold); transition: width 400ms var(--ease-out); }
.hud-count { font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; }

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 60;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(13, 20, 28, .9);
  color: #f6f3ec;
  font: 700 14px/1 var(--font-sans);
  transform: translate(-50%, -12px);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.blackout {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 400ms ease, visibility 0s linear 400ms;
}
.blackout.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }

.help {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(13, 20, 28, .72);
  font-family: var(--font-sans);
}
.help[hidden] { display: none; }
.help-card {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 28px 32px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--navy);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.help-card h2 { margin: 0 0 16px; font: 700 26px/1.2 var(--font-serif); }
.help-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 15px; line-height: 1.4; }
.help-card dt { font-weight: 800; }
.help-card dd { margin: 0; color: var(--navy-2); }
.help-card kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  background: #fff;
  font: 700 13px/1.4 var(--font-sans);
  text-align: center;
}
.help-card p { margin: 16px 0 0; font-size: 14px; color: var(--ink-muted); }

/* --- Vorschau-Modus in der Referentenansicht --- */
.is-embed .hud, .is-embed .toast, .is-embed .help { display: none; }

/* --- Übersicht (?print) und Druck/PDF: alle Folien im Endzustand untereinander --- */
.is-print, .is-print body { height: auto; overflow: auto; }
.is-print .viewport { position: static; }
.is-print .stage {
  position: static;
  transform: none;
  height: auto;
  overflow: visible;
  background: none;
  zoom: var(--print-zoom, 1);
}
.is-print .slide {
  position: relative;
  width: 1920px;
  height: 1080px;
  opacity: 1;
  visibility: visible;
  margin-bottom: 24px;
  break-after: page;
}
.is-print .hud, .is-print .safezone, .is-print .morph-layer { display: none; }

@page { size: 1920px 1080px; margin: 0; }
@media print {
  html, body { background: none; }
  .is-print .stage { zoom: 1; }
  .is-print .slide { margin: 0; }
  .hud, .toast, .help, .blackout { display: none !important; }
}
