.presentation-editor-ui[hidden] { display: none !important; }

.slide .editor-text-title {
  max-width: 1050px;
  margin-bottom: var(--space-5);
  font-family: var(--font-display);
  font-size: clamp(40px, 4.3cqw, 68px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.04;
}

.slide .editor-text-body {
  max-width: 850px;
  margin-bottom: var(--space-4);
  font-family: var(--font-body);
  font-size: clamp(23px, 2cqw, 32px);
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.38;
}

.slide .editor-text-small {
  max-width: 1100px;
  font-size: clamp(13px, 1.15cqw, 18px) !important;
  font-weight: 400;
  letter-spacing: 0.005em;
  line-height: 1.4 !important;
}

.slide .editor-added-text {
  position: absolute;
  z-index: 12;
  box-sizing: border-box;
  min-width: 220px;
  min-height: 72px;
  max-width: calc(100% - 72px);
  max-height: calc(100% - 96px);
  margin: 0;
  padding: 12px 16px;
  overflow: visible;
  color: inherit;
  background: transparent;
}

.slide .editor-added-text h2,
.slide .editor-added-text p,
.slide .editor-added-text ul { max-width: none; margin: 0; }
.slide .editor-added-text--title h2 { font-size: clamp(42px, 4.4cqw, 68px); line-height: 1; }
.slide .editor-added-text--text p,
.slide .editor-added-text--list li { font-size: clamp(22px, 2cqw, 32px); line-height: 1.35; }
.slide .editor-added-text--text p { white-space: pre-wrap; }
.slide .editor-added-list { padding-left: 1.15em; }
.slide .section-number { display: none !important; }

.slide .editor-added-text-controls { display: none; }

.slide .editor-youtube-media {
  display: flex;
  width: min(100%, 1120px, 74.667cqh);
  max-width: 100%;
  max-height: 42cqh;
  flex: 0 0 auto;
  margin: clamp(18px, 3cqh, 34px) auto 0;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #101820;
}
.slide .editor-youtube-media iframe,
.slide .editor-youtube-media video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.slide .editor-youtube-media video { background: transparent; object-fit: contain; }
.slide .editor-youtube-media.editor-x-post { width:min(100%,720px); height:min(68cqh,650px); max-height:68cqh; aspect-ratio:auto; background:transparent; border:0; border-radius:16px; }
.slide .editor-x-post .x-post-embed { background:transparent; border:0; border-radius:13px; }
/* Nach der resize-Meldung des Embeds (initXPostAutosize) schmiegt sich die Figure an die Karte an;
   #deck erhoeht die Spezifitaet gegenueber deck-lokalen .kb-shot-Regeln. */
#deck .slide figure[data-x-post-fitted],
.slide figure[data-x-post-fitted] { display:flex; align-items:flex-start; justify-content:center; height:auto; max-height:none; aspect-ratio:auto; background:transparent; }
#deck .slide figure[data-x-post-fitted] > iframe.x-post-embed { width:min(100%, 550px); object-fit:unset; border-radius:13px; }

.slide a.slide-text-link {
  color: inherit;
  text-decoration-color: currentColor;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
}
.slide a.slide-text-link:hover,
.slide a.slide-text-link:focus-visible { color: inherit; text-decoration-thickness: 3px; }

.slide .editor-media-free {
  position: absolute !important;
  z-index: 18 !important;
  display: block !important;
  max-width: none !important;
  max-height: none !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  transform: none !important;
}

.slide .editor-media-free > img,
.slide .editor-media-free > video,
.slide .editor-media-free > iframe,
.slide .editor-media-free img:only-child,
.slide .editor-media-free video:only-child,
.slide .editor-media-free iframe:only-child {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  transform: none !important;
}

.slide.editor-layout-preset > .editor-media-free,
.slide.editor-layout-title-video > .editor-media-free { display: block !important; }

/* Freie Medien liegen ausserhalb des Inhaltsflusses. Titel bleiben deshalb zuverlässig oben. */
.slide:has(.editor-media-free) > .slide__content {
  justify-content: flex-start !important;
}

/* Globale Bildgarantie: Bilder bleiben vollständig sichtbar, ohne ihren Alpha-Hintergrund zu überschreiben.
   Ausgenommen sind Brand-Heros: sie sind kein Inhaltsbild, sondern die Fläche
   der Folie, und ihr Zuschnitt kommt aus dem Kern (data-hero-fit). Ohne diese
   Ausnahme gewänne das !important hier gegen jede Kernregel — der Hero wäre
   dauerhaft auf contain festgenagelt. Rahmen, Hintergrund und Geometrie deckt
   für Heros die Regel in runtime/core.css ab. */
.slide img:not([data-brand-hero]) {
  border: 0 !important;
  background: transparent !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Bildcontainer bleiben rahmenlos und transparent. Ihre bestehende Layoutart bleibt erhalten.
   Die Hero-Figur ist ausgenommen: sie ist der Bildgrund der Folie und trägt
   ihren Backdrop aus dem Kern. */
.slide figure:not(.brand-hero-media):has(img),
.slide .visual-frame:has(img),
.slide .import-media:has(img),
.slide .ai-uploaded-media:has(img),
.slide picture:has(img) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Auch hier gilt die Hero-Ausnahme: sein Zuschnitt steht in runtime/core.css. */
.slide figure:has(> img) > img:not([data-brand-hero]),
.slide .visual-frame:has(> img) > img,
.slide .import-media:has(> img) > img,
.slide .ai-uploaded-media:has(> img) > img,
.slide picture:has(> img) > img {
  display: block !important;
  margin: auto !important;
  object-fit: contain !important;
  object-position: center !important;
}

.slide figure:has(img) > figcaption,
.slide .visual-frame:has(img) > figcaption,
.slide .import-media:has(img) > figcaption,
.slide .ai-uploaded-media:has(img) > figcaption {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.slide .editor-image-caption {
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 9px 12px 0 !important;
  color: var(--ink-2) !important;
  background: transparent !important;
  border: 0 !important;
  font-family: var(--font-ui) !important;
  font-size: clamp(13px, 1cqw, 16px) !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  text-align: center !important;
}

.slide .editor-captioned-image {
  display: flex;
  min-width: 0;
  min-height: 0;
  margin: 0;
  flex-direction: column;
  align-items: stretch;
  background: transparent;
  border: 0;
}

.slide .editor-captioned-image > img,
.slide .editor-captioned-image > picture {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.slide .editor-media-free:has(> .editor-image-caption) {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

.slide .editor-media-free:has(> .editor-image-caption) > img,
.slide .editor-media-free:has(> .editor-image-caption) > picture {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

/* Gleich grosse Galerien übernehmen die Folienfarbe statt weisser Karten. */
.slide:not(.editor-layout-preset) .visual-grid--3 {
  display: grid !important;
  height: auto !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  align-items: stretch !important;
}

.slide:not(.editor-layout-preset) .visual-grid--3 .visual-frame--gallery {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  background: transparent !important;
  border: 0 !important;
}

.slide:not(.editor-layout-preset) .visual-grid--3 .visual-frame--gallery img {
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Geprüfte Layout-Presets: Der Agent wählt das Muster, der Editor garantiert die Geometrie. */
.slide.editor-layout-preset {
  --editor-layout-title-top: 48px;
  position: relative !important;
  overflow: hidden !important;
}

.slide.editor-layout-preset > :not(.editor-layout-path):not(.editor-added-text):not(.editor-media-free):not(.editor-callout-layer):not(.editor-callout):not(style) { display: none !important; }
.slide.editor-layout-preset .editor-layout-path { position: static !important; display: contents !important; }
.slide.editor-layout-preset .editor-layout-path > :not(.editor-layout-path):not(.editor-layout-title):not(.editor-layout-media-item) { display: none !important; }

.slide.editor-layout-preset .editor-layout-title {
  position: absolute !important;
  inset: var(--editor-layout-title-top) 72px auto !important;
  z-index: 2 !important;
  display: block !important;
  box-sizing: border-box !important;
  width: min(1160px, calc(100% - 144px)) !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  color: var(--ink) !important;
  font-family: var(--font-display) !important;
  font-size: var(--editor-layout-title-size, clamp(42px, 4.4cqw, 68px)) !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  line-height: 1 !important;
  text-align: left !important;
  text-indent: 0 !important;
  text-transform: none !important;
  text-wrap: balance !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
  transform: none !important;
}

.slide.editor-layout-preset:not(.editor-layout-title-image) .editor-layout-title {
  font-size: var(--editor-layout-title-size, clamp(36px, 3.4cqw, 56px)) !important;
}

.slide.editor-layout-preset .editor-layout-media-item {
  position: absolute !important;
  z-index: 1 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 14px !important;
  overflow: visible !important;
}

.slide.editor-layout-preset .editor-layout-media-item picture { display: contents !important; }
.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) :is(img, video).editor-layout-media {
  position: static !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-layout-preset :is(img, video).editor-layout-media-item.editor-layout-media {
  display: block !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) > figcaption,
.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) > p,
.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) > span,
.slide.editor-layout-preset .editor-layout-media-item:not(img):not(video) > strong {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--ink) !important;
  font-size: 24px !important;
  line-height: 1.15 !important;
  text-align: center !important;
}

.slide.editor-layout-title-image {
  color: var(--ink) !important;
  background: var(--paper) !important;
}

.slide.editor-layout-title-image .editor-layout-item-1 {
  inset: var(--editor-layout-media-top, 220px) 72px auto !important;
  height: var(--editor-layout-media-height, calc(100% - 276px)) !important;
}
.slide.editor-layout-title-image .editor-layout-media { object-fit: contain !important; }
.slide.editor-layout-title-image .editor-layout-media-item:not(img):not(video) > :not(img):not(video):not(picture) { display: none !important; }

.slide.editor-layout-two-equal .editor-layout-media-item,
.slide.editor-layout-two-captioned .editor-layout-media-item,
.slide.editor-layout-three-equal .editor-layout-media-item,
.slide.editor-layout-hero-two .editor-layout-media-item,
.slide.editor-layout-grid-2x2 .editor-layout-media-item { top: var(--editor-layout-media-top, 360px) !important; }

.slide.editor-layout-two-equal .editor-layout-media-item,
.slide.editor-layout-two-captioned .editor-layout-media-item,
.slide.editor-layout-three-equal .editor-layout-media-item,
.slide.editor-layout-hero-two .editor-layout-item-1 {
  bottom: auto !important;
  height: var(--editor-layout-media-height, calc(100% - 432px)) !important;
}

.slide.editor-layout-two-equal .editor-layout-item-1 { left: 72px !important; width: calc(50% - 88px) !important; }
.slide.editor-layout-two-equal .editor-layout-item-2 { left: calc(50% + 16px) !important; width: calc(50% - 88px) !important; }
.slide.editor-layout-two-captioned .editor-layout-item-1 { left: 72px !important; width: calc(50% - 88px) !important; }
.slide.editor-layout-two-captioned .editor-layout-item-2 { left: calc(50% + 16px) !important; width: calc(50% - 88px) !important; }
.slide.editor-layout-two-captioned .editor-layout-caption {
  display: block !important;
  min-height: 58px !important;
  margin: 0 !important;
  padding: 12px 14px !important;
  color: var(--ink) !important;
  background: var(--blue-soft) !important;
  font-size: 22px !important;
  line-height: 1.25 !important;
  text-align: left !important;
}

.slide.editor-layout-three-equal .editor-layout-media-item { width: calc(33.333% - 69.333px) !important; }
.slide.editor-layout-three-equal .editor-layout-media-item,
.slide.editor-layout-three-equal .editor-layout-media { background: transparent !important; }
.slide.editor-layout-three-equal .editor-layout-item-1 { left: 72px !important; }
.slide.editor-layout-three-equal .editor-layout-item-2 { left: calc(33.333% + 34.667px) !important; }
.slide.editor-layout-three-equal .editor-layout-item-3 { left: calc(66.667% - 2.667px) !important; }

.slide.editor-layout-hero-two .editor-layout-item-1 { left: 72px !important; width: calc(62% - 88px) !important; }
.slide.editor-layout-hero-two .editor-layout-item-2,
.slide.editor-layout-hero-two .editor-layout-item-3 {
  left: calc(62% + 16px) !important;
  right: 72px !important;
  width: auto !important;
  height: var(--editor-layout-row-height, calc(50% - 230px)) !important;
  bottom: auto !important;
}
.slide.editor-layout-hero-two .editor-layout-item-3 { top: var(--editor-layout-row-two-top, calc(50% + 158px)) !important; }

.slide.editor-layout-grid-2x2 .editor-layout-media-item {
  width: calc(50% - 88px) !important;
  height: var(--editor-layout-row-height, calc(50% - 230px)) !important;
  bottom: auto !important;
}
.slide.editor-layout-grid-2x2 .editor-layout-item-1,
.slide.editor-layout-grid-2x2 .editor-layout-item-3 { left: 72px !important; }
.slide.editor-layout-grid-2x2 .editor-layout-item-2,
.slide.editor-layout-grid-2x2 .editor-layout-item-4 { left: calc(50% + 16px) !important; }
.slide.editor-layout-grid-2x2 .editor-layout-item-3,
.slide.editor-layout-grid-2x2 .editor-layout-item-4 { top: var(--editor-layout-row-two-top, calc(50% + 158px)) !important; }

.slide.editor-layout-title-video {
  position: relative !important;
  overflow: hidden !important;
  color: var(--ink) !important;
  background: var(--paper) !important;
}

.slide.editor-layout-title-video > :not(.editor-layout-video-path):not(.editor-added-text):not(.editor-callout-layer):not(.editor-callout):not(style) { display: none !important; }
.slide.editor-layout-title-video .editor-layout-video-path { position: static !important; display: contents !important; }
.slide.editor-layout-title-video .editor-layout-video-path > :not(.editor-layout-video-path):not(.editor-layout-video-title):not(.editor-layout-video-item) { display: none !important; }

.slide.editor-layout-title-video .editor-layout-video-title {
  position: absolute !important;
  inset: var(--editor-video-title-top, 48px) var(--editor-video-title-right, 72px) auto 72px !important;
  z-index: 2 !important;
  display: block !important;
  box-sizing: border-box !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  color: var(--ink) !important;
  font-family: var(--font-display) !important;
  font-size: var(--editor-video-title-size, clamp(38px, 3.8cqw, 62px)) !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  line-height: 1 !important;
  text-align: left !important;
  text-wrap: balance !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  opacity: 1 !important;
  visibility: visible !important;
  filter: none !important;
  transform: none !important;
}

.slide.editor-layout-title-video .editor-layout-video-item {
  position: absolute !important;
  inset: var(--editor-video-top, 180px) auto auto var(--editor-video-left, 72px) !important;
  z-index: 1 !important;
  display: flex !important;
  box-sizing: border-box !important;
  width: var(--editor-video-width, calc(100% - 144px)) !important;
  max-width: none !important;
  height: var(--editor-video-height, calc((100cqw - 144px) * 0.5625)) !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9 !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #101820 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-layout-title-video .editor-layout-video-item > :not(iframe):not(video):not(.media-play):not([data-slide-media-frame]) { display: none !important; }
.slide.editor-layout-title-video .editor-layout-video-item iframe,
.slide.editor-layout-title-video .editor-layout-video-item video {
  position: static !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #101820 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-layout-title-video iframe.editor-layout-video-item,
.slide.editor-layout-title-video video.editor-layout-video-item {
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.slide.editor-layout-title-video .editor-layout-video-item .media-play {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  width: 100% !important;
  height: 100% !important;
  place-items: center !important;
  margin: 0 !important;
}

/* Jeder bestehende Textblock kann frei verschoben und in seiner Breite angepasst werden. */
.slide .editor-text-free,
.slide.editor-layout-preset .editor-text-free,
.slide.editor-layout-title-video .editor-text-free,
.slide.editor-image-only-layout .editor-text-free {
  position: absolute !important;
  z-index: 22 !important;
  display: block !important;
  min-width: 120px !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  overflow: visible !important;
  box-sizing: border-box !important;
  transform: none !important;
}

/* Persistente Callouts: immer oberhalb aller Folieninhalte, aber ausserhalb des Editors nicht interaktiv. */
.slide > .editor-callout-layer {
  position:absolute !important;
  inset:0 !important;
  z-index:1000000 !important;
  width:100% !important;
  height:100% !important;
  overflow:visible !important;
  pointer-events:none !important;
  isolation:isolate;
}
.slide .editor-callout {
  position:absolute !important;
  z-index:1 !important;
  display:block !important;
  overflow:visible !important;
  pointer-events:none;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.24));
}

/* Persistentes Folienlayout: Ein ausgewähltes Bild bleibt sichtbar, der übrige Inhalt wird nur ausgeblendet. */
.slide.editor-image-only-layout > :not(.editor-image-only-path):not(.editor-callout-layer):not(.editor-callout):not(style) { display: none !important; }

.slide.editor-image-only-layout .editor-image-only-path {
  position: static !important;
  display: flex !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.slide.editor-image-only-layout > .editor-image-only-path {
  box-sizing: border-box !important;
  padding: 72px !important;
}

.slide.editor-image-only-layout .editor-image-only-path > :not(.editor-image-only-path):not(.editor-image-only-target) { display: none !important; }

.slide.editor-image-only-layout img.editor-image-only-target {
  position: absolute !important;
  inset: 72px auto auto 72px !important;
  display: block !important;
  width: calc(100% - 144px) !important;
  max-width: none !important;
  height: calc(100% - 144px) !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  object-fit: contain !important;
  transform: none !important;
}

/* Einheitliche Folienbühne: Jede Folie hat logisch 1440 × 810 und wird als Ganzes skaliert. */
@media screen {
  :root {
    --deck-scale: 1;
    --deck-letterbox-y: 0px;
  }

  body { overflow-x: hidden; }

  .deck {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .deck > section.slide {
    width: 1440px !important;
    min-width: 1440px !important;
    max-width: 1440px !important;
    height: 810px !important;
    min-height: 810px !important;
    max-height: 810px !important;
    flex: 0 0 auto !important;
    margin: var(--deck-letterbox-y) 0 !important;
    overflow: hidden !important;
    container-type: size;
    scroll-snap-align: center;
    zoom: var(--deck-scale);
  }

  .deck > section.slide > .slide__content {
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
  }

  .deck > section.slide { font-size: clamp(17px, 1.25cqw, 21px); }

}

@media print { .presentation-editor-ui { display: none !important; } }
