/* Family Recipes — Schirmacher & Nordstrom brand theme.
   Palette SAMPLED from the supplied logo artwork (PIL + colour Counter), never
   eyeballed: ink brown #7b3911, gold #b87c0d, paper #efd8a8.

   Dark mode is "candlelit kitchen", not a grey inversion: the paper warms down
   into dark walnut and the ink flips to cream, so it still reads as this brand.
   Everything colours through tokens, so both modes stay in one file. */

:root {
  /* --- sampled from the logo artwork --- */
  --brown: #7b3911;        /* the wordmark ink */
  --brown-dp: #5e2a0a;     /* headline / pressed */
  --brown-md: #9a5a2a;     /* secondary ink */
  --gold: #b87c0d;         /* the ampersand — a FILL/border accent */
  --gold-lt: #d9a13a;
  /* Gold is far too light to READ on paper (2.26:1). Text that needs the accent
     hue uses this instead; --gold stays for fills, rules and marks. */
  --gold-ink: #8a5c05;
  --paper: #efd8a8;        /* page centre */
  --paper-2: #f6e7c4;      /* raised card */
  --paper-3: #e5b876;      /* warm page edge */
  --rule: #d8b483;         /* hairlines on paper */
  --ink: #4a2408;          /* body copy */
  --muted: #7a5528;        /* secondary copy — WARM, never grey-blue.
                              Darkened from #8a6236: that only reached 3.88:1 on
                              the paper, under the 4.5 the body text needs. */
  --accent: #7b3911;
  --red: #a8261a;          /* an aged brick, not a neon alert */
  --r: 14px;
  --tap: 46px;

  /* surfaces that differ between modes */
  --field: rgba(255, 255, 255, .62);
  --field-focus: #fffdf6;
  --raised: rgba(255, 255, 255, .5);
  --on-brand: #fdf3dc;     /* text on a solid brown fill */
  --shimmer: rgba(255, 255, 255, .42);
  --grain: rgba(123, 57, 17, .035);
  --page:
    radial-gradient(1100px 700px at 50% -10%, #f7ebc9 0%, transparent 55%),
    radial-gradient(900px 620px at 100% 100%, #e8bd7d 0%, transparent 58%),
    radial-gradient(900px 620px at 0% 100%, #e8bd7d 0%, transparent 58%),
    linear-gradient(180deg, #f2dfb2 0%, #efd8a8 45%, #e9cd97 100%);
  --bar: rgba(240, 220, 174, .9);
  --thumb: #e8cf9e;

  /* legacy names kept so older markup keeps working */
  --bg: var(--paper);
  --card: var(--paper-2);
  --card2: var(--raised);
  --border: var(--rule);
  --emerald: var(--brown);
  --emerald-lt: var(--brown-md);
  --amber: var(--gold);
}

html.dark {
  --brown: #e8c48a;        /* wordmark -> warm gold-cream */
  --brown-dp: #f2ddb4;     /* headings */
  --brown-md: #c9a978;     /* secondary ink */
  --gold: #d9a13a;         /* ampersand stays gold, brightened */
  --gold-lt: #e8bb5c;
  --gold-ink: #e8bb5c;     /* on walnut the brightened gold reads fine as text */
  --paper: #1b1410;        /* page centre — dark walnut */
  --paper-2: #251c15;      /* raised card */
  --paper-3: #120d0a;      /* page edge, deeper */
  --rule: #3f3021;         /* hairlines */
  --ink: #ecd9b4;          /* body copy — cream */
  --muted: #a98f66;        /* secondary copy */
  --accent: #d9a13a;
  --red: #e2705f;
  --field: rgba(255, 255, 255, .06);
  --field-focus: rgba(255, 255, 255, .1);
  --raised: rgba(255, 255, 255, .05);
  --on-brand: #1b1410;     /* dark text on the gold button */
  --shimmer: rgba(255, 232, 190, .10);
  --grain: rgba(232, 196, 138, .03);
  --page:
    radial-gradient(1100px 700px at 50% -10%, #33251a 0%, transparent 58%),
    radial-gradient(900px 620px at 100% 100%, #241a12 0%, transparent 60%),
    radial-gradient(900px 620px at 0% 100%, #241a12 0%, transparent 60%),
    linear-gradient(180deg, #1f1712 0%, #1b1410 45%, #150f0b 100%);
  --bar: rgba(27, 20, 16, .88);
  --thumb: #2e2318;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--page) fixed, var(--paper);
  color: var(--ink);
  font: 17px/1.55 Georgia, "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}

/* a faint fibre grain over the paper — a flat cream fill looks cheap */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--grain) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, var(--grain) 0 1px, transparent 1px 3px);
  opacity: .9;
}
body > * { position: relative; z-index: 1; }

a { color: var(--brown); text-decoration: none; }
a:hover { color: var(--gold); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-family: Georgia, serif; }
h1 { font-size: 27px; letter-spacing: -.01em; color: var(--brown-dp); }
h2 { font-size: 21px; color: var(--brown-dp); }
h3 { font-size: 18px; color: var(--brown-dp); }

/* UI bits stay in the sans face — serif body is for READING */
button, input, .chip, .afhint, .tag, .badge, .stat .k, nav, footer,
.stepper, .meta, .lead, .hintline, .label {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 12px 96px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bar);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
}
.topbar-in {
  max-width: 780px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: Georgia, serif; font-weight: 700; font-size: 15px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brown);
  /* NEVER wrap: the full lockup on one line, or the topbar breaks the layout.
     The surname shortens on narrow phones below (see the media query). */
  white-space: nowrap; min-width: 0;
}
.brand .amp { color: var(--gold); }
/* on a narrow phone the full name plus nav plus toggle will not fit. Drop to the
   surname only — truncating to "S&" reads as nonsense, which is why the whole
   given name goes rather than half of both. */
@media (max-width: 429px) {
  /* drop the given name AND the ampersand: "& NORDSTROM" reads wrong, and the
     hero crest directly below carries the full lockup anyway. */
  .brand .given, .brand .amp { display: none; }
  .brand { font-size: 14px; letter-spacing: .07em; }
}
.topbar nav { margin-left: auto; display: flex; gap: 4px; min-width: 0; }
.topbar nav a {
  padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600;
  color: var(--muted); border: 1px solid transparent; white-space: nowrap;
}
@media (max-width: 429px) {
  .topbar nav a { padding: 8px 9px; font-size: 14px; }
  .topbar-in { padding: 7px 8px; gap: 6px; }
  .themebtn { width: 34px; height: 34px; font-size: 15px; }
}
.topbar nav a.on, .topbar nav a:hover {
  color: var(--on-brand); background: var(--brown); border-color: var(--brown);
  opacity: 1;
}
.topbar nav a.on { color: var(--on-brand); }
html.dark .topbar nav a.on, html.dark .topbar nav a:hover { color: #1b1410; }

/* ---------------------------------------------------------------- hero */
/* The crest sits in the hero with the wordmark artwork; on phones the text
   lockup carries the brand instead of a squashed logo. */
.hero {
  background: var(--page);
  border-bottom: 1px solid var(--rule);
  padding: 30px 12px 26px;
  text-align: center;
}
.hero-in { max-width: 780px; margin: 0 auto; }
.crest { display: block; margin: 0 auto 10px; width: min(360px, 86vw); height: auto; }
html.dark .crest { content: url("/logo-dark.png"); }
.hero h1 { font-size: 31px; }
.hero h1 .amp { color: var(--gold); }
.hero p { color: var(--muted); margin: 8px auto 0; font-size: 16px; max-width: 46ch; }
/* a rule with a wheat-ish diamond, echoing the lockup */
.hero .rule {
  width: 120px; height: 1px; margin: 16px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  position: relative;
}
.hero .rule::after {
  content: "\25C6"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); font-size: 8px; color: var(--gold);
}
.trust-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--brown);
  background: var(--raised); border: 1px solid var(--rule);
  padding: 4px 10px; border-radius: 999px;
}
.chip .dot { color: var(--gold); font-size: 8px; }

/* ---------------------------------------------------------------- search */
.searchbox { position: relative; margin-top: 14px; }
.searchbox input {
  width: 100%; height: var(--tap);
  background: var(--field); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 12px;
  padding: 0 44px 0 40px; font-size: 16px;
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:focus {
  outline: none; border-color: var(--gold-ink);
  background: var(--field-focus); box-shadow: 0 0 0 3px var(--shimmer);
}
.searchbox .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox .clr {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; display: none;
}
.searchbox .clr:hover { color: var(--brown); background: var(--raised); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto; height: 36px; padding: 0 13px; font-size: 14px; font-weight: 600;
  color: var(--brown); background: var(--raised); border: 1px solid var(--rule);
  border-radius: 999px; cursor: pointer;
}
.filters button:hover { border-color: var(--gold-ink); }
.filters button.on { color: var(--on-brand); background: var(--brown); border-color: var(--brown); }

/* attribute filter row: the "what can I cook tonight" chips. Multi-select,
   so these read as toggles rather than a single-choice row. */
.afrow { margin-top: 12px; }
.afhint { color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 2px; }
.afilters { flex-wrap: wrap; overflow: visible; padding-top: 6px; }
.afilters button {
  height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; border-radius: 10px;
}
.afilters button .n {
  font-size: 12px; font-weight: 700; color: var(--muted); background: var(--raised);
  border-radius: 6px; padding: 1px 6px; min-width: 20px; text-align: center;
}
.afilters button.on .n { color: var(--on-brand); background: rgba(255, 255, 255, .22); }
.afilters button[aria-pressed="true"] { box-shadow: 0 4px 14px rgba(123, 57, 17, .16); }

.count { color: var(--muted); font-size: 14px; padding: 12px 2px 6px; }

/* ------------------------------------------------ home: search-new panel */
/* The reason to open the app is finding something new, so it gets the prime
   real estate and a solid CTA — not a ghost button. */
.findspanel {
  background: var(--raised); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 16px 14px; margin: 14px 0 22px;
}
.findspanel h2 { font-size: 22px; }
.findspanel .lead { color: var(--muted); font-size: 15px; margin: 6px 0 12px; }
.findspanel .row { display: flex; gap: 8px; flex-wrap: wrap; }
.findspanel .row .btn { flex: 1 1 auto; }
.findspanel .opt-list:not(:empty) { margin-top: 12px; }
.hintline { color: var(--muted); font-size: 14px; padding-top: 10px; }

.secthead { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.secthead h2 { font-size: 21px; display: flex; align-items: center; gap: 8px; }
.secthead .pill {
  font-size: 13px; font-weight: 700; color: var(--brown);
  background: var(--raised); border: 1px solid var(--rule);
  border-radius: 999px; padding: 2px 9px;
}
.secthead .mini { font-size: 14px; font-weight: 600; color: var(--brown); text-decoration: none; }
.secthead .mini:hover { color: var(--gold-ink); }

/* grouped type filters: a heading per question, chips under it */
.afgroup { margin-bottom: 10px; }
.afgroup .afhint { padding-bottom: 4px; }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  display: block; background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: var(--r); overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  box-shadow: 0 1px 2px rgba(94, 42, 10, .05);
}
.card:hover {
  transform: translateY(-2px); border-color: var(--gold);
  box-shadow: 0 10px 26px rgba(94, 42, 10, .14);
}
html.dark .card { box-shadow: none; }
html.dark .card:hover { box-shadow: 0 10px 26px rgba(0, 0, 0, .4); }

/* the wrapper holds the link + the delete button, so the button can sit ON the
   card without being nested inside the anchor (a button inside <a> is invalid
   HTML and unclickable on touch). */
.cardwrap { position: relative; }
.cardwrap .del {
  position: absolute; top: 8px; right: 8px;
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  background: var(--bar); color: var(--muted);
  border: 1px solid var(--rule); cursor: pointer;
  backdrop-filter: blur(3px);
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
.cardwrap .del:hover { color: var(--red); border-color: var(--red); background: rgba(168, 38, 26, .12); }
.cardwrap .del:disabled { opacity: .6; cursor: default; }
/* on a phone the button is only visible while the tile is pressed, so an
   accidental delete is much less likely than a tap on the recipe */
@media (hover: none) {
  .cardwrap .del { opacity: .6; }
  .cardwrap:active .del { opacity: 1; }
}
/* placeholder tile: a warm paper gradient that follows the THEME. A light-cream
   image baked in would stay bright in dark mode. */
.card .thumb { height: 132px; background: var(--paper-3) center/cover no-repeat; display: block; }
.card .thumb.empty {
  display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(160deg, var(--thumb), var(--paper-2));
  color: var(--brown); opacity: .72;
}
/* keep the padding a BLOCK: as an inline <span> the vertical padding never
   applied and text sat 1px from the card edge. */
.card .body { display: block; padding: 16px 18px 18px; }
.card h3 { font-size: 19px; }
.card .meta { color: var(--muted); font-size: 14px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag {
  font-size: 12px; font-weight: 600; color: var(--brown);
  background: var(--raised); border: 1px solid var(--rule);
  padding: 3px 8px; border-radius: 7px;
}

.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--raised); color: var(--brown); border: 1px solid var(--rule);
}
/* the TINTED FILL carries the gold; the text must stay dark. Gold-on-gold reads
   at 3.70:1 and the badge is small, so it needs the extra weight. */
.badge.warn { background: rgba(184, 124, 13, .14); color: var(--brown-dp); border-color: rgba(184, 124, 13, .38); }
html.dark .badge.warn { color: var(--gold-lt); }
.opt .n { font-size: 13px; color: var(--ink); margin-top: 3px; opacity: .82; }

/* ---------------------------------------------------------------- recipe */
.rec-hero { position: relative; border-radius: var(--r); overflow: hidden; margin-top: 12px; border: 1px solid var(--rule); }
.rec-hero img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.rec-hero .src {
  position: absolute; right: 8px; bottom: 8px;
  background: var(--bar); border: 1px solid var(--rule);
  font-size: 12px; color: var(--muted); padding: 3px 9px; border-radius: 7px;
}
.rec-head { padding: 14px 2px 0; }
.rec-head h1 { font-size: 26px; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stat {
  background: var(--raised); border: 1px solid var(--rule); border-radius: 11px;
  padding: 9px 10px; text-align: center;
}
.stat .v { font-size: 18px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.panel { background: var(--raised); border: 1px solid var(--rule); border-radius: var(--r); padding: 13px; margin-top: 12px; }

/* scaling stepper */
.scale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scale .lab { font-size: 15px; font-weight: 600; color: var(--muted); }
.stepper { display: flex; align-items: center; background: var(--field); border: 1px solid var(--rule); border-radius: 11px; overflow: hidden; }
.stepper button {
  width: var(--tap); height: var(--tap); border: 0; background: transparent; color: var(--ink);
  font-size: 22px; font-weight: 700; cursor: pointer;
}
.stepper button:hover { background: var(--raised); }
.stepper .val { min-width: 74px; text-align: center; font-size: 18px; font-weight: 700; }
.scale .hint { font-size: 13px; color: var(--muted); }
.scale .warnline { font-size: 13px; color: var(--amber); width: 100%; }

/* ingredient rows */
ul.ings { list-style: none; margin: 0; padding: 0; }
.ing {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--rule);
}
.ing:last-child { border-bottom: 0; }
.ing .qty { flex: 0 0 auto; min-width: 76px; font-weight: 700; font-size: 17px; color: var(--gold-ink); }
.ing .txt { flex: 1 1 auto; min-width: 0; }
.ing .nm { font-size: 16px; }
.ing .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* the small "sub" marker beside an ingredient. Specificity (0,2,0) beats a bare
   .opt, so this is the rule that actually paints it — muted left it at 4.38:1. */
.ing .opt { font-size: 11px; font-weight: 700; color: var(--ink); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; margin-left: 6px; }
.ing button.subbtn {
  flex: 0 0 auto; height: 36px; padding: 0 11px; font-size: 13px; font-weight: 700;
  color: var(--brown); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 9px; cursor: pointer;
}
.ing button.subbtn:hover { background: var(--paper-3); border-color: var(--gold); }

/* steps */
.steps { counter-reset: s; }
.step {
  display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.step:last-child { border-bottom: 0; }
.step .n {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  font-family: Inter, sans-serif;
  background: var(--raised); color: var(--brown); border: 1px solid var(--rule);
}
.step .tx { flex: 1 1 auto; font-size: 18px; line-height: 1.55; }
.step .sect { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 3px; }
.step-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.timerbtn {
  height: 38px; padding: 0 13px; font-size: 14px; font-weight: 700; cursor: pointer;
  color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 10px;
}
.timerbtn:hover { border-color: var(--gold); }
.timerbtn.running { color: var(--on-brand); background: var(--brown); border-color: var(--brown); }
.timerbtn.done { color: #fff; background: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .62; } }

/* substitution sheet */
.sheet-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--paper-2); border-top: 1px solid var(--rule);
  border-radius: 18px 18px 0 0; padding: 16px 14px 22px;
  max-height: 84vh; overflow-y: auto;
  transform: translateY(102%); transition: transform .22s cubic-bezier(.22,.8,.3,1);
}
.sheet.on { transform: none; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; width: 660px; transform: translate(-50%, 102%); border-radius: 18px 18px 0 0; }
  .sheet.on { transform: translate(-50%, 0); }
}
.sheet .grab { width: 40px; height: 4px; background: var(--rule); border-radius: 999px; margin: -6px auto 12px; }
.sheet h2 { font-size: 19px; }
.sheet .lead { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.opt-list { display: grid; gap: 8px; }
.opt {
  background: var(--field); border: 1px solid var(--rule); border-radius: 11px; padding: 11px 12px;
  color: var(--ink);
}
.opt .s { font-size: 15px; font-weight: 600; }
.opt .n { font-size: 13px; color: var(--muted); margin-top: 3px; }
.ai-note {
  margin-top: 12px; font-size: 13px; color: var(--amber);
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.28);
  padding: 9px 11px; border-radius: 10px;
}
.ask { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 13px; }
.ask label { font-size: 14px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.ask .row { display: flex; gap: 8px; }
.ask input {
  flex: 1 1 auto; height: var(--tap); background: var(--field); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 11px; padding: 0 12px; font-size: 16px;
}
.ask input:focus { outline: none; border-color: var(--gold); }
.btn {
  height: var(--tap); padding: 0 16px; font-size: 15px; font-weight: 700; cursor: pointer;
  color: var(--on-brand); background: var(--brown); border: 1px solid var(--brown); border-radius: 11px;
}
.btn:hover { background: var(--brown-dp); border-color: var(--brown-dp); color: var(--on-brand); }
/* In dark mode a solid button becomes GOLD with dark text. Scoped to :not(.ghost)
   because `.btn` also matches `.btn.ghost` — an unscoped rule here outranks
   `.btn.ghost` and leaves the ghost button dark-on-dark and unreadable. */
html.dark .btn:not(.ghost) { color: #1b1410; }
html.dark .btn:not(.ghost):hover { background: var(--gold-lt); border-color: var(--gold-lt); }
.btn.ghost {
  background: transparent; color: var(--brown); border-color: var(--rule);
}
.btn.ghost:hover { border-color: var(--gold-ink); color: var(--gold-ink); }
html.dark .btn.ghost { color: var(--brown); border-color: var(--rule); }
html.dark .btn.ghost:hover { color: var(--gold-lt); border-color: var(--gold-lt); }
.btn[disabled] { opacity: .5; cursor: default; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: currentColor; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* add recipe */
.addrow { display: flex; gap: 8px; }
.addrow input {
  flex: 1 1 auto; height: var(--tap); background: var(--field); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 11px; padding: 0 12px; font-size: 16px;
}
.addrow input:focus { outline: none; border-color: var(--gold); }
.result { margin-top: 11px; font-size: 15px; }
.result.ok { color: var(--gold-ink); }
.result.err { color: var(--red); }
.result .w { color: var(--amber); font-size: 13px; display: block; margin-top: 5px; }

/* misc */
.empty-state { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty-state .big { font-size: 40px; opacity: .4; margin-bottom: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 15px; font-weight: 600; padding: 12px 2px; }
.back:hover { color: var(--gold-ink); }
.src-link { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }
footer { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 12px 30px; }
footer a { color: var(--brown); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* reduced motion — reveals/hover must never be the only signal */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .card:hover { transform: none; }
}


/* ------------------------------------------------------- theme toggle */
.themebtn {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  line-height: 0; cursor: pointer;
  color: var(--brown); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 10px;
}
/* Exactly one icon shows, chosen by CSS from the mode the <head> script already
   set — so the correct one is painted on the first frame, no swap flash. */
.themebtn .i-sun { display: none; }
html.dark .themebtn .i-moon { display: none; }
html.dark .themebtn .i-sun { display: block; }
.themebtn svg { width: 19px; height: 19px; }
.themebtn:hover { border-color: var(--gold-ink); color: var(--gold-ink); }

/* ============================================================ motion
   Copied from the NLK canon (/var/www/nlkauto #motion-style + #motion-js):
   translateY(46px) scale(.97) -> none over .9s cubic-bezier(.22,.61,.36,1),
   data-delay stagger, and a soft sweep on the crest.

   The `html.js` prefix IS the no-JS guard: without JS the class is never set,
   so everything stays visible. Reduced motion kills both. */
html.js .reveal {
  opacity: 0;
  transform: translateY(46px) scale(.97);
  transition: opacity .9s cubic-bezier(.22,.61,.36,1),
              transform .9s cubic-bezier(.22,.61,.36,1);
}
html.js .reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }
.reveal[data-delay="5"] { transition-delay: .4s; }

@keyframes heroIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}
/* a white sweep across the crest on entrance, same idea as the NLK hero shimmer */
.crestwrap { position: relative; display: block; margin: 0 auto 10px; width: min(360px, 86vw); }
.crestwrap .crest { margin: 0; width: 100%; }
html.js .crestwrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, var(--shimmer) 50%, transparent 62%);
  background-size: 260% 100%; background-position: 130% 0;
  animation: shimmer 2.4s .5s ease-out 1 both;
}
@keyframes shimmer {
  0%   { background-position: 130% 0; }
  100% { background-position: -30% 0; }
}

/* cascading hero entrance */
html.js body.loaded .hero h1 { animation: heroIn 1s .1s cubic-bezier(.22,.61,.36,1) both; }
html.js body.loaded .hero .rule { animation: heroIn 1s .18s cubic-bezier(.22,.61,.36,1) both; }
html.js body.loaded .hero p { animation: heroIn 1s .24s cubic-bezier(.22,.61,.36,1) both; }
html.js body.loaded .trust-chips { animation: heroIn 1s .32s cubic-bezier(.22,.61,.36,1) both; }

@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  html.js .crestwrap::before { display: none !important; }
  html.js body.loaded .hero h1,
  html.js body.loaded .hero .rule,
  html.js body.loaded .hero p,
  html.js body.loaded .trust-chips { animation: none !important; }
}
