:root {
  --canvas: #F4F3F1;
  --card: #FFFFFF;
  --ink: #1C1A1B;
  --ink-soft: #6B6669;
  --line: #E4E2DF;
  --accent: #B03A5B;
  --accent-soft: #FBEEF2;
  --on-accent: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 26, 27, .05), 0 6px 20px rgba(28, 26, 27, .06);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #17161A;
    --card: #201E23;
    --ink: #EFECEE;
    --ink-soft: #9C959B;
    --line: #302D34;
    --accent: #F1849F;
    --accent-soft: #331F27;
    --on-accent: #17161A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  text-decoration: none; color: var(--ink);
}
.brand-mark { font-size: 1.4rem; }
.brand-name { font-family: var(--serif); font-size: 1.25rem; letter-spacing: -.01em; }

.topbar-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* On a phone the header was wrapping onto three rows and eating the screen.
   Lay it out as a grid instead: brand + controls up top, search across the bottom. */
@media (max-width: 560px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand  add"
      "search search";
    gap: .55rem;
    align-items: center;
    padding: .8rem 1rem;
  }
  .topbar-actions { display: contents; }
  .brand { grid-area: brand; min-width: 0; }
  .brand-name { font-size: 1.1rem; }
  .topbar .btn { grid-area: add; padding: .45rem .85rem; font-size: .85rem; }
  .search { grid-area: search; }
  .search input { width: 100%; max-width: none; }
}

.search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .9rem;
}
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { border: 0; background: none; outline: none; width: 11rem; max-width: 40vw; }
.search:focus-within { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 999px;
  padding: .5rem 1.1rem;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn[disabled] { opacity: .55; cursor: default; filter: none; }

/* Once the recipe is done, the button asks to be pressed. */
.btn.ready { animation: ready 1.4s ease-in-out infinite; }
@keyframes ready {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50%      { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); }
}


/* ---------- layout ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem) 4rem;
}
main:focus { outline: none; }

.page-head { margin-bottom: 1.8rem; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.page-head p { color: var(--ink-soft); margin-top: .4rem; }

/* ---------- recipe grid ---------- */
.grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(28,26,27,.06), 0 14px 32px rgba(28,26,27,.10); }

.card-top {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  font-size: 3.4rem;
  line-height: 1;
  position: relative;
}
.card-cooked {
  position: absolute;
  top: .6rem; right: .6rem;
  background: rgba(255,255,255,.92);
  color: #1C1A1B;
  border-radius: 999px;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 600;
}
.card-body { padding: .95rem 1.05rem 1.15rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card-body h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.card-body .blurb { color: var(--ink-soft); font-size: .88rem; flex: 1; }
.card-meta {
  display: flex; gap: .5rem; flex-wrap: wrap;
  font-size: .78rem; color: var(--ink-soft);
  margin-top: .45rem;
}
.card-meta span:not(:last-child)::after { content: " ·"; }

/* ---------- recipe detail ---------- */
.back {
  display: inline-block;
  font-size: .9rem;
  text-decoration: none;
  margin-bottom: 1.2rem;
  color: var(--ink-soft);
}
.back:hover { color: var(--accent); }

.hero {
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  line-height: 1;
  padding: clamp(1.8rem, 6vw, 3rem);
  margin-bottom: 1.5rem;
}

.recipe-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5.5vw, 2.8rem);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.08;
}
.recipe-head .blurb { color: var(--ink-soft); margin-top: .5rem; max-width: 55ch; }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .8rem;
  color: var(--ink-soft);
}
.chip strong { color: var(--ink); font-weight: 600; }

.cols {
  display: grid;
  gap: 1.6rem;
  margin-top: 2rem;
  align-items: start;
}
@media (min-width: 820px) {
  .cols { grid-template-columns: 20rem 1fr; gap: 2.4rem; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}
.panel h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: .3rem;
}
.panel .hint { font-size: .8rem; color: var(--ink-soft); margin-bottom: .9rem; }
.group-name {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 1.1rem 0 .5rem;
}
.group-name:first-of-type { margin-top: 0; }

.tick {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  padding: .42rem 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.tick input { position: absolute; opacity: 0; pointer-events: none; }
.box {
  flex: none;
  width: 19px; height: 19px;
  margin-top: .18rem;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  display: grid;
  place-items: center;
  transition: background .14s ease, border-color .14s ease;
}
.box::after {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid var(--on-accent);
  border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg) scale(0);
  transition: transform .14s ease;
  margin-top: -2px;
}
.tick input:checked + .box { background: var(--accent); border-color: var(--accent); }
.tick input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.tick input:checked ~ .tick-text { color: var(--ink-soft); text-decoration: line-through; }
.tick input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.tick-text { transition: color .14s ease; }

.step { align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.step:last-of-type { border-bottom: 0; }
.step-n {
  flex: none;
  width: 1.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
  font-size: .88rem;
  margin-top: .16rem;
}
.step input:checked ~ .step-body { color: var(--ink-soft); }
.step input:checked ~ .step-n { opacity: .45; }

/* ---------- the heat gauge ---------- */
/* The recipe warms up as you work through the steps. */

.heat {
  --heat: #7B98AC;
  margin: .1rem 0 1.5rem;
  position: relative;
}
.heat[data-stage="low"]      { --heat: #8FA98A; }
.heat[data-stage="warm"]     { --heat: #C9A227; }
.heat[data-stage="hot"]      { --heat: #E0873A; }
.heat[data-stage="sizzling"] { --heat: #D6512B; }
.heat[data-stage="done"]     { --heat: var(--accent); }

.heat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .4rem;
}
.heat-label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--heat);
  transition: color .3s ease;
}
.heat-steps { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.heat-steps b { color: var(--ink); }

.heat-track {
  height: 12px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.heat-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--heat) 45%, transparent), var(--heat));
  transition: width .45s cubic-bezier(.34, 1.2, .64, 1), background .4s ease, box-shadow .4s ease;
}
.heat[data-stage="hot"] .heat-fill,
.heat[data-stage="sizzling"] .heat-fill,
.heat[data-stage="done"] .heat-fill {
  box-shadow: 0 0 14px color-mix(in srgb, var(--heat) 70%, transparent);
}
.heat[data-stage="sizzling"] .heat-fill { animation: shimmer 1.1s ease-in-out infinite; }
@keyframes shimmer {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.25); }
}

/* Wisps of steam, once it's actually hot. */
.heat-steam {
  position: absolute;
  inset: auto 0 100% 0;
  height: 28px;
  display: flex;
  justify-content: center;
  gap: 18px;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.heat[data-stage="hot"] .heat-steam,
.heat[data-stage="sizzling"] .heat-steam,
.heat[data-stage="done"] .heat-steam { opacity: .6; }
.heat-steam i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--heat);
  align-self: flex-end;
  animation: rise 2.4s ease-in-out infinite;
}
.heat-steam i:nth-child(2) { animation-delay: .8s; }
.heat-steam i:nth-child(3) { animation-delay: 1.6s; }
@keyframes rise {
  0%   { transform: translateY(0) scale(.6); opacity: 0; }
  25%  { opacity: .9; }
  100% { transform: translateY(-26px) scale(1.7); opacity: 0; }
}

/* A little kick each time a step gets ticked off. */
.heat.bump .heat-track { animation: bump .32s ease; }
@keyframes bump {
  0%   { transform: scaleY(1); }
  40%  { transform: scaleY(1.55); }
  100% { transform: scaleY(1); }
}

canvas.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.made {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.made .tally { font-size: .88rem; color: var(--ink-soft); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
.pop { animation: pop .34s ease; }

/* ---------- form ---------- */
/* The add page is a single column of fields, so centre the whole thing rather
   than letting a 44rem form sit flush left in a 1060px page. */
.narrow { max-width: 44rem; margin-inline: auto; }

form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; }
.field .help { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }
.field input, .field textarea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem .8rem;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
.row { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .row { grid-template-columns: 1fr 1fr; } }

.picker { display: flex; gap: .4rem; flex-wrap: wrap; }
.picker button {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  width: 2.6rem; height: 2.6rem;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid; place-items: center;
}
.picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.picker.colors button { border-radius: 999px; }
.picker.colors span { display: block; width: 100%; height: 100%; border-radius: 999px; }

.notice { border-radius: 10px; padding: .75rem .9rem; font-size: .9rem; }
.notice.bad { background: var(--accent-soft); color: var(--accent); }
.notice.good { background: var(--accent-soft); }

/* ---------- 🤫 ---------- */

.secret {
  text-align: center;
  max-width: 26rem;
  margin: 2rem auto;
  padding: clamp(1.6rem, 6vw, 2.4rem);
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: reveal .45s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
.secret-mark {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: .6rem;
  animation: toss 1.7s ease-in-out infinite;
}
@keyframes toss {
  0%, 100% { transform: translateY(0) rotate(-12deg); }
  50%      { transform: translateY(-9px) rotate(12deg); }
}
.secret-eyebrow {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent);
  font-weight: 600;
}
.secret h2 {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-top: .4rem;
}
.secret-blurb { color: var(--ink-soft); font-size: .9rem; margin-top: .5rem; }
.secret .btn { margin-top: 1.2rem; }

.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
}
.empty .big { font-size: 2.6rem; display: block; margin-bottom: .6rem; }

.foot {
  border-top: 1px solid var(--line);
  padding: 1.2rem clamp(1rem, 4vw, 2.5rem);
  font-size: .82rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- the front door ---------- */

.gate-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}
.gate { width: 100%; max-width: 26rem; }
.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.8rem, 6vw, 2.6rem);
  text-align: center;
}
.gate-mark {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: .9rem;
  animation: sway 4s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(7deg); }
}
.gate-card h1 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.gate-sub { color: var(--ink-soft); font-size: .92rem; margin-top: .35rem; }

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-top: 1.6rem;
  max-width: none;
}
.gate-card input {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .9rem;
  outline: none;
  text-align: center;
  width: 100%;
}
.gate-card input:focus { border-color: var(--accent); }
.gate-card .btn { width: 100%; padding: .65rem 1.1rem; }

.gate-msg { font-size: .85rem; min-height: 1.2em; margin: 0; }
.gate-msg.bad { color: var(--accent); }
.gate-note { font-size: .78rem; color: var(--ink-soft); margin-top: 1.3rem; }

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