/**
 * Base styles — Reset, Container, Header/Footer/Nav, generische Utilities.
 * Komponentenstile (Grade-Badge, Ampeln, Kategorie-Block) liegen in
 * separaten Dateien unter /blocks/ bzw. werden im jeweiligen Block-CSS
 * eingebunden.
 */

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
}

body {
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }

a {
    color: var(--terracotta-ink);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
a:hover { color: var(--terracotta); }

/* Alle Headings serif mit balanced wrap — entspricht Handoff */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--ink);
    margin: 0;
    text-wrap: balance;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(44px, 5.6vw, 88px); line-height: 1.02; letter-spacing: -0.025em; }
h2 { font-size: clamp(30px, 3vw, 44px);   line-height: 1.10; letter-spacing: -0.015em; }
h3 { font-size: 22px; line-height: 1.25; }
h4 {
    font-size: 16px; line-height: 1.3;
    font-family: var(--font-sans); font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--ink-2);
}

p { margin: 0 0 1em 0; text-wrap: pretty; }

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--r);
}

/* Tabellen-Zahlen ausrichten (Noten, Preise, Prozent) */
.tabular, .grade, .price, .score {
    font-variant-numeric: tabular-nums;
}

/* Skip-Link (a11y) — Enter-fokussierbar aus dem Nichts */
.skip-link {
    position: absolute; left: -9999px; top: auto;
    width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
    left: 16px; top: 16px; width: auto; height: auto;
    padding: 10px 16px; background: var(--ink); color: #fff;
    z-index: 9999; border-radius: var(--r);
}
.screen-reader-text {
    clip: rect(1px,1px,1px,1px); position: absolute !important;
    width: 1px; height: 1px; overflow: hidden;
}

/* Container — zwei Breiten, beide mit einheitlichem horizontalem Padding */
.container        { max-width: var(--maxw);        margin: 0 auto; padding: 0 var(--pad-x); }
.container-narrow { max-width: var(--maxw-narrow); margin: 0 auto; padding: 0 var(--pad-x); }

/* ---------- SITE HEADER ---------- */

.site-header {
    position: sticky; top: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    z-index: 100;
}
.site-header__inner {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 18px; padding-bottom: 18px;
    gap: 32px;
}

.site-brand {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.015em;
}
.site-brand__mark { color: var(--ink); }
.site-brand__text { white-space: nowrap; }
.site-brand__dot  { color: var(--terracotta); }

.site-nav__list {
    list-style: none; margin: 0; padding: 0;
    display: flex; gap: 28px; align-items: center;
}
.site-nav__list a {
    color: var(--ink);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
}
.site-nav__list a:hover { color: var(--terracotta-ink); }

/* ---------- SITE FOOTER ---------- */

.site-footer {
    margin-top: 96px;
    background: var(--ink);
    color: var(--bg-2);
    padding: 64px 0 32px;
}
.site-footer a { color: var(--bg); }
.site-footer__brand { margin-bottom: 32px; }
.site-footer__mark {
    font-family: var(--font-serif); font-size: 24px; color: var(--bg);
}
.site-footer__tagline {
    color: var(--bg-2); opacity: 0.8;
    max-width: 42ch;
}
.site-footer__list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
}
.site-footer__list a { font-size: 15px; }
.site-footer__legal {
    margin-top: 32px;
    font-size: 13px;
    color: var(--ink-3);
}

/* ---------- POST (single.php) ---------- */

.kf-post { padding: 40px 0 80px; }

.kf-post__header { padding-bottom: 32px; }

.kf-post__title {
    font-size: clamp(32px, 4.2vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 10px 0 20px 0;
}

.kf-post__lede {
    font-family: var(--font-serif);
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.5;
    color: var(--ink-2);
    margin: 0 0 24px 0;
    max-width: 58ch;
}

.kf-post__meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--ink-3);
    font-family: var(--font-sans);
}
.kf-post__author { color: var(--ink-2); font-weight: 500; }

.kf-post__hero {
    margin: 0 0 48px 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: var(--bg-2);
}
.kf-post__hero img { width: 100%; height: 100%; object-fit: cover; }

.kf-post__content {
    font-size: 18px;
    color: var(--ink-2);
    line-height: 1.65;
}
.kf-post__content h2,
.kf-post__content h3 {
    margin-top: 40px;
    margin-bottom: 12px;
    color: var(--ink);
}
.kf-post__content p { margin: 0 0 1.2em 0; max-width: 65ch; }
.kf-post__content a { color: var(--terracotta-ink); }

/* ---------- 404 ---------- */

.kf-404 { padding: 80px 0 100px; }
.kf-404__title {
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 16px 0 24px 0;
}
.kf-404__lede {
    font-family: var(--font-serif);
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.5;
    color: var(--ink-2);
    margin: 0 0 32px 0;
    max-width: 58ch;
}
.kf-404__links { list-style: none; margin: 0 0 40px 0; padding: 0; }
.kf-404__links li { padding: 12px 0; border-bottom: 1px dashed var(--rule); }
.kf-404__links a {
    font-family: var(--font-serif);
    font-size: 18px;
    color: var(--terracotta-ink);
    text-decoration: none;
}
.kf-404__links a:hover { color: var(--terracotta); text-decoration: underline; }
.kf-404__search { display: flex; gap: 8px; max-width: 500px; }

/* ---------- SEARCH ---------- */

.kf-search { padding: 40px 0 80px; }
.kf-search__head { margin-bottom: 40px; max-width: 700px; }
.kf-search__title {
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.1;
    margin: 10px 0 24px 0;
}
.kf-search__form { display: flex; gap: 8px; }

.kf-404__search input,
.kf-search__form input {
    flex: 1;
    padding: 14px 18px;
    font-family: var(--font-sans);
    font-size: 16px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    background: var(--bg);
    color: var(--ink);
}
.kf-404__search input:focus,
.kf-search__form input:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: var(--focus-ring);
}

.kf-search__list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 12px;
}
.kf-search__item {
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.kf-search__item:hover { border-color: var(--ink-3); background: var(--bg-2); }
.kf-search__link {
    display: block;
    padding: 20px 24px;
    text-decoration: none;
    color: inherit;
}
.kf-search__type {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--terracotta-ink);
}
.kf-search__item-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    margin: 6px 0 8px 0;
    color: var(--ink);
    line-height: 1.25;
}
.kf-search__item-summary {
    font-size: 15px;
    color: var(--ink-2);
    margin: 0;
    max-width: 72ch;
}
.kf-search__empty {
    border: 1px dashed var(--rule);
    padding: 32px;
    border-radius: var(--r-lg);
    color: var(--ink-2);
}
.kf-search__empty ul { margin-top: 12px; padding-left: 24px; }
.kf-search__empty a { color: var(--terracotta-ink); }

/* ---------- RELATED POSTS (single.php) ---------- */

.kf-related-posts {
    margin-top: 80px;
    padding: 56px 0;
    background: var(--bg-2);
    border-top: 1px solid var(--rule);
}
.kf-related-posts__head { margin-bottom: 32px; }
.kf-related-posts__head h2 { margin: 0; }
.kf-related-posts__grid {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.kf-related-posts__card {
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    background: var(--bg);
    transition: border-color 0.15s ease;
}
.kf-related-posts__card:hover { border-color: var(--ink-3); }
.kf-related-posts__link {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.kf-related-posts__link h3 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 500;
    margin: 0;
    color: var(--ink);
    line-height: 1.25;
}
.kf-related-posts__link p {
    font-size: 14px;
    color: var(--ink-2);
    line-height: 1.5;
    margin: 0;
    flex: 1;
}
.kf-related-posts__more {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--terracotta-ink);
}
@media (max-width: 900px) {
    .kf-related-posts__grid { grid-template-columns: 1fr; }
    .kf-404__search, .kf-search__form { flex-direction: column; }
}

/* ---------- KONTAKTFORMULAR ---------- */

.kf-contact {
    display: grid;
    gap: 20px;
    max-width: 620px;
    margin: 40px 0;
    padding: 32px 36px;
    background: var(--bg-2);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    position: relative;
}

.kf-contact__honey {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.kf-contact__row { display: grid; gap: 6px; }
.kf-contact__row label {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.kf-contact input[type="text"],
.kf-contact input[type="email"],
.kf-contact textarea {
    padding: 12px 14px;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    width: 100%;
}
.kf-contact input:focus,
.kf-contact textarea:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: var(--focus-ring);
}

.kf-contact textarea {
    resize: vertical;
    min-height: 160px;
    font-family: var(--font-sans);
}

.kf-contact__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-2);
    line-height: 1.45;
}
.kf-contact__consent label { cursor: pointer; display: block; }
.kf-contact__consent input[type="checkbox"] {
    margin-top: 4px;
    accent-color: var(--terracotta);
}
.kf-contact__consent a { color: var(--terracotta-ink); }

.kf-contact button[type="submit"] { justify-self: start; }

.kf-contact__note {
    padding: 14px 18px;
    border-radius: var(--r);
    font-size: 15px;
    font-family: var(--font-sans);
    line-height: 1.5;
}
.kf-contact__note--ok {
    background: rgba(94, 138, 91, 0.12);
    border: 1px solid var(--sage);
    color: var(--sage-ink);
}
.kf-contact__note--err {
    background: rgba(181, 80, 62, 0.08);
    border: 1px solid var(--traffic-red);
    color: var(--traffic-red);
}
.kf-contact__note ul { margin: 8px 0 0 20px; padding: 0; }

/* ---------- RATGEBER-HUB ---------- */

.kf-ratgeber { padding: 40px 0 80px; }
.kf-ratgeber__hero { padding-bottom: 40px; }
.kf-ratgeber__title {
    font-size: clamp(34px, 4.2vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 10px 0 20px 0;
}
.kf-ratgeber__intro p {
    font-family: var(--font-serif);
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.5;
    color: var(--ink-2);
    max-width: 58ch;
    margin: 0 0 1em 0;
}

.kf-ratgeber__category {
    padding: 40px 0;
    border-top: 1px solid var(--rule);
}
.kf-ratgeber__cat-head { margin-bottom: 32px; max-width: 700px; }
.kf-ratgeber__cat-title {
    font-family: var(--font-serif);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 500;
    margin: 0 0 12px 0;
    letter-spacing: -0.015em;
}
.kf-ratgeber__cat-desc { color: var(--ink-2); margin: 0; }

.kf-ratgeber__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.kf-ratgeber__card {
    margin: 0;
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.kf-ratgeber__card:hover { border-color: var(--ink-3); background: var(--bg-2); }

.kf-ratgeber__link {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.kf-ratgeber__card-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.25;
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.kf-ratgeber__card-summary {
    flex: 1;
    margin: 0;
    font-size: 15px;
    color: var(--ink-2);
    line-height: 1.5;
}

.kf-ratgeber__card-more {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--terracotta-ink);
}

@media (max-width: 900px) {
    .kf-ratgeber__grid { grid-template-columns: 1fr; }
}

/* ---------- PAGE ---------- */

.kf-page { padding: 48px 0 80px; }
.kf-page__title { margin-bottom: 32px; }
.kf-page__content {
    font-size: 17px;
    color: var(--ink-2);
    line-height: 1.65;
}
.kf-page__content h2,
.kf-page__content h3 {
    margin-top: 40px;
    margin-bottom: 12px;
    color: var(--ink);
}
.kf-page__content p { margin: 0 0 1em 0; max-width: 65ch; }
.kf-page__content ul,
.kf-page__content ol { max-width: 65ch; padding-left: 24px; }
.kf-page__content li { margin: 6px 0; }
.kf-page__content a { color: var(--terracotta-ink); }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 900px) {
    .site-header__inner { flex-wrap: wrap; gap: 16px; }
    .site-nav__list     { gap: 16px; font-size: 14px; flex-wrap: wrap; }
    :root { --pad-x: 20px; }
}
