/* ============================================================
   amoscooks — shadcn/ui inspired design system
   Neutral (zinc) base + tweakable warm "yolk" brand accent
   ============================================================ */

/* ---- Tokens ------------------------------------------------ */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5% 65%;
  --radius: 0.7rem;

  /* brand (overwritten by JS tweak) */
  --brand: #f4b400;
  --brand-fg: #3a2c00;
  --brand-soft: color-mix(in srgb, var(--brand) 15%, hsl(var(--background)));
  --brand-line: color-mix(in srgb, var(--brand) 42%, hsl(var(--border)));

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / .07), 0 1px 2px -1px rgb(0 0 0 / .07);
  --shadow-md: 0 8px 24px -6px rgb(20 18 10 / .14), 0 2px 6px -2px rgb(0 0 0 / .08);
  --shadow-lg: 0 24px 60px -18px rgb(20 18 10 / .28);
}

.dark {
  --background: 240 10% 4.5%;
  --foreground: 0 0% 98%;
  --card: 240 8% 7.5%;
  --card-foreground: 0 0% 98%;
  --popover: 240 9% 6.5%;
  --popover-foreground: 0 0% 98%;
  --muted: 240 4% 15%;
  --muted-foreground: 240 5% 65%;
  --accent: 240 4% 16%;
  --accent-foreground: 0 0% 98%;
  --secondary: 240 4% 15%;
  --secondary-foreground: 0 0% 98%;
  --border: 240 4% 16%;
  --input: 240 4% 20%;
  --ring: 240 5% 44%;
  --shadow-md: 0 10px 30px -8px rgb(0 0 0 / .6), 0 2px 8px -2px rgb(0 0 0 / .5);
  --shadow-lg: 0 30px 70px -20px rgb(0 0 0 / .75);
}

/* ---- Reset / base ----------------------------------------- */
* { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
.mono { font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; font-feature-settings: "tnum"; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--brand) 40%, transparent); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 99px; border: 3px solid hsl(var(--background)); }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / .5); }

/* ---- Type scale ------------------------------------------- */
.h-display { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 600; }
.h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); line-height: 1.08; letter-spacing: -0.028em; font-weight: 600; }
.h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
.h3 { font-size: 1.18rem; line-height: 1.3; letter-spacing: -0.012em; font-weight: 600; }
.eyebrow { font-size: .735rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: hsl(var(--muted-foreground)); }
.lead { font-size: clamp(1.02rem, 1.4vw, 1.18rem); color: hsl(var(--muted-foreground)); line-height: 1.6; }
.muted { color: hsl(var(--muted-foreground)); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- Layout ----------------------------------------------- */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.2rem); }
.container-tight { max-width: 880px; }
.row { display: flex; align-items: center; gap: .6rem; }
.col { display: flex; flex-direction: column; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ---- Buttons ---------------------------------------------- */
.btn {
  --bh: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: var(--bh); padding-inline: 1rem; border-radius: calc(var(--radius) - .15rem);
  font-size: .9rem; font-weight: 500; white-space: nowrap; user-select: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(.5px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }
.btn-primary { background: var(--brand); color: var(--brand-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(.95) saturate(1.05); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(var(--muted-foreground) / .16); }
.btn-outline { border-color: hsl(var(--border)); background: hsl(var(--background)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-sm { --bh: 2.1rem; padding-inline: .75rem; font-size: .84rem; border-radius: calc(var(--radius) - .25rem); }
.btn-lg { --bh: 2.95rem; padding-inline: 1.5rem; font-size: 1rem; }
.btn-icon { --bh: 2.4rem; width: 2.4rem; padding: 0; }
.btn-icon.btn-sm { --bh: 2.1rem; width: 2.1rem; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---- Card ------------------------------------------------- */
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: clamp(1.1rem, 2.4vw, 1.6rem); }

/* ---- Badge / chip ----------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  height: 1.5rem; padding-inline: .6rem; border-radius: 99px;
  font-size: .735rem; font-weight: 500; letter-spacing: .005em;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border: 1px solid transparent; white-space: nowrap;
}
.badge svg { width: .85rem; height: .85rem; }
.badge-brand { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 72%, hsl(var(--foreground))); border-color: var(--brand-line); }
.badge-outline { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }

.chip {
  display: inline-flex; align-items: center; gap: .4rem; height: 2.15rem; padding-inline: .85rem;
  border-radius: 99px; border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  font-size: .85rem; font-weight: 500; color: hsl(var(--muted-foreground));
  transition: all .15s ease; user-select: none;
}
.chip:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-fg); border-color: transparent; }
.chip svg { width: 1rem; height: 1rem; }

/* ---- Input ------------------------------------------------ */
.input {
  display: flex; align-items: center; gap: .55rem; height: 2.6rem;
  padding-inline: .8rem; border-radius: calc(var(--radius) - .15rem);
  border: 1px solid hsl(var(--input)); background: hsl(var(--background));
  color: hsl(var(--foreground)); font-size: .92rem; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .input:focus-within { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input input { border: none; background: none; outline: none; width: 100%; color: inherit; font: inherit; }
.input input::placeholder { color: hsl(var(--muted-foreground)); }
.input svg { width: 1.1rem; height: 1.1rem; color: hsl(var(--muted-foreground)); flex: none; }

.kbd {
  display: inline-flex; align-items: center; gap: 1px; height: 1.35rem; padding-inline: .4rem;
  border-radius: .35rem; border: 1px solid hsl(var(--border)); background: hsl(var(--muted));
  font-family: "Geist Mono", monospace; font-size: .72rem; color: hsl(var(--muted-foreground));
}

/* ---- Separator / misc ------------------------------------- */
.sep { height: 1px; background: hsl(var(--border)); border: 0; width: 100%; }
.sep-v { width: 1px; align-self: stretch; background: hsl(var(--border)); }
.dotline { border: 0; border-top: 1px dashed hsl(var(--border)); }

/* ---- Checkbox (ingredient) -------------------------------- */
.check {
  appearance: none; width: 1.25rem; height: 1.25rem; flex: none; border-radius: .4rem;
  border: 1.5px solid hsl(var(--muted-foreground) / .55); background: hsl(var(--background));
  display: grid; place-content: center; cursor: pointer; transition: all .15s ease;
}
.check:hover { border-color: var(--brand); }
.check:checked { background: var(--brand); border-color: var(--brand); }
.check:checked::after {
  content: ""; width: .35rem; height: .65rem; margin-top: -2px;
  border: solid var(--brand-fg); border-width: 0 2px 2px 0; transform: rotate(42deg);
}

/* ---- Pill switch (cook-mode "only this step") ------------- */
.switch {
  --sw: 2.5rem; --sh: 1.4rem;
  position: relative; flex: none; width: var(--sw); height: var(--sh); padding: 0;
  border-radius: 99px; border: 1.5px solid hsl(var(--muted-foreground) / .45);
  background: hsl(var(--muted)); cursor: pointer; transition: background .18s ease, border-color .18s ease;
}
.switch[aria-checked="true"] { background: var(--brand); border-color: transparent; }
.switch i {
  position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: calc(var(--sh) - 8px); height: calc(var(--sh) - 8px); border-radius: 99px;
  background: #fff; box-shadow: var(--shadow-sm); transition: left .18s ease;
}
.switch[aria-checked="true"] i { left: calc(var(--sw) - var(--sh) + 3px); }

/* ---- Navbar ----------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, hsl(var(--background)) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid hsl(var(--border));
}
.nav-inner { height: 4rem; display: flex; align-items: center; gap: 1.2rem; }
.nav-link {
  position: relative; font-size: .92rem; font-weight: 500; color: hsl(var(--muted-foreground));
  padding: .4rem .2rem; transition: color .15s ease;
}
.nav-link:hover { color: hsl(var(--foreground)); }
.nav-link.active { color: hsl(var(--foreground)); }
.nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1.05rem; height: 2px;
  background: var(--brand); border-radius: 2px;
}

/* ---- Recipe grid + card ----------------------------------- */
.grid-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: clamp(1.1rem, 2.2vw, 1.6rem); }
.rcard {
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius);
  border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  box-shadow: var(--shadow-sm); transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s ease, border-color .22s ease;
}
.rcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--brand-line); }
.rcard-media { position: relative; aspect-ratio: 4/3; overflow: hidden; background: hsl(var(--muted)); }
.rcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.22,1,.36,1); }
.rcard:hover .rcard-media img { transform: scale(1.045); }
.rcard-media .badge { position: absolute; top: .7rem; left: .7rem; backdrop-filter: blur(6px); background: color-mix(in srgb, hsl(var(--background)) 80%, transparent); }

/* ---- Image placeholder (striped) -------------------------- */
.ph {
  display: grid; place-content: center; gap: .4rem; text-align: center;
  background:
    repeating-linear-gradient(135deg, hsl(var(--muted)) 0 14px, color-mix(in srgb, hsl(var(--muted)) 60%, hsl(var(--background))) 14px 28px);
  color: hsl(var(--muted-foreground));
}
.ph .mono { font-size: .72rem; letter-spacing: .03em; }

/* ---- Prose (markdown article) ----------------------------- */
.prose { font-size: 1.04rem; line-height: 1.72; color: hsl(var(--foreground)); }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin-top: 2.1em; line-height: 1.2; }
.prose h3 { font-size: 1.18rem; font-weight: 600; margin-top: 1.7em; }
.prose h2 + p, .prose h3 + p { margin-top: .6em; }
.prose p { color: hsl(var(--foreground) / .92); }
.prose strong { font-weight: 650; color: hsl(var(--foreground)); }
.prose a { color: color-mix(in srgb, var(--brand) 60%, hsl(var(--foreground))); text-underline-offset: 3px; text-decoration: underline; text-decoration-color: var(--brand-line); }
.prose a:hover { text-decoration-color: var(--brand); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose blockquote { border-left: 3px solid var(--brand); padding-left: 1.1em; color: hsl(var(--muted-foreground)); font-style: italic; }

/* ---- Steps ------------------------------------------------ */
.step { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; padding: 1rem 0; }
.step + .step { border-top: 1px solid hsl(var(--border)); }
.step-num {
  width: 2.1rem; height: 2.1rem; flex: none; border-radius: 50%; display: grid; place-content: center;
  font-weight: 600; font-size: .95rem; border: 1.5px solid hsl(var(--border));
  background: hsl(var(--background)); transition: all .2s ease; cursor: pointer; user-select: none;
}
.step[data-done="true"] .step-num { background: var(--brand); color: var(--brand-fg); border-color: transparent; }
.step[data-done="true"] .step-body { color: hsl(var(--muted-foreground)); text-decoration: line-through; text-decoration-color: hsl(var(--muted-foreground) / .4); }
.step-body { padding-top: .25rem; }

/* ---- Ingredient table ------------------------------------- */
.ing { display: flex; align-items: center; gap: .85rem; padding: .62rem 0; }
.ing + .ing { border-top: 1px dashed hsl(var(--border)); }
.ing-label { flex: 1; transition: opacity .15s ease; }
.ing[data-checked="true"] .ing-label { opacity: .45; text-decoration: line-through; }
.ing-amt { font-family: "Geist Mono", monospace; font-size: .9rem; color: hsl(var(--foreground)); white-space: nowrap; }
.ing[data-opt="true"] .ing-label::after { content: "optional"; margin-left: .5rem; font-size: .68rem; vertical-align: middle; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); border-radius: 99px; padding: .05rem .4rem; }

/* ---- Command palette -------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center;
  padding-top: 12vh; background: rgb(10 9 6 / .42); backdrop-filter: blur(3px);
  animation: fadeIn .14s ease both;
}
.cmd {
  width: min(640px, 92vw); background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + .2rem); overflow: hidden;
  box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.22,1,.36,1) both;
}
.cmd-head { display: flex; align-items: center; gap: .6rem; padding: .4rem .9rem; border-bottom: 1px solid hsl(var(--border)); }
.cmd-head input { flex: 1; height: 3rem; border: none; background: none; outline: none; font-size: 1rem; color: inherit; }
.cmd-head input::placeholder { color: hsl(var(--muted-foreground)); }
.cmd-list { max-height: 56vh; overflow-y: auto; padding: .4rem; }
.cmd-group-label { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: hsl(var(--muted-foreground)); padding: .6rem .65rem .3rem; }
.cmd-item {
  display: flex; align-items: center; gap: .75rem; padding: .55rem .65rem; border-radius: calc(var(--radius) - .25rem);
  cursor: pointer; scroll-margin: .5rem;
}
.cmd-item[data-active="true"] { background: hsl(var(--accent)); }
.cmd-item .ci-ico { width: 2.1rem; height: 2.1rem; border-radius: .5rem; flex: none; display: grid; place-content: center; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); overflow: hidden; }
.cmd-item .ci-ico img { width: 100%; height: 100%; object-fit: cover; }
.cmd-item .ci-ico svg { width: 1.1rem; height: 1.1rem; }
.cmd-empty { padding: 2.4rem 1rem; text-align: center; color: hsl(var(--muted-foreground)); font-size: .92rem; }

/* ---- Cook mode -------------------------------------------- */
.cook { position: fixed; inset: 0; z-index: 95; background: hsl(var(--background)); display: flex; flex-direction: column; animation: fadeIn .2s ease both; }
.cook-top { display: flex; align-items: center; justify-content: space-between; padding: 1rem clamp(1rem,4vw,2rem); border-bottom: 1px solid hsl(var(--border)); }
.cook-body { flex: 1; overflow-y: auto; display: grid; place-items: center; padding: clamp(1.5rem, 6vw, 4rem); }
.cook-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 0.8fr) 1.2fr; }
.cook-ings { overflow-y: auto; padding: clamp(1.2rem,3vw,2rem); border-right: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .3); }
.cook-instr { overflow-y: auto; display: grid; place-items: center; padding: clamp(1.5rem,5vw,3.5rem); }
@media (max-width: 760px) {
  .cook-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .cook-ings { border-right: none; border-bottom: 1px solid hsl(var(--border)); max-height: 38vh; }
}
.cook-step { max-width: 760px; width: 100%; }
.cook-progress { height: 4px; background: hsl(var(--muted)); border-radius: 99px; overflow: hidden; }
.cook-progress > div { height: 100%; background: var(--brand); transition: width .35s cubic-bezier(.22,1,.36,1); }

/* ---- Toggle (theme) --------------------------------------- */
.theme-btn svg { transition: transform .4s cubic-bezier(.22,1,.36,1), opacity .2s ease; }

/* ---- Footer ----------------------------------------------- */
.footer { border-top: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .35); margin-top: 5rem; }

/* ---- Animations ------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.page { animation: pageIn .32s ease; }
@keyframes pageIn { from { opacity: .55; } to { opacity: 1; } }
.stagger { /* stagger handled per-child via .reveal --i delay */ }
.reveal { transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1); transition-delay: calc(var(--i, 0) * 50ms); }
.reveal.pre { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- Motion off (tweak) ----------------------------------- */
body[data-motion="off"] .reveal, body[data-motion="off"] .reveal.pre { opacity: 1 !important; transform: none !important; }
body[data-motion="off"] .page { animation: none !important; }
body[data-motion="off"] * { transition-duration: .01ms !important; }

/* ---- Print ------------------------------------------------ */
@media print {
  .nav, .footer, .om-tweaks, .btn-primary, .btn-outline, .step-num { box-shadow: none !important; }
  .nav, .footer { display: none !important; }
  body { background: #fff; color: #000; }
  .recipe-body { display: block !important; }
  aside { position: static !important; }
  .rcard-media, .reveal { break-inside: avoid; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 880px) {
  .hero-grid, .recipe-hero, .recipe-body { grid-template-columns: 1fr !important; }
  .recipe-body aside { position: static !important; }
}
.hide-mobile { }
@media (max-width: 820px) {
  .hide-mobile { display: none !important; }
  .nav-inner { height: 3.6rem; }
}
.show-mobile { display: none !important; }
@media (max-width: 820px) { .show-mobile { display: inline-flex !important; } }
