/* =====================================================================
   Premium: Desktop (V29)
   Wird NUR geladen, wenn die Einladung mit premium=true rendert
   (makeTemplate.tsx → <link precedence>). Ohne Schalter: kein Byte.
   Alle Regeln greifen erst ab 1024 px.
   ===================================================================== */

/* =====================================================================
   V29: Editorial-Desktop ab 1024 px (.tl-ed an der Bühne)
   ===================================================================== */
@media (min-width: 1024px) {
  /* Breites Blatt statt schmaler Karte. Alle festen Elemente (Sprachschalter,
     Musik, Leiste, Hinweis) richten sich über --tl-col/--tl-gutter danach. */
  :root:has(.tl-ed) {
    --tl-col: min(1240px, 100% - 2 * clamp(28px, 5vw, 112px));
    --tl-col-radius: 22px;
    --tl-ed-pad: clamp(3rem, 6vw, 6.5rem);
  }

  .tl-ed > .tl-col {
    position: relative;
  }

  /* Demo-Hinweis: als ruhige Pille oben mittig statt quer über das Blatt. */
  :root:has(.tl-ed) .tl-sample-notice {
    left: 50%;
    right: auto;
    top: calc(var(--tl-col-my) + 18px);
    transform: translateX(-50%);
    width: min(600px, calc(var(--tl-col) - 260px));
    border-radius: 999px;
  }

  /* Feiner Doppelrand wie bei Briefpapier – das Blatt als Objekt. */
  .tl-ed > .tl-col::after {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid color-mix(in oklab, var(--eden-accent) 22%, transparent);
    border-radius: calc(var(--tl-col-radius) - 8px);
    box-shadow: inset 0 0 0 4px color-mix(in oklab, var(--eden-ivory) 0%, transparent),
      inset 0 0 0 5px color-mix(in oklab, var(--eden-accent) 10%, transparent);
    pointer-events: none;
    z-index: 30;
  }

  /* ---------- Hero über die volle Breite ---------- */
  .tl-ed .tl-hero {
    padding-inline: var(--tl-ed-pad);
  }

  /* Rahmenbild am Desktop als EIN Bild (keine geteilten, überblendeten
     Hälften mehr – die erzeugten in der Mitte oben/unten Geisterbilder):
     das Originalbild (object-fit: cover, identisch zum V20-Loop darüber).
     Der Hero ist höchstens 62rem hoch, damit das Blatt nie hochkant wird. */
  .tl-ed .tl-hero {
    min-height: min(100svh, 62rem);
  }
  /* Große Namenstypografie, eine Zeile (bricht bei langen Namen um). */
  .tl-ed .tl-hero > [data-hero-fade] {
    max-width: min(60rem, 100%);
  }
  .tl-ed .tl-hero h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: clamp(1.1rem, 1.7vw, 2rem);
    margin-top: 1.75rem;
    line-height: 1.05;
  }
  /* Rahmen 2 (Sträuße hängen von beiden oberen Ecken bis zur Mitte) und
     Rahmen 3 (Ecke oben links / unten rechts): Namen bleiben in der freien
     Mitte – schmalere Bühne, bei Rahmen 2 etwas tiefer. fit-text passt die
     Namen dieser Breite an. */
  .tl-ed .tl-hero:has(> [data-parallax] > img[src*="-2.jpg"], > [data-parallax] > img[src*="-2-v2.jpg"]) > [data-hero-fade] {
    max-width: min(44rem, 50%);
    margin-top: 16vh;
  }
  .tl-ed .tl-hero:has(> [data-parallax] > img[src*="-3.jpg"]) > [data-hero-fade] {
    max-width: min(46rem, 52%);
  }
  /* Lange Namen: gestapelt am „&“ (fit-text setzt data-stacked). */
  .tl-ed .tl-hero h1[data-stacked] {
    flex-direction: column;
    row-gap: 0.1em;
  }
  .tl-ed .tl-hero h1 > span:not([aria-hidden]) {
    font-size: clamp(4.4rem, 6.4vw, 7.4rem);
  }
  .tl-ed .tl-hero h1 > span[aria-hidden] {
    margin: 0;
    font-size: clamp(2rem, 2.6vw, 3rem);
  }
  .tl-ed .tl-hero > [data-hero-fade] > p.uppercase {
    letter-spacing: 0.42em;
    text-indent: 0.42em;
  }
  .tl-ed .tl-hero > [data-hero-fade] > p.tracking-wide {
    font-size: 1.02rem;
    letter-spacing: 0.08em;
  }

  /* ---------- Kapitel: Kapitelkopf links, Inhalt rechts ---------- */
  .tl-ed .tl-ed-ch > section {
    padding-inline: var(--tl-ed-pad);
    padding-block: clamp(5.5rem, 8vw, 8.5rem);
  }
  .tl-ed .tl-ed-ch > section > div.mx-auto:has(> :first-child h2) {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(3rem, 6vw, 6.5rem);
    align-items: start;
    max-width: 68rem;
  }
  .tl-ed .tl-ed-ch > section > div.mx-auto:has(> :first-child h2) > :first-child {
    grid-column: 1;
    grid-row: 1 / span 12;
    position: sticky;
    top: calc(var(--tl-col-my) + 14vh);
  }
  .tl-ed .tl-ed-ch > section > div.mx-auto:has(> :first-child h2) > :not(:first-child) {
    grid-column: 2;
  }
  .tl-ed .tl-ed-ch > section > div.mx-auto:has(> :first-child h2) > :nth-child(2) {
    margin-top: 0.5rem;
  }
  /* Kurze Kapitel (Kopf + ein Textblock): Text mittig zum Kopf, linksbündig
     wie in einem Magazin, etwas größer. */
  .tl-ed .tl-ed-ch:is([data-ch="stay"], [data-ch="dresscode"], [data-ch="gifts"]) > section > div.mx-auto:has(> :first-child h2) {
    align-items: center;
  }
  .tl-ed .tl-ed-ch:is([data-ch="stay"], [data-ch="dresscode"], [data-ch="gifts"]) > section > div.mx-auto:has(> :first-child h2) > :first-child {
    grid-row: auto;
    position: static;
  }
  .tl-ed .tl-ed-ch:is([data-ch="stay"], [data-ch="dresscode"], [data-ch="gifts"]) > section > div.mx-auto:has(> :first-child h2) > :not(:first-child) {
    text-align: left;
    font-size: 1.06rem;
  }
  .tl-ed .tl-ed-ch:is([data-ch="stay"], [data-ch="dresscode"], [data-ch="gifts"]) > section > div.mx-auto:has(> :first-child h2) > :not(:first-child) p {
    font-size: inherit;
    line-height: 1.8;
  }

  .tl-ed .tl-ed-ch:is([data-ch="stay"], [data-ch="dresscode"], [data-ch="gifts"]) > section {
    padding-block: clamp(4.5rem, 6.5vw, 6.5rem);
  }
  /* Das kleine Zweig-Ornament am Kapitelende hängt in zwei Spalten verloren
     in der Mitte – die Haarlinie zwischen den Kapiteln übernimmt. */
  .tl-ed .tl-ed-ch > section > div[aria-hidden]:last-child:has(> .js-reveal) {
    display: none;
  }

  /* Save the Date: Countdown und „Die Einladung folgt“ sind zwei Sektionen
     in einem Kapitel – ohne doppelte Kapitelabstände (sonst große Leere). */
  .tl-ed .tl-ed-ch[data-ch="calendar"] > section {
    padding-block: clamp(3rem, 4vw, 4.5rem);
  }
  .tl-ed .tl-ed-ch[data-ch="calendar"] > section:first-child {
    padding-top: clamp(4.5rem, 6vw, 6rem);
  }

  /* Kapitel ohne Kopf (Countdown, Kalender) und das Ende: ruhig mittig. */
  .tl-ed .tl-ed-ch[data-ch="countdown"] > section {
    padding-block: clamp(4rem, 6vw, 6rem);
  }

  /* Kapitel-Trenner: Haarlinie statt Ornament zwischen den Spalten-Kapiteln */
  .tl-ed .tl-ed-ch + .tl-ed-ch::before {
    content: "";
    display: block;
    width: min(68rem, calc(100% - 2 * var(--tl-ed-pad)));
    height: 1px;
    margin-inline: auto;
    background: linear-gradient(
      90deg,
      transparent,
      color-mix(in oklab, var(--eden-accent) 26%, transparent) 20%,
      color-mix(in oklab, var(--eden-accent) 26%, transparent) 80%,
      transparent
    );
  }
  /* Keine Linie direkt an Hero, Countdown, Karten und Ende. */
  .tl-ed .tl-ed-ch[data-ch="countdown"]::before,
  .tl-ed .tl-ed-ch[data-ch="story"]::before,
  .tl-ed .tl-ed-ch[data-ch="rsvp"]::before,
  .tl-ed .tl-ed-ch[data-ch="schedule"]::before,
  .tl-ed .tl-ed-ch[data-ch="end"]::before,
  .tl-ed .tl-ed-ch[data-ch="rsvp"] + .tl-ed-ch::before,
  .tl-ed .tl-ed-ch[data-ch="schedule"] + .tl-ed-ch::before {
    display: none;
  }

  /* ---------- Programm und Rückmeldung als Karten ---------- */
  .tl-ed .tl-ed-ch[data-ch="schedule"],
  .tl-ed .tl-ed-ch[data-ch="rsvp"] {
    padding: clamp(1.5rem, 3vw, 3rem) var(--tl-ed-pad);
  }
  .tl-ed .tl-ed-ch[data-ch="schedule"] > section,
  .tl-ed .tl-ed-ch[data-ch="rsvp"] > section {
    max-width: 74rem;
    margin-inline: auto;
    padding-block: clamp(4rem, 6vw, 6rem);
    padding-inline: clamp(2.5rem, 5vw, 5rem);
    border-radius: 26px;
    background:
      linear-gradient(
        180deg,
        color-mix(in oklab, var(--eden-paper) 88%, #fff) 0%,
        var(--eden-paper) 100%
      );
    border: 1px solid color-mix(in oklab, var(--eden-accent) 20%, transparent);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.7) inset,
      0 2px 6px rgba(42, 30, 16, 0.04),
      0 30px 70px -36px rgba(42, 30, 16, 0.32);
  }
  .tl-ed.tl-stage--dark .tl-ed-ch[data-ch="schedule"] > section,
  .tl-ed.tl-stage--dark .tl-ed-ch[data-ch="rsvp"] > section {
    background: linear-gradient(
      180deg,
      color-mix(in oklab, var(--eden-ivory) 90%, #fff) 0%,
      color-mix(in oklab, var(--eden-ivory) 95%, #fff) 100%
    );
    border-color: color-mix(in oklab, var(--eden-accent) 30%, transparent);
    box-shadow:
      0 1px 0 rgba(255, 244, 220, 0.06) inset,
      0 30px 70px -30px rgba(0, 0, 0, 0.6);
  }

  /* ---------- Kulisse der Welt links/rechts neben dem Blatt ---------- */
  .tl-ed .tl-stage-bg::before {
    filter: blur(6px) saturate(0.95);
    opacity: 0.8;
  }
  .tl-ed .tl-stage-bg::after {
    background:
      radial-gradient(
        ellipse 50% 80% at 50% 50%,
        color-mix(in oklab, var(--eden-ivory, #f6f2e9) 60%, transparent) 0%,
        transparent 100%
      ),
      radial-gradient(ellipse 110% 110% at 50% 50%, transparent 55%, rgba(20, 14, 6, 0.2) 100%);
  }
  .tl-ed.tl-stage--dark .tl-stage-bg::after {
    background:
      radial-gradient(
        ellipse 50% 80% at 50% 50%,
        color-mix(in oklab, var(--eden-ivory, #1b1b1d) 65%, transparent) 0%,
        transparent 100%
      ),
      radial-gradient(ellipse 110% 110% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  }
}

/* Signature-Welten im Editorial-Blatt: Bühne folgt Tag/Nacht der Szene. */
@media (min-width: 1024px) {
  .tl-stage:has([data-living-scene][data-zeit="nacht"]) > .tl-stage-bg::before {
    background-image: var(--tl-stage-img-night, var(--tl-stage-img));
  }
}

/* Signature-Welten (Weinberg/Alm) im Editorial-Blatt: Namen groß in einer
   Zeile (lange Namen stapelt fit-text am „&“), Text etwas breiter. */
@media (min-width: 1024px) {
  .tl-ed [data-living-scene]:not([data-world-hero]) [data-hero-fade] {
    max-width: min(56rem, 78%);
  }
  .tl-ed [data-living-scene]:not([data-world-hero]) h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: clamp(1rem, 1.6vw, 1.8rem);
    line-height: 1.05;
  }
  .tl-ed [data-living-scene]:not([data-world-hero]) h1[data-stacked] {
    flex-direction: column;
  }
  .tl-ed [data-living-scene]:not([data-world-hero]) h1 > span:not([aria-hidden]):not(.sr-only) {
    /* × 0.82: Datum bleibt über der Villa/den Bergen */
    font-size: calc(clamp(4.2rem, 5.8vw, 6.6rem) * 0.82);
  }
  .tl-ed [data-living-scene]:not([data-world-hero]) h1 > span[aria-hidden] {
    margin: 0;
    font-size: clamp(1.8rem, 2.4vw, 2.6rem);
  }
}

/* Lange Namen (> 12 Zeichen, data-long-names) im Editorial-Blatt: deutlich
   kleiner, damit Namen und Datum über der gemalten Szene bleiben und nie auf
   Haus, Villa oder Bergen stehen (Welten und Signature-Welten). */
@media (min-width: 1024px) {
  .tl-ed .tl-hero[data-long-names] h1 > span:not([aria-hidden]):not(.sr-only),
  .tl-ed [data-living-scene][data-long-names]:not([data-world-hero]) h1 > span:not([aria-hidden]):not(.sr-only) {
    font-size: calc(clamp(4.2rem, 5.8vw, 6.6rem) * 0.56);
  }
}
