/* ===================================================================
   BASE — Reset, Typografie, Layout-Primitive, Buttons, Karten,
   Formulare, Footer. Alles, was auf mehr als einer Seite vorkommt.

   Setzt tokens.css voraus.
   =================================================================== */

/* ── RESET ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Anker landen unter dem Sticky-Header, nicht dahinter */
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Inhalt endet oberhalb der Sticky-Leiste auf Mobil */
    padding-bottom: var(--sticky-bar-h);
    overflow-x: hidden;
}

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

/* ── TYPOGRAFIE ───────────────────────────────────────────────── */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    color: var(--primary);
    line-height: var(--leading-tight);
    text-wrap: balance;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); line-height: var(--leading-snug); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

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

strong { font-weight: 600; }

/* Fokus sichtbar — durchgängig, nicht pro Komponente */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: var(--space-3) var(--space-5);
    background: var(--primary);
    color: var(--text-inverse);
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
    transition: top var(--duration) var(--ease);
}
.skip-to-content:focus { top: 0; }

/* ── LAYOUT ───────────────────────────────────────────────────── */
.section {
    max-width: var(--width-page);
    margin-inline: auto;
    padding: var(--section-y) var(--section-x);
}

/* Der Band-Wrapper für abgesetzte Abschnitte. Vorher lag die
   Hintergrundfarbe auf einem zusätzlichen <div> um jede Section —
   jetzt reicht die Klasse am Abschnitt selbst. */
.band { background: var(--bg-alt); }
.band + .band { border-top: 1px solid var(--border); }

.section-header {
    max-width: var(--width-prose);
    margin: 0 auto var(--space-8);
    text-align: center;
}
.section-header p {
    max-width: 60ch;
    margin: var(--space-4) auto 0;
    font-size: var(--text-lg);
    color: var(--text-light);
}

.section-label {
    display: inline-block;
    margin-bottom: var(--space-3);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-dark);   /* dunkler als --accent: erfüllt AA auf hellem Grund */
}

/* Breadcrumb — sitzt meist im Seitenkopf, auf Seiten ohne Kopf allein
   oben im Inhalt. Beide Faelle sollen gleich aussehen. */
.breadcrumb {
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-light);
}
.breadcrumb a { color: var(--accent-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-light); }

.breadcrumb-standalone {
    max-width: var(--width-page);
    margin-inline: auto;
    padding: var(--space-5) var(--section-x) 0;
}

.grid { display: grid; gap: var(--space-5); }

/* Automatisch umbrechende Raster — ersetzt die
   repeat(4,1fr) → repeat(2,1fr) → 1fr Breakpoint-Ketten. */
.grid-auto      { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid-auto-wide { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.grid-split     { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: var(--space-9); align-items: center; }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    min-height: 48px;             /* Touch-Ziel */
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration) var(--ease),
                border-color var(--duration) var(--ease),
                transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.btn-block { width: 100%; }

@media (hover: none) {
    /* Auf Touch-Geräten kein Hover-Versatz — der bleibt sonst hängen */
    .btn:hover { transform: none; }
}

.link-accent {
    color: var(--accent-dark);
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 0.25em;
}
.link-accent:hover { text-decoration: underline; }

/* ── KARTEN ───────────────────────────────────────────────────── */
.card {
    padding: var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                border-color var(--duration) var(--ease);
}
.card-link { display: block; color: inherit; text-decoration: none; }
.card-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.card-center { text-align: center; }

.card h3 { margin-bottom: var(--space-3); font-size: var(--text-lg); }
.card p  { font-size: var(--text-sm); color: var(--text-light); line-height: var(--leading-normal); }

.card-icon { display: block; margin-bottom: var(--space-4); font-size: 2rem; line-height: 1; }

@media (hover: none) { .card-lift:hover { transform: none; } }

/* ── FORMULARE ────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    min-height: 48px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);   /* 16px — verhindert Auto-Zoom auf iOS */
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form-group textarea { min-height: 120px; resize: vertical; line-height: var(--leading-normal); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--space-4); }

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-light);
    cursor: pointer;
}
.consent-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.15rem;
    accent-color: var(--accent);
}

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

/* ── FOOTER ───────────────────────────────────────────────────── */
/* Markup wird von assets/js/site-footer.js erzeugt — wie die
   Navigation. Vorher stand er 28× hartkodiert im HTML. */
.site-footer {
    padding: var(--space-8) var(--section-x) var(--space-5);
    background: var(--primary);
    color: var(--text-inverse);
}
.site-footer-inner { max-width: var(--width-page); margin-inline: auto; }

.site-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}
.site-footer h4 { margin-bottom: var(--space-4); font-size: var(--text-base); color: var(--accent); }
.site-footer p, .site-footer a { font-size: var(--text-sm); color: var(--on-primary-70); line-height: var(--leading-relaxed); }
.site-footer a {
    display: block;
    margin-bottom: var(--space-1);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
.site-footer a:hover { color: var(--accent); }

.site-footer-brand { font-family: var(--font-serif); font-size: var(--text-lg); color: var(--accent) !important; margin-bottom: var(--space-3); }
.site-footer-brand span { display: block; font-family: var(--font-sans); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-primary-40); }

.site-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--on-primary-15);
}
.site-footer-bottom p, .site-footer-bottom a { font-size: var(--text-xs); color: var(--on-primary-40); }

/* ── FAQ (<details>/<summary>) ────────────────────────────────── */
/* Loest den frueheren Button-plus-max-height-Aufbau ab: funktioniert
   ohne JavaScript, ist von Haus aus tastaturbedienbar, und lange
   Antworten werden nicht mehr bei 500px abgeschnitten.
   Gilt fuer alle Seitentypen, deshalb hier statt je Typ. */
/* <details>/<summary> statt Button + max-height-Trick: funktioniert
   ohne JavaScript, ist von Haus aus tastaturbedienbar, und lange
   Antworten werden nicht mehr bei 500px abgeschnitten. */
.faq-list { max-width: var(--width-prose); margin-inline: auto; }

.faq-item {
    margin-bottom: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--duration) var(--ease);
}
.faq-item:hover, .faq-item[open] { border-color: var(--accent); }

.faq-item summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent-dark); }

.faq-item summary::after {
    content: '+';
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--accent-dark);
    transition: transform var(--duration) var(--ease);
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-answer {
    padding: 0 var(--space-5) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-light);
    line-height: var(--leading-relaxed);
}

/* ── EINBLENDEN BEIM SCROLLEN ─────────────────────────────────── */
/* Vorher: .fade-in war standardmäßig sichtbar und wurde per JS auf
   unsichtbar gesetzt — kurzes Aufblitzen. Jetzt greift der Effekt
   nur, wenn JS ihn aktiviert hat. */
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--duration-lg) var(--ease-out),
                transform var(--duration-lg) var(--ease-out);
}
.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .js-reveal .reveal { opacity: 1; transform: none; }
}
