/* Vorführung (/vorfuehrung/) – Wachbuch Klar 2.
   Bausteine (.device, .boundary, .code-block, .steps, .facts, .pub-button)
   kommen aus public.css, Farben aus tokens.css. Hier nur die Folienbühne:
   Kopf der App oben, Folie in der Mitte, Steuerleiste fest unten – zusammen
   genau ein Bildschirm. Keine Inline-Styles; Verhalten in app.js. */

.demo-noscript-hint {
  width: min(42rem, calc(100% - 2rem));
  margin: 1rem auto;
  color: var(--muted);
  font-size: .95rem;
}

/* —— Seitengerüst, sobald das Deck läuft (app.js setzt die Klasse) —— */
body.demo-deck-active {
  box-sizing: border-box;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.demo-deck-active > .app-header,
body.demo-deck-active > .app-nav { flex: none; }
body.demo-deck-active .page-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
/* Der Fuß steht auf dieser Seite im letzten Bild (Datenschutz, Hilfe, Version). */
body.demo-deck-active .site-footer { display: none; }

/* —— Ohne JavaScript: Folien untereinander —— */
.demo-deck {
  --demo-gutter: clamp(1rem, 4vw, 3rem);
  background: var(--bg);
}
.demo-deck:not(.is-js) .demo-slide {
  padding: clamp(2rem, 5vw, 4rem) 0;
  border-bottom: 1px solid var(--line);
}
.demo-deck-bar { display: none; }

/* —— Mit JavaScript: Bühne + Leiste —— */
.demo-deck.is-js {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.demo-deck.is-js .demo-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  container-type: size;
}
.demo-deck.is-js .demo-slide {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  padding-block: clamp(1.25rem, 4cqh, 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
}
.demo-deck.is-js .demo-slide.is-on {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

/* —— Folieninhalt —— */
.demo-split,
.demo-single {
  /* Gleiche Fluchtlinie wie der App-Kopf darüber und die Leiste darunter. */
  width: min(var(--content), 100% - 2 * var(--demo-gutter));
  margin-inline: auto;
}
.demo-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
}
.demo-split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.demo-kicker { margin: 0 0 1rem; color: var(--muted); font-weight: 600; }
.demo-slide h2 {
  margin: 0 0 1.25rem;
  max-width: 15ch;
  color: var(--text);
  font-size: clamp(2rem, min(4.2vw, 7cqh), 3.6rem);
  line-height: 1.05;
  letter-spacing: -.03em;
  font-weight: 700;
}
.demo-lead {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
}

/* Aufnahmen: Größe richtet sich nach der Höhe der Bühne (cqh), damit Text und
   Bild ohne Scrollen in den Bildschirm passen. */
.demo-media { position: relative; justify-self: center; width: 100%; }
.demo-media .device img { width: 100%; height: auto; }

/* Desktop + Handy (wie Bühne der Projektseite) */
.demo-media-duo { max-width: 118cqh; padding: 0 6% 3rem 0; }

/* Ein Handy allein */
.demo-media-phone { max-width: min(36cqh, 22rem); }
.demo-media-phone .device-phone { position: static; width: 100%; }

/* Zwei Desktops: hell vorn links, dunkel versetzt rechts unten */
.demo-media-pair { max-width: 124cqh; padding: 0 16% 20% 0; }
.demo-media-pair .device-second {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 56%;
}

/* Ein Desktop */
.demo-media-desktop { max-width: 136cqh; }

/* Grenze: einzige Fläche mit Warnrahmen */
.demo-slide .boundary { padding-block: clamp(1.5rem, 5cqh, 3rem); }
.demo-slide .boundary h2 { max-width: none; }
.demo-slide .boundary-list { margin-top: 2rem; gap: 1.5rem 3rem; }
.demo-slide .boundary-list strong { font-size: 1.15rem; margin-bottom: .25rem; }
.demo-slide .boundary-list span { line-height: 1.5; }

/* Installation */
.demo-single > .demo-copy { margin-bottom: 2rem; }
.demo-slide .demo-single h2 { max-width: none; }
.demo-slide .demo-single .demo-lead { max-width: 44rem; }
.demo-slide .code-block code { white-space: pre-wrap; word-break: break-all; }
.demo-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
.demo-steps li { grid-template-columns: 1fr; align-content: start; gap: .75rem; }
.demo-steps h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; color: var(--text); }
.demo-steps p { line-height: 1.5; font-size: .95rem; }

/* Schluss */
.demo-cta { margin-top: 2rem; }
.demo-cta form { display: contents; }
.demo-facts .facts { font-size: 1rem; }
.demo-facts .note { margin-top: 1.5rem; }
.demo-legal { margin: 1.5rem 0 0; color: var(--muted); font-size: .92rem; }
.demo-legal a { color: inherit; }

/* —— Steuerleiste —— */
.demo-deck.is-js .demo-deck-bar {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  padding: .75rem max(var(--demo-gutter), (100% - var(--content)) / 2) calc(.75rem + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.demo-deck-bar > [data-demo-prev] { justify-self: start; }
.demo-deck-bar-end { justify-self: end; display: flex; gap: .5rem; }
.demo-music[aria-pressed="true"] { color: var(--on-primary); background: var(--text); border-color: var(--text); }

.demo-progress {
  position: absolute;
  inset: -1px 0 auto;
  height: 3px;
  background: transparent;
}
.demo-progress-fill {
  display: block;
  height: 100%;
  width: 12.5%;
  background: var(--brand);
}
.demo-deck[data-demo-index="0"] .demo-progress-fill { width: 12.5%; }
.demo-deck[data-demo-index="1"] .demo-progress-fill { width: 25%; }
.demo-deck[data-demo-index="2"] .demo-progress-fill { width: 37.5%; }
.demo-deck[data-demo-index="3"] .demo-progress-fill { width: 50%; }
.demo-deck[data-demo-index="4"] .demo-progress-fill { width: 62.5%; }
.demo-deck[data-demo-index="5"] .demo-progress-fill { width: 75%; }
.demo-deck[data-demo-index="6"] .demo-progress-fill { width: 87.5%; }
.demo-deck[data-demo-index="7"] .demo-progress-fill { width: 100%; }

.demo-count {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* —— Bewegung nur auf Wunsch —— */
@media (prefers-reduced-motion: no-preference) {
  .demo-deck.is-js .demo-slide { transition: opacity .35s ease, visibility 0s linear .35s; }
  .demo-deck.is-js .demo-slide.is-on { transition: opacity .35s ease, visibility 0s; }
  .demo-progress-fill { transition: width .35s ease; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-deck.is-js .demo-slide,
  .demo-progress-fill { transition: none !important; }
}

/* —— Tablet / Hochformat: Bild unter den Text —— */
@media (max-width: 60rem) {
  .demo-deck.is-js .demo-slide { align-content: start; }
  .demo-split,
  .demo-split-even { grid-template-columns: 1fr; gap: 1.75rem; }
  .demo-slide h2 { max-width: 20ch; font-size: clamp(1.75rem, 6vw, 2.5rem); margin-bottom: .9rem; }
  .demo-lead { font-size: 1.05rem; line-height: 1.5; }
  .demo-kicker { margin-bottom: .6rem; }
  .demo-media { justify-self: start; }
  .demo-media-duo { max-width: 34rem; }
  .demo-media-pair { max-width: 34rem; }
  .demo-media-desktop { max-width: 34rem; }
  .demo-media-phone { max-width: 15rem; }
  .demo-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .demo-deck { --demo-gutter: 1rem; }
  .demo-deck.is-js .demo-slide { padding-block: 1rem; }
  .demo-media-phone { max-width: min(13rem, 30cqh); }
  /* Schritte als nummerierte Liste mit Ziffer links – spart Höhe. */
  .demo-steps { grid-template-columns: 1fr; gap: .9rem; margin-top: 1.25rem; }
  .demo-steps li { grid-template-columns: 2rem minmax(0, 1fr); gap: .75rem; }
  .demo-steps li::before { width: 2rem; height: 2rem; font-size: .9rem; }
  .demo-steps p { font-size: .92rem; }
  .demo-single > .demo-copy { margin-bottom: 1.25rem; }
  .demo-slide .boundary { padding: 1.25rem 1.25rem 1.25rem 2.5rem; }
  .demo-slide .boundary::before { width: .75rem; }
  .demo-slide .boundary-list { margin-top: 1rem; gap: .75rem; }
  .demo-slide .boundary-list strong { font-size: 1.05rem; overflow-wrap: anywhere; }
  .demo-slide .boundary-list span { font-size: .95rem; }
  .demo-slide .code-block { font-size: .8rem; padding: .9rem 1rem; }
  .demo-cta { margin-top: 1.25rem; }
  .pub-actions.demo-cta .pub-button { flex: 1 1 auto; }
  .demo-facts .facts { font-size: .95rem; }
  .demo-facts .facts th, .demo-facts .facts td { padding-block: .5rem; }
  .demo-facts .facts th { width: 28%; padding-right: 1rem; }
  .demo-facts .note { margin-top: 1rem; padding: .75rem 1rem; font-size: .95rem; }
  .demo-legal { margin-top: .6rem; }
  .demo-deck-bar .pub-button { padding-inline: .8rem; }
  .demo-deck-bar { gap: .5rem; }
}

@media (prefers-contrast: more) {
  .demo-deck.is-js .demo-deck-bar { border-top: 2px solid var(--text); }
  .demo-progress-fill { background: var(--text); }
}
