/**
 * Template: Single Post (single.php).
 *
 * 1. Single-Post-Hero — Kategorie als H1, Eyebrow + Datum, 16:9-Medium,
 *    Decor-Overlay rechts (oben, beige), Downloads-Box rechts (unten,
 *    weiß). Beige/White-Split via linear-gradient.
 * 2. Body-Content (`the_content()`)
 *
 * Regel: niemals Hex-Werte direkt — immer var(--color-*).
 */

.single-post {
    background-color: var(--color-white);
}

.single-post__article {
    display: block;
}

/* ──────────────────────────────────────────────────────────────
 * 1. Single-Post-Hero
 *
 * Custom Properties (vom Render-Template gesetzt):
 *   --pm-overlay-width       Breite des Decor-Overlays (z. B. 40 %)
 *   --pm-overlay-offset-y    Vertikaler Versatz (negativ = nach oben)
 *   --line-start-y-px        Top-Offset der Polyline-SVG
 *
 * Lokale Variablen für den Beige/White-Split:
 *   --pm-split               % der Hero-Höhe, die beige bleibt (Rest weiß)
 * ────────────────────────────────────────────────────────────── */

.single-post-hero {
    --pm-split: 60%;

    position: relative;
    z-index: 2;
    overflow: hidden;
    /* Top-Padding analog zur Archive-Hero (block--pad-normal),
     * damit Kategorie auf gleicher Höhe wie der Archive-Titel sitzt. */
    padding-block: var(--space-16) 0;
    background: linear-gradient(
        to bottom,
        var(--color-beige) 0,
        var(--color-beige) var(--pm-split),
        var(--color-white) var(--pm-split),
        var(--color-white) 100%
    );
}

/* Polyline soll vor Bild + Overlay liegen */
.single-post-hero > .block__line-svg {
    z-index: calc(var(--z-raised) + 1);
}

/* ── Decor-Overlay (rechts, beige Hälfte) ──────────── */

.single-post-hero__overlay {
    position: absolute;
    top: var(--pm-overlay-offset-y, 0);
    right: 0;
    width: var(--pm-overlay-width, 40%);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.single-post-hero__overlay-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── Inner Grid (60 / 40) ──────────────────────────── */

.single-post-hero__inner {
    position: relative;
    z-index: var(--z-raised);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    align-items: stretch;
}

@media (min-width: 769px) {
    .single-post-hero__inner {
        grid-template-columns: minmax(0, 920px) minmax(280px, 1fr);
        gap: var(--space-12);
    }

    /* Ohne Downloads-Aside nimmt die Hauptspalte alles ein. */
    .single-post-hero__inner--no-aside {
        grid-template-columns: minmax(0, 920px);
    }
}

/* ── Main (links): Title + Meta + Medium ──────────── */

.single-post-hero__main {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.single-post-hero__category {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(var(--text-4xl), 4.5vw, 3.25rem);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.single-post-hero__meta {
    margin: var(--space-6) 0 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
}

.single-post-hero__media {
    margin: var(--space-2) 0 0;
    width: 100%;
    max-width: 920px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: var(--color-dunkelbeige);
}

.single-post-hero__image,
.single-post-hero__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Aside (rechts): Downloads ────────────────────── */

.single-post-hero__aside {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: var(--space-12);
}

.single-post-hero__downloads {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.single-post-hero__downloads-title {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-bold);
    color: var(--color-text);
}

.single-post-hero__downloads-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.single-post-hero__downloads-item {
    margin: 0;
    padding: 0;
}

.single-post-hero__downloads-link {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    text-decoration: none;
    line-height: var(--lh-snug);
}

.single-post-hero__downloads-link:hover,
.single-post-hero__downloads-link:focus-visible {
    color: var(--color-navy);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.single-post-hero__downloads-icon {
    flex-shrink: 0;
    width: 8px;
    height: 12px;
    margin-top: 0.4em;
    color: var(--color-navy);
    transition: transform var(--duration-fast) var(--ease-default);
}

.single-post-hero__downloads-link:hover .single-post-hero__downloads-icon,
.single-post-hero__downloads-link:focus-visible .single-post-hero__downloads-icon {
    transform: translateX(3px);
}

/* ── Mobile-Anpassungen ───────────────────────────── */

@media (max-width: 768px) {
    .single-post-hero {
        --pm-split: 55%;
    }

    .single-post-hero__overlay {
        width: 60%;
    }

    /* Hero-Bild bis an die Viewport-Ränder ziehen. */
    .single-post-hero__media {
        margin-inline: calc(var(--container-padding) * -1);
        max-width: none;
        width: auto;
    }

    .single-post-hero__aside {
        padding-bottom: var(--space-8);
    }
}

/* ──────────────────────────────────────────────────────────────
 * 2. Body (H1 + Subline + Content links, Sticky-Aside rechts)
 * ────────────────────────────────────────────────────────────── */

.single-post__body {
    padding-block: var(--space-12);
}

.single-post__body-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    align-items: start;
}

/* Identische Spaltenbreiten wie im Hero (minmax(0, 920px) | 1fr),
 * damit das rechte Aside genau auf der Höhe der Downloads sitzt. */
@media (min-width: 769px) {
    .single-post__body-grid {
        grid-template-columns: minmax(0, 920px) minmax(280px, 1fr);
        gap: var(--space-12);
    }
}

@media (max-width: 768px) {
    .single-post__body {
        padding-block: var(--space-8);
    }

    /* Auf Single-Post-Seiten liegt der Content in einem äußeren
     * .container (single-post__body-grid). Innen liegende Blöcke
     * (Media, News, Galerie etc.) bringen ihren eigenen .container
     * mit – das ergibt doppeltes Padding. Wir brechen die innere
     * Block-Spur aus dem äußeren Container aus, damit Blöcke wie
     * auf normalen Pages bündig zum Viewport sitzen. Titel und
     * Subline bleiben als Geschwister im äußeren Container. */
    .single-post__content {
        margin-inline: calc(var(--container-padding) * -1);
    }
}

/* ── Main (links) ───────────────────────────── */

.single-post__title {
    margin: 0 0 var(--space-4);
    font-family: var(--font-display);
    font-size: clamp(var(--text-3xl), 3.5vw, var(--text-4xl));
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.single-post__subline {
    margin: 0 0 var(--space-8);
    font-family: var(--font-body);
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-snug);
    color: var(--color-text);
}

.single-post__content > p {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--lh-relaxed);
    color: var(--color-text);
    margin: 0 0 var(--space-4);
}

.single-post__content > h2,
.single-post__content > h3 {
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
}

.single-post__content > h2 { font-size: var(--text-2xl); }
.single-post__content > h3 { font-size: var(--text-xl); }

/* Block-WYSIWYG-Headings auf Beitragsseiten: eine Stufe kleiner als
 * global. Greift in allen ACF-Block-Body-Wrappern (.text__body,
 * .media-text__body). H6 bleibt global text-lg. */
.single-post .text__body h2,
.single-post .media-text__body h2 { font-size: var(--text-3xl); }

.single-post .text__body h3,
.single-post .media-text__body h3 { font-size: var(--text-2xl); }

.single-post .text__body h4,
.single-post .media-text__body h4 { font-size: var(--text-xl); }

.single-post .text__body h5,
.single-post .media-text__body h5 { font-size: var(--text-lg); }

/* Heading-Spacing in Block-WYSIWYGs auf Beitragsseiten.
 * H2: Top 48px, Bottom 24px (etwas mehr Luft als der globale H-Default).
 * H3: Top 24px, Bottom 16px (globaler Default). */
.single-post .text__body h2,
.single-post .media-text__body h2 {
    margin-top: var(--space-12);
    margin-bottom: var(--space-6);
}

.single-post .text__body h3,
.single-post .media-text__body h3 { margin-top: var(--space-6); }

/* Erstes Element im WYSIWYG bekommt keinen zusätzlichen Top-Abstand. */
.single-post .text__body > :first-child,
.single-post .media-text__body > :first-child { margin-top: 0; }

.single-post__content > blockquote {
    border-left: 4px solid var(--color-electric-blue);
    padding-left: var(--space-6);
    margin: var(--space-6) 0;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--fw-medium);
    line-height: var(--lh-snug);
    color: var(--color-text);
}

/* ──────────────────────────────────────────────────────────────
 * 3. Sticky-Aside: „Weitere Pressemitteilungen"
 * ────────────────────────────────────────────────────────────── */

.single-post__related-aside {
    min-width: 0;
}

@media (min-width: 769px) {
    .single-post__related-aside {
        position: sticky;
        top: calc(var(--header-h) + var(--space-6));
    }
}

.single-post-related {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.single-post-related__title {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-bold);
    color: var(--color-text);
}

.single-post-related__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.single-post-related__item {
    margin: 0;
    padding: 0;
}

.single-post-related__link {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
    text-decoration: none;
    color: var(--color-text);
}

.single-post-related__link:hover .single-post-related__post-title,
.single-post-related__link:focus-visible .single-post-related__post-title {
    color: var(--color-navy);
}

.single-post-related__media {
    display: block;
    width: 80px;
    height: 80px;
    overflow: hidden;
    background-color: var(--color-dunkelbeige);
}

.single-post-related__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.single-post-related__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

.single-post-related__meta {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
}

.single-post-related__post-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-snug);
    color: var(--color-text);
    transition: color var(--duration-fast) var(--ease-default);
}
