/* Opskriftskassen: indekskort i en kasse. Kølig papirgrå, marineblå tekst, safran til handling. */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --ink: #101B2D;
  --ink-2: #4A5568;
  --line: #D5DDEA;
  --rule: #C3D3EC;
  --blue: #2B5BA8;
  --blue-soft: #E4ECF8;
  --saffron: #F2B632;
  --navy: #101B2D;
  --danger: #B3261E;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh: 1.75rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1420;
    --surface: #152033;
    --ink: #E9EEF6;
    --ink-2: #A8B3C5;
    --line: #26334A;
    --rule: #2A3B5A;
    --blue: #8DB2EE;
    --blue-soft: #1C2B45;
    --danger: #FF8A80;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1:focus, main:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }

/* ---------- top ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .6rem; }
.brand { display: flex; align-items: center; gap: .6rem; margin-right: auto; font: 700 1.2rem/1 var(--serif); color: var(--ink); text-decoration: none; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { border-radius: 7px; flex: none; }
.top .btn { white-space: nowrap; flex: none; }
@media (max-width: 430px) { .brand span { display: none; } .top .btn-primary { padding: 0 .9rem; } }
main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* ---------- knapper og felter ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: 0 1.1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--saffron); border-color: var(--saffron); color: var(--navy); }
.btn-primary:hover { border-color: var(--navy); }
.btn-danger { color: var(--danger); }
.icon-btn { width: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }
.step-btn { width: 44px; padding: 0; font-size: 1.4rem; }

.field { display: grid; gap: .35rem; margin: 0 0 1rem; }
.field > label, .field > .lbl { font-weight: 600; }
.opt { font-weight: 400; color: var(--ink-2); }
.hint { margin: 0; color: var(--ink-2); font-size: .9rem; }
.fine { margin: 1rem 0 0; color: var(--ink-2); font-size: .85rem; }
input[type=text], input[type=url], input[type=search], input[type=number], input[type=password], textarea {
  width: 100%; min-height: 44px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--blue); }
.check { display: flex; gap: .6rem; align-items: center; min-height: 44px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; }
.msg { min-height: 1.4em; margin: 0 0 .75rem; color: var(--ink-2); }
.msg.err { color: var(--danger); font-weight: 600; }
.spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -.15em; margin-right: .5rem; }
@keyframes rot { to { transform: rotate(1turn); } }

/* ---------- dialoger ---------- */
dialog { width: min(560px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(13, 20, 32, .6); }
.dlg { padding: 1.25rem; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dlg-head h2 { font-size: 1.4rem; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.set { padding: 1rem 0; border-top: 1px solid var(--line); display: grid; gap: .6rem; }
.set h3 { font-size: 1.1rem; }

/* ---------- liste ---------- */
.search { min-height: 48px; font-size: 1.05rem; }
.tabs { display: flex; gap: 4px; margin-top: 1rem; padding: 0 2px; overflow-x: auto; border-bottom: 2px solid var(--ink); scrollbar-width: thin; }
.tab { flex: none; min-height: 40px; padding: 0 1rem; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--blue-soft); color: var(--ink); cursor: pointer; }
.tab:hover { border-color: var(--ink); }
.tab[aria-pressed="true"] { background: var(--saffron); border-color: var(--navy); color: var(--navy); font-weight: 700; }
.count { margin: .9rem 0; color: var(--ink-2); font-size: .9rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.none { grid-column: 1 / -1; color: var(--ink-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card:hover, .card:focus-within { border-color: var(--ink); }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 30%; background: var(--blue-soft); }
.ph { display: grid; place-items: center; font: 700 3.5rem/1 var(--serif); }
.ph-0 { background: var(--blue-soft); color: var(--blue); }
.ph-1 { background: #F7E4AE; color: #6B4A00; }
.ph-2 { background: #1B2A44; color: var(--saffron); }
@media (prefers-color-scheme: dark) { .ph-1 { background: #3A3014; color: var(--saffron); } }
.card-body { padding: .8rem .9rem 1rem; }
.card-title { font-size: 1.1rem; margin-bottom: .35rem; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; color: var(--ink-2); font-size: .9rem; }
.card-meta:empty { display: none; }

.empty { max-width: 34rem; margin: 3rem auto; text-align: left; display: grid; gap: 1rem; justify-items: start; }
.empty h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.empty p { margin: 0; }

/* ---------- opskrift ---------- */
.recipe { max-width: 980px; margin: 0 auto; }
.back { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; margin-bottom: .25rem; text-decoration: none; font-weight: 600; }
.recipe-hero { margin: 0 0 1rem; border-radius: 14px; overflow: hidden; background: var(--blue-soft); }
.recipe-hero img { display: block; width: 100%; max-height: 380px; object-fit: cover; object-position: center 30%; }
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1rem, 3vw, 2rem); }
.recipe h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); overflow-wrap: anywhere; }
.lede { margin: .5rem 0 0; color: var(--ink-2); font-size: 1.05rem; }
.taglist { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.taglist li { padding: .15rem .7rem; border-radius: 999px; background: var(--blue-soft); font-size: .9rem; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.serv { display: flex; align-items: center; gap: .5rem; }
.serv-out { min-width: 7.5rem; text-align: center; font-weight: 700; }
.fact { display: grid; line-height: 1.3; }
.fact-l { color: var(--ink-2); font-size: .85rem; }
.fact-v { font-weight: 700; }
.cols { display: grid; gap: 2rem; margin-top: 1.5rem; }
@media (min-width: 760px) { .cols { grid-template-columns: minmax(240px, 320px) 1fr; align-items: start; } }
.recipe h2 { font-size: 1.4rem; margin-bottom: .75rem; }
.grp + .grp { margin-top: 1rem; }
.grp h3 { font-size: 1.05rem; margin-bottom: .25rem; color: var(--blue); }
.ing { list-style: none; margin: 0; padding: 0; }
.ing li { border-bottom: 1px solid var(--line); }
.ing label { display: flex; align-items: flex-start; gap: .65rem; min-height: 44px; padding: .5rem 0; cursor: pointer; }
.ing input { flex: none; width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--blue); }
.ing input:checked ~ span { color: var(--ink-2); text-decoration: line-through; }
.amt { font-weight: 700; white-space: nowrap; }

/* Fremgangsmåden står på stregpapir: hver linje sidder på en streg. */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px), var(--rule) var(--lh)); }
.steps li { position: relative; counter-increment: s; padding-left: 2.2rem; margin: 0 0 var(--lh); font-size: 1.05rem; line-height: var(--lh); overflow-wrap: anywhere; }
.steps li:last-child { margin-bottom: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; font: 700 1.1rem/var(--lh) var(--serif); color: var(--blue); }
.no-steps { color: var(--ink-2); margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.actions .spacer { margin-left: auto; }
.btn[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); }
.source { margin: 1rem 0 0; color: var(--ink-2); font-size: .9rem; overflow-wrap: anywhere; }

/* ---------- redigér ---------- */
.edit { max-width: 760px; margin: 0 auto; }
.edit h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); margin-bottom: 1rem; }
.banner { margin: 0 0 1.25rem; padding: .8rem 1rem; border-left: 4px solid var(--saffron); background: var(--surface); border-radius: 0 10px 10px 0; }
.edit-img { display: grid; gap: .6rem; justify-items: start; }
.edit-img img { width: 100%; max-width: 360px; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 30%; border-radius: 10px; background: var(--blue-soft); }
.nums { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .nums { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 36px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--saffron); border-color: var(--navy); color: var(--navy); font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 2rem); padding: .7rem 1.1rem; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
#toast.on { opacity: 1; }

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

@media print {
  body { background: #fff; color: #000; }
  .top, .actions, .back, .serv .btn, #toast { display: none !important; }
  .paper { border: 0; padding: 0; }
  .recipe-hero { display: none; }
  .steps { background: none; }
  .steps li { margin-bottom: .6rem; }
}
