/* Kitchen. Same type and palette family as the rest of kistlabs: Roboto for
   reading, Barlow Condensed for headings, IBM Plex Mono for quantities -
   figures line up in a column when they are monospaced, which matters more in
   an ingredient list than it looks like it should. */

@font-face{font-family:"Roboto";src:url("/fonts/roboto-300.woff2") format("woff2");font-weight:300;font-display:swap}
@font-face{font-family:"Roboto";src:url("/fonts/roboto-400.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Roboto";src:url("/fonts/roboto-500.woff2") format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:"Roboto";src:url("/fonts/roboto-700.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:"Barlow Condensed";src:url("/fonts/barlow-condensed-600.woff2") format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url("/fonts/ibm-plex-mono-400.woff2") format("woff2");font-weight:400;font-display:swap}

:root {
  --bg: #fefefe;
  --raised: #f4f5f6;
  --raised-2: #e9eef2;
  --text: #243541;
  --dim: #46545e;
  --muted: #7b8894;
  --divider: rgba(0, 59, 95, 0.16);
  --divider-strong: rgba(0, 59, 95, 0.32);
  --accent: #0076bd;
  --accent-hover: #005e97;
  --accent-contrast: #ffffff;
  --ok: #157539;
  --ok-bg: rgba(21, 117, 57, 0.10);
  --warn: #9a6700;
  --warn-bg: rgba(204, 139, 0, 0.14);
  --bad: #b3391f;
  --bad-bg: rgba(204, 75, 55, 0.12);
  --font-body: "Roboto", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Roboto", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --frame: 1180px;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 59, 95, 0.10);
  --motion: 180ms cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171a;
    --raised: #1c2126;
    --raised-2: #242b31;
    --text: #e7edf3;
    --dim: #c2ccd5;
    --muted: #97a3ae;
    --divider: rgba(231, 237, 243, 0.16);
    --divider-strong: rgba(231, 237, 243, 0.32);
    --accent: #94bce3;
    --accent-hover: #b5d9fd;
    --accent-contrast: #14171a;
    --ok: #6fce93;
    --ok-bg: rgba(111, 206, 147, 0.14);
    --warn: #e8b35f;
    --warn-bg: rgba(232, 179, 95, 0.14);
    --bad: #f08f78;
    --bad-bg: rgba(240, 143, 120, 0.14);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

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

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.01em; }
h1 { font-size: clamp(28px, 5vw, 38px); }
h2 { font-size: clamp(20px, 3vw, 24px); }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.muted { color: var(--muted); }
.loading { padding: 40px 20px; color: var(--muted); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 50;
  background: var(--accent); color: var(--accent-contrast); padding: 10px 16px; border-radius: 6px;
}
.skip-link:focus { left: 16px; }

/* ------------------------------------------------------------- masthead -- */

.masthead {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--divider);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: 0.02em; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  transform: rotate(-35deg);
}

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav-link {
  padding: 6px 12px; border-radius: 999px; color: var(--dim);
  font-size: 15px; white-space: nowrap;
}
.nav-link:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--accent); color: var(--accent-contrast); }
.nav-link.is-active:hover { color: var(--accent-contrast); }

.status {
  padding: 10px clamp(16px, 4vw, 32px);
  background: var(--warn-bg);
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}
.status-text { display: flex; align-items: center; gap: 8px; color: var(--warn); margin: 0; }

.view { max-width: var(--frame); margin: 0 auto; padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 32px) 80px; }

.view-header { margin-bottom: 20px; }
.view-count { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* -------------------------------------------------------------- controls -- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; min-height: 44px;
  border: 1px solid var(--divider-strong); border-radius: 8px;
  background: var(--raised); color: var(--text);
  font: inherit; font-size: 15px; cursor: pointer;
  transition: background var(--motion), border-color var(--motion);
}
.button:hover { background: var(--raised-2); text-decoration: none; color: var(--text); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }
.button-quiet { background: transparent; }
.button.is-active { border-color: var(--accent); color: var(--accent); }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; min-height: 40px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.icon-button:hover { background: var(--raised); color: var(--text); }
.icon { display: inline-flex; align-items: center; }
.icon svg { display: block; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

.input {
  width: 100%; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--divider-strong); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px;   /* 16px stops iOS zooming on focus */
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1 1 180px; margin-bottom: 12px; }
.field-label { font-size: 13px; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  padding: 6px 12px; min-height: 36px;
  border: 1px solid var(--divider-strong); border-radius: 999px;
  background: transparent; color: var(--dim);
  font: inherit; font-size: 14px; cursor: pointer; text-transform: capitalize;
}
.chip:hover { background: var(--raised); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--raised-2); color: var(--dim);
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* --------------------------------------------------------------- filters -- */

.filters {
  padding: 16px; margin-bottom: 24px;
  background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius);
}
.filters-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters-row-end { justify-content: space-between; align-items: center; margin-top: 4px; }
.search { flex: 2 1 260px; }

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

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.card {
  position: relative;
  background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius);
  transition: border-color var(--motion), transform var(--motion), box-shadow var(--motion);
}
.card:hover { border-color: var(--divider-strong); box-shadow: var(--shadow); }
.card.is-archived { opacity: 0.62; }
.card-link { display: block; padding: 16px 48px 16px 16px; color: inherit; }
.card-link:hover { text-decoration: none; color: inherit; }
.card-title { margin-bottom: 2px; }
.card-subtitle { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--dim); margin-bottom: 10px; }
/* Only the meal-time list needs capitalising; applying it to the whole row
   turned "1 h 35 min" into "1 H 35 Min". */
.card-meta .meta-item:last-child { text-transform: capitalize; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--divider); padding-top: 8px; }
.card-history.is-new { color: var(--accent); }
.card-rating { color: var(--warn); letter-spacing: 1px; }
.card-favourite { position: absolute; top: 10px; right: 10px; z-index: 2; }
.card-favourite[aria-pressed="true"] { color: var(--bad); }

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

.recipe-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; }
.provenance { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.provenance-type { padding: 2px 8px; border-radius: 999px; background: var(--raised-2); color: var(--dim); }

.recipe-header { margin-bottom: 8px; }
.recipe-subtitle { color: var(--muted); font-size: 17px; margin: 6px 0 0; }
.recipe-facts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 14px; color: var(--dim); }
.recipe-facts .fact:last-child { text-transform: capitalize; }
.fact { display: inline-flex; align-items: center; gap: 5px; }
.recipe-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.recipe-body { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .recipe-body { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); } }
.recipe-right { display: grid; gap: 20px; }

.panel { padding: 18px; background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius); }
.panel h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

.notice { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid transparent; }
.notice h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin-bottom: 6px; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.notice-warn p, .notice-warn li { color: var(--text); }
.notice-quiet { background: var(--raised); border-color: var(--divider); color: var(--dim); }

.servings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--divider); margin-bottom: 14px; }
.servings-label { font-size: 14px; color: var(--muted); }
.servings-note { font-size: 13px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--divider-strong); border-radius: 8px; overflow: hidden; }
.stepper-button { width: 44px; height: 44px; border: 0; background: var(--bg); color: var(--text); font-size: 20px; cursor: pointer; }
.stepper-button:hover:not(:disabled) { background: var(--raised-2); }
.stepper-button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper-value { width: 62px; height: 44px; border: 0; border-left: 1px solid var(--divider); border-right: 1px solid var(--divider); background: var(--bg); color: var(--text); text-align: center; font: 400 17px var(--font-mono); }

.ingredient-group + .ingredient-group { margin-top: 16px; }
.group-title { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.ingredient-list { list-style: none; margin: 0; padding: 0; }
.ingredient { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--divider); align-items: baseline; }
.ingredient:last-child { border-bottom: 0; }
.ingredient-amount { flex: 0 0 82px; font-family: var(--font-mono); font-size: 14px; color: var(--text); text-align: right; }
.ingredient-body { flex: 1 1 auto; min-width: 0; }
.ingredient-name { font-size: 15px; }
.ingredient-optional, .ingredient-note { color: var(--muted); font-size: 13px; }
.ingredient-note { display: block; }
.ingredient-flags { display: inline-flex; gap: 4px; margin-left: 6px; }
.ingredient-swap { display: flex; gap: 6px; align-items: flex-start; margin: 5px 0 0; padding: 6px 8px; background: var(--warn-bg); border-radius: 6px; color: var(--warn); font-size: 13px; }
.ingredient-swap.is-bad { background: var(--bad-bg); color: var(--bad); }
.ingredient-fixed { flex: 0 0 auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.scaling-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 10px; background: var(--warn-bg); color: var(--warn); border-radius: 6px; font-size: 14px; }

.equipment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.equipment-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--divider); border-radius: 8px; }
.equipment-item.is-owned { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.equipment-name { font-weight: 500; }
.equipment-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }

.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.step:last-child { border-bottom: 0; }
.step-number { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--raised-2); color: var(--dim); display: grid; place-items: center; font: 400 14px var(--font-mono); }
.step-body { flex: 1 1 auto; min-width: 0; }
.step-text { margin: 0 0 6px; }

.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.log-entry { padding: 10px 12px; background: var(--bg); border: 1px solid var(--divider); border-radius: 8px; }
.log-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.log-rating { color: var(--warn); }
.log-notes { margin: 6px 0 0; font-size: 15px; }

/* ------------------------------------------------------------- cook mode -- */

body.is-cooking-route .masthead { position: static; }
.cook-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cook-title { font-size: clamp(22px, 4vw, 30px); flex: 1 1 200px; }

.timer-bar { position: sticky; top: 60px; z-index: 15; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.timer {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.timer.is-paused { opacity: 0.65; }
.timer.is-done { background: var(--bad-bg); border-color: var(--bad); animation: pulse 1s ease-in-out infinite; }
.timer-label { font-size: 14px; color: var(--dim); }
.timer-clock { font-family: var(--font-mono); font-size: 19px; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .timer.is-done { animation: none; } }

.cook-body { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: start; }

/* On a phone the step you are cooking comes first. Scrolling past fifteen
   ingredients to read step one is the whole reason cook mode exists. */
.cook-main { order: 1; }
.cook-ingredients { order: 2; }
@media (min-width: 980px) {
  .cook-body { grid-template-columns: 320px minmax(0, 1fr); }
  .cook-ingredients { order: 0; grid-column: 1; }
  .cook-main { order: 0; grid-column: 2; }
}

.cook-ingredients { padding: 16px; background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius); }
.cook-ingredients-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
.cook-ingredients-summary::-webkit-details-marker { display: none; }
.cook-ingredients-summary::after { content: "show"; margin-left: auto; font-size: 13px; color: var(--accent); }
.cook-ingredients[open] .cook-ingredients-summary::after { content: "hide"; }
.cook-ingredient-group { padding: 12px 0 2px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cook-servings { font-size: 14px; color: var(--muted); margin: 0; }
.cook-ingredient-list { list-style: none; margin: 0; padding: 0; }
.cook-ingredient { border-bottom: 1px solid var(--divider); }
.cook-ingredient:last-child { border-bottom: 0; }
.cook-ingredient label { display: flex; gap: 10px; align-items: baseline; padding: 11px 0; cursor: pointer; }
.cook-ingredient input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); }
.cook-ingredient.is-checked { opacity: 0.45; }
.cook-ingredient.is-checked .cook-item { text-decoration: line-through; }
.cook-amount { flex: 0 0 76px; font-family: var(--font-mono); font-size: 15px; text-align: right; }
.cook-item { flex: 1 1 auto; font-size: 16px; }
.cook-swap { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: 13px; color: var(--warn); }

.cook-main { display: grid; gap: 18px; }
.cook-progress { height: 4px; border-radius: 999px; background: var(--raised-2); overflow: hidden; }
.cook-progress-fill { height: 100%; background: var(--accent); transition: width var(--motion); }

.cook-step { padding: 24px; background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius); }
.cook-step-number { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.cook-step-text { font-size: clamp(20px, 3.4vw, 27px); line-height: 1.45; margin: 0 0 16px; }
.cook-all-steps { display: grid; gap: 12px; }
.cook-all-steps .cook-step-text { font-size: 17px; }
.cook-all-steps .cook-step { padding: 16px; }
.cook-all-steps .cook-step.is-current { border-color: var(--accent); }
.button-timer { border-color: var(--accent); color: var(--accent); }

.cook-nav { display: flex; gap: 12px; }
.cook-nav .button { flex: 1 1 auto; min-height: 56px; font-size: 17px; }

/* ------------------------------------------------- plan, shopping, unsorted -- */

.week { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.day { padding: 14px; background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius); }
.day.is-today { border-color: var(--accent); }
.day-name { font-size: 17px; margin-bottom: 10px; }
.slot { padding: 6px 0; border-top: 1px solid var(--divider); }
.slot-name { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.slot-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.slot-recipe { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; background: var(--bg); border: 1px solid var(--divider); border-radius: 999px; font-size: 14px; }
.slot-add { width: 32px; height: 32px; display: grid; place-items: center; border: 1px dashed var(--divider-strong); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.slot-add:hover { border-style: solid; color: var(--accent); border-color: var(--accent); }

.shopping { display: grid; gap: 18px; }
.shopping-section h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.shopping-list { list-style: none; margin: 0; padding: 0; }
.shopping-line { border-bottom: 1px solid var(--divider); }
.shopping-line label { display: flex; gap: 12px; align-items: baseline; padding: 12px 0; cursor: pointer; }
.shopping-line input { width: 22px; height: 22px; accent-color: var(--accent); }
.shopping-qty { flex: 0 0 86px; font-family: var(--font-mono); font-size: 14px; text-align: right; color: var(--dim); }
.shopping-item { flex: 1 1 auto; }
.shopping-line.is-checked { opacity: 0.45; }
.shopping-line.is-checked .shopping-item { text-decoration: line-through; }

.unsorted-list { display: grid; gap: 14px; }
.unsorted-item { padding: 16px; background: var(--raised); border: 1px solid var(--divider); border-radius: var(--radius); }
.unsorted-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.unsorted-url { display: block; word-break: break-all; font-size: 14px; margin-bottom: 8px; }
.unsorted-image { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--divider); }
.unsorted-caption { white-space: pre-wrap; font-size: 15px; background: var(--bg); border: 1px solid var(--divider); border-radius: 8px; padding: 10px; max-height: 260px; overflow: auto; }
.unsorted-note { font-size: 14px; color: var(--muted); }
.unsorted-warning { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--warn); }

.equipment-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.equipment-grid .checkbox { padding: 8px; border: 1px solid var(--divider); border-radius: 8px; }
.equipment-grid .checkbox.is-used { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* -------------------------------------------------------- empty, dialogs -- */

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }
.empty p { max-width: 52ch; margin: 0 auto 18px; }

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 22px; border: 1px solid var(--divider-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog h2 { margin-bottom: 8px; }
.dialog p { color: var(--muted); font-size: 15px; }
.dialog .input { margin-top: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 15px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity var(--motion), transform var(--motion);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { background: var(--ok); color: #fff; }
.toast-bad { background: var(--bad); color: #fff; }

/* The page the share target returns, which has no app shell around it. */
.share-receipt main { max-width: 42ch; margin: 18vh auto; padding: 0 20px; text-align: center; }
.share-receipt h1 { margin-bottom: 10px; }
.share-receipt p { color: var(--muted); margin-bottom: 20px; }

@media (max-width: 620px) {
  .masthead { gap: 10px; padding: 8px 16px; }
  .nav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .card-link { padding-right: 46px; }
  .ingredient-amount { flex-basis: 70px; }
  .cook-nav .button { min-height: 60px; }
}

/* --------------------------------------------- versions of the same dish -- */

.card-versions {
  display: block; margin: 0 16px 14px;
  font-size: 13px; color: var(--accent);
}

.notice-good {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
}
.notice-good p, .notice-good li { color: var(--text); }

.versions-strip ul { margin: 8px 0 14px; padding-left: 20px; }
.versions-strip li { margin-bottom: 4px; }

.versions {
  display: grid; gap: 16px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  align-items: start;
}

.version {
  position: relative;
  padding: 18px;
  background: var(--raised);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
}
/* The keeper is the one thing on this page that should read at a glance. */
.version.is-preferred { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.version-crown {
  position: absolute; top: -11px; left: 18px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--ok); color: var(--bg);
  font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
}
.version-head h2 { font-size: 21px; }
.version-note { margin: 4px 0 0; font-size: 14px; color: var(--dim); }
.version-source { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.version-stats {
  display: grid; gap: 1px 14px; margin: 14px 0;
  grid-template-columns: 1fr 1fr;
}
.stat {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--divider);
  font-size: 13px;
}
.stat-label { color: var(--muted); }
.stat-value { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.stat-value.is-good { color: var(--ok); }
.stat-value.is-quiet { color: var(--muted); }

.version-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }

.version-log h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.version-log ul { list-style: none; margin: 0 0 12px; padding: 0; }
.version-log li { padding: 8px 0; border-bottom: 1px solid var(--divider); }
.version-log li:last-child { border-bottom: 0; }
.version-log p { margin: 3px 0 0; font-size: 14px; }
.version-untested { margin-bottom: 12px; font-size: 14px; }
.version-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The difference table is the answer to "what actually changed", so it gets
   room to breathe and scrolls on its own rather than squeezing the page. */
.diff { overflow-x: auto; }
.diff-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.diff-table th, .diff-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--divider); }
.diff-table th { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--dim); }
.diff-table th:not(:first-child), .diff-cell { text-align: center; width: 1%; white-space: nowrap; }
.diff-cell.has-it { color: var(--ok); font-weight: 700; }
.diff-cell.lacks-it { color: var(--muted); }

/* ----------------------------------------------------------- link import -- */

.panel-import { border-color: color-mix(in srgb, var(--accent) 36%, transparent); }
.panel-import .filters-row { align-items: stretch; gap: 8px; }
.panel-import .input { flex: 1 1 260px; }
.import-caveat { font-size: 13px; margin-top: 10px; }
.import-result:not(:empty) { margin-top: 14px; }
.import-result .notice { margin-bottom: 0; }

@media (max-width: 620px) {
  .version-stats { grid-template-columns: 1fr; }
  .card-versions { margin: 0 16px 12px; }
}

/* ---------------------------------------------------------- photographs -- */

/* A card photo is a recognition aid, not the point of the card, so it is a
   fixed-height band rather than something that pushes the text around. */
.card-photo {
  display: block; width: 100%; height: 148px;
  object-fit: cover; border-radius: 6px;
  margin: 0 0 12px; background: var(--raised-2);
}

.recipe-hero { margin: 0 0 18px; }
.recipe-hero img {
  display: block; width: 100%; max-height: 420px;
  object-fit: cover; border-radius: var(--radius);
  background: var(--raised-2);
}
.recipe-hero figcaption {
  margin-top: 6px; font-size: 13px; color: var(--muted);
}

.step-photo {
  display: block; margin-top: 10px;
  width: 100%; max-width: 320px; border-radius: 8px;
  background: var(--raised-2);
}

/* In cook mode the picture is a reference for the step you are on, so it gets
   real size - but capped, because the words are still what you are reading. */
.cook-step-photo {
  display: block; margin: 0 0 16px;
  width: 100%; max-width: 460px; max-height: 300px;
  object-fit: cover; border-radius: 8px;
  background: var(--raised-2);
}

@media (max-width: 620px) {
  .card-photo { height: 160px; }
  .recipe-hero img { max-height: 260px; }
}
