/*
 * wievielkaese.de – schlankes, mobile-first CSS ohne Framework.
 * Ein auffälliges Element: die Käsemenge auf geschmolzenem Käsegelb. Alles andere bleibt ruhig.
 * Nur System-Schriften, keine externen Requests.
 */

:root {
    --tinte: #2a1f14;
    --tinte-weich: #6b5a48;
    --papier: #ffffff;
    --kaese: #f5c43d;
    --kaese-hell: #fdf1c7;
    --rinde: #9a4a12;
    --linie: #e9e1d3;

    --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --schrift-rund: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;

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

*,
*::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-rund);
    line-height: 1.15;
    text-wrap: balance;
}

h2 {
    margin: 0 0 0.75rem;
    font-size: 1.3125rem;
    font-weight: 750;
}

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

:focus-visible {
    outline: 3px solid var(--rinde);
    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-rund);
    font-size: 1.125rem;
    font-weight: 800;
    text-decoration: none;
}

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

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

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

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

.fuss__links a {
    color: inherit;
}

/* ─── Antwort: die Käsemenge ─────────────────────────────── */

.antwort {
    position: relative;
    margin: 1.5rem 0 3.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
    border-radius: 1.5rem 1.5rem 0 0;
    background: var(--kaese);
}

/* Geschmolzener Käse läuft über die Unterkante */
.antwort::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 28px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='28' viewBox='0 0 300 28'%3E%3Cpath fill='%23f5c43d' d='M0 0H300V0C290 0 287 2 286 9C285 18 274 18 273 9C272 2 268 0 255 0H200C193 0 191 2 190 5C189 10 182 10 181 5C180 2 178 0 170 0H112C102 0 99 3 98 12C97 23 84 23 83 12C82 3 79 0 70 0H42C34 0 32 2 31 4C30 8 25 8 24 4C23 2 20 0 14 0H0Z'/%3E%3C/svg%3E") repeat-x 0 0 / 300px 28px;
}

.antwort__menge {
    margin: 0;
    font-family: var(--schrift-rund);
    font-size: clamp(3.75rem, 2rem + 12vw, 7rem);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.antwort__menge.ist-neu {
    animation: schmelzen 0.35s ease-out;
}

@keyframes schmelzen {
    from {
        transform: translateY(-0.06em) scale(1.03);
    }
}

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

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

.rechner__spalten {
    display: grid;
    gap: 2.5rem;
}

@media (min-width: 52rem) {
    .rechner__spalten {
        grid-template-columns: 1fr 1fr;
        gap: 3.5rem;
    }
}

.zaehler {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding-block: 0.625rem;
    border-bottom: 1px solid var(--linie);
}

.zaehler__label {
    font-weight: 600;
}

/* „davon Vielfresser“ hängt sichtbar an seiner Gruppe */
.zaehler--davon {
    margin-left: 0.25rem;
    padding-left: 1rem;
    border-left: 3px solid var(--kaese);
}

.zaehler--davon .zaehler__label {
    color: var(--tinte-weich);
    font-weight: 400;
}

.zaehler__stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.zaehler__knopf {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 2px solid var(--tinte);
    border-radius: 50%;
    background: var(--papier);
    color: var(--tinte);
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.zaehler--davon .zaehler__knopf {
    width: 2.25rem;
    height: 2.25rem;
    border-width: 1.5px;
    font-size: 1.25rem;
}

.zaehler__knopf:hover:not(:disabled) {
    background: var(--kaese-hell);
}

.zaehler__knopf:active:not(:disabled) {
    transform: scale(0.94);
}

.zaehler__knopf:disabled {
    opacity: 0.3;
    cursor: default;
}

.zaehler__zahl {
    width: 3.25rem;
    padding: 0.25rem 0;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--tinte);
    font-family: var(--schrift-rund);
    font-size: 1.375rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.zaehler__zahl::-webkit-inner-spin-button,
.zaehler__zahl::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

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

/* ─── Einkaufsliste ──────────────────────────────────────── */

.einkaufsliste {
    margin: 0;
    padding: 0;
    border-top: 2px solid var(--tinte);
    list-style: none;
}

.einkaufsliste__eintrag {
    border-bottom: 1px solid var(--linie);
}

.einkaufsliste__label {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "haken name menge"
        ". hinweis hinweis";
    column-gap: 0.75rem;
    align-items: baseline;
    padding-block: 0.75rem;
    cursor: pointer;
}

.einkaufsliste__haken {
    grid-area: haken;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--rinde);
    align-self: center;
}

.einkaufsliste__name {
    grid-area: name;
    font-weight: 650;
}

.einkaufsliste__menge {
    grid-area: menge;
    font-family: var(--schrift-rund);
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.einkaufsliste__hinweis {
    grid-area: hinweis;
    color: var(--tinte-weich);
    font-size: 0.875rem;
}

.einkaufsliste__eintrag:has(:checked) :is(.einkaufsliste__name, .einkaufsliste__menge) {
    color: var(--tinte-weich);
    text-decoration: line-through;
}

.einkauf__leer {
    margin: 0;
    padding: 1rem 0;
    border-top: 2px solid var(--tinte);
    color: var(--tinte-weich);
}

.einkauf__aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.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(--rinde);
    background: var(--rinde);
    color: var(--papier);
}

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

/* ─── 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;
}

.tabelle {
    overflow-x: auto;
}

.grundmengen {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

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

.grundmengen thead th {
    color: var(--tinte-weich);
    font-size: 0.875rem;
    font-weight: 600;
}

.grundmengen td {
    font-variant-numeric: tabular-nums;
}

/* ─── Personenseiten ─────────────────────────────────────── */

.personenseiten {
    margin-top: 4rem;
}

.personenseiten__liste {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.personenseiten__liste a {
    display: grid;
    place-items: center;
    min-width: 2.75rem;
    height: 2.75rem;
    padding-inline: 0.5rem;
    border: 2px solid var(--linie);
    border-radius: 0.75rem;
    color: var(--tinte);
    font-family: var(--schrift-rund);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-decoration: none;
}

.personenseiten__liste a:hover {
    border-color: var(--kaese);
    background: var(--kaese-hell);
}

.personenseiten__liste a[aria-current="page"] {
    border-color: var(--kaese);
    background: var(--kaese);
}

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

.fehlercode {
    margin: 0 0 0.25rem;
    color: var(--rinde);
    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) {
    .antwort__menge.ist-neu {
        animation: none;
    }

    .zaehler__knopf:active:not(:disabled) {
        transform: none;
    }
}

@media print {
    .kopf,
    .fuss,
    .einleitung,
    .gaeste,
    .einkauf__aktionen,
    .text,
    .personenseiten {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .antwort {
        margin: 0 0 1rem;
        padding: 0;
        background: none;
    }

    .antwort::after {
        display: none;
    }

    .antwort__menge {
        font-size: 28pt;
    }

    .rechner__spalten {
        display: block;
    }
}
