/* DIWA – Grundlagen: Reset, Typografie, Fokus, Hilfsklassen */

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

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

body {
    margin: 0;
    background: var(--c-page);
    color: var(--c-text);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

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

[hidden] {
    display: none !important;
}

a {
    color: var(--c-blue);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

/* Links im Fließtext immer unterstrichen (nicht nur über die Farbe erkennbar, BITV 1.4.1) */
main :where(p, dd, li, .hint, .field__help, .alert__body) a:not([class]):not(:where(nav, .tiles, .tabs, .pagination) a) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

p,
ul,
ol,
dl,
table,
fieldset {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

p {
    max-width: 75ch;
}

p:last-child,
ul:last-child,
ol:last-child,
dl:last-child {
    margin-bottom: 0;
}

ul,
ol {
    padding-left: 1.25em;
}

hr {
    border: 0;
    border-top: 1px solid var(--c-line);
    margin: var(--space-5) 0;
}

strong,
b {
    font-weight: 700;
}

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

h1,
h2,
h3,
h4 {
    margin: 0 0 var(--space-3);
    color: var(--c-heading);
}

h1 { font-size: var(--fs-h1); font-weight: 700; line-height: 1.3; }
h2 { font-size: var(--fs-h2); font-weight: 400; line-height: 1.3; }
h3 { font-size: var(--fs-h3); font-weight: 400; line-height: 1.4; }
h4 { font-size: var(--fs-base); font-weight: 700; line-height: 1.4; }

code,
kbd {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9em;
    padding: 0.05em 0.35em;
    border-radius: var(--radius);
    background: var(--c-panel);
    color: var(--c-text-strong);
}

pre {
    overflow-x: auto;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    background: var(--c-panel);
    font-size: var(--fs-small);
}

/* Fokus: deutlich sichtbar auf weißen, grauen und farbigen Flächen (WCAG 2.4.7 / 2.4.11) */
:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 2px;
}

::selection {
    background: var(--brand-accent-soft);
    color: var(--c-text-strong);
}

/* ---- Hilfsklassen --------------------------------------------------------- */

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: var(--space-2) var(--space-4);
    background: var(--c-blue);
    color: #fff;
    font-weight: 500;
}

.skip-link:focus {
    left: var(--space-2);
    top: var(--space-2);
}

.icon {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -0.2em;
}

.num {
    font-variant-numeric: tabular-nums;
}

.muted,
.text-muted {
    color: var(--c-muted);
}

.subtle,
.text-small {
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.nowrap {
    white-space: nowrap;
}

.align-right {
    text-align: right;
}

.stack > * + * {
    margin-top: var(--space-4);
}

.stack-lg > * + * {
    margin-top: var(--space-6);
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.spread {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-5);
}

@media (max-width: 900px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@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;
    }
}

@media (forced-colors: active) {
    :focus-visible {
        outline: 3px solid CanvasText;
    }
}
