@font-face {
    font-family: "Inter";
    src: url("inter.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --ink: #1a1a1a;
    --muted: #6e6e6e;
    --line: #e8e8e6;
    --tile: #f3f3f1;
    --paper: #fff;
    --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
}

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

a { color: inherit; }

a:focus-visible, input:focus-visible, button:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Kopfzeile */
.site-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px var(--gutter) 0;
}

.site-header__top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-title { margin: 0 auto 0 0; font: inherit; }

.brand {
    margin-right: auto;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    text-decoration: none;
}

.search { flex: 0 1 260px; min-width: 0; }

.admin-link {
    display: flex;
    flex: none;
    padding: 4px;
    margin-right: -4px;
    color: #a3a3a3;
}

.admin-link:hover { color: var(--ink); }

.search input {
    width: 100%;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1rem;
    appearance: none;
}

.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: none; border-bottom-color: var(--ink); }

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-top: 20px;
    font-size: 0.9375rem;
}

.categories a { color: var(--muted); text-decoration: none; }
.categories a:hover, .categories a[aria-current] { color: var(--ink); }

/* Raster */
main { padding-bottom: 96px; }

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 40px 24px;
    max-width: 1400px;
    margin: 36px auto 0;
    padding: 0 var(--gutter);
}

@media (min-width: 560px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 28px; }
}

.card { display: block; text-decoration: none; }

.card img, .card__blank {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--tile);
}

.card__title {
    display: block;
    margin: 12px 0 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
}

.card:hover .card__title { text-decoration: underline; text-underline-offset: 3px; }

.page-title {
    max-width: 1400px;
    margin: 44px auto 0;
    padding: 0 var(--gutter);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.empty {
    max-width: 1400px;
    margin: 44px auto 0;
    padding: 0 var(--gutter);
    color: var(--muted);
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    max-width: 1400px;
    margin: 64px auto 0;
    padding: 0 var(--gutter);
}

.pager a[rel="next"] { margin-left: auto; }

/* Rezept */
.recipe__cover { margin-top: 28px; padding: 0 var(--gutter); }

.recipe__cover img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--tile);
}

.recipe__text {
    max-width: calc(680px + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.recipe__text h1 {
    margin: 32px 0 0;
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.08;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Auf grossen Bildschirmen: oben Bild und Zutaten nebeneinander, darunter der Freitext über beide Spalten. */
@media (min-width: 900px) {
    .recipe--with-cover {
        display: grid;
        grid-template-columns: minmax(0, min(640px, 76vh)) minmax(0, 1fr);
        grid-template-columns: minmax(0, min(640px, 76svh)) minmax(0, 1fr);
        gap: clamp(40px, 5vw, 64px);
        align-items: start;
        max-width: 1400px;
        margin: 36px auto 0;
        padding: 0 var(--gutter);
    }

    .recipe--with-cover .recipe__cover { margin: 0; padding: 0; }

    .recipe--with-cover .recipe__text { max-width: 680px; margin: 0; padding: 0; }
    .recipe--with-cover h1 { margin-top: 0; }
    .recipe--with-cover .recipe__draft { margin-top: 0; margin-bottom: 16px; }

    .recipe--with-cover .recipe__body {
        grid-column: 1 / -1;
        max-width: none;
        margin: 16px 0 0;
        padding: 0;
    }
}

.recipe__draft {
    margin: 32px 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
}

.recipe__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
}

.recipe__meta a { text-decoration: none; }
.recipe__meta a:hover { color: var(--ink); }

.ingredients { margin-top: 36px; }
.ingredients h2 { margin: 0 0 10px; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.ingredients ul { margin: 0; padding-left: 1.1em; list-style: disc; }
.ingredients li { padding: 2px 0 2px 0.2em; overflow-wrap: anywhere; }
.ingredients li::marker { color: #b4b4b0; font-size: 0.8em; }

.recipe__body {
    max-width: calc(680px + 2 * var(--gutter));
    margin: 36px auto 0;
    padding: 0 var(--gutter);
    overflow-wrap: break-word;
}

.recipe__body h2 { margin: 2em 0 0.5em; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.recipe__body h3 { margin: 1.75em 0 0.4em; font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
.recipe__body p { margin: 0 0 1em; }
.recipe__body ul, .recipe__body ol { margin: 0 0 1.25em; padding-left: 1.25em; }
.recipe__body li { margin-bottom: 0.3em; padding-left: 0.2em; }
.recipe__body img { width: 100%; max-width: 680px; margin: 2em 0; background: var(--tile); }
.recipe__body a { text-underline-offset: 3px; }
.recipe__body .recipe__source { margin: 2em 0 0; color: var(--muted); font-size: 0.9375rem; }

/* Bildausschnitt: Die Klassen setzt der Server, weil die Inhaltsrichtlinie Inline-Stile verbietet. */
.card img, .recipe__cover img, .recipe-list img {
    object-position: var(--fx, 50%) var(--fy, 50%);
}

.fx-0 { --fx: 0%; }
.fy-0 { --fy: 0%; }
.fx-10 { --fx: 10%; }
.fy-10 { --fy: 10%; }
.fx-20 { --fx: 20%; }
.fy-20 { --fy: 20%; }
.fx-30 { --fx: 30%; }
.fy-30 { --fy: 30%; }
.fx-40 { --fx: 40%; }
.fy-40 { --fy: 40%; }
.fx-50 { --fx: 50%; }
.fy-50 { --fy: 50%; }
.fx-60 { --fx: 60%; }
.fy-60 { --fy: 60%; }
.fx-70 { --fx: 70%; }
.fy-70 { --fy: 70%; }
.fx-80 { --fx: 80%; }
.fy-80 { --fy: 80%; }
.fx-90 { --fx: 90%; }
.fy-90 { --fy: 90%; }
.fx-100 { --fx: 100%; }
.fy-100 { --fy: 100%; }

/* Druck */
@media print {
    @page { margin: 16mm; }

    body { font-size: 10.5pt; line-height: 1.45; }
    main { padding: 0; }
    .site-header, .recipe__meta { display: none; }

    .recipe--with-cover {
        display: grid;
        grid-template-columns: 65mm minmax(0, 1fr);
        gap: 8mm;
        align-items: start;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .recipe__cover, .recipe__text { margin: 0; padding: 0; }
    .recipe--with-cover .recipe__text { max-width: none; }
    .recipe__text h1 { margin: 0; font-size: 22pt; }
    .recipe__body { max-width: none; margin: 8mm 0 0; padding: 0; }
    .recipe--with-cover .recipe__body { grid-column: 1 / -1; margin: 0; }
    .ingredients { margin-top: 5mm; }
    .ingredients h2, .recipe__body h2 { font-size: 13pt; }
    .recipe__body img { max-width: 90mm; margin: 4mm 0; }
    .recipe__body li, .recipe__body p, .ingredients li, img { break-inside: avoid; }
    .recipe__body h2, .recipe__body h3 { break-after: avoid; }
    .recipe__body .recipe__source { color: #a3a3a3; font-size: 7.5pt; }
    .recipe__source a { text-decoration: none; }
    .recipe__source a::after { content: " – " attr(href); overflow-wrap: anywhere; }
}
