/* Middagsbladet — food-first, image-led. Light and dark. */

:root {
  --paper: #fbf7f1;
  --surface: #ffffff;
  --ink: #1f1b17;
  --muted: #6b6157;
  --line: #e9e0d4;
  --accent: #c2410c;
  --accent-ink: #9a3412;
  --accent-wash: #fceee2;
  --shadow: 0 1px 2px rgb(31 27 23 / 0.05), 0 8px 24px -12px rgb(31 27 23 / 0.18);
  --shadow-lift: 0 2px 4px rgb(31 27 23 / 0.06), 0 18px 40px -16px rgb(31 27 23 / 0.28);
  --radius: 14px;
  --serif: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14110f;
    --surface: #1d1a17;
    --ink: #f3ece4;
    --muted: #a89a8c;
    --line: #2f2823;
    --accent: #fb923c;
    --accent-ink: #fdba74;
    --accent-wash: #2a1a11;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.5), 0 18px 40px -16px rgb(0 0 0 / 0.7);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .75rem 1rem; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.bar {
  max-width: var(--wrap); margin: 0 auto;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  display: flex; align-items: center; gap: clamp(.75rem, 3vw, 2rem);
}

.wordmark {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 600;
  text-decoration: none; letter-spacing: -0.02em; white-space: nowrap;
}
.wordmark::first-letter { color: var(--accent); }

.nav { display: flex; gap: clamp(.6rem, 2vw, 1.4rem); margin-left: auto; }
.nav a {
  text-decoration: none; font-size: .95rem; font-weight: 500; color: var(--muted);
  padding: .4rem .1rem; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.search { display: flex; align-items: center; position: relative; }
.search input {
  font: inherit; font-size: .95rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .5rem 2.4rem .5rem .95rem; width: clamp(8rem, 18vw, 15rem);
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); outline: none; }
.search button {
  position: absolute; right: .3rem; background: none; border: 0; cursor: pointer;
  padding: .35rem; color: var(--muted); display: grid; place-items: center;
}
.search button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search button:hover { color: var(--accent); }

@media (max-width: 720px) {
  .bar { flex-wrap: wrap; row-gap: .55rem; }
  .nav { margin-left: auto; order: 2; }
  .search { order: 3; flex: 1 1 100%; }
  .search input { width: 100%; }
}

/* --------------------------------------------------------------- hero */

.hero { position: relative; }
.hero-link { display: block; text-decoration: none; position: relative; }
.hero-media { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--line); }
.hero-img { width: 100%; height: 100%; object-fit: cover; }

.hero-link::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgb(12 9 7 / .88) 0%, rgb(12 9 7 / .55) 32%, rgb(12 9 7 / .05) 62%);
}

.hero-text {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 2; color: #fff;
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem);
}
.hero-title {
  font-size: clamp(2rem, 6.5vw, 4rem); color: #fff; margin: .3rem 0 .5rem;
  text-wrap: balance; text-shadow: 0 2px 24px rgb(0 0 0 / .35);
}
.hero-intro {
  margin: 0 0 1.1rem; max-width: 46ch; color: rgb(255 255 255 / .92);
  font-size: clamp(1rem, 2.2vw, 1.15rem); text-shadow: 0 1px 12px rgb(0 0 0 / .4);
}

.eyebrow {
  margin: 0; font-size: .78rem; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent-ink);
}
.hero-text .eyebrow, .recipe-hero-text .eyebrow { color: #ffd9be; }

.cta {
  display: inline-block; background: var(--accent); color: #fff;
  padding: .7rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: transform .15s, background .15s;
}
.hero-link:hover .cta { background: var(--accent-ink); transform: translateY(-1px); }

@media (min-width: 800px) {
  .hero-media { aspect-ratio: 21 / 9; max-height: 78vh; }
}

/* ------------------------------------------------------------ sections */

.section {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2rem);
}
.section.narrow { max-width: 46rem; }

.section-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.section-head h1, .section-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); text-wrap: balance; }
.section-sub { margin: .4rem 0 0; color: var(--muted); font-size: 1rem; }

/* --------------------------------------------------------------- grid */

.grid {
  display: grid; gap: clamp(1rem, 2.5vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}

.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.card-link { text-decoration: none; display: flex; flex-direction: column; height: 100%; }

.card-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--line); }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-img { transform: scale(1.045); }

.card-body { padding: .95rem 1.05rem 1.15rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card-title { font-size: 1.14rem; line-height: 1.3; text-wrap: balance; }
.card-meta { margin: 0; color: var(--muted); font-size: .85rem; }

.img-fallback { background: linear-gradient(135deg, var(--accent-wash), var(--line)); }

.empty { color: var(--muted); }

/* -------------------------------------------------------------- pager */

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3rem); padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.page-link {
  text-decoration: none; font-weight: 600; color: var(--accent);
  padding: .6rem 1.1rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.page-link:hover { border-color: var(--accent); background: var(--accent-wash); }
.page-count { color: var(--muted); font-size: .9rem; }

/* -------------------------------------------------------------- recipe */

.recipe-hero { position: relative; background: var(--line); }
.recipe-hero-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.recipe-hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgb(12 9 7 / .9) 0%, rgb(12 9 7 / .5) 34%, rgb(12 9 7 / .05) 65%);
}
.recipe-hero-text {
  position: absolute; inset-inline: 0; bottom: 0; color: #fff;
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(1.4rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem);
}
.recipe-hero-text h1 {
  font-size: clamp(1.9rem, 5.5vw, 3.5rem); color: #fff; margin-top: .35rem;
  text-wrap: balance; text-shadow: 0 2px 24px rgb(0 0 0 / .4);
}

@media (min-width: 800px) {
  .recipe-hero-img { aspect-ratio: 16 / 9; max-height: 72vh; }
}

.lede {
  max-width: 42rem; margin: clamp(1.75rem, 4vw, 2.75rem) auto 0;
  padding: 0 clamp(1rem, 4vw, 2rem);
  font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.6; color: var(--muted);
  font-family: var(--serif); text-wrap: pretty;
}

.recipe-cols {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 4rem);
  display: grid; gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

@media (min-width: 900px) {
  .recipe-cols { grid-template-columns: minmax(17rem, 21rem) 1fr; }
  .ingredients { position: sticky; top: 5.5rem; }
}

.recipe-cols h2 {
  font-size: 1.5rem; margin-bottom: 1rem;
  padding-bottom: .6rem; border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* ---- ingredients */

.ingredients {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.15rem, 3vw, 1.6rem); box-shadow: var(--shadow);
}
.ing-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.ing { border-bottom: 1px solid var(--line); }
.ing:last-child { border-bottom: 0; }
.ing label {
  display: flex; align-items: flex-start; gap: .8rem; cursor: pointer;
  padding: .7rem .2rem; /* generous tap target for cooking with messy hands */
  transition: color .15s;
}
.ing-check { position: absolute; opacity: 0; width: 0; height: 0; }
.ing label::before {
  content: ""; flex: 0 0 auto; width: 1.35rem; height: 1.35rem; margin-top: .12rem;
  border: 2px solid var(--line); border-radius: 6px; background: var(--paper);
  transition: background .15s, border-color .15s;
}
.ing-check:checked + label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--accent); }
.ing-check:checked + label::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 0.95rem no-repeat;
  border-color: var(--accent);
}
.ing-check:focus-visible + label::before { outline: 3px solid var(--accent); outline-offset: 2px; }

.reset-ings {
  margin-top: 1rem; font: inherit; font-size: .85rem; font-weight: 600;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .45rem 1rem; color: var(--muted); cursor: pointer;
}
.reset-ings:hover { border-color: var(--accent); color: var(--accent); }

/* ---- steps */

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { display: flex; gap: clamp(.9rem, 2vw, 1.4rem); padding: 1rem 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step p { margin: 0; font-size: 1.075rem; line-height: 1.7; text-wrap: pretty; }
.step-n {
  flex: 0 0 auto; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-ink);
  font-family: var(--serif); font-size: 1.15rem; font-weight: 700;
  display: grid; place-items: center;
}

.related { border-top: 1px solid var(--line); }

/* --------------------------------------------------------------- prose */

.prose, .page {
  max-width: 42rem; margin: 0 auto;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) clamp(2.5rem, 6vw, 4rem);
}
.page h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin-bottom: 1.25rem; }
.prose p { margin: 0 0 1.15rem; text-wrap: pretty; }
.prose h2, .prose h3 { margin: 2rem 0 .75rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.15rem; }
.prose li { margin-bottom: .45rem; }
.prose img { border-radius: var(--radius); margin: 1.5rem 0; box-shadow: var(--shadow); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.5rem 0; padding: .25rem 0 .25rem 1.15rem;
  border-left: 3px solid var(--accent); color: var(--muted); font-family: var(--serif); font-size: 1.15rem;
}

/* -------------------------------------------------------- search page */

.search.big { max-width: 34rem; margin: 0 0 2.5rem; gap: .6rem; }
.search.big input { width: 100%; padding: .85rem 1.15rem; border-radius: 999px; font-size: 1.05rem; }
.search.big button {
  position: static; background: var(--accent); color: #fff; border-radius: 999px;
  padding: .85rem 1.5rem; font: inherit; font-weight: 600; font-size: 1rem;
}
.search.big button:hover { background: var(--accent-ink); color: #fff; }

/* -------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: auto; }
.foot-inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
}
.foot-mark { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 0; }
.foot-mark::first-letter { color: var(--accent); }
.foot-inner nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.foot-inner nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.foot-inner nav a:hover { color: var(--accent); }
.foot-note { margin: 0 0 0 auto; color: var(--muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:hover { transform: none; }
  .card:hover .card-img { transform: none; }
}

@media print {
  .site-header, .site-footer, .related, .pager, .reset-ings { display: none; }
  .recipe-hero { max-height: 8cm; overflow: hidden; }
  .recipe-cols { display: block; }
  body { background: #fff; color: #000; }
}
