/* Inhaltsverzeichnis
/* ----------------------------------------------------------

Aufbau nach den offiziellen Ghost-Themes (Source, Casper, Solo).
Natives CSS ohne Build-Schritt. Alle Farben leiten sich aus zwei Werten ab:

    --background-color   Settings → Design → Site wide → Background color
    --ghost-accent-color Settings → Design → Brand → Accent color

Ob Text hell oder dunkel ist, entscheidet ein kleines Skript in default.hbs
(Klasse has-light-text bzw. has-dark-text auf <html>).

1. Variablen
2. Schrift
3. Reset
4. Grundlagen
5. Layout
6. Navigation
    6.1. „Mehr“-Menü
    6.2. Mobiles Menü
    6.3. Layout „Logo mittig“
7. Buttons und Formulare
8. Startseite: Kopfbereich
9. Abschnitte
10. Beitragskarten und Liste
11. Beiträge und Seiten
12. Inhalte aus dem Editor
    12.1. Formulare im Inhalt
13. Karten (Koenig)
14. Newsletter-Bereich
15. Fußbereich
16. Fehlerseiten
17. Schrift-Einstellungen von Ghost
18. Hilfsklassen

*/

/* 1. Variablen
/* ---------------------------------------------------------- */

:root {
    --background-color: #0f172a;
    --ghost-accent-color: #c50042;

    /* Dunkler Text auf hellem Hintergrund (Standard) */
    --color-primary-text: #15171a;
    --color-mix-base: #000;
    --color-on-accent: #fff;
    --color-accent-text: color-mix(in oklab, var(--ghost-accent-color), #000 8%);

    /* Abgeleitete Töne – passen sich jeder Hintergrundfarbe an */
    --color-secondary-text: color-mix(in srgb, var(--color-primary-text) 66%, var(--background-color));
    --color-border: color-mix(in srgb, var(--color-mix-base) 12%, var(--background-color));
    --color-surface: color-mix(in srgb, var(--color-mix-base) 4%, var(--background-color));
    --color-surface-strong: color-mix(in srgb, var(--color-mix-base) 8%, var(--background-color));
    --color-header: color-mix(in srgb, var(--background-color) 82%, transparent);
    --color-focus: var(--color-primary-text);

    /* Eingabefelder: leicht durchscheinend, damit sie auf jeder Fläche abgesetzt sind
       (Seitenhintergrund und hinterlegter Newsletter-Bereich) */
    --color-field: color-mix(in srgb, var(--color-mix-base) 4%, transparent);
    --color-field-border: color-mix(in srgb, var(--color-mix-base) 16%, transparent);
    --color-field-ring: color-mix(in srgb, var(--ghost-accent-color) 40%, transparent);

    --font-sans: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --container-width: 1200px;
    --container-gap: clamp(20px, 1.2rem + 2vw, 48px);
    --content-width: 720px;
    --section-spacing: clamp(48px, 2.5rem + 3vw, 88px);
    --header-spacing: clamp(48px, 2.5rem + 2.5vw, 80px);
    --radius: 12px;
    --radius-small: 8px;
}

:root { color-scheme: light; }

:root.has-light-text {
    /* Heller Text auf dunklem Hintergrund */
    color-scheme: dark;
    --color-primary-text: #fff;
    --color-mix-base: #fff;
    --color-secondary-text: color-mix(in srgb, #fff 68%, var(--background-color));
    --color-border: color-mix(in srgb, #fff 13%, var(--background-color));
    --color-surface: color-mix(in srgb, #fff 5%, var(--background-color));
    --color-surface-strong: color-mix(in srgb, #fff 9%, var(--background-color));
    --color-accent-text: color-mix(in oklab, var(--ghost-accent-color), #fff 45%);
    --color-field: color-mix(in srgb, #fff 6%, transparent);
    --color-field-border: color-mix(in srgb, #fff 16%, transparent);
}

@supports (color: contrast-color(red)) {
    :root { --color-on-accent: contrast-color(var(--ghost-accent-color)); }
}

/* 2. Schrift
/* ---------------------------------------------------------- */

/* Manrope (SIL Open Font License), lokal ausgeliefert – keine Verbindung zu Google Fonts */
@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-variable.woff2") format("woff2");
}

/* 3. Reset
/* ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
/* Außenabstände zurücksetzen – außer bei Dialogen, die margin: auto zum Zentrieren brauchen */
:where(*:not(dialog)) { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    interpolate-size: allow-keywords;
}

img, picture, video, canvas, svg, iframe { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
h1, h2, h3, h4, h5, h6 { line-height: 1.15; }

/* 4. Grundlagen
/* ---------------------------------------------------------- */

html { scroll-padding-top: 24px; }

body {
    font-family: var(--gh-font-body, var(--font-sans));
    font-size: 1.0625rem;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--color-primary-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--gh-font-heading, var(--font-sans));
    font-weight: 800;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p, li { text-wrap: pretty; }

a {
    color: inherit;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: 2px;
}

::selection {
    background-color: var(--ghost-accent-color);
    color: var(--color-on-accent);
}

@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 5. Layout
/* ---------------------------------------------------------- */

.gh-site {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.gh-main { flex-grow: 1; }

.gh-outer { padding-inline: var(--container-gap); }

.gh-inner {
    width: 100%;
    max-width: var(--container-width);
    margin-inline: auto;
}

/* Raster für Editor-Inhalte: normale, breite und volle Breite */
.gh-canvas {
    --main: min(var(--content-width), 100% - var(--container-gap) * 2);
    --wide: minmax(0, calc((var(--container-width) - var(--content-width)) / 2));
    --full: minmax(var(--container-gap), 1fr);

    display: grid;
    grid-template-columns:
        [full-start] var(--full)
        [wide-start] var(--wide)
        [main-start] var(--main) [main-end]
        var(--wide) [wide-end]
        var(--full) [full-end];
}

.gh-canvas > * { grid-column: main; }
.gh-canvas > .kg-width-wide { grid-column: wide; }
.gh-canvas > .kg-width-full { grid-column: full; }

/* 6. Navigation
/* ---------------------------------------------------------- */

.gh-navigation {
    border-bottom: 1px solid var(--color-border);
}

.gh-navigation-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    min-height: 88px;
}

.gh-navigation-brand {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.gh-navigation-logo {
    display: inline-flex;
    align-items: center;
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
    white-space: nowrap;

    img { max-height: 48px; width: auto; }
}

.gh-navigation-brand-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gh-icon-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;

    svg { width: 22px; height: 22px; }
    &:hover { background-color: var(--color-surface-strong); }
}

.gh-navigation-close { display: none; }

.gh-navigation .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 28px;
    padding: 0;
    list-style: none;
}

.gh-navigation .nav a,
.gh-navigation-link,
.gh-more-toggle {
    display: block;
    padding-block: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary-text);
    text-decoration: none;
    white-space: nowrap;

    &:hover { color: var(--color-accent-text); }
}

.gh-navigation .nav-current > a {
    text-decoration: underline;
    text-decoration-color: var(--ghost-accent-color);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.45em;
}

.gh-navigation-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 20px;
}

.gh-navigation-members {
    display: flex;
    align-items: center;
    gap: 20px;
    white-space: nowrap;
}

.gh-social-links {
    display: flex;
    align-items: center;
    gap: 4px;

    &:not(:has(a)) { display: none; }

    a {
        display: inline-grid;
        place-items: center;
        min-width: 40px;
        height: 40px;
        border-radius: 50%;
        color: var(--color-secondary-text);
        transition: color 0.15s, background-color 0.15s;

        &:hover { color: var(--color-primary-text); background-color: var(--color-surface-strong); }
    }

    svg { width: 20px; height: 20px; }
    span { padding-inline: 8px; font-size: 0.9rem; font-weight: 700; }
}

/* Desktop: Menü einzeilig in der Kopfzeile */
@media (min-width: 992px) {
    .gh-navigation-brand { flex: 0 0 auto; }
    .gh-burger { display: none; }
    .gh-navigation-brand-actions .gh-search { display: none; }
    .gh-navigation-actions .gh-social-links { display: none; }

    .gh-navigation-menu,
    .gh-navigation-menu:popover-open {
        /* Popover-Standardstile des Browsers aufheben */
        position: static;
        inset: auto;
        display: flex;
        flex: 1;
        align-items: center;
        gap: 32px;
        min-width: 0;
        width: auto;
        height: auto;
        margin: 0;
        padding: 0;
        overflow: visible;
        background: none;
        border: 0;
        color: inherit;
    }

    .gh-navigation-links {
        flex: 1;
        min-width: 0;
    }

    /* partials/components/navigation-more.hbs verschiebt Einträge, die nicht passen,
       ins „Mehr“-Menü und setzt dann .is-nav-ready */
    .gh-navigation.is-nav-ready .nav { flex-wrap: nowrap; }
}

/* Bis dahin die Einträge unsichtbar lassen (Platz bleibt reserviert, wie in Source).
   Nur wenn JavaScript läuft – sonst bleibt die Navigation ganz normal sichtbar. */
@media (min-width: 992px) and (scripting: enabled) {
    .gh-navigation .nav { flex-wrap: nowrap; }
    .gh-navigation:not(.is-nav-ready) .nav > li { opacity: 0; }
}

/* 6.1. „Mehr“-Menü
/* ---------------------------------------------------------- */

.gh-more { position: relative; }

.gh-more-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    cursor: pointer;

    &::after {
        content: "";
        width: 7px;
        height: 7px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        rotate: 45deg;
        translate: 0 -2px;
        transition: rotate 0.2s, translate 0.2s;
    }

    &[aria-expanded="true"]::after { rotate: 225deg; translate: 0 2px; }
}

.gh-more.nav-current > .gh-more-toggle {
    text-decoration: underline;
    text-decoration-color: var(--ghost-accent-color);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.45em;
}

.gh-more-list {
    position: absolute;
    top: calc(100% + 12px);
    left: -16px;
    z-index: 90;
    min-width: 220px;
    padding: 8px;
    list-style: none;
    background-color: var(--color-surface-strong);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.35);

    &[hidden] { display: none; }

    a {
        padding: 8px 12px !important;
        border-radius: var(--radius-small);

        &:hover { background-color: var(--color-surface); }
    }

    .nav-current > a { text-underline-offset: 0.3em; }
}

.gh-more-list.is-right {
    right: -16px;
    left: auto;
}

/* 6.2. Mobiles Menü
/* ---------------------------------------------------------- */

@media (max-width: 991px) {
    .gh-navigation-menu {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 88px var(--container-gap) 40px;
        overflow-y: auto;
        background-color: var(--background-color);
        border: 0;
        color: var(--color-primary-text);

        &:popover-open {
            display: flex;
            flex-direction: column;
            gap: 40px;
        }

        &::backdrop { background-color: rgb(0 0 0 / 0.5); }
    }

    .gh-navigation-close {
        display: inline-grid;
        position: absolute;
        top: 22px;
        right: var(--container-gap);
    }

    .gh-navigation .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .gh-navigation .nav a {
        padding-block: 4px;
        font-family: var(--gh-font-heading, var(--font-sans));
        font-size: clamp(1.625rem, 1.4rem + 1.5vw, 2rem);
        font-weight: 800;
        letter-spacing: -0.02em;
        white-space: normal;
    }

    .gh-navigation-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        margin-top: auto;
    }

    .gh-navigation-actions > .gh-search { display: none; }

    .gh-navigation-members {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 12px;
        width: 100%;

        .gh-button { width: 100%; }
        .gh-navigation-link { text-align: center; }
    }
}

@media (max-width: 991px) and (prefers-reduced-motion: no-preference) {
    .gh-navigation-menu {
        opacity: 0;
        translate: 0 -12px;
        transition: opacity 0.2s, translate 0.2s, display 0.2s allow-discrete, overlay 0.2s allow-discrete;

        &:popover-open { opacity: 1; translate: 0 0; }
    }

    @starting-style {
        .gh-navigation-menu:popover-open { opacity: 0; translate: 0 -12px; }
    }
}

/* 6.3. Layout „Logo mittig“
/* ---------------------------------------------------------- */

@media (min-width: 992px) {
    .is-head-middle-logo .gh-navigation-inner {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
    }

    .is-head-middle-logo .gh-navigation-brand { grid-column: 2; grid-row: 1; }
    .is-head-middle-logo .gh-navigation-menu { display: contents; }

    .is-head-middle-logo .gh-navigation-links {
        grid-column: 1;
        grid-row: 1;
    }

    .is-head-middle-logo .gh-navigation-actions {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }
}

/* 7. Buttons und Formulare
/* ---------------------------------------------------------- */

.gh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 22px;
    border: 0;
    border-radius: 999px;
    background-color: var(--ghost-accent-color);
    color: var(--color-on-accent);
    font-size: 0.975rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.15s, background-color 0.15s, color 0.15s, box-shadow 0.15s;

    &:hover { filter: brightness(1.1); }
}

.gh-button-outline {
    background-color: transparent;
    color: var(--color-primary-text);
    box-shadow: inset 0 0 0 1.5px var(--color-border);

    &:hover {
        filter: none;
        box-shadow: inset 0 0 0 1.5px var(--color-primary-text);
    }
}

/* Newsletter-Formular: Eingabefeld und Button in einer Pille.
   Gleiche Feldfarben wie die Formulare im Inhalt (12.1), damit alles zusammenpasst. */
.gh-form {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: 520px;
    padding: 5px;
    background-color: var(--color-field);
    border: 1px solid var(--color-field-border);
    border-radius: 999px;
    transition: border-color 0.15s, box-shadow 0.15s;

    &:hover { border-color: var(--color-secondary-text); }

    &:focus-within {
        border-color: var(--color-primary-text);
        box-shadow: 0 0 0 3px var(--color-field-ring);
    }
}

/* Formular-Container: Ab hier entscheidet die verfügbare Breite, nicht der Bildschirm */
.gh-hero-form,
.gh-signup-form { container-type: inline-size; }

.gh-form-input {
    flex: 1 1 8rem;
    min-width: 0;
    min-height: 44px;
    padding: 8px 18px;
    background: none;
    border: 0;
    color: var(--color-primary-text);
    font-size: 1rem;

    &::placeholder { color: var(--color-secondary-text); }
    &:focus-visible { outline: none; }
}

.gh-form .gh-button { flex: 0 0 auto; }

.gh-form-loading,
.gh-form-sent,
.gh-form-success,
.gh-form-error:empty { display: none; }

.gh-form-loading svg { width: 24px; height: 24px; }

.gh-form.loading {
    .gh-form-idle { display: none; }
    .gh-form-loading { display: inline-flex; }
    .gh-button { cursor: progress; }
}

.gh-form.success {
    border-radius: var(--radius);
    .gh-form-input, .gh-button { display: none; }
    .gh-form-success { display: block; padding: 10px 18px; font-weight: 700; }
}

.gh-form-error {
    flex-basis: 100%;
    padding: 4px 18px 8px;
    font-size: 0.925rem;
    color: var(--color-accent-text);
}

.gh-form.error { border-radius: 24px; }

/* Sehr schmal: Feld und Button untereinander statt umgebrochener Pille */
@container (max-width: 280px) {
    .gh-form {
        flex-direction: column;
        align-items: stretch;
        border-radius: var(--radius);
    }

    .gh-form .gh-button { width: 100%; }
    .gh-form-input { flex-basis: auto; }
}

.gh-form-privacy {
    /* Bündig mit dem Text im Eingabefeld: 6px Rahmen/Abstand der Pille + 18px Feldabstand */
    max-width: 520px;
    margin-top: 10px;
    padding-inline: 24px;
    font-size: 0.875rem;
    color: var(--color-secondary-text);
    text-wrap: pretty;

    a { color: var(--color-primary-text); }
}

/* 8. Startseite: Kopfbereich
/* ---------------------------------------------------------- */

.gh-hero {
    position: relative;
    isolation: isolate;
    padding-block: var(--header-spacing);
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;

    /* Dezenter Schimmer aus Akzent- und Textfarbe – kein Bild nötig */
    background-image:
        radial-gradient(50% 80% at 95% 0%, color-mix(in srgb, var(--color-mix-base) 6%, transparent), transparent 70%),
        radial-gradient(35% 70% at 0% 100%, color-mix(in srgb, var(--ghost-accent-color) 10%, transparent), transparent 70%);
}

/* Größen wie Solo (aktuelle Seite): Titel 32–58 px, Untertitel 20–24 px */
.gh-hero-title {
    max-width: 1200px;
    font-size: clamp(2rem, 1.53rem + 2.1vw, 3.625rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

/* Optional: Logo links neben dem Titel (Design → Homepage → hero_logo).
   Größe in em, damit es mit der Titelgröße mitwächst. */
.gh-hero-title:has(.gh-hero-logo) {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.gh-hero-logo {
    flex: 0 0 auto;
    width: 1.35em;
    height: 1.35em;
    object-fit: contain;
}

/* Auf schmalen Bildschirmen steht das Logo schon direkt darüber in der Kopfzeile –
   zweimal untereinander wirkt doppelt, und der Titel bräche um. */
@media (max-width: 599px) {
    .gh-hero-logo { display: none; }
}

.gh-hero-subtitle {
    max-width: 640px;
    margin-top: 20px;
    color: var(--color-secondary-text);
    font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.375rem);
    font-weight: 450;
    line-height: 1.5;
}

.gh-hero-form { margin-top: 32px; }

/* Nächste Veranstaltung */
.gh-next-event {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "label label"
        "date  title"
        "date  time";
    column-gap: 20px;
    width: fit-content;
    max-width: 100%;
    margin-top: 32px;
    padding: 14px 22px 16px 18px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;

    &[hidden] { display: none; }

    &:hover {
        background-color: var(--color-surface-strong);
        border-color: var(--color-secondary-text);

        .gh-next-event-title { text-decoration: underline; }
    }
}

.gh-next-event-label {
    grid-area: label;
    justify-self: start;
    margin-bottom: 10px;
    padding: 2px 10px;
    background-color: var(--ghost-accent-color);
    color: var(--color-on-accent);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.gh-next-event-date {
    grid-area: date;
    align-self: center;
    font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.gh-next-event-title {
    grid-area: title;
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-underline-offset: 0.15em;
}

.gh-next-event-time {
    grid-area: time;
    color: var(--color-secondary-text);
}

/* 9. Abschnitte
/* ---------------------------------------------------------- */

.gh-events,
.gh-news,
.gh-container,
.gh-home-content { padding-block: var(--section-spacing); }

/* Aufeinanderfolgende Abschnitte nicht doppelt einrücken */
:is(.gh-events, .gh-home-content, .gh-news) + :is(.gh-events, .gh-home-content, .gh-news) { padding-top: 0; }

.gh-section-title {
    margin-bottom: clamp(20px, 1rem + 1vw, 32px);
    font-size: clamp(1.625rem, 1.35rem + 1.2vw, 2.375rem);
    letter-spacing: -0.025em;
}

.gh-section-more { margin-top: clamp(32px, 1.5rem + 1.5vw, 48px); }

.gh-empty {
    max-width: 44ch;
    color: var(--color-secondary-text);
}

/* 10. Beitragskarten und Liste
/* ---------------------------------------------------------- */

.gh-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: clamp(32px, 1.5rem + 2vw, 56px) clamp(24px, 1rem + 2vw, 40px);
}

.gh-card-link {
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-decoration: none;

    &:hover .gh-card-title { text-decoration: underline; text-decoration-thickness: 2px; }
    &:hover .gh-card-image img { scale: 1.03; }
}

.gh-card-image {
    overflow: hidden;
    border-radius: var(--radius);
    background-color: var(--color-surface);

    img {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        transition: scale 0.4s ease;
    }
}

.gh-card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gh-card-tag {
    color: var(--color-accent-text);
    font-size: 0.85rem;
    font-weight: 700;
}

.gh-card-title {
    font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
    letter-spacing: -0.02em;
    text-underline-offset: 0.18em;
}

.gh-card-excerpt { color: var(--color-secondary-text); }

.gh-card-meta {
    color: var(--color-secondary-text);
    font-size: 0.875rem;
}

.gh-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: clamp(48px, 2rem + 3vw, 80px);
}

.gh-pagination-info { color: var(--color-secondary-text); }

/* 11. Beiträge und Seiten
/* ---------------------------------------------------------- */

.gh-page-header {
    padding-top: var(--header-spacing);
}

.gh-page-title,
.gh-article-title {
    font-size: clamp(2rem, 1.6rem + 1.8vw, 3.25rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.gh-page-description,
.gh-article-excerpt {
    max-width: 52ch;
    margin-top: 16px;
    color: var(--color-secondary-text);
    font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
    line-height: 1.5;
}

.gh-page-header + .gh-container { padding-top: clamp(40px, 2rem + 2vw, 64px); }

.gh-article { padding-top: var(--header-spacing); }

.gh-article-header { margin-bottom: clamp(32px, 1.5rem + 1.5vw, 48px); }

.gh-article-tag {
    margin-bottom: 16px;
    color: var(--color-accent-text);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;

    &:hover { text-decoration: underline; }
}

.gh-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-top: 24px;
    color: var(--color-secondary-text);
    font-size: 0.925rem;
}

.gh-article-image {
    grid-column: wide;
    margin-top: clamp(32px, 1.5rem + 2vw, 56px);

    img {
        width: 100%;
        border-radius: var(--radius);
    }
}

.gh-article > .gh-content:last-child,
.gh-comments { padding-bottom: var(--section-spacing); }

.gh-related { border-top: 1px solid var(--color-border); }

/* Seite „Monatsplan“: Liste in Lesebreite, direkt unter dem Seitentext
   (steht bewusst nach .gh-article > .gh-content:last-child, gleiche Spezifität) */
.gh-article-plan > .gh-content:last-child { padding-bottom: 0; }
.gh-events.gh-events-narrow { padding-top: clamp(24px, 1rem + 1.5vw, 40px); }
.gh-article-plan:not(:has(> .gh-content)) + .gh-events-narrow { padding-top: 0; }

/* 12. Inhalte aus dem Editor
/* ---------------------------------------------------------- */

.gh-content {
    font-size: 1.125rem;
    line-height: 1.65;
    word-break: break-word;
}

/* Grundabstand zwischen allen Elementen */
.gh-content > * + * { margin-top: 1.5em; }

/* Überschriften bekommen mehr Luft nach oben, wenig nach unten */
.gh-content > :is(h2, h3, h4) { margin-top: 2em; }
.gh-content > :is(h2, h3, h4) + * { margin-top: 0.75em; }
.gh-content > :first-child { margin-top: 0; }

.gh-content > h2 { font-size: 1.8em; letter-spacing: -0.03em; }
.gh-content > h3 { font-size: 1.4em; }
.gh-content > h4 { font-size: 1.15em; }

.gh-content a:not([class]) {
    color: var(--color-accent-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;

    &:hover { text-decoration-thickness: 2px; }
}

/* Nur direkte Listen des Editors – eingebettete Listen (z. B. der Monatsplan) bleiben unberührt */
.gh-content > :is(ul, ol) { padding-left: 1.3em; }
.gh-content > :is(ul, ol) li + li { margin-top: 0.5em; }
.gh-content > :is(ul, ol) li::marker { color: var(--color-secondary-text); }

.gh-content > blockquote:not([class]) {
    padding-left: 1.25em;
    border-left: 4px solid var(--ghost-accent-color);
    font-size: 1.15em;
    font-weight: 600;
}

/* .gh-canvas ist ein Grid: Außenabstände addieren sich dort, statt zu kollabieren.
   Deshalb bekommt die Linie nur oben Abstand und das Folgeelement den gleichen. */
.gh-content > hr {
    height: 1px;
    margin-block: 2.5em 0;
    background-color: var(--color-border);
    border: 0;
}

.gh-content > hr + * { margin-top: 2.5em; }

/* 12.1. Formulare im Inhalt (HTML-Karten, z. B. Kontakt, Jobs, Vermietungen)
   Gilt nur für Formulare ohne Klasse – Newsletter-Formulare (.gh-form) und Ghosts
   eigene Karten (z. B. .kg-signup-card-form) bringen ihr Aussehen selbst mit. */

.gh-content form:not([class]) {
    display: grid;
    gap: 20px;
    max-width: none;
    margin-inline: 0;
    padding: 0;
}

/* Umbrüche zwischen den Feldern übernimmt der Abstand des Grids */
.gh-content form:not([class]) br { display: none; }

.gh-content form:not([class]) label {
    display: grid;
    gap: 8px;
    margin: 0;
    color: var(--color-primary-text);
    font-size: 0.95rem;
    font-weight: 700;
}

.gh-content form:not([class]) :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"]), textarea, select) {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    background-color: var(--color-field);
    border: 1px solid var(--color-field-border);
    border-radius: var(--radius-small);
    color: var(--color-primary-text);
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    transition: border-color 0.15s, box-shadow 0.15s;

    &::placeholder { color: var(--color-secondary-text); }
    &:hover { border-color: var(--color-secondary-text); }

    &:focus-visible {
        outline: none;
        border-color: var(--color-primary-text);
        box-shadow: 0 0 0 3px var(--color-field-ring);
    }

    &:user-invalid { border-color: var(--color-accent-text); }

    /* Hier verschachtelt, weil :is() oben die höhere Spezifität von input:not(…) übernimmt */
    &:is(textarea) {
        min-height: 160px;
        resize: vertical;
    }
}

.gh-content form:not([class]) :is(button[type="submit"], input[type="submit"]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 24px;
    background-color: var(--ghost-accent-color);
    border: 0;
    border-radius: 999px;
    color: var(--color-on-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s;

    &:hover { filter: brightness(1.1); }
    &:disabled { cursor: progress; opacity: 0.7; }
}

.gh-content form:not([class]) .submit-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin: 0;
}

.gh-content form:not([class]) #result:empty { display: none; }
.gh-content form:not([class]) #result { font-weight: 700; }

.gh-content :not(pre) > code {
    padding: 0.15em 0.4em;
    background-color: var(--color-surface-strong);
    border-radius: 4px;
    font-size: 0.875em;
}

.gh-content > pre {
    overflow-x: auto;
    padding: 20px 24px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    font-size: 0.875em;
}

.gh-table { overflow-x: auto; }

.gh-content table:not(.gist table) {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925em;

    :is(th, td) {
        padding: 10px 12px;
        border-bottom: 1px solid var(--color-border);
        text-align: left;
        vertical-align: top;
    }

    th { font-weight: 700; }
}

.gh-content figcaption,
.gh-article-image figcaption {
    margin-top: 12px;
    color: var(--color-secondary-text);
    font-size: 0.875rem;
    text-align: center;
}

/* 13. Karten (Koenig)
/* ---------------------------------------------------------- */

/* Extra Luft um Karten, außer direkt nach einer Überschrift */
.gh-content > :not(.kg-card):not(:is(h2, h3, h4)) + .kg-card,
.gh-content > .kg-card + :not(.kg-card) { margin-top: 2.25em; }

/* Volle Breite direkt hintereinander ohne Abstand */
.gh-content > .kg-width-full + .kg-width-full { margin-top: 0; }

.gh-content .kg-image-card img,
.gh-content .kg-gallery-image img,
.gh-content .kg-video-card video,
.gh-content .kg-embed-card iframe { border-radius: var(--radius-small); }

.gh-content .kg-width-full img,
.gh-content .kg-width-full video { border-radius: 0; }

.gh-content .kg-button-card .kg-btn,
.gh-content .kg-cta-button,
.gh-content .kg-header-card-button,
.gh-content .kg-product-card-button,
.gh-content .kg-signup-card-button {
    border-radius: 999px;
    font-weight: 700;
}

.gh-content :is(.kg-callout-card-grey, .kg-callout-card-white),
.gh-content .kg-toggle-card,
.gh-content .kg-product-card-container,
.gh-content .kg-file-card-container,
.gh-content .kg-bookmark-container {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-primary-text);
}

.gh-content .kg-bookmark-container { text-decoration: none; }

.gh-content :is(.kg-header-card h2, .kg-header-card-heading) {
    font-family: var(--gh-font-heading, var(--font-sans));
    letter-spacing: -0.03em;
}

/* 14. Newsletter-Bereich
/* ---------------------------------------------------------- */

.gh-signup {
    padding-block: clamp(56px, 3rem + 4vw, 96px);
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.gh-signup-inner {
    display: grid;
    gap: 28px clamp(32px, 2rem + 3vw, 80px);
    align-items: center;

    @media (min-width: 880px) { grid-template-columns: 1fr 1fr; }
}

.gh-signup-title {
    font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
    letter-spacing: -0.03em;
}

.gh-signup-subtitle {
    max-width: 44ch;
    margin-top: 12px;
    color: var(--color-secondary-text);
}

/* 15. Fußbereich
/* ---------------------------------------------------------- */

.gh-footer {
    padding-block: clamp(48px, 2.5rem + 3vw, 80px) 32px;
    border-top: 1px solid var(--color-border);
    color: var(--color-secondary-text);
    font-size: 0.95rem;
}

.gh-footer-inner {
    display: grid;
    gap: 32px;

    @media (min-width: 768px) {
        grid-template-columns: 1fr auto;
        align-items: start;
    }
}

.gh-footer-logo {
    color: var(--color-primary-text);
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.gh-footer-description {
    max-width: 40ch;
    margin-top: 8px;
}

.gh-footer-brand .gh-social-links { margin-top: 16px; margin-left: -10px; }

.gh-footer-menu .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 0;
    list-style: none;

    a {
        color: var(--color-primary-text);
        font-weight: 600;
        text-decoration: none;

        &:hover { text-decoration: underline; }
    }
}

.gh-footer-copyright {
    grid-column: 1 / -1;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
}

/* 16. Fehlerseiten
/* ---------------------------------------------------------- */

.gh-error { padding-block: clamp(80px, 4rem + 8vw, 176px); }

.gh-error-inner { max-width: var(--content-width); }

.gh-error-code {
    color: var(--color-accent-text);
    font-size: clamp(5rem, 3rem + 10vw, 10rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.06em;
}

.gh-error-title {
    margin-top: 16px;
    font-size: clamp(2rem, 1.6rem + 2vw, 3rem);
}

.gh-error-text {
    margin-top: 16px;
    color: var(--color-secondary-text);
}

.gh-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

/* 17. Schrift-Einstellungen von Ghost
/* ----------------------------------------------------------
   Settings → Design → Brand → Typography setzt --gh-font-heading und
   --gh-font-body. Die Klassen .is-title / .is-body übernehmen sie. */

.is-title { font-family: var(--gh-font-heading, var(--font-sans)); }
.is-body { font-family: var(--gh-font-body, var(--font-sans)); }

/* 18. Hilfsklassen
/* ---------------------------------------------------------- */

.gh-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.gh-skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 1000;
    padding: 10px 18px;
    background-color: var(--color-primary-text);
    color: var(--background-color);
    border-radius: var(--radius-small);
    font-weight: 700;

    &:focus { top: 16px; }
}

/* Lightbox-Gerüst (partials/lightbox.hbs) verstecken, bis lightbox.css nachgeladen ist.
   main.js lädt die Lightbox nur auf Seiten mit Bildern – ohne diese Regel stünden
   die PhotoSwipe-Knöpfe sonst sichtbar am Seitenende. lightbox.css (.pswp--open)
   blendet sie beim Öffnen wieder ein. */
.pswp { display: none; }
