/* ==========================================================================
   Mathe-Seite.de – Design System
   Ersetzt Bootstrap 3 + theme.css. Kein Framework, keine jQuery-Abhängigkeit.
   Markenfarbe (Rot) aus dem Altbestand übernommen, Rest neu aufgebaut.
   ========================================================================== */

/* ---------- Design-Tokens ---------- */
:root {
    /* Marke */
    --brand:            #e3001b;
    --brand-dark:       #b30015;
    --brand-light:      #fff1f2;

    /* Stufen-Akzente.
       --*        = Flächenakzent (Balken, Rahmen) – kräftig
       --*-ink    = Textfarbe auf hellem Grund – dunkel genug für WCAG AA (≥4.5:1)
       --*-bg     = zarter Hintergrund für Badges/aktive Menüpunkte */
    --mittelstufe:      #f59e0b;
    --mittelstufe-ink:  #b45309;
    --mittelstufe-bg:   #fffbeb;
    --oberstufe:        #2563eb;
    --oberstufe-ink:    #1d4ed8;
    --oberstufe-bg:     #eff6ff;
    --studium:          #0d9488;
    --studium-ink:      #0f766e;
    --studium-bg:       #f0fdfa;

    /* Neutrale Skala */
    --gray-0:  #ffffff;
    --gray-50: #f8fafc;
    --gray-100:#f1f5f9;
    --gray-200:#e2e8f0;
    --gray-300:#cbd5e1;
    --gray-400:#94a3b8;
    --gray-500:#64748b;
    --gray-600:#475569;
    --gray-700:#334155;
    --gray-800:#1e293b;
    --gray-900:#0f172a;

    /* Semantisch */
    --bg:            var(--gray-0);
    --bg-subtle:     var(--gray-50);
    --bg-muted:      var(--gray-100);
    --text:          var(--gray-800);
    --text-muted:    var(--gray-500);
    --text-strong:   var(--gray-900);
    --border:        var(--gray-200);
    --border-strong: var(--gray-300);

    /* Typografie – fluid */
    --font-sans: 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --step--1: clamp(0.83rem, 0.81rem + 0.11vw, 0.89rem);
    --step-0:  clamp(1rem, 0.96rem + 0.18vw, 1.09rem);
    --step-1:  clamp(1.2rem, 1.13rem + 0.34vw, 1.4rem);
    --step-2:  clamp(1.44rem, 1.32rem + 0.57vw, 1.8rem);
    --step-3:  clamp(1.73rem, 1.54rem + 0.9vw, 2.3rem);
    --step-4:  clamp(2.07rem, 1.78rem + 1.39vw, 2.95rem);
    --step-5:  clamp(2.49rem, 2.04rem + 2.1vw, 3.79rem);

    /* Raster & Abstände */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;

    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06), 0 1px 3px rgb(15 23 42 / 0.1);
    --shadow:    0 4px 6px -1px rgb(15 23 42 / 0.07), 0 2px 4px -2px rgb(15 23 42 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.05);
    --shadow-lg: 0 20px 25px -5px rgb(15 23 42 / 0.1), 0 8px 10px -6px rgb(15 23 42 / 0.05);

    --container: 1180px;
    --container-narrow: 74ch;
    --header-h: 68px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Dark Mode ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:            #0b1120;
        --bg-subtle:     #0f172a;
        --bg-muted:      #1e293b;
        --text:          #e2e8f0;
        --text-muted:    #94a3b8;
        --text-strong:   #f8fafc;
        --border:        #1e293b;
        --border-strong: #334155;

        --brand:         #ff4d5e;
        --brand-dark:    #ff7885;
        --brand-light:   #2a1116;

        --mittelstufe-bg: #2a2010;
        --oberstufe-bg:   #111d38;
        --studium-bg:     #0c2725;

        /* auf dunklem Grund muss die Textfarbe heller sein, nicht dunkler */
        --mittelstufe-ink: #fbbf24;
        --oberstufe-ink:   #93b4fd;
        --studium-ink:     #5eead4;

        --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
        --shadow:    0 4px 6px -1px rgb(0 0 0 / 0.4);
        --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.45);
        --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5);
    }
    img:not([src*=".svg"]) { filter: brightness(0.92) contrast(1.02); }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--space-5));
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern' 1, 'liga' 1;
}

img, svg, video, iframe { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- Typografie ---------- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
h5, h6 { font-size: var(--step-0); }

p, ul, ol, table, blockquote, figure, pre { margin-block: 0 var(--space-4); }
p { text-wrap: pretty; }
:is(h1, h2, h3, h4) + p { margin-top: var(--space-3); }

a {
    color: var(--brand);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color 0.15s var(--ease);
}
a:hover { color: var(--brand-dark); }

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

strong, b { font-weight: 650; color: var(--text-strong); }
sub, sup { font-size: 0.72em; line-height: 0; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin-block: var(--space-7);
}

ul, ol { padding-left: 1.4em; }
li + li { margin-top: var(--space-1); }
li::marker { color: var(--brand); }

blockquote {
    border-left: 3px solid var(--brand);
    padding-left: var(--space-4);
    color: var(--text-muted);
    font-style: italic;
}

code, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-muted);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-5);
}
@media (max-width: 640px) { .container { padding-inline: var(--space-4); } }

.section { padding-block: var(--space-7); }
.section--tight { padding-block: var(--space-6); }
.section--subtle { background: var(--bg-subtle); }

/* Haupt-Content-Raster: Inhalt + Sidebar */
.layout {
    display: grid;
    gap: var(--space-7);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}
@media (min-width: 960px) {
    .layout--sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}

.prose { max-width: var(--container-narrow); }
.prose :is(h2, h3) { margin-top: var(--space-6); }

/* Skip-Link */
.skip-link {
    position: absolute;
    left: var(--space-4);
    top: calc(-1 * var(--space-9));
    z-index: 200;
    background: var(--brand);
    color: #fff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: top 0.2s var(--ease);
}
.skip-link:focus { top: var(--space-4); color: #fff; }

/* ---------- Header / Navigation ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.5) blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: var(--header-h);
}

.nav__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 800;
    font-size: var(--step-1);
    letter-spacing: -0.03em;
    color: var(--text-strong);
    text-decoration: none;
    flex-shrink: 0;
}
.nav__brand:hover { color: var(--text-strong); }
.nav__brand img { height: 32px; width: auto; }
.nav__brand-dot { color: var(--brand); }

.nav__list {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: auto;
}
.nav__list li { margin: 0; }

.nav__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-weight: 550;
    font-size: var(--step--1);
    white-space: nowrap;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav__link:hover { background: var(--bg-muted); color: var(--text-strong); }
.nav__link[aria-expanded="true"] { background: var(--bg-muted); }

.nav__link.is-active {
    color: var(--brand);
    background: var(--brand-light);
}

/* Stufen-Menüpunkte tragen dieselbe Farbe wie die Teaser-Karten der Startseite.
   Steht bewusst NACH .nav__link.is-active, sonst gewinnt dort das Markenrot.
   Text nutzt --*-ink (kontraststark), Balken/Flächen den vollen Akzent. */
.nav__link--stufe { color: var(--accent-ink); }
.nav__link--stufe:hover,
.nav__link--stufe[aria-expanded="true"] {
    background: var(--accent-bg);
    color: var(--accent-ink);
}
.nav__link--stufe.is-active {
    background: var(--accent-bg);
    color: var(--accent-ink);
    box-shadow: inset 0 -2px 0 var(--accent);
}
.nav__link--mittelstufe { --accent: var(--mittelstufe); --accent-ink: var(--mittelstufe-ink); --accent-bg: var(--mittelstufe-bg); }
.nav__link--oberstufe   { --accent: var(--oberstufe);   --accent-ink: var(--oberstufe-ink);   --accent-bg: var(--oberstufe-bg); }
.nav__link--studium     { --accent: var(--studium);     --accent-ink: var(--studium-ink);     --accent-bg: var(--studium-bg); }

.nav__caret {
    width: 0.65em;
    height: 0.65em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-15%);
    transition: transform 0.2s var(--ease);
    opacity: 0.6;
}
[aria-expanded="true"] .nav__caret { transform: rotate(-135deg) translateY(-15%); }

/* Dropdown */
.nav__item { position: relative; }

.nav__dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    /* Rechtsbündig ausrichten: mit left:0 ragte das 310px breite Menü des
       rechten Eintrags („Downloads") über den Viewport und erzeugte auf
       Desktop-Breiten einen horizontalen Scrollbalken. */
    right: 0;
    left: auto;
    min-width: 310px;
    max-width: calc(100vw - var(--space-4));
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
}
/* Hover-Öffnen nur auf Geräten mit echtem Zeiger – auf Touch bleibt :hover
   nach dem Tippen "kleben" und blockiert sonst das Klick-Menü. */
@media (hover: hover) and (pointer: fine) {
    .nav__item:hover .nav__dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}
.nav__dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav__dropdown a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: var(--step--1);
    line-height: 1.4;
    transition: background 0.12s var(--ease);
}
.nav__dropdown a:hover { background: var(--bg-muted); color: var(--brand); }
.nav__dropdown a.is-active { color: var(--brand); background: var(--brand-light); }
.nav__dropdown hr { margin-block: var(--space-2); }
.nav__dropdown-all {
    font-weight: 650 !important;
    color: var(--brand) !important;
}

/* Suche im Header */
.nav__search { position: relative; flex-shrink: 0; }
.nav__search input {
    width: 190px;
    padding: var(--space-2) var(--space-3) var(--space-2) 2.2rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    font-size: var(--step--1);
    transition: width 0.2s var(--ease), border-color 0.15s, background 0.15s;
}
.nav__search input:focus {
    width: 240px;
    outline: none;
    border-color: var(--brand);
    background: var(--bg);
}
.nav__search svg {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}
@media (max-width: 1100px) { .nav__search input { width: 150px; } }

/* Mobile-Toggle */
.nav__toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-2);
    min-width: 44px;
    min-height: 44px;
    color: var(--text);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav__toggle svg { width: 1.3rem; height: 1.3rem; }
.nav__toggle .icon-close { display: none; }
.nav__toggle[aria-expanded="true"] .icon-close { display: block; }
.nav__toggle[aria-expanded="true"] .icon-menu { display: none; }

@media (max-width: 900px) {
    .nav__toggle { display: inline-flex; }
    .nav__list {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: var(--space-3);
        max-height: calc(100dvh - var(--header-h));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        display: none;
    }
    .nav__list.is-open { display: flex; }

    /* Touch-Ziele: mindestens 48px hoch */
    .nav__link {
        width: 100%;
        justify-content: space-between;
        padding: var(--space-3) var(--space-4);
        min-height: 48px;
        font-size: var(--step-0);
    }
    .nav__list > li + li { border-top: 1px solid var(--border); }

    .nav__dropdown {
        position: static;
        min-width: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--border);
        border-radius: 0;
        margin-left: var(--space-4);
        padding-block: 0;
        display: none;
    }
    .nav__dropdown.is-open { display: block; }
    .nav__dropdown a {
        padding: var(--space-3);
        min-height: 44px;
        display: flex;
        align-items: center;
        font-size: var(--step-0);
    }

    .nav__search { order: -1; width: 100%; padding: var(--space-2); }
    .nav__search input, .nav__search input:focus { width: 100%; }
}

/* ---------- Badges / Labels ---------- */
.badge {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: var(--space-1);
    padding: 0.25em 0.7em;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
}
.badge--mittelstufe { background: var(--mittelstufe-bg); color: var(--mittelstufe-ink); }
.badge--oberstufe   { background: var(--oberstufe-bg);   color: var(--oberstufe-ink); }
.badge--studium     { background: var(--studium-bg);     color: var(--studium-ink); }
.badge--brand       { background: var(--brand-light);    color: var(--brand); }
.badge--muted       { background: var(--bg-muted);       color: var(--text-muted); }

/* Kapitelnummer, z.B. "A.12.05" */
.chapter-code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-light);
    padding: 0.1em 0.45em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--step--1);
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s var(--ease), border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--brand-dark); color: #fff; box-shadow: var(--shadow); }

.btn--secondary {
    background: var(--bg);
    color: var(--text-strong);
    border-color: var(--border-strong);
}
.btn--secondary:hover { background: var(--bg-muted); color: var(--text-strong); }

.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--brand-light); }

.btn--sm { padding: var(--space-2) var(--space-3); font-size: 0.8rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.card--link:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card__title { font-size: var(--step-1); margin-bottom: var(--space-2); }
.card__title a { color: var(--text-strong); text-decoration: none; }
.card--link:hover .card__title a { color: var(--brand); }
.card__meta { font-size: var(--step--1); color: var(--text-muted); }

.grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }

/* ---------- Sidebar-Panel ---------- */
.panel {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.panel + .panel { margin-top: var(--space-5); }
.panel__head {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.panel__title {
    font-size: var(--step--1);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.panel__body { padding: var(--space-3); }

/* Navigationsliste in der Sidebar */
.navlist { list-style: none; margin: 0; padding: 0; }
.navlist li { margin: 0; }
.navlist a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: var(--step--1);
    line-height: 1.4;
    transition: background 0.12s var(--ease), color 0.12s;
}
.navlist a:hover { background: var(--bg-muted); color: var(--brand); }
.navlist a[aria-current="page"] {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
}
.navlist--counted { counter-reset: nl; }
.navlist--counted a::before {
    counter-increment: nl;
    content: counter(nl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    margin-right: var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 0.75em;
    font-weight: 700;
    font-family: var(--font-mono);
}
.navlist--counted a[aria-current="page"]::before { background: var(--brand); color: #fff; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    /* kein pauschales margin:0 – sonst kippt das margin-inline:auto von .container
       und der Breadcrumb steht links am Rand statt am Satzspiegel */
    margin-block: 0;
    padding-block: var(--space-4);
    font-size: var(--step--1);
    color: var(--text-muted);
}
.breadcrumb li { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.breadcrumb li + li::before {
    content: '';
    width: 0.35em;
    height: 0.35em;
    border-right: 1.5px solid var(--border-strong);
    border-top: 1.5px solid var(--border-strong);
    transform: rotate(45deg);
    flex-shrink: 0;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 550; }

/* ---------- Page-Header ---------- */
.page-head { padding-block: var(--space-5) var(--space-6); }
.page-head__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.page-head h1 { font-size: var(--step-4); }
.page-head__lead {
    font-size: var(--step-1);
    color: var(--text-muted);
    max-width: 68ch;
    margin-top: var(--space-3);
    line-height: 1.55;
}

/* ---------- Video ---------- */
.video {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-block: var(--space-5);
}
.video > iframe, .video > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- Hero (Startseite) ---------- */
.hero {
    position: relative;
    padding-block: var(--space-8) var(--space-7);
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, var(--brand-light), transparent 70%),
        var(--bg);
    overflow: hidden;
}
.hero__inner { position: relative; text-align: center; }
.hero h1 {
    font-size: var(--step-5);
    max-width: 22ch;
    margin-inline: auto;
}
.hero__lead {
    font-size: var(--step-1);
    color: var(--text-muted);
    max-width: 58ch;
    margin: var(--space-4) auto 0;
}
.hero__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
}
.hero__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-6) var(--space-8);
    margin-top: var(--space-7);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
}
.stat { text-align: center; }
.stat__value {
    display: block;
    font-size: var(--step-3);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}
.stat__label {
    font-size: var(--step--1);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Stufen-Auswahlkarten */
.stufen-cards {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}
.stufe-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg);
    text-decoration: none;
    color: var(--text);
    position: relative;
    overflow: hidden;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.stufe-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--accent, var(--brand));
}
.stufe-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent, var(--brand));
    color: var(--text);
}
.stufe-card--mittelstufe { --accent: var(--mittelstufe); --accent-ink: var(--mittelstufe-ink); }
.stufe-card--oberstufe   { --accent: var(--oberstufe);   --accent-ink: var(--oberstufe-ink); }
.stufe-card--studium     { --accent: var(--studium);     --accent-ink: var(--studium-ink); }
.stufe-card h3 { font-size: var(--step-2); }
.stufe-card p { color: var(--text-muted); font-size: var(--step--1); margin: 0; }
.stufe-card__go {
    margin-top: auto;
    padding-top: var(--space-3);
    font-weight: 650;
    font-size: var(--step--1);
    color: var(--accent-ink, var(--brand));
}

/* Feature-Zeilen */
.feature {
    display: grid;
    gap: var(--space-6);
    align-items: center;
    padding-block: var(--space-6);
    border-top: 1px solid var(--border);
}
@media (min-width: 820px) {
    .feature { grid-template-columns: 5fr 7fr; }
    .feature--flip > :first-child { order: 2; }
}
.feature__media img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
}
.feature h3 { font-size: var(--step-2); margin-bottom: var(--space-2); }
.feature h3 small {
    display: block;
    font-size: 0.62em;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
    margin-top: var(--space-1);
}

/* USP-Liste */
.usps { list-style: none; padding: 0; display: grid; gap: var(--space-4); }
.usps li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-3);
    margin: 0;
}
.usps li::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    border-radius: var(--radius-full);
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 800;
    font-size: 0.8em;
    margin-top: 0.15em;
}
.usps strong { display: block; color: var(--text-strong); }

/* ---------- Themenübersicht (Stufen-Seite) ---------- */
.toc { display: grid; gap: var(--space-6); }
.toc__thema {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg);
}
.toc__thema > summary {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-subtle);
    cursor: pointer;
    font-weight: 700;
    font-size: var(--step-1);
    color: var(--text-strong);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    list-style: none;
}
.toc__thema > summary::-webkit-details-marker { display: none; }
.toc__thema > summary::after {
    content: '';
    margin-left: auto;
    width: 0.5em;
    height: 0.5em;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.2s var(--ease);
    flex-shrink: 0;
}
.toc__thema[open] > summary::after { transform: rotate(-135deg); }
.toc__thema > summary:hover { background: var(--bg-muted); }
.toc__body { padding: var(--space-4) var(--space-5) var(--space-5); }
.toc__kat { margin-bottom: var(--space-5); }
.toc__kat:last-child { margin-bottom: 0; }
.toc__kat > a {
    display: block;
    font-weight: 650;
    color: var(--text-strong);
    text-decoration: none;
    margin-bottom: var(--space-2);
}
.toc__kat > a:hover { color: var(--brand); }
.toc__subs {
    list-style: none;
    padding: 0 0 0 var(--space-4);
    border-left: 2px solid var(--border);
    display: grid;
    gap: var(--space-1);
}
.toc__subs a { font-size: var(--step--1); color: var(--text-muted); text-decoration: none; }
.toc__subs a:hover { color: var(--brand); }

/* ---------- Rechenbeispiele ---------- */
.examples { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.example-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    font-size: var(--step--1);
    font-weight: 550;
    transition: all 0.15s var(--ease);
}
.example-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.example-chip[aria-current="page"] {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.example-chip__n {
    font-family: var(--font-mono);
    font-weight: 700;
    opacity: 0.7;
}

/* ---------- Suche ---------- */
.searchbox {
    display: flex;
    gap: var(--space-2);
    max-width: 560px;
}
.searchbox input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: var(--step-0);
}
.searchbox input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

.results { display: grid; gap: var(--space-4); }
.result {
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.result:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.result__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.result__title { font-size: var(--step-0); font-weight: 650; }
.result__title a { color: var(--text-strong); text-decoration: none; }
.result:hover .result__title a { color: var(--brand); }
.result__path {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.result p { font-size: var(--step--1); color: var(--text-muted); margin: 0; }

.result-group + .result-group { margin-top: var(--space-7); }
.result-group__title {
    font-size: var(--step--1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

mark { background: color-mix(in srgb, var(--mittelstufe) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 0.15em; }

/* ---------- Tabellen / Downloads ---------- */
.table-wrap { overflow-x: auto; margin-block: var(--space-4); }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--step--1);
}
th, td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    font-weight: 650;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    background: var(--bg-subtle);
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--bg-subtle); }

.dl-list { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.dl-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    text-decoration: none;
    color: var(--text);
    margin: 0;
    transition: all 0.15s var(--ease);
}
.dl-item:hover { border-color: var(--brand); background: var(--brand-light); color: var(--text); }
.dl-item__icon {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--brand-light);
    color: var(--brand);
    font-size: 0.65rem;
    font-weight: 800;
    font-family: var(--font-mono);
}
.dl-item:hover .dl-item__icon { background: var(--brand); color: #fff; }
.dl-item__name { font-weight: 550; flex: 1; }
.dl-item__hint { font-size: var(--step--1); color: var(--text-muted); }

/* ---------- FAQ / Accordion ---------- */
.accordion { display: grid; gap: var(--space-3); }
.accordion details {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    overflow: hidden;
}
.accordion summary {
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    font-weight: 650;
    color: var(--text-strong);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
    content: '+';
    margin-left: auto;
    font-size: 1.3em;
    line-height: 1;
    color: var(--brand);
    font-weight: 400;
    flex-shrink: 0;
    transition: transform 0.2s var(--ease);
}
.accordion details[open] summary::after { transform: rotate(45deg); }
.accordion summary:hover { background: var(--bg-subtle); }
.accordion__body { padding: 0 var(--space-5) var(--space-5); color: var(--text-muted); }

/* ---------- Partner / Logos ---------- */
.logo-grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
}
.logo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    min-height: 180px;
    transition: all 0.15s var(--ease);
}
.logo-card:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--text); }
.logo-card img { max-height: 70px; width: auto; object-fit: contain; }
.logo-card__name { font-weight: 600; font-size: var(--step--1); }
.logo-card__url { font-size: 0.78rem; color: var(--text-muted); word-break: break-word; }

/* ---------- Zitate / Komplimente ---------- */
.quotes {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.quote {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
}
.quote__text { font-size: var(--step-0); color: var(--text); }
.quote__text p:last-child { margin-bottom: 0; }
.quote__meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--step--1);
    color: var(--text-muted);
}

/* ---------- Formeln-Block ---------- */
.formula-block {
    margin-top: var(--space-7);
    padding: var(--space-6);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.formula-block h2, .formula-block h3 { font-size: var(--step-1); }
.formula-block :last-child { margin-bottom: 0; }

/* ---------- Werbeplatz ---------- */
.adslot {
    display: grid;
    place-items: center;
    max-width: 100%;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    overflow: hidden;
}
.adslot::after { content: 'Anzeige'; opacity: 0.5; }
.adslot:not(:empty)::after { content: none; }
@media (max-width: 960px) { .adslot--sky { display: none; } }

/* Gebuchtes Werbemittel: kein Platzhalter-Rahmen, Kennzeichnung sichtbar */
.adslot--filled {
    position: relative;
    display: block;
    border: 0;
    background: none;
    height: auto !important;
    /* Nie über die native Breite hinaus skalieren – sonst wird ein
       160er Skyscraper in der 300er Sidebar unscharf aufgeblasen.
       --ad-w setzt das Snippet aus der Platzierungs-Konfiguration. */
    width: min(100%, var(--ad-w, 100%));
    max-width: 100%;
    /* Pflicht: Als Flex-Item gilt sonst min-width:auto, und die intrinsische
       Bildbreite (z. B. 728px) sprengt auf dem Handy das ganze Layout. */
    min-width: 0;
    margin-inline: auto;
}
.adslot--filled img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}
/* „Anzeige“ ist in Deutschland Pflicht (§ 6 TMG / Trennungsgebot) */
.adslot__label {
    display: block;
    margin-bottom: 2px;
    font-size: 0.625rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Leaderboard über dem Inhalt und Banner über dem Footer */
.adslot-leaderboard,
.adslot-footer {
    display: flex;
    justify-content: center;
}
.adslot-leaderboard { margin-top: var(--space-5); }
.adslot-footer      { margin-top: var(--space-8); }

/* Leere Platzhalter kosten auf dem Handy nur Platz */
@media (max-width: 700px) {
    .adslot:not(.adslot--filled) { display: none; }
}

@media (max-width: 760px) {
    .adslot--superbanner.adslot--filled,
    .adslot--billboard.adslot--filled { max-width: 100%; }
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: var(--space-9);
    padding-block: var(--space-7) var(--space-5);
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
    font-size: var(--step--1);
}
.footer-grid {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}
.footer-col h2 {
    font-size: var(--step--1);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.footer-col li { margin: 0; }
.footer-col a { color: var(--text); text-decoration: none; }
.footer-col a:hover { color: var(--brand); text-decoration: underline; }

.footer-bottom {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    color: var(--text-muted);
}
.footer-bottom img { height: 38px; width: auto; opacity: 0.7; }

/* ---------- Utilities ---------- */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack   { display: grid; gap: var(--space-4); }
.stack-6 { display: grid; gap: var(--space-6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.sticky-side { position: sticky; top: calc(var(--header-h) + var(--space-5)); }

/* ---------- Print ---------- */
@media print {
    .site-header, .site-footer, .adslot, .breadcrumb, .nav__search, .panel { display: none !important; }
    body { font-size: 11pt; color: #000; background: #fff; }
    a { color: #000; text-decoration: underline; }
    a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 0.85em; color: #555; }
    .video { display: none; }
}
