/*
 * BCW Public Knowledge Portal - design tokens & components.
 *
 * BCW-Grün is the primary accent per spec. No real BCW brand color file
 * exists anywhere in this repository (checked: no logo, no style guide,
 * no color spec) - this is therefore a considered PLACEHOLDER green,
 * clearly isolated in the tokens below so it is a one-line swap once the
 * real brand color is supplied. Chosen for AA text contrast on white and
 * a calm, professional (not playful) feel.
 *
 * Vanilla CSS only - no framework, no external fonts.
 */

:root {
    /* --- Placeholder BCW brand palette - swap here once real values
       are supplied. --- */
    --color-primary: #1c7a4d;
    --color-primary-dark: #145c3a;
    --color-primary-tint: #eaf6ef;
    --color-primary-tint-strong: #d3ecdd;

    --color-bg: #f7f9f7;
    --color-surface: #ffffff;
    --color-text: #1b241f;
    --color-text-muted: #57655d;
    --color-border: #dfe6e1;

    --color-danger-bg: #fdecec;
    --color-danger-text: #7a2323;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 3px rgba(20, 30, 25, 0.07), 0 1px 2px rgba(20, 30, 25, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 40, 30, 0.10);

    --max-width: 1240px;
    --reading-width: 42rem;

    --font-body: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

    font-size: 16px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Accessibility helpers --- */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--color-primary);
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 100;
    text-decoration: none;
}
.skip-link:focus {
    left: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Header / brand --- */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: var(--color-text);
    flex: none;
}

.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    flex: none;
}
.brand-logo {
    display: block;
    height: 2.75rem;
    width: auto;
    max-width: 11rem;
    object-fit: contain;
}
.brand-logo[hidden] {
    display: none;
}

/* Fallback shown only if the real logo (loaded from LOGO_URL in app.js)
   fails - see initBrandLogo(). Not a "designed" logo, just a legible
   text badge so the header never looks broken. */
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    width: 2.5rem;
    height: 2.5rem;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    flex: none;
}
/* Author-origin `display` always wins over the user-agent `[hidden]`
   default at equal specificity, so without this override the JS-toggled
   `hidden` attribute (initBrandLogo()) would never actually hide the
   badge - it would keep rendering next to a successfully loaded logo.
   Same fix already applied to .brand-logo[hidden] above. */
.brand-mark[hidden] {
    display: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.header-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}
.header-nav a:hover {
    color: var(--color-primary-dark);
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.3rem 0.3rem 1.1rem;
    flex: 1 1 260px;
    max-width: 380px;
    margin-left: auto;
}
.header-search input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    outline: none;
    color: var(--color-text);
    min-width: 0;
}
.header-search button {
    border: none;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-pill);
    width: 2.3rem;
    height: 2.3rem;
    min-width: 2.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.header-search button:hover {
    background: var(--color-primary-dark);
}

/* --- Breadcrumb --- */

.breadcrumb {
    margin: 1.5rem 0 0;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}
.breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb .sep {
    margin: 0 0.45rem;
}

/* --- Hero --- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2.25rem 1rem 2rem;
    margin: 1.25rem 0 2rem;
    background: linear-gradient(180deg, var(--color-primary-tint) 0%, rgba(234, 246, 239, 0) 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.hero__content {
    text-align: center;
    max-width: 40rem;
    position: relative;
    z-index: 1;
}

.hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin: 0 0 0.6rem;
}

.hero h1 {
    font-size: clamp(1.7rem, 3.2vw, 2.5rem);
    margin: 0 0 0.75rem;
    color: var(--color-text);
}

.hero__biber {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    opacity: 0.9;
    z-index: 0;
}

.hero-search {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    max-width: 32rem;
    margin: 1.1rem auto 0;
}
.hero-search input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    font-size: 1rem;
    background: var(--color-surface);
}
.hero-search button {
    border: none;
    background: var(--color-primary);
    color: #fff;
    padding: 0 1.5rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.15s ease;
}
.hero-search button:hover {
    background: var(--color-primary-dark);
}

/* --- Section headings --- */

.section {
    margin: 2.5rem 0;
}
.section > h2 {
    font-size: 1.3rem;
    margin: 0 0 1.1rem;
    color: var(--color-text);
}

/* --- Cards (shared look) --- */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--color-text);
    display: block;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-tint-strong);
}

.article-grid,
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

/* A single card should look deliberate, not stretched across the whole
   row like a half-filled template (spec 6). */
.article-grid.grid--single,
.category-grid.grid--single {
    grid-template-columns: minmax(0, 22rem);
    justify-content: start;
}

.article-card {
    padding: 1.25rem 1.35rem;
}
.card__title {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    color: var(--color-primary-dark);
}
.card__excerpt {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.badge {
    display: inline-block;
    background: var(--color-primary-tint);
    color: var(--color-primary-dark);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    margin-bottom: 0.5rem;
}

/* --- Category cards --- */

.category-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.35rem 1.4rem;
    display: flex;
    flex-direction: column;
    /* Equal-looking heights within a row without forcing an exact
       number: grid items stretch to the tallest by default, and the
       subcats disclosure (if present) is pinned to the bottom below. */
    height: 100%;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.category-card:hover,
.category-card:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-tint-strong);
}
.category-card__title {
    margin: 0 0 0.75rem;
    font-size: 1.08rem;
    color: var(--color-text);
    padding-left: 0.85rem;
    border-left: 4px solid var(--color-primary);
}
.category-card__articles {
    list-style: none;
    margin: 0;
    padding: 0;
}
.category-card__articles li + li {
    margin-top: 0.5rem;
}
.category-card__articles a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.94rem;
    display: block;
    padding: 0.35rem 0.1rem;
    border-radius: 6px;
}
.category-card__articles a:hover {
    color: var(--color-primary-dark);
    background: var(--color-primary-tint);
}
.category-card__empty {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.category-card__subcats {
    margin-top: auto;
    padding-top: 0.9rem;
    border-top: 1px solid var(--color-border);
}
.category-card__subcats summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    list-style: none;
}
.category-card__subcats summary::-webkit-details-marker {
    display: none;
}
.category-card__subcats summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 0.4rem;
    transition: transform 0.15s ease;
}
.category-card__subcats[open] summary::before {
    transform: rotate(90deg);
}

/* No connecting "tree lines" - subcategories read as a spaced,
   indented list rather than a technical folder tree. */
.category-sublist {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}
.category-sublist > li + li {
    margin-top: 0.75rem;
}
.category-sublist__name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0 0 0.35rem;
    padding-left: 0.7rem;
    border-left: 3px solid var(--color-primary-tint-strong);
}
.category-sublist ul {
    list-style: none;
    margin: 0;
    padding: 0 0 0 0.7rem;
}
.category-sublist a {
    color: var(--color-primary-dark);
    text-decoration: none;
    font-size: 0.88rem;
    display: block;
    padding: 0.2rem 0;
}
.category-sublist a:hover {
    text-decoration: underline;
}

/* --- Article layout --- */

.article-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.article-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem clamp(1.25rem, 4vw, 3rem);
    max-width: calc(var(--reading-width) + 6rem);
}
.article-body h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    max-width: var(--reading-width);
}
.article-meta {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin: 0 0 1.75rem;
}

/* --- Article body typography (redakteur-freundlich, kein Inline-CSS
   nötig - siehe spec 7/9) --- */

.article-content {
    max-width: var(--reading-width);
    font-size: 1.02rem;
}

/* A small accent dot before each <h2> adds visual rhythm to long
   articles (spec 8: "etwas mehr visuelle Führung, weniger große weiße
   Textfläche") without any extra markup from the editor. */
.article-content h2 {
    font-size: 1.35rem;
    margin: 2.75rem 0 1rem;
    color: var(--color-text);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    scroll-margin-top: 5.5rem;
}
.article-content h2::before {
    content: '';
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-primary);
    flex: none;
}
.article-content h2:first-child {
    margin-top: 0;
}
.article-content h3 {
    font-size: 1.12rem;
    margin: 1.6rem 0 0.7rem;
    color: var(--color-text);
    line-height: 1.35;
}
.article-content p {
    margin: 0 0 1.15rem;
    line-height: 1.7;
}
.article-content ul,
.article-content ol {
    margin: 0 0 1.15rem;
    padding-left: 1.4rem;
    line-height: 1.65;
}
.article-content li + li {
    margin-top: 0.35rem;
}
.article-content strong {
    color: var(--color-text);
    font-weight: 700;
}
.article-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.article-content img {
    display: block;
    margin: 1.25rem auto;
    border-radius: var(--radius-sm);
    max-width: 100%;
    height: auto;
}

/* Links: plain, recognizable text links in running copy. A link that is
   the sole content of its paragraph reads as a deliberate call-to-action
   in EspoCRM articles, so it gets a dedicated CTA treatment - pure CSS
   (:has()), no DOM manipulation of article content. */
.article-content a {
    color: var(--color-primary-dark);
    text-decoration: underline;
    text-decoration-color: var(--color-primary-tint-strong);
    text-underline-offset: 2px;
}
.article-content a:hover {
    text-decoration-color: currentColor;
}
.article-content p > a:only-child {
    display: inline-block;
    text-decoration: none;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-pill);
    margin-top: 0.25rem;
}
.article-content p > a:only-child:hover {
    background: var(--color-primary-dark);
}

/* Blockquote -> hochwertige BCW-Hinweisbox, automatisch, ohne
   Inline-CSS im Artikel (spec 12). */
.article-content blockquote {
    margin: 1.5rem 0;
    padding: 1.1rem 1.4rem;
    background: var(--color-primary-tint);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    color: var(--color-text);
}
.article-content blockquote p:last-child {
    margin-bottom: 0;
}
.article-content blockquote strong:first-child {
    color: var(--color-primary-dark);
}

/* Tables: normal data tables stay clearly gridded and readable. A table
   used purely for layout (e.g. an editor placing a Biber image next to
   text side-by-side) is detected via a robust CSS-only heuristic - a
   table containing an <img> - and rendered borderless/transparent
   instead of like a spreadsheet (spec 11: "keine fragile
   DOM-Manipulation, wenn eine robuste CSS-Lösung möglich ist"). */
.article-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
.article-content th,
.article-content td {
    border: 1px solid var(--color-border);
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.article-content th {
    background: var(--color-bg);
    font-weight: 700;
}
.article-content table:has(img) {
    border: none;
}
.article-content table:has(img) th,
.article-content table:has(img) td {
    border: none;
    background: transparent;
    padding: 0.5rem;
    vertical-align: middle;
}
.article-content table:has(img) img {
    margin: 0;
}

/* Horizontally-scrollable safety net for a wide data table on narrow
   viewports, without ever scrolling the page itself. */
.article-content table:not(:has(img)) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Article sidebar: stacked cards (spec 9) ---
   A) "Gut zu wissen" (.tip-card) - always shown.
   B) "In diesem Artikel" (.toc-card) - only if there are <h2> headings.
   C) "Passende Artikel" (.related-card) - only if relatedArticles exist.
   Each is omitted entirely (not rendered empty) when not applicable -
   see app.js articleSidebar(). */

.article-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 5.5rem;
}

.sidebar-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
}
.sidebar-card__title {
    margin: 0 0 0.85rem;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--color-text);
}

.tip-card {
    background: var(--color-primary-tint);
    border-color: var(--color-primary-tint-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
}
.tip-card__biber {
    width: 84px;
    height: 84px;
}
.tip-card .sidebar-card__title {
    margin: 0;
    color: var(--color-primary-dark);
}
.tip-card__body p {
    margin: 0 0 0.9rem;
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.55;
}
.tip-card__link {
    color: var(--color-primary-dark);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
}
.tip-card__link:hover {
    text-decoration: underline;
}

.toc-list,
.related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc-list li + li,
.related-list li + li {
    margin-top: 0.55rem;
}
.toc-list a,
.related-list a {
    display: block;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.15rem 0;
    border-left: 2px solid var(--color-border);
    padding-left: 0.7rem;
}
.toc-list a:hover,
.related-list a:hover {
    color: var(--color-primary-dark);
    border-left-color: var(--color-primary);
}

/* Shared width for elements below the two-column article layout
   (feedback widget, contact box) - matches .article-body's width so they
   visually line up with the article column above, left-aligned rather
   than centered across the whole page (spec 5: "über die
   Artikelbreite laufen"). */
.article-below-width {
    max-width: calc(var(--reading-width) + 6rem);
    margin-top: 2rem;
}

/* --- "War dieser Artikel hilfreich?" feedback widget --- */

.feedback-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem clamp(1.25rem, 4vw, 2rem);
    text-align: center;
}
.feedback-widget__question {
    margin: 0 0 1rem;
    font-weight: 700;
    font-size: 1rem;
}
.feedback-widget__buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.feedback-widget__button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.feedback-widget__button:hover:not(:disabled) {
    border-color: var(--color-primary);
    background: var(--color-primary-tint);
}
.feedback-widget__button:disabled {
    opacity: 0.55;
    cursor: default;
}
.feedback-widget__status {
    margin: 0.9rem 0 0;
    min-height: 1.2rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.feedback-widget--done .feedback-widget__thanks {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.feedback-widget__biber {
    width: 56px;
    height: 56px;
}
.feedback-widget--done p {
    margin: 0;
    font-weight: 600;
    color: var(--color-primary-dark);
}

/* --- Contact box --- */

.contact-box {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--color-primary-tint);
    border: 1px solid var(--color-primary-tint-strong);
    border-radius: var(--radius-lg);
    padding: 1.5rem clamp(1.25rem, 4vw, 2rem);
    flex-wrap: wrap;
}
.contact-box__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-primary-dark);
    flex: none;
}
.contact-box__text {
    flex: 1 1 16rem;
}
.contact-box__title {
    margin: 0 0 0.2rem;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--color-text);
}
.contact-box__subtitle {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
}
.contact-box__cta {
    display: inline-block;
    flex: none;
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.94rem;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.contact-box__cta:hover {
    background: var(--color-primary-dark);
}

/* --- Generic state / loading messages --- */

.loading-hint {
    color: var(--color-text-muted);
    padding: 2rem 0;
    text-align: center;
}

.state-message {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--color-text-muted);
}
.state-message h1 {
    color: var(--color-text);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.button-primary {
    display: inline-block;
    margin-top: 1rem;
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-pill);
}
.button-primary:hover {
    background: var(--color-primary-dark);
}

/* --- Search page --- */

.search-page h1 {
    font-size: 1.6rem;
    margin: 0 0 1.25rem;
}
.search-form-page {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
    max-width: 32rem;
}
.search-form-page input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    font-size: 1rem;
}
.search-form-page button {
    border: none;
    background: var(--color-primary);
    color: #fff;
    padding: 0 1.3rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 600;
}
.search-form-page button:hover {
    background: var(--color-primary-dark);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}
.pagination span {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.pagination button {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
}
.pagination button:hover:not([disabled]) {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}
.pagination button[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* --- Footer --- */

.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: 3.5rem;
    padding: 2rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.footer-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: none;
}
.footer-brand-logo-wrap {
    display: inline-flex;
}
.footer-brand-logo {
    height: 1.75rem;
    max-width: 8rem;
}
.footer-brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.6rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-left: auto;
}
.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.footer-links a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.footer-copyright {
    margin: 0;
    width: 100%;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
}

/* ==================================================================
   Responsive breakpoints
   Desktop >= 1200px (default styles above already suit this)
   Tablet ~768-1024px, Smartphone ~375-430px
   ================================================================== */

/* Tablet and up: article gets its two-column layout with the sidebar. */
@media (min-width: 900px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
    }
}

/* Below that, the sidebar simply follows the article in normal document
   flow - it must not stay sticky once it is no longer beside the
   article, or it would float oddly over stacked content. */
@media (max-width: 899px) {
    .article-sidebar {
        position: static;
    }
}

/* Keep the header nav out of the way once brand + nav + search no
   longer comfortably fit on one line (spec 2: "keine Überladung",
   "Mobile: kompakt, keine abgeschnittenen Elemente"). */
@media (max-width: 860px) {
    .header-nav {
        display: none;
    }
}

/* Tablet: tighten hero/card spacing slightly, keep single-column
   category/article grids readable rather than cramped. */
@media (max-width: 1024px) {
    .hero {
        padding: 2rem 1rem 1.75rem;
    }
    .hero__biber {
        width: 88px;
        height: 88px;
        top: 0.75rem;
        right: 1rem;
    }
}

/* Smartphone: single column everywhere, comfortable touch targets, the
   Biber never displaces content - decorative Biber images are hidden or
   shrunk rather than pushing text around, and cards/boxes that are
   normally side-by-side stack vertically. */
@media (max-width: 600px) {
    :root {
        font-size: 15.5px;
    }

    .wrap {
        padding: 0 1.1rem;
    }

    .header-row {
        padding: 0.75rem 1.1rem;
        gap: 0.75rem;
    }

    .brand-logo {
        height: 2.1rem;
        max-width: 7.5rem;
    }

    .header-search {
        max-width: none;
        flex-basis: 100%;
        order: 3;
    }

    .hero {
        margin: 1rem 0 2rem;
        padding: 1.75rem 1rem 1.5rem;
        border-radius: var(--radius-md);
    }
    .hero__biber {
        display: none;
    }
    .hero-search {
        flex-direction: column;
    }
    .hero-search button {
        padding: 0.85rem;
    }

    .article-body {
        padding: 1.5rem 1.15rem;
        border-radius: var(--radius-md);
    }

    .category-grid,
    .article-grid {
        grid-template-columns: 1fr;
    }

    .contact-box {
        flex-direction: column;
        text-align: center;
    }
    .contact-box__text {
        /* Reset the row-layout flex-basis (16rem) - in column direction
           it would otherwise be read as a height, leaving a tall empty
           gap under the text. */
        flex: initial;
    }
    .contact-box__cta {
        width: 100%;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .footer-links {
        margin-left: 0;
    }
}
