/* Kookboek — warm paper, ink, and one tomato accent. Mobile first. */
:root {
  --paper: #faf6ef;
  --card: #fffdf9;
  --ink: #2b2420;
  --muted: #74685f;
  --line: #e6dccf;
  --accent: #b5452b;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3dc;
  --herb: #4f6b3a;
  --shadow: 0 1px 2px rgb(60 40 20 / 6%), 0 4px 16px rgb(60 40 20 / 6%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1916;
    --card: #25211d;
    --ink: #efe7dc;
    --muted: #a99c8f;
    --line: #3a332c;
    --accent: #e0775c;
    --accent-ink: #1c1916;
    --accent-soft: #3d2922;
    --herb: #9cbc7e;
    --shadow: none;
    color-scheme: dark;
  }
  .card .pic.tint0, .card .pic.tint1, .card .pic.tint2, .card .pic.tint3, .card .pic.tint4 { background-color: #2c2723; }
}

* { box-sizing: border-box; }
/* elements hidden from JS (filtered cards, cooking-mode stages) must stay hidden
   even when their own rule sets display: flex / grid */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .8rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; color: var(--muted); font-family: var(--sans); text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a, .nav button.linkish {
  color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 999px; font-size: .95rem;
}
.nav a:hover, .nav a.on { background: var(--accent-soft); }
.nav .badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .7rem; padding: 1px 6px; margin-left: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: 4px 10px; font-size: .85rem; text-decoration: none; color: var(--muted); }
.seg a.on { background: var(--ink); color: var(--paper); }

main { padding: 20px 0 64px; }
footer { border-top: 1px solid var(--line); padding: 20px 0 calc(20px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: .85rem; }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; border-radius: 999px; font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none;
  min-height: 42px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: 12px 22px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=search], input[type=password], input[type=url], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 10px 0 4px; }
.error { color: var(--accent); font-weight: 600; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; color: var(--accent); padding: 0; }

/* overview */
.search { margin: 4px 0 12px; }
.search input { font-size: 1.05rem; padding: 12px 16px; border-radius: 999px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer; font-family: inherit;
}
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; border: 1px solid var(--line);
}
.card .pic { aspect-ratio: 4 / 3; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .pic.noimg {
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1.5px);
  background-size: 14px 14px;
}
.card .pic.tint0 { background-color: #f3e3d8; }
.card .pic.tint1 { background-color: #e7ead9; }
.card .pic.tint2 { background-color: #f1e6cf; }
.card .pic.tint3 { background-color: #e3e6e8; }
.card .pic.tint4 { background-color: #efdcdc; }
.card .pic .initial {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); color: var(--accent); box-shadow: var(--shadow);
  font-family: var(--serif); font-size: 1.5rem; font-weight: 600; line-height: 1;
}
.card .body { padding: 12px 14px 14px; }
.card .title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.card .meta { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* recipe */
.hero { display: grid; gap: 20px; align-items: end; }
.hero .photo { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; background: var(--accent-soft); }
.hero .photo img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 760px) { .hero.has-photo { grid-template-columns: 1fr 1fr; } }
.lede { font-size: 1.05rem; color: var(--muted); margin: .4rem 0 0; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.facts b { color: var(--ink); font-weight: 600; }
.tags a { font-size: .8rem; color: var(--herb); text-decoration: none; margin-right: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0 8px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.stepper a { width: 42px; height: 42px; display: grid; place-items: center; text-decoration: none; font-size: 1.3rem; color: var(--ink); }
.stepper span { min-width: 6.5em; text-align: center; font-size: .95rem; }
.cols { display: grid; gap: 8px 40px; }
@media (min-width: 860px) { .cols { grid-template-columns: minmax(260px, 1fr) 2fr; } .cols .ingr { position: sticky; top: 72px; align-self: start; } }
.ingr ul { list-style: none; padding: 0; margin: 0; }
.ingr li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.ingr .amt { min-width: 5.2em; font-weight: 600; font-variant-numeric: tabular-nums; }
.ingr .note, .ingr .opt { color: var(--muted); }
.steps ol { padding: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding: 4px 0 16px 44px; }
.steps li::before {
  counter-increment: s; content: attr(data-n); position: absolute; left: 0; top: 2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.temp { white-space: nowrap; font-weight: 600; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
.panel.warn { border-color: var(--accent); background: var(--accent-soft); }
.nutri { display: flex; gap: 18px; flex-wrap: wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.gallery img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.gallery figcaption { padding: 6px 8px; font-size: .8rem; }
.comment { border-bottom: 1px solid var(--line); padding: 10px 0; }
.comment .who { font-weight: 600; }
.comment p { margin: 4px 0 0; white-space: pre-wrap; }
details summary { cursor: pointer; color: var(--accent); }
.form-row { display: grid; gap: 8px; }
@media (min-width: 600px) { .form-row.two { grid-template-columns: 1fr 1fr; } }

/* cooking mode */
body.cooking { background: var(--card); }
body.cooking main { display: none; }
.cookbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid var(--line); }
.cookbar .t { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wake { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.wake.on { color: var(--herb); }
.cook-body { max-width: 760px; margin: 0 auto; padding: 16px 16px 140px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; font-size: 1.2rem; color: var(--ink); padding: 10px 0; border-bottom: 1px dashed var(--line); margin: 0; }
.checklist input { width: 26px; height: 26px; margin-top: 3px; accent-color: var(--herb); flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }
.stepview .count { color: var(--muted); font-size: .95rem; }
.stepview .group { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; }
.stepview .text { font-size: clamp(1.35rem, 4.5vw, 1.9rem); line-height: 1.45; margin: 14px 0 20px; font-family: var(--serif); }
.stepview .uses { font-size: 1.05rem; color: var(--muted); }
.cooknav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line);
}
.cooknav .btn { flex: 1; min-height: 60px; font-size: 1.15rem; }
button.timer {
  font: inherit; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: 8px; padding: 0 8px; cursor: pointer;
}
button.timer::after { content: " ⏱"; font-size: .8em; }
.timers { position: fixed; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 20; }
.timerpill { background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: 1.1rem; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.timerpill.ring { background: var(--accent); animation: pulse 1s infinite; }
.timerpill button { background: none; border: 0; color: inherit; font-size: 1rem; cursor: pointer; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* shopping */
.shoplist { list-style: none; padding: 0; margin: 0; }
.shoplist label { display: flex; gap: 12px; align-items: flex-start; font-size: 1.1rem; color: var(--ink); padding: 10px 0; border-bottom: 1px dashed var(--line); margin: 0; }
.shoplist input { width: 24px; height: 24px; accent-color: var(--herb); flex: none; margin-top: 3px; }
.shoplist input:checked ~ span { text-decoration: line-through; color: var(--muted); }
.shoplist .from { display: block; font-size: .8rem; color: var(--muted); }
.listrecipes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* capture */
.capture { max-width: 560px; margin: 0 auto; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin: 16px 0; }
.page { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.page img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.page .n { position: absolute; left: 6px; top: 6px; background: var(--ink); color: var(--paper); border-radius: 999px; font-size: .75rem; padding: 1px 7px; }
.page .acts { display: flex; justify-content: space-between; }
.page .acts button { flex: 1; background: none; border: 0; padding: 8px; font-size: 1rem; cursor: pointer; color: var(--ink); }
.page .state { position: absolute; inset: auto 0 38px 0; text-align: center; font-size: .75rem; background: rgb(0 0 0 / 55%); color: #fff; padding: 2px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress div { height: 100%; background: var(--herb); width: 0; transition: width .3s; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.inboxrow { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.inboxrow img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.status { font-size: .8rem; border-radius: 999px; padding: 2px 10px; background: var(--accent-soft); color: var(--accent); }
.status.processed { background: color-mix(in srgb, var(--herb) 18%, transparent); color: var(--herb); }

.narrow { max-width: 420px; margin: 40px auto; }

@media print {
  .top, footer, .toolbar, .no-print, #made-it, #comments { display: none !important; }
  body { background: #fff; color: #000; }
  .cols { grid-template-columns: 1fr 2fr; }
}

/* phones: two columns of cards, tags in one swipeable row */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .body { padding: 8px 10px 10px; }
  .card .title { font-size: .98rem; }
  .card .meta { font-size: .72rem; }
  .card .pic .initial { width: 44px; height: 44px; font-size: 1.2rem; }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}
