/* public/css/legal.css: Impressum, Datenschutz, AGB. Polished, nur Optik, Text unverändert */
.legal-page {
    background: var(--gray-50);
    min-height: calc(100vh - var(--header-height));
    padding: 32px 20px 48px;
}

.legal-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    /* clip statt hidden: Ecken bleiben abgerundet, aber das sticky
       Inhaltsverzeichnis kann weiter am Bildschirm haften */
    overflow: clip;
    position: relative;
}

/* Kopfbereich außerhalb des Rechtstextes, kein Rechtstext */
.legal-header {
    padding: 28px 48px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    transition: all .15s;
}
.legal-back:hover {
    color: var(--gray-900);
    border-color: var(--gray-300);
    background: #fff;
    text-decoration: none;
}

.legal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-bg);
    border: 1px solid #dbe2ff;
    padding: 5px 10px;
    border-radius: 20px;
}
.legal-eyebrow i { font-size: 0.8rem; }

.legal-meta {
    padding: 10px 48px 0;
    font-size: 0.78rem;
    color: var(--gray-500);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.legal-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* eigentlicher Inhalt */
.legal-content {
    padding: 28px 48px 40px;
}

.legal-content h1 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--gray-900);
    margin: 8px 0 10px;
    padding: 0;
    border: 0;
}

.legal-content h1 + p,
.legal-content .legal-intro {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* H2 als Abschnitts-Trenner */
.legal-content h2 {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.35;
    margin: 40px 0 14px;
    padding: 0 0 0 14px;
    border-left: 3px solid var(--primary);
    scroll-margin-top: 84px;
}
.legal-content h2:first-of-type { margin-top: 4px; }

.legal-content h3 {
    font-size: 0.94rem;
    font-weight: 650;
    color: var(--gray-800);
    margin: 22px 0 10px;
    line-height: 1.4;
}
.legal-content h3 strong { color: inherit; }

/* Fließtext */
.legal-content p {
    font-size: 0.93rem;
    line-height: 1.75;
    color: #3f4756;
    margin: 0 0 16px;
    hyphens: auto;
}
.legal-content p strong {
    color: var(--gray-900);
    font-weight: 650;
}

/* Listen: eigene Bullet in Markenfarbe */
.legal-content ul {
    margin: 12px 0 20px;
    padding-left: 0;
    list-style: none;
}
.legal-content ul li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 8px;
    font-size: 0.93rem;
    line-height: 1.65;
    color: #3f4756;
}
.legal-content ul li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.7em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: .9;
}

/* Links */
.legal-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: rgba(67,97,238,.35);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.25px;
    font-weight: 500;
    word-break: break-word;
}
.legal-content a:hover {
    color: var(--primary-dark);
    text-decoration-color: currentColor;
}

/* Impressum: Kontaktkarte optisch abheben */
.legal-content p:has(> strong) + p:has(a[href^="mailto:"]) {
    /* fallback: kein :has-Support ignoriert */
}

/* Druck */
@media print {
    .legal-page { background: #fff; padding: 0; }
    .legal-container { border: 0; box-shadow: none; border-radius: 0; }
    .legal-header { display: none; }
    .legal-content { padding: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .legal-page { padding: 16px 12px 32px; }
    .legal-header { padding: 18px 20px 0; }
    .legal-meta { padding: 10px 20px 0; }
    .legal-content { padding: 20px 20px 28px; }
    .legal-content h1 { font-size: 1.55rem; }
    .legal-content h2 { font-size: 1.05rem; margin-top: 32px; }
}

@media (max-width: 480px) {
    .legal-content p, .legal-content li { font-size: 0.9rem; }
}

/* ══════════════════════════════════════════════════════════════════
   Flowdue Legal Redesign: Hero, Layout mit TOC, Begriffe, Erklär-Leiste
   (Nur Optik & UI-Chrome. Der Rechtstext selbst bleibt unverändert.)
   ══════════════════════════════════════════════════════════════════ */

/* Kein eigenes Sidebar-Element auf Legal-Seiten: volle Breite nutzen */
.main-layout.no-sidebar > .main-content {
    margin-left: 0;
    width: 100%;
}

/* Kleiner Abstand unter dem fixierten Flowdue-Header (start.css):
   64px kommen aus .main-layout (base.css), Rest von hier.
   Beim Scrollen gleitet der Inhalt unter den Header. */
.legal-page.has-site-header {
    padding-top: 24px;
}

/* ── Hero im Flowdue-Stil ─────────────────────────────────────── */
.legal-hero {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    border-radius: var(--border-radius-xl);
    color: #fff;
    padding: 36px 40px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}
.legal-hero .legal-back {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.25);
    color: #fff;
}
.legal-hero .legal-back:hover {
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.45);
    color: #fff;
}
.legal-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.3);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
}
.legal-hero h1 {
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 8px;
    border: 0;
    padding: 0;
}
.legal-hero-sub {
    color: rgba(255,255,255,.85);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 16px;
    max-width: 60ch;
}
.legal-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.8rem;
    color: rgba(255,255,255,.85);
}
.legal-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.legal-hero-meta a { color: #fff; font-weight: 600; }

/* ── Layout mit sticky Inhaltsverzeichnis (Datenschutz) ───────── */
.legal-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.legal-toc {
    position: sticky;
    top: calc(68px + 16px);
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 16px;
    font-size: 0.82rem;
    max-height: calc(100vh - 68px - 32px);
    overflow: auto;
}
.legal-toc-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.legal-toc ol { list-style: none; margin: 0; padding: 0; }
.legal-toc li { margin: 0; padding: 0; }
.legal-toc a {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--gray-600);
    text-decoration: none;
    line-height: 1.4;
    border-left: 2px solid transparent;
}
.legal-toc a:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
    text-decoration: none;
}
.legal-toc a.active {
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-weight: 600;
    border-left-color: var(--primary);
}

/* ── Begriffs-Buttons im Fließtext (Google-Stil) ──────────────── */
.fd-term {
    all: unset;
    display: inline;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(67,97,238,.55);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.25px;
}
.fd-term:hover, .fd-term:focus-visible {
    color: var(--primary-dark);
    text-decoration-style: solid;
    background: var(--primary-bg);
}
.fd-term:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.fd-term[aria-expanded="true"] {
    color: var(--primary-dark);
    background: var(--primary-bg);
    text-decoration-style: solid;
}
.fd-term sup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 2px;
    border: 1.25px solid currentColor;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    vertical-align: super;
    text-decoration: none;
}

/* ── Erklär-Leiste rechts ─────────────────────────────────────── */
.fd-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(33,37,41,.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 2000;
}
.fd-drawer-overlay.open { opacity: 1; pointer-events: auto; }
.fd-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(390px, 94vw);
    background: #fff;
    z-index: 2001;
    box-shadow: -12px 0 40px rgba(0,0,0,.16);
    transform: translateX(105%);
    transition: transform .3s var(--ease-out, cubic-bezier(0.22,1,0.36,1));
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--gray-200);
}
.fd-drawer.open { transform: translateX(0); }
.fd-drawer-head {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.fd-drawer-title {
    font-size: 1.1rem;
    font-weight: 750;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.35;
}
.fd-drawer-close {
    margin-left: auto;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-600);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.fd-drawer-close:hover { background: #fff; color: var(--gray-900); border-color: var(--gray-300); }
.fd-drawer-body {
    padding: 18px 22px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #3f4756;
}
.fd-drawer-body p { margin: 0 0 12px; }

/* ── Impressum: Kontakt-Karten ────────────────────────────────── */
.legal-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 22px 0;
}
.legal-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 18px;
    background: var(--gray-50);
}
.legal-card h2 {
    margin: 0 0 10px !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 0.78rem !important;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-500) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.legal-card h2 i { color: var(--primary); }
.legal-card p { margin: 0 0 6px; }
.legal-card p:last-child { margin-bottom: 0; }
.legal-card a[href^="mailto:"], .legal-card a[href^="tel:"] { font-weight: 600; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 960px) {
    .legal-layout { grid-template-columns: 1fr; }
    .legal-toc {
        position: static;
        max-height: none;
    }
    .legal-toc ol {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .legal-toc a { border: 1px solid var(--gray-200); border-left-width: 1px; }
    .legal-toc a.active { border-color: var(--primary); }
}
@media (max-width: 768px) {
    .legal-page.has-site-header { padding-top: 16px; }
    .legal-hero { padding: 26px 22px; }
    .legal-hero h1 { font-size: 1.55rem; }
    .legal-cards { grid-template-columns: 1fr; }
}

/* ── Druck: Erklär-UI ausblenden, Begriffe normal ─────────────── */
@media print {
    .fd-drawer, .fd-drawer-overlay, .legal-toc, .legal-hero { display: none !important; }
    .fd-term { color: inherit; font-weight: inherit; text-decoration: none; }
    .fd-term sup { display: none; }
}
