/*
 * wievielschenken.de – schlankes, mobile-first CSS ohne Framework.
 * Ein auffälliges Element: der Betrag im mintgrünen Geldumschlag mit Lasche. Alles andere bleibt ruhig.
 * Nur System-Schriften, keine externen Requests. Die Serife für Betrag und Überschriften erinnert an eine Glückwunschkarte.
 */

:root {
    --tinte: #1d2b24;
    --tinte-weich: #56655d;
    --papier: #ffffff;
    --umschlag: #cfe8d8;
    --umschlag-lasche: #b8dcc6;
    --umschlag-falz: #9fcbb0;
    --beere: #a3243b;
    --linie: #e1e7e3;
    --schalter-aus: #b9c3bd;

    --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --schrift-karte: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;

    --rand: 1.25rem;
    --breite: 62rem;
}

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

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

body {
    margin: 0;
    background: var(--papier);
    color: var(--tinte);
    font-family: var(--schrift);
    font-size: 1.0625rem;
    line-height: 1.55;
}

h1,
h2 {
    font-family: var(--schrift-karte);
    line-height: 1.15;
    text-wrap: balance;
}

h2 {
    margin: 0 0 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
}

a {
    color: var(--beere);
    text-underline-offset: 0.15em;
}

:focus-visible {
    outline: 3px solid var(--beere);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

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

/* ─── Rahmen ─────────────────────────────────────────────── */

.kopf,
.seite,
.fuss {
    max-width: var(--breite);
    margin-inline: auto;
    padding-inline: var(--rand);
}

.kopf {
    padding-block: 1rem;
}

.kopf__marke {
    color: var(--tinte);
    font-family: var(--schrift-karte);
    font-size: 1.1875rem;
    font-weight: 700;
    text-decoration: none;
}

.titel {
    max-width: 24ch;
    margin: 1rem 0 0.75rem;
    font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.einleitung {
    max-width: 38rem;
    margin: 0;
    color: var(--tinte-weich);
    font-size: 1.125rem;
}

.einleitung p {
    margin: 0 0 0.75rem;
}

.einleitung p:last-child {
    margin-bottom: 0;
}

.fuss {
    margin-top: 4rem;
    padding-block: 2rem;
    border-top: 1px solid var(--linie);
    color: var(--tinte-weich);
    font-size: 0.9375rem;
}

.fuss__links {
    display: flex;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fuss__links a {
    color: inherit;
}

.fuss__nachbar {
    margin: 1rem 0 0;
}

/* ─── Rechner ────────────────────────────────────────────── */

.rechner {
    display: grid;
    gap: 2.5rem;
    margin-top: 1.75rem;
}

/* Am Desktop links die Auswahl, rechts der Umschlag, der beim Scrollen stehen bleibt */
@media (min-width: 52rem) {
    .rechner {
        grid-template-columns: minmax(0, 1fr) minmax(0, 23rem);
        gap: 3.5rem;
        align-items: start;
    }

    .rechner .umschlag {
        position: sticky;
        top: 1.5rem;
        grid-column: 2;
        grid-row: 1;
    }

    .rechner .auswahl {
        grid-column: 1;
        grid-row: 1;
    }
}

/* ─── Der Umschlag ───────────────────────────────────────── */

.umschlag {
    position: relative;
    overflow: hidden;
    padding: 4.75rem 1.5rem 1.5rem;
    border-radius: 0.625rem;
    background: var(--umschlag);
}

/* Lasche: ein Dreieck von der Oberkante, darunter eine Spur dunkler als Falz */
.umschlag::before,
.umschlag::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.umschlag::after {
    height: calc(3.75rem + 2px);
    background: var(--umschlag-falz);
}

.umschlag::before {
    z-index: 1;
    height: 3.75rem;
    background: var(--umschlag-lasche);
}

.umschlag > * {
    position: relative;
    z-index: 2;
}

.umschlag__kontext {
    margin: 0;
    color: var(--tinte-weich);
    font-weight: 600;
}

.umschlag__betrag {
    margin: 0.125rem 0 0.25rem;
    font-family: var(--schrift-karte);
    font-size: clamp(3.75rem, 2rem + 11vw, 6rem);
    font-variant-numeric: lining-nums tabular-nums;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Der neue Betrag rutscht in den Umschlag */
.umschlag__betrag.ist-neu {
    animation: einstecken 0.3s ease-out;
}

@keyframes einstecken {
    from {
        opacity: 0.35;
        transform: translateY(0.15em);
    }
}

.umschlag__spanne {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.umschlag__spanne span {
    white-space: nowrap;
}

.umschlag__begruendung {
    margin: 1rem 0 0;
}

.umschlag__hinweis {
    margin: 0.75rem 0 0;
    color: var(--tinte-weich);
    font-size: 0.9375rem;
}

.umschlag__teilen {
    margin-top: 1.25rem;
}

/* ─── Auswahl ────────────────────────────────────────────── */

.auswahl {
    display: grid;
    gap: 2rem;
}

.auswahl__gruppe {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.auswahl__frage {
    margin-bottom: 0.75rem;
    padding: 0;
    font-family: var(--schrift-karte);
    font-size: 1.25rem;
    font-weight: 700;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    position: relative;
    cursor: pointer;
}

/* Das Radio bleibt bedienbar (Tastatur, Screenreader), sichtbar ist nur die Pille */
.chip__eingabe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.chip__text {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 1rem;
    border: 2px solid var(--linie);
    border-radius: 999px;
    background: var(--papier);
    font-weight: 600;
    line-height: 1.2;
}

.chip:hover .chip__text {
    border-color: var(--umschlag-falz);
}

.chip__eingabe:checked + .chip__text {
    border-color: var(--tinte);
    background: var(--tinte);
    color: var(--papier);
}

.chip__eingabe:focus-visible + .chip__text {
    outline: 3px solid var(--beere);
    outline-offset: 2px;
}

.schalter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    padding-block: 0.25rem;
    cursor: pointer;
}

.schalter__eingabe {
    position: relative;
    flex: none;
    width: 2.75rem;
    height: 1.625rem;
    margin: 0;
    border-radius: 999px;
    background: var(--schalter-aus);
    cursor: pointer;
    appearance: none;
    transition: background-color 0.15s;
}

.schalter__eingabe::before {
    content: "";
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: var(--papier);
    transition: transform 0.15s;
}

.schalter__eingabe:checked {
    background: var(--tinte);
}

.schalter__eingabe:checked::before {
    transform: translateX(1.125rem);
}

.schalter__text {
    font-weight: 600;
}

/* ─── Knöpfe ─────────────────────────────────────────────── */

.knopf {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 1.1rem;
    border: 2px solid var(--tinte);
    border-radius: 0.75rem;
    background: var(--tinte);
    color: var(--papier);
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.knopf:hover {
    border-color: var(--beere);
    background: var(--beere);
    color: var(--papier);
}

.knopf--still {
    background: transparent;
    color: var(--tinte);
}

/* ─── Richtwert-Tabelle ──────────────────────────────────── */

.richtwerte {
    max-width: 40rem;
    margin-top: 2.5rem;
}

.tabelle {
    overflow-x: auto;
}

.richtwerte__tabelle {
    width: 100%;
    border-collapse: collapse;
}

.richtwerte__tabelle th,
.richtwerte__tabelle td {
    padding: 0.75rem 1rem 0.75rem 0;
    border-bottom: 1px solid var(--linie);
    text-align: left;
    vertical-align: baseline;
}

.richtwerte__tabelle thead th {
    padding-block: 0.5rem;
    border-bottom: 2px solid var(--tinte);
    color: var(--tinte-weich);
    font-size: 0.875rem;
    font-weight: 600;
}

.richtwerte__tabelle tbody th {
    font-weight: 600;
}

.richtwerte__tabelle td {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.richtwerte__betrag {
    font-family: var(--schrift-karte);
    font-size: 1.25rem;
    font-weight: 700;
}

.richtwerte__hinweis {
    margin: 1rem 0 0;
    color: var(--tinte-weich);
    font-size: 0.9375rem;
}

/* ─── Verweise (Anlässe, Beziehungen) ────────────────────── */

.verweise {
    margin-top: 3.5rem;
}

/* Verweise sind Navigation, keine Auswahl: deshalb Textlinks statt Pillen wie bei den Chips im Rechner */
.verweise__liste {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.verweise__liste a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    font-weight: 600;
}

.verweise__liste a[aria-current="page"] {
    color: var(--tinte);
    text-decoration: none;
    cursor: default;
}

.verweise__mehr {
    margin: 1rem 0 0;
}

/* ─── Textabschnitte ─────────────────────────────────────── */

.text {
    max-width: 40rem;
    margin-top: 4rem;
}

.text > .titel {
    margin-top: 0;
}

.text h2 {
    margin-top: 2rem;
}

.text > h2:first-child {
    margin-top: 0;
}

/* ─── Fehlerseiten ───────────────────────────────────────── */

.fehlercode {
    margin: 0 0 0.25rem;
    color: var(--beere);
    font-weight: 700;
}

.weiter ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

/* ─── Bewegung und Druck ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .umschlag__betrag.ist-neu {
        animation: none;
    }

    .schalter__eingabe,
    .schalter__eingabe::before {
        transition: none;
    }
}

@media print {
    .kopf,
    .fuss,
    .auswahl,
    .umschlag__teilen,
    .verweise,
    .text {
        display: none !important;
    }

    .umschlag {
        padding-top: 1rem;
        background: none;
    }

    .umschlag::before,
    .umschlag::after {
        display: none;
    }
}
