/* Copyright (c) 2026 Ashley Bayliss. All rights reserved.
 * NummyBites site styles. Colors, fonts and radii come from tokens.css (one set per season).
 */

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--texture);
  background-size: var(--texture-size);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--space-4); text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 2.5px; }
img, svg { max-width: 100%; }
code { font-size: .9em; background: var(--surface); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
::selection { background: var(--highlight); }

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

.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-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: var(--space-3); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700;
  color: var(--accent-2); margin-bottom: var(--space-2);
}
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 var(--space-5); } }
.container.narrow { max-width: 680px; }
.container.medium { max-width: 920px; }
.site-main { flex: 1; padding: var(--space-6) 0 var(--space-8); }
.page-title { margin-top: var(--space-2); }
.section { margin-top: var(--space-8); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.stack > * + * { margin-top: var(--space-4); }

/* ============ Header ============ */
.site-header {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  z-index: 20;
}
.season-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: .9; }
.season-art svg { position: absolute; right: 0; top: 0; height: 100%; width: auto; max-width: none; }
.header-bar { position: relative; display: flex; align-items: center; gap: var(--space-4); min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; color: var(--accent); }
.brand-name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.45rem; letter-spacing: -0.02em; }
.brand-name span { color: var(--accent-2); }
.brand-small .brand-mark { width: 30px; height: 30px; }
.brand-small .brand-name { font-size: 1.2rem; }

.site-nav { display: flex; align-items: center; gap: var(--space-1); flex: 1; }
.site-nav > a {
  color: var(--ink); text-decoration: none; font-weight: 550; padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  transition: background .15s var(--ease);
}
.site-nav > a:hover { background: var(--surface); }
.site-nav > a.is-active { background: var(--accent-soft); color: var(--accent); }
.site-nav > a.btn { color: var(--accent-ink); }
.nav-spacer { flex: 1; }
/* Desktop: breathing room between the brand, the main links and the account controls */
@media (min-width: 1240px) {
  .site-header .container.header-bar { max-width: 1400px; gap: var(--space-6); }
  .site-nav { gap: var(--space-2); }
  .nav-spacer { min-width: var(--space-6); }
  .site-nav > .nav-spacer + * { margin-left: var(--space-5); }
}
.btn-glow { position: relative; box-shadow: 0 0 0 0 var(--accent); animation: nb-glow 2.4s ease-in-out infinite; }
@keyframes nb-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent), 0 0 18px 2px color-mix(in srgb, var(--accent) 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .btn-glow { animation: none; box-shadow: 0 0 12px 2px color-mix(in srgb, var(--accent) 45%, transparent); } }
.site-banner { background: var(--accent-soft); color: var(--ink); padding: 0.5rem 0; font-size: 0.95rem; text-align: center; }
.icon-btn.nav-toggle { display: none; margin-left: auto; }

@media (max-width: 1239px) {
  .icon-btn.nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--card); border-bottom: 1px solid var(--line); padding: var(--space-3) 16px var(--space-4);
    box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .nav-spacer { display: none; }
  .site-nav > a { border-radius: var(--radius-sm); }
  .site-nav .theme-btn { align-self: flex-start; }
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.theme-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: block; }
}

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 10px 4px 4px; border-radius: 999px; font-weight: 550;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: var(--space-2);
  display: flex; flex-direction: column; z-index: 30;
}
.user-menu-panel a, .user-menu-panel button {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; text-align: left; width: 100%;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface); }
@media (max-width: 1239px) {
  .user-menu-panel { position: static; box-shadow: none; border: 0; padding: 0 0 0 var(--space-4); }
}

.avatar { display: inline-block; width: 32px; height: 32px; border-radius: 999px; overflow: hidden; flex: none; background: var(--surface); object-fit: cover; }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar-small { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.avatar-large { width: 72px; height: 72px; }

/* ============ Footer ============ */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: var(--space-6) 0 var(--space-5); }
.footer-grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 820px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--space-4); }
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.season-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; align-content: start; }
.copyright { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }

/* ============ Cards, buttons, chips ============ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius);
  box-shadow: var(--shadow); padding: var(--space-5);
}
@media (min-width: 720px) { .card { padding: var(--space-6); } }
.card-tight { padding: var(--space-4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; transition: transform .12s var(--ease), box-shadow .15s var(--ease), background .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -8px var(--accent); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); box-shadow: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #1a0505; }
.btn-small { min-height: 36px; padding: 0 16px; font-size: .9rem; }
.btn-large { min-height: 56px; padding: 0 30px; font-size: 1.08rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-on { background: var(--accent-soft); color: var(--accent); }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linklike.danger { color: var(--danger); }
.linklike { font-family: var(--font-body); font-weight: 500; }
.linklike.small { font-size: .875rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .9rem;
  line-height: 1.2; cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--accent); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-small { padding: 3px 10px; font-size: .8rem; }
.chip-missing { background: var(--highlight); border-color: transparent; cursor: default; }
.chip-have { background: var(--accent-soft); border-color: transparent; color: var(--ink); cursor: default; }
.chip button { background: none; border: 0; padding: 0; margin-left: 2px; color: inherit; cursor: pointer; font-size: 1.1em; line-height: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.badge-warn { background: var(--highlight); color: var(--danger); }

/* ============ Forms ============ */
.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin: var(--space-4) 0; }
.inline-form .field { flex: 1 1 240px; }
.inline-form.compact { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span:first-child, .field legend { font-weight: 600; font-size: .95rem; }
.field-error { color: var(--danger); font-size: .85rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"],
input[type="number"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="file"] { font: inherit; padding: 8px 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 3px; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 64px; }
.password-wrap button { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.copy-field { font-family: ui-monospace, monospace; font-size: .85rem; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 550; font-size: .92rem;
}
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.range-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }

.alert {
  border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.alert-error { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.alert p:last-child { margin-bottom: 0; }
.flash {
  margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow);
  animation: flash-in .35s var(--ease);
}
@keyframes flash-in { from { transform: translateY(-8px); opacity: 0; } }

/* ============ Tables & admin ============ */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
/* In a table the cell itself must stay a table cell, or it loses vertical centering and the row's height */
td.row-actions { display: table-cell; white-space: nowrap; }
td.row-actions > * { display: inline-block; vertical-align: middle; margin: 0 var(--space-3) 0 0; }
td.row-actions > :last-child { margin-right: 0; }
/* Holds the place of an action a row doesn't have, so the links line up down the column */
.action-slot { visibility: hidden; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.subnav a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--card); font-size: .9rem; }
.subnav a.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.stat { padding: var(--space-4) var(--space-5); }
.stat strong { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; }

/* ============ Auth & settings ============ */
.auth-card h1 { font-size: 2rem; }
.auth-links { margin: var(--space-4) 0 0; text-align: center; }
.settings-section { margin-bottom: var(--space-5); }
.settings-section h2 { font-size: 1.35rem; }
.profile-row { display: flex; gap: var(--space-3); align-items: center; }
.profile-row .avatar { width: 56px; height: 56px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* ============ Empty states ============ */
.empty-state { text-align: center; padding: var(--space-7) var(--space-5); }
.empty-state .empty-art { width: 160px; height: 120px; margin: 0 auto var(--space-4); display: block; color: var(--accent); }
.empty-state .button-row { justify-content: center; }

/* ============ Home ============ */
.hero { position: relative; padding: var(--space-6) 0 var(--space-5); }
.hero-grid { display: grid; gap: var(--space-6); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr .85fr; } }
.hero h1 { font-size: clamp(2.3rem, 1.5rem + 3.6vw, 4rem); margin-bottom: var(--space-4); }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: 1.18rem; color: var(--muted); max-width: 36em; }
.hero-art { width: 100%; max-width: 420px; justify-self: center; color: var(--accent); }
.search-bar { display: flex; gap: var(--space-2); margin-top: var(--space-5); max-width: 560px; }
.search-bar input { min-height: 54px; border-radius: 999px; padding-left: 22px; font-size: 1.05rem; }
.search-bar .btn { min-height: 54px; }
.feature-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { padding: var(--space-5); }
.feature .icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: var(--space-3); }
.feature h3 { margin-bottom: var(--space-2); }
.feature p { color: var(--muted); margin: 0; }

/* ============ Recipe cards ============ */
.recipe-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.recipe-card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--card-radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink);
  text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgb(0 0 0 / .05), 0 18px 40px -18px color-mix(in srgb, var(--accent) 60%, transparent); }
[hidden] { display: none !important; }
.recipe-card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface); overflow: hidden; }
.recipe-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card-media .placeholder-art { width: 100%; height: 100%; display: block; }
.recipe-card-body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.recipe-card h3 { font-size: 1.15rem; margin: 0; }
.recipe-card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .85rem; color: var(--muted); }
.recipe-card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.recipe-card .source { font-size: .8rem; color: var(--muted); margin-top: auto; }
.card-flag { position: absolute; left: 10px; top: 10px; }
.match-meter { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.match-meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.stars { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; }
.stars .star { color: #d99a06; }
.stars .count { color: var(--muted); font-weight: 400; }

/* ============ Recipe page ============ */
.recipe-header { display: grid; gap: var(--space-5); margin-bottom: var(--space-6); }
@media (min-width: 900px) { .recipe-header { grid-template-columns: 1.2fr .8fr; align-items: center; } }
.recipe-header h1 { margin-bottom: var(--space-3); }
.recipe-header .summary { font-size: 1.1rem; color: var(--muted); }
.recipe-hero-media { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface); box-shadow: var(--shadow); }
.recipe-hero-media .hero-figure { position: absolute; inset: 0; margin: 0; }
.photo-credit { position: absolute; right: 0; bottom: 0; max-width: 100%; padding: 0.15rem 0.6rem; font-size: 0.72rem; line-height: 1.4;
  color: #fff; background: rgb(0 0 0 / 0.55); border-top-left-radius: var(--radius-sm); }
.photo-credit a { color: #fff; text-decoration: underline; }
.recipe-header .byline { margin: 0.25rem 0 0.75rem; color: var(--muted); }
.recipe-header .byline strong { color: var(--ink); font-weight: 600; }
@media print { .photo-credit { position: static; color: inherit; background: none; } }
.recipe-hero-media img, .recipe-hero-media svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.source-note {
  display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  background: var(--surface); font-size: .92rem; margin: var(--space-4) 0;
}
.source-note .icon { color: var(--accent); }

.time-block { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: var(--space-2) var(--space-6); margin: var(--space-4) 0; }
.time-stat .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.time-stat .value { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.6rem; line-height: 1.1; }
.time-bar { grid-column: 1 / -1; display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface); max-width: 420px; }
.time-bar .active { background: var(--accent); }
.time-bar .waiting { background: repeating-linear-gradient(45deg, var(--accent-soft) 0 6px, transparent 6px 12px); }
.time-legend { grid-column: 1 / -1; display: flex; gap: var(--space-4); font-size: .8rem; color: var(--muted); }
.time-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.time-legend .k-active { background: var(--accent); }
.time-legend .k-wait { background: var(--accent-soft); outline: 1px solid var(--line); }
.verified { display: inline-flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--success); font-weight: 600; }

.recipe-layout { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 960px) { .recipe-layout { grid-template-columns: 360px 1fr; } }
.ingredients-panel { padding: var(--space-5); }
@media (min-width: 960px) { .ingredients-panel { position: sticky; top: var(--space-4); max-height: calc(100vh - 32px); overflow: auto; } }
.ingredients-panel h2 { font-size: 1.4rem; display: flex; justify-content: space-between; align-items: baseline; }
.ingredient-group { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-2); font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { border-bottom: 1px dashed var(--line); }
.check-list li:last-child { border-bottom: 0; }
.check-list label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; cursor: pointer; }
.check-list input { margin-top: 4px; flex: none; }
.check-list .qty { font-weight: 700; white-space: nowrap; }
.check-list .prep { color: var(--muted); }
.check-list input:checked ~ span { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.servings { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: .9rem; font-weight: 600; }
.servings button { width: 30px; height: 30px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 1.1rem; line-height: 1; }

.steps-list { list-style: none; padding: 0; margin: 0; counter-reset: step; display: flex; flex-direction: column; gap: var(--space-4); }
.step-card {
  position: relative; display: grid; grid-template-columns: 52px 1fr; gap: var(--space-4);
  padding: var(--space-5); background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius);
  box-shadow: var(--shadow); transition: opacity .2s, background .2s;
}
.step-num {
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  border: 2px solid transparent; cursor: pointer;
}
.step-card h3 { margin: 4px 0 var(--space-2); font-size: 1.15rem; }
.step-card p { margin: 0; font-size: 1.06rem; }
.step-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-3); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface); color: var(--ink); border: 0; font-family: inherit; }
.pill-active { background: var(--accent-soft); color: var(--accent); }
button.pill { cursor: pointer; }
button.pill:hover { background: var(--accent); color: var(--accent-ink); }
.step-card.is-done { opacity: .62; }
.step-card.is-done .step-num { background: var(--accent); color: var(--accent-ink); }
.step-card.is-done p { text-decoration: line-through; text-decoration-color: var(--line); }
.step-uses { margin-top: var(--space-2); font-size: .85rem; color: var(--muted); }

.recipe-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.rating-form { display: inline-flex; gap: 2px; }
.rating-form button { background: none; border: 0; padding: 2px; cursor: pointer; font-size: 1.6rem; line-height: 1; color: var(--line); }
.rating-form button.is-on, .rating-form:hover button { color: #d99a06; }
.rating-form button:hover ~ button { color: var(--line); }

.photo-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.photo-grid figure { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface); position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-grid figcaption { font-size: .8rem; padding: 6px 8px; color: var(--muted); }

.swap-box { margin-top: var(--space-4); }
.swap-answer { background: var(--surface); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin-top: var(--space-3); }

/* ============ Cook mode ============ */
body.cook-mode .site-header, body.cook-mode .site-footer { display: none; }
body.cook-mode .site-main { padding: 0; }
.cook-shell { min-height: 100vh; display: flex; flex-direction: column; }
.cook-top { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.cook-top h1 { font-size: 1.05rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-body); font-weight: 650; }
.cook-progress { height: 6px; background: var(--surface); }
.cook-progress span { display: block; height: 100%; background: var(--accent); transition: width .3s var(--ease); }
.cook-stage { flex: 1; display: grid; place-items: center; padding: var(--space-6) 16px; }
.cook-step { max-width: 760px; width: 100%; display: none; }
.cook-step.is-current { display: block; animation: step-in .3s var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateX(16px); } }
.cook-step .eyebrow { font-size: .85rem; }
.cook-step h2 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem); }
.cook-step .step-text { font-size: clamp(1.25rem, 1.05rem + .9vw, 1.7rem); line-height: 1.5; }
.cook-step .uses { margin-top: var(--space-4); }
.cook-check { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); font-size: 1.1rem; font-weight: 600; cursor: pointer; }
.cook-check input { width: 28px; height: 28px; }
.cook-nav { display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-3) 16px calc(var(--space-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); position: sticky; bottom: 0; }
.cook-nav .btn { flex: 1; max-width: 260px; }
.cook-drawer { position: fixed; inset: 0 0 0 auto; width: min(400px, 92vw); background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(105%); transition: transform .25s var(--ease); z-index: 40; overflow: auto; padding: var(--space-5); }
.cook-drawer.is-open { transform: none; }
.timer-dock { position: fixed; left: 16px; bottom: 88px; display: flex; flex-direction: column; gap: var(--space-2); z-index: 30; }
.timer { display: flex; align-items: center; gap: var(--space-3); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; font-weight: 700; }
.timer button { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; opacity: .8; }
.timer.is-done { background: var(--accent-2); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .timer.is-done, .cook-step.is-current, .flash { animation: none; } }
.cook-finished { text-align: center; }

/* ============ Pantry ============ */
.pantry-layout { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 960px) { .pantry-layout { grid-template-columns: 380px 1fr; } }
.pantry-panel { padding: var(--space-5); }
@media (min-width: 960px) { .pantry-panel { position: sticky; top: var(--space-4); } }
.chip-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); min-height: 52px; position: relative; }
.chip-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.chip-input input { border: 0; box-shadow: none !important; flex: 1 1 140px; min-height: 34px; padding: 4px 6px; background: transparent; }
.suggest-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.suggest-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest-list li[aria-selected="true"], .suggest-list li:hover { background: var(--accent-soft); }
.quick-add { margin-top: var(--space-3); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px dashed var(--line); }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.htmx-request .loading-dot, .loading-dot.htmx-request { opacity: 1; }
.loading-dot { opacity: 0; transition: opacity .2s; display: inline-block; width: 10px; height: 10px; border-radius: 999px; background: var(--accent); animation: pulse 1s infinite; }

/* ============ Browse & filters ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; margin-bottom: var(--space-5); }
.filter-bar .field { flex: 1 1 180px; }
.filter-bar .field.grow { flex: 3 1 300px; }
.pager { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-6); }

/* ============ Recipe editor ============ */
.editor-rows { display: flex; flex-direction: column; gap: var(--space-2); }
.editor-row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); align-items: start; }
.editor-row textarea { min-height: 80px; }
.editor-row .row-tools { display: flex; flex-direction: column; gap: 4px; }
.editor-row .row-tools button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.step-time-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.step-time-inputs label { font-size: .8rem; color: var(--muted); }
.step-time-inputs input { min-height: 38px; padding: 6px 10px; }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ============ Prose pages ============ */
.prose { max-width: 70ch; }
.prose h2 { margin-top: var(--space-6); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: var(--space-2); }

/* ============ Seasonal art animations ============ */
.sa-float { animation: sa-float 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sa-float.d2 { animation-delay: -2.3s; animation-duration: 8.5s; }
.sa-float.d3 { animation-delay: -4.1s; animation-duration: 9.5s; }
@keyframes sa-float { 50% { transform: translateY(-6px) rotate(8deg); } }
.sa-spin { animation: sa-spin 60s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sa-spin { to { transform: rotate(360deg); } }
.sa-fall { animation: sa-fall 9s linear infinite; transform-box: fill-box; }
.sa-fall.d2 { animation-delay: -3s; animation-duration: 11s; }
.sa-fall.d3 { animation-delay: -6s; animation-duration: 13s; }
@keyframes sa-fall { 0% { transform: translate(0, -20px) rotate(0deg); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translate(-30px, 110px) rotate(200deg); opacity: 0; } }
.sa-snow { animation: sa-snow 10s linear infinite; }
.sa-snow.d2 { animation-delay: -3.5s; animation-duration: 12s; }
.sa-snow.d3 { animation-delay: -7s; animation-duration: 14s; }
@keyframes sa-snow { 0% { transform: translateY(-10px); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(100px); opacity: 0; } }
.sa-grow { animation: sa-grow 1.4s var(--ease) both; transform-box: fill-box; transform-origin: bottom center; }
@keyframes sa-grow { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) {
  .sa-float, .sa-spin, .sa-fall, .sa-snow, .sa-grow { animation: none; }
}

/* ============ Print: just the recipe ============ */
@media print {
  /* Ctrl+P on the recipe page: plain black on white (the Print button opens a tidier printable page) */
  :root { color-scheme: light; }
  *, *::before, *::after { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; }
  .site-header, .site-footer, .recipe-actions, .button-row, .swap-box, .photo-section, .skip-link,
  .recipe-hero-media, .rating-row, .servings-slider, .timer-dock, .creator-support, .season-art, .site-banner { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .step-card { box-shadow: none; border-color: #ccc; }
  .recipe-layout { grid-template-columns: 1fr 2fr; }
}

/* ============ Small screens ============ */
@media (max-width: 1099px) {
  .hero { padding-top: var(--space-4); }
  .hero-art { max-width: 200px; order: -1; justify-self: start; margin-bottom: calc(-1 * var(--space-4)); }
  .site-main { padding-top: var(--space-4); }
  .time-block { gap: var(--space-2) var(--space-5); }
  .step-card { grid-template-columns: 44px 1fr; padding: var(--space-4); gap: var(--space-3); }
  .step-num { width: 38px; height: 38px; font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .hero-art { display: none; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }
}

.more-filters summary { cursor: pointer; padding: var(--space-2) 0; }
.more-filters[open] summary { margin-bottom: var(--space-3); }
.recipe-page .timer-dock { bottom: 16px; }

/* ============ Cleanup rating ============ */
.cleanup-box { margin: var(--space-2) 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); max-width: 560px; }
.cleanup-box summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 14px; cursor: pointer; }
.cleanup-box summary::-webkit-details-marker { display: none; }
.cleanup-stat { display: inline-flex; align-items: center; gap: 6px; }
.cleanup-stat .icon { color: var(--accent); }
.cleanup-more { margin-left: auto; text-decoration: underline; text-underline-offset: 3px; }
.cleanup-box[open] .cleanup-more { display: none; }
.cleanup-detail { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.cleanup-detail ul { margin: 0; padding-left: 1.2em; }
.mess-meter { display: inline-flex; gap: 3px; }
.mess-meter i { width: 9px; height: 9px; border-radius: 999px; background: var(--surface); outline: 1px solid var(--line); }
.mess-meter i.on { background: var(--accent); outline-color: var(--accent); }
[data-mess="4"] .mess-meter i.on, [data-mess="5"] .mess-meter i.on { background: var(--accent-2); outline-color: var(--accent-2); }
.badge-clean { background: var(--accent-soft); color: var(--accent); }
