/* Kookboek — one stylesheet, no build step, no webfont requests.
   Light by default (a recipe gets read in a bright kitchen and printed);
   dark follows the system. */

:root {
    color-scheme: light dark;

    --paper:   #faf7f2;
    --card:    #ffffff;
    --ink:     #22201c;
    --muted:   #7a7268;
    --line:    #e6dfd4;
    --accent:  #b4541f;   /* paprika */
    --accent-soft: #fbeee6;
    --green:   #2f6b4f;
    --danger:  #a32b2b;
    --shadow:  0 1px 2px rgba(34,32,28,.05), 0 8px 24px rgba(34,32,28,.06);
    --radius:  14px;

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:  #17150f;
        --card:   #201d17;
        --ink:    #f0ebe2;
        --muted:  #a29889;
        --line:   #322d24;
        --accent: #e8834a;
        --accent-soft: #2b2119;
        --green:  #6cc79b;
        --danger: #e8756f;
        --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    }
}

* { box-sizing: border-box; }

/* Any element we toggle with the `hidden` attribute also carries a display rule
   of its own (flex, inline-block); without this those win and `hidden` does
   nothing at all. Bit us on the timer bar and the list badge. */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    font: 17px/1.6 var(--sans);
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
code { font-size: .9em; background: var(--accent-soft); padding: .08em .35em; border-radius: 5px; }

.wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 calc(1.25rem + env(safe-area-inset-left)) 0 calc(1.25rem + env(safe-area-inset-right));
}
.narrow { max-width: 420px; }
.muted { color: var(--muted); }

/* ---------- masthead ---------- */
.masthead {
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 20;
}
.masthead__bar {
    display: flex; align-items: center; gap: 1rem;
    padding-top: calc(.7rem + env(safe-area-inset-top)); padding-bottom: .7rem;
}
.brand { display: flex; align-items: baseline; gap: .45rem; text-decoration: none; font-family: var(--serif); }
.brand__mark { color: var(--accent); font-size: 1.1rem; }
.brand__name { font-size: 1.22rem; letter-spacing: .01em; }
.search { flex: 1 1 auto; min-width: 0; }
.search input {
    width: 100%; max-width: 380px; font: inherit; font-size: .95rem;
    padding: .45rem .8rem; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); color: inherit;
}
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.masthead__nav { display: flex; gap: .9rem; font-size: .88rem; }
.masthead__nav a { color: var(--muted); text-decoration: none; }
.masthead__nav a:hover { color: var(--accent); }

main { padding: 2rem 0 4rem; min-height: 60vh; }

.page-title { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; margin: 0 0 1.2rem; }
.page-title--flush { margin: 0; }
.section-h { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin: 2.4rem 0 .8rem; }

/* ---------- toolbar + pills ---------- */
.toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.count { margin: 0; color: var(--muted); font-size: .9rem; }
.toolbar__right { margin-left: auto; display: flex; gap: .35rem; flex-wrap: wrap; }

.pill {
    display: inline-flex; align-items: center; gap: .35rem;
    font: inherit; font-size: .82rem; line-height: 1.3;
    padding: .28rem .7rem; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); color: var(--muted);
    text-decoration: none; cursor: pointer;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill__n { font-size: .7rem; opacity: .6; }
.pill--danger:hover { border-color: var(--danger); color: var(--danger); }

.tagbar { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.tagbar--tight { margin: 1rem 0 0; }

/* ---------- cards ---------- */
.cards {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(34,32,28,.06), 0 16px 36px rgba(34,32,28,.10); }
.card__link { text-decoration: none; display: block; height: 100%; }
.card__media { aspect-ratio: 4 / 3; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__placeholder { font-size: 2rem; color: var(--accent); opacity: .35; }
.card__body { padding: .85rem 1rem 1.05rem; }
.card__title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin: 0 0 .3rem; line-height: 1.25; }
.card__desc { margin: 0 0 .5rem; font-size: .88rem; color: var(--muted); }
.card__meta { margin: 0; font-size: .78rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; }
.stars { color: var(--accent); letter-spacing: .05em; }
.stars__off { opacity: .25; }

/* boodschappenlijst */
.narrow-ish { max-width: 720px; }
.badge { display: inline-block; min-width: 1.15rem; margin-left: .3rem; padding: 0 .3rem;
         border-radius: 999px; background: var(--accent); color: #fff;
         font-size: .7rem; line-height: 1.15rem; text-align: center; font-variant-numeric: tabular-nums; }
.listgroup { margin-bottom: 1rem; }
.listgroup h2 a { text-decoration: none; }
.listgroup h2 a:hover { color: var(--accent); }

/* confirmation after "Op de lijst" — a button that does nothing visible reads as broken */
.toast { position: fixed; left: 50%; translate: -50% 0;
         bottom: calc(1.2rem + env(safe-area-inset-bottom)); z-index: 60;
         background: var(--ink); color: var(--paper); padding: .6rem 1.1rem;
         border-radius: 999px; box-shadow: var(--shadow); font-size: .9rem; }

.pager { display: flex; gap: .35rem; align-items: center; justify-content: center;
         flex-wrap: wrap; margin: 2.5rem 0 1rem; }
.pager__gap { color: var(--muted); padding: 0 .2rem; }

.empty { text-align: center; padding: 4rem 1rem; }
.empty h1, .empty h2 { font-family: var(--serif); font-weight: 600; }
.empty p { color: var(--muted); max-width: 46ch; margin: .5rem auto; }

/* ---------- recipe page ---------- */
.hero { max-width: 1200px; margin: 0 auto 1.8rem; }
.hero img { width: 100%; max-height: 46vh; object-fit: cover; border-radius: var(--radius); }
@media (max-width: 720px) { .hero { padding: 0; } .hero img { border-radius: 0; max-height: 38vh; } }

.recipe__head { max-width: 780px; }
.recipe__head h1 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 600; line-height: 1.12; margin: 0 0 .5rem; letter-spacing: -.01em; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 1.2rem; max-width: 62ch; }

.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 0 2rem; margin: 0 0 1.2rem; padding: .9rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts li { display: flex; flex-direction: column; }
.facts span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts strong { font-weight: 600; font-size: 1rem; }

.recipe__tools { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    font: inherit; font-size: .9rem; padding: .5rem 1rem;
    border-radius: 999px; border: 1px solid var(--line);
    background: var(--card); color: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.07); color: #fff; }
.btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

.recipe__body {
    display: grid; gap: 2.5rem; margin-top: 2.2rem;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    align-items: start;
}
@media (max-width: 860px) { .recipe__body { grid-template-columns: 1fr; gap: 2rem; } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem 1.4rem; box-shadow: var(--shadow); }
.ingredients { position: sticky; top: 5.2rem; }
@media (max-width: 860px) { .ingredients { position: static; } }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.panel h2, .steps-wrap h2 { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin: 0; }
.group { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--accent); margin: 1.2rem 0 .35rem; }

.scaler { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.scaler__btn { font: inherit; width: 2rem; height: 1.9rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.scaler__btn:hover { background: var(--accent-soft); color: var(--accent); }
.scaler__val { min-width: 2.4rem; text-align: center; font-variant-numeric: tabular-nums; font-size: .92rem; }

.ing { list-style: none; margin: 0; padding: 0; }
.ing li + li { border-top: 1px dashed var(--line); }
.ing__row { display: flex; gap: .65rem; align-items: baseline; padding: .45rem 0; cursor: pointer; }
.ing__check { accent-color: var(--accent); width: 1rem; height: 1rem; flex: none; translate: 0 2px; }
.ing__text { font-size: .95rem; }
.ing__check:checked + .ing__text { text-decoration: line-through; color: var(--muted); }

.nutrition { margin-top: 1.2rem; font-size: .85rem; }
.nutrition summary { cursor: pointer; color: var(--muted); }
.nutrition dl { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; margin: .6rem 0 0; }
.nutrition dt { color: var(--muted); }
.nutrition dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.steps { list-style: none; counter-reset: none; margin: .8rem 0 0; padding: 0; }
.step { display: grid; grid-template-columns: 2rem 1fr; gap: .9rem; padding: .7rem 0; border-top: 1px solid var(--line); align-items: start; }
.step:first-child { border-top: 0; }
.step__no {
    font: inherit; font-family: var(--serif); font-size: .95rem;
    width: 2rem; height: 2rem; border-radius: 50%; flex: none;
    border: 1px solid var(--line); background: var(--card); color: var(--accent);
    cursor: pointer; display: grid; place-items: center;
}
.step.is-done .step__no { background: var(--green); border-color: var(--green); color: #fff; }
.step.is-done .step__text { color: var(--muted); }
.step__body { min-width: 0; }
.step__text { margin: 0; padding-top: .15rem; max-width: 68ch; }
/* Step photos: the reason a step-by-step post is worth importing at all. */
.step__shot { margin-top: .7rem; border-radius: 10px; max-width: min(100%, 420px); border: 1px solid var(--line); }
.step.is-done .step__shot { opacity: .45; }

.shots { margin-top: -.3rem; }
.shots__strip { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; }
.shots__strip figure { margin: 0; flex: none; width: 96px; position: relative; }
.shots__strip img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.shots__strip figcaption { position: absolute; left: .25rem; top: .25rem; background: rgba(0,0,0,.6); color: #fff; font-size: .68rem; border-radius: 4px; padding: 0 .3rem; }

.timer {
    font: inherit; font-size: inherit; color: var(--accent);
    background: var(--accent-soft); border: 1px solid transparent;
    border-radius: 6px; padding: 0 .3rem; cursor: pointer;
}
.timer:hover { border-color: var(--accent); }

.notes { margin-top: 2rem; background: var(--accent-soft); border-color: transparent; }
.notes p { margin: .5rem 0 0; }
.source { margin-top: 2rem; font-size: .85rem; color: var(--muted); }

/* running timer, pinned bottom-right */
.timerbar {
    position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 50;
    display: flex; align-items: center; gap: .7rem;
    background: var(--ink); color: var(--paper);
    padding: .6rem .8rem .6rem 1rem; border-radius: 999px; box-shadow: var(--shadow);
}
.timerbar__clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.timerbar__label { font-size: .8rem; opacity: .7; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timerbar__stop { font: inherit; font-size: .78rem; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 999px; padding: .1rem .55rem; cursor: pointer; }
.timerbar.is-ringing { animation: ring .7s ease-in-out infinite alternate; }
@keyframes ring { from { background: var(--ink); } to { background: var(--accent); } }

/* ---------- cook mode: bigger type, no chrome ---------- */
body.cookmode { font-size: 19px; }
body.cookmode .masthead, body.cookmode .hero,
body.cookmode .card__desc { display: none; }
body.cookmode .step__text { font-size: 1.15rem; }
body.cookmode .ing__text { font-size: 1.05rem; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.stack__inner { display: block; margin-top: .6rem; }
.form { max-width: 780px; }
label { display: block; font-size: .84rem; color: var(--muted); }
.hint { font-size: .78rem; opacity: .8; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=search], textarea {
    display: block; width: 100%; margin-top: .25rem;
    font: inherit; font-size: .95rem; color: inherit;
    padding: .55rem .7rem; border-radius: 10px;
    border: 1px solid var(--line); background: var(--card);
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; line-height: 1.55; resize: vertical; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid-3 { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .9rem; }
.check input { accent-color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }

.note { padding: .7rem 1rem; border-radius: 10px; background: var(--accent-soft); font-size: .92rem; }
.note--error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.import { margin-bottom: 1rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th { text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.admin-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table__actions { display: flex; gap: .4rem; justify-content: flex-end; }
.admin-table__actions form { display: inline; }
.thumb { margin: 2rem 0 0; max-width: 320px; }
.thumb img { border-radius: 10px; }
.prose { max-width: 60ch; }


/* ---------- print: the actual reason a recipe site needs print CSS ---------- */
@media print {
    :root { --paper: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #ccc; --accent: #000; --accent-soft: #fff; --shadow: none; }
    body { font-size: 11pt; }
    .masthead, .recipe__tools, .timerbar, .toast, .tagbar, .toolbar, .scaler, .nutrition summary { display: none !important; }
    .hero img { max-height: 6cm; }
    .recipe__body { grid-template-columns: 1fr; gap: 1rem; }
    .panel { border: 0; padding: 0; box-shadow: none; }
    .ingredients { position: static; }
    .step { break-inside: avoid; }
    .step__shot { max-width: 6cm; }
    .shots { display: none !important; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
