/* ==========================================================================
   Rechtsseiten (Datenschutz) - moderne Darstellung
   Der Rechtstext bleibt unveraendert; hier passiert ausschliesslich Layout:
   Sprungnavigation, Abschnittskarten, ruhige Typografie.
   ========================================================================== */

.legal-modern {
    max-width: var(--container-width);
    margin: 0 auto;
    --legal-measure: 68ch;
}

/* Lesefortschritt: .reading-progress liegt in style.css (seitenuebergreifend) */

/* --- Kopfbereich -------------------------------------------------------- */
.legal-hero {
    position: relative;
    overflow: hidden;
    margin: 0 0 2.5rem;
    padding: 3.5rem 2.5rem 3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(90rem 30rem at 15% -40%, rgba(37, 99, 235, 0.10), transparent 60%),
        radial-gradient(60rem 24rem at 95% 0%, rgba(56, 189, 248, 0.12), transparent 60%),
        var(--bg-card);
}

.legal-hero h1 {
    /* Lange Komposita wie "Datenschutzerklärung" muessen auf schmalen
       Displays passen - daher vw-basiert skalieren und notfalls trennen. */
    font-size: clamp(1.6rem, 6.5vw, 3rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text);
    hyphens: auto;
    overflow-wrap: break-word;
}

.legal-hero-subtitle {
    margin: 1rem 0 0;
    max-width: 62ch;
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text-light);
}

.legal-hero-subtitle a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-stand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1.25rem 0 0;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    color: var(--text-light);
}

.legal-stand-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

/* Schnellsprung-Chips (Beschriftung = die Abschnittsueberschriften) */
.legal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
}

.legal-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    line-height: 1.35;
    gap: 0.55rem;
    padding: 0.55rem 1rem 0.55rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.legal-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
}

.legal-chip:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

/* --- Layout: Sprungnavigation + Inhalt ---------------------------------- */
.legal-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.legal-aside {
    position: sticky;
    top: 84px;
}

.legal-nav {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 0.4rem;
    scrollbar-width: thin;
}

.legal-nav::-webkit-scrollbar {
    width: 6px;
}

.legal-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.legal-nav-title {
    margin: 0 0 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-light);
}

.legal-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.legal-nav-list > li > a {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 0.92rem;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.legal-nav-num {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--primary);
    opacity: 0.7;
}

.legal-nav-list > li > a:hover {
    background: rgba(37, 99, 235, 0.06);
    color: var(--text);
}

.legal-nav-item.is-active > a {
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary-dark);
    font-weight: 600;
}

.legal-nav-item.is-active .legal-nav-num {
    opacity: 1;
}

.legal-nav-subs {
    list-style: none;
    margin: 0.2rem 0 0.6rem;
    padding: 0 0 0 1.85rem;
    border-left: 2px solid var(--border);
    margin-left: 1.05rem;
}

.legal-nav-subs a {
    display: block;
    padding: 0.28rem 0;
    color: var(--text-light);
    font-size: 0.83rem;
    line-height: 1.35;
    text-decoration: none;
}

.legal-nav-subs a:hover {
    color: var(--primary);
}

/* Erst mit JS werden die Unterpunkte eingeklappt - ohne JS bleiben sie sichtbar */
.legal-nav-spy .legal-nav-subs {
    display: none;
}

.legal-nav-spy .legal-nav-item.is-active .legal-nav-subs {
    display: block;
}

.legal-nav-mobile {
    display: none;
}

/* --- Abschnittskarten --------------------------------------------------- */
.legal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.legal-section {
    scroll-margin-top: 90px;
    padding: 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.legal-section-intro {
    color: var(--text-light);
}

.legal-section-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.legal-section-num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.7);
}

.legal-section-head h2 {
    margin: 0;
    min-width: 0;
    font-size: clamp(1.15rem, 3.5vw, 1.6rem);
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text);
    hyphens: auto;
    overflow-wrap: break-word;
}

/* --- Kompakte Karten (Impressum) ---------------------------------------- */
.legal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.legal-section--card {
    padding: 1.75rem;
}

.legal-section--card .legal-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.legal-section--card .legal-section-head h2 {
    font-size: 1.05rem;
    line-height: 1.35;
}

.legal-section-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.7);
}

.legal-section-icon svg {
    width: 1.2rem;
    height: 1.2rem;
    display: block;
}

.legal-address {
    font-style: normal;
    line-height: 1.7;
}

.legal-note {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-light);
}

/* --- Typografie im Fliesstext ------------------------------------------- */
.legal-section-body {
    color: #334155;
    font-size: 1.02rem;
    line-height: 1.78;
}

.legal-section-body > *:first-child {
    margin-top: 0;
}

.legal-section-body p {
    max-width: var(--legal-measure);
    margin: 0 0 1.15rem;
}

.legal-section-body h3 {
    position: relative;
    scroll-margin-top: 90px;
    margin: 2.75rem 0 1rem;
    padding-left: 1rem;
    font-size: 1.2rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--text);
}

.legal-section-body h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.28em;
    bottom: 0.28em;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), #38bdf8);
}

.legal-section-body h3,
.legal-section-body h4 {
    hyphens: auto;
    overflow-wrap: break-word;
}

.legal-section-body h4 {
    margin: 1.85rem 0 0.65rem;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.005em;
    color: var(--primary-dark);
}

.legal-section-body ul,
.legal-section-body ol {
    max-width: var(--legal-measure);
    margin: 0 0 1.25rem;
    padding-left: 1.35rem;
}

.legal-section-body li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.legal-section-body li::marker {
    color: var(--primary);
}

.legal-section-body a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.legal-section-body a:hover {
    color: var(--primary-dark);
}

.legal-section-body code {
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    font-size: 0.88em;
}

/* Absaetze der Bauart "<strong>Zweck:</strong> ..." als Merkmalszeilen setzen.
   :has() faellt in aelteren Browsern still weg - dann bleibt der normale Absatz. */
.legal-section-body p:has(> strong:first-child) {
    padding: 0.85rem 1.1rem;
    margin-bottom: 0.6rem;
    border-left: 3px solid rgba(37, 99, 235, 0.35);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: #f8fafc;
}

.legal-section-body p:has(> strong:first-child) strong {
    color: var(--text);
}

.legal-section-body p:has(> strong:first-child) + p:not(:has(> strong:first-child)) {
    margin-top: 1.15rem;
}

/* Versalien-Bloecke (Widerspruchsrecht Art. 21) lesbar rahmen */
.legal-section-body p.legal-caps {
    padding: 1.15rem 1.35rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    background: rgba(245, 158, 11, 0.06);
    font-size: 0.86rem;
    line-height: 1.75;
    letter-spacing: 0.015em;
    color: #78350f;
}

.legal-back {
    margin: 2.5rem 0 0;
    font-size: 0.95rem;
}

.legal-back a {
    color: var(--text-light);
    text-decoration: none;
}

.legal-back a:hover {
    color: var(--primary);
}

/* --- Responsiv ---------------------------------------------------------- */
@media (max-width: 1024px) {
    .legal-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .legal-aside {
        position: static;
    }

    .legal-nav {
        display: none;
    }

    .legal-nav-mobile {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .legal-nav-mobile summary {
        padding: 1rem 1.25rem;
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

    .legal-nav-mobile summary::-webkit-details-marker {
        display: none;
    }

    .legal-nav-mobile summary::after {
        content: "▾";
        float: right;
        color: var(--text-light);
        transition: transform 0.2s ease;
    }

    .legal-nav-mobile[open] summary::after {
        content: "▴";
    }

    .legal-nav-mobile .legal-nav-list {
        padding: 0 0.75rem 0.75rem;
    }
}

@media (max-width: 768px) {
    .legal-hero {
        padding: 2.25rem 1.35rem 2rem;
        margin-bottom: 1.5rem;
    }

    .legal-chips {
        margin-top: 1.5rem;
    }

    .legal-section {
        padding: 1.5rem 1.25rem;
    }

    .legal-section-head {
        gap: 0.75rem;
        margin-bottom: 1.25rem;
        padding-bottom: 1rem;
    }

    .legal-section-num {
        width: 2.1rem;
        height: 2.1rem;
        border-radius: 12px;
        font-size: 0.9rem;
    }

    .legal-section-body {
        font-size: 1rem;
    }

    .legal-section-body h3 {
        margin-top: 2.25rem;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .legal-hero {
        padding: 1.85rem 1.1rem 1.6rem;
    }

    .legal-chip {
        font-size: 0.85rem;
        padding: 0.45rem 0.8rem 0.45rem 0.45rem;
    }

    .legal-section {
        padding: 1.35rem 1.1rem;
        border-radius: var(--radius);
    }

    .legal-section-body {
        font-size: 0.98rem;
        line-height: 1.72;
    }

    .legal-section-body p:has(> strong:first-child) {
        padding: 0.7rem 0.85rem;
    }

    .legal-section-body p.legal-caps {
        padding: 0.9rem 1rem;
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legal-chip {
        transition: none;
    }
}

/* --- Druck -------------------------------------------------------------- */
@media print {
    .legal-aside,
    .legal-chips,
    .legal-back {
        display: none !important;
    }

    .legal-layout {
        display: block;
    }

    .legal-hero,
    .legal-section {
        border: none;
        box-shadow: none;
        background: none;
        padding: 0;
        margin-bottom: 1.5rem;
        break-inside: auto;
    }

    .legal-section-head {
        break-after: avoid;
    }
}
