/* ==========================================================================
   Base — Reset, Grundtypografie und globale Elementstile
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    tab-size: 4;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: var(--fs-15);
    line-height: var(--lh-normal);
    color: var(--text-primary);
    background: var(--surface-base);
}

/* ── Überschriften ───────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    letter-spacing: -0.011em;
    color: var(--text-primary);
}

h1 { font-size: var(--fs-28); }
h2 { font-size: var(--fs-22); }
h3 { font-size: var(--fs-18); }
h4 { font-size: var(--fs-16); }
h5, h6 { font-size: var(--fs-14); }

p { line-height: var(--lh-normal); }

small { font-size: var(--fs-13); }

code, pre, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    background: var(--surface-sunken);
    color: var(--text-secondary);
}

pre {
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    overflow-x: auto;
}
pre code { padding: 0; background: none; }

hr {
    border: 0;
    border-top: 1px solid var(--border-subtle);
}

/* ── Links ───────────────────────────────────────────────────────────── */
a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}
a:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

/* ── Listen ──────────────────────────────────────────────────────────── */
ul, ol { padding-left: var(--space-5); }
ul.list-plain, ol.list-plain { list-style: none; padding-left: 0; }

/* ── Medien ──────────────────────────────────────────────────────────── */
img, svg, video, canvas {
    display: block;
    max-width: 100%;
}

/* ── Formular-Elemente erben Schrift ─────────────────────────────────── */
button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}
button:disabled { cursor: not-allowed; }

/* ── Fokus: sichtbar nur bei Tastaturbedienung ───────────────────────── */
:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Auswahl ─────────────────────────────────────────────────────────── */
::selection {
    background: var(--brand-soft);
    color: var(--text-primary);
}

/* ── Scrollbars (WebKit) ─────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: var(--radius-pill);
    background-clip: content-box;
    background-color: var(--border-strong);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-disabled); }

/* ── Icons ───────────────────────────────────────────────────────────── */
/* Inline-SVGs werden von icons.js in .icon[data-icon] eingesetzt. */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    font-size: 18px;
    line-height: 1;
}
.icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-xs { font-size: 13px; }
.icon-sm { font-size: 15px; }
.icon-lg { font-size: 22px; }
.icon-xl { font-size: 28px; }

/* ── Ladeindikator ───────────────────────────────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) var(--space-4);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 2.5px solid var(--border-default);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reduzierte Bewegung respektieren ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
