@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --cobalt: #17379b;
  --cobalt-deep: #0f2670;
  --enamel: #fafcfb;
  --ink: #14203f;
  --muted: #55607d;
  --line: #d5dcec;
  --wash: #e6ecf8;
  --butter: #ffd050;
  --danger: #b3261e;
  --rim-text: #ffffff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cobalt: #0f2670;
    --cobalt-deep: #0a1a50;
    --enamel: #131c38;
    --ink: #eef2fb;
    --muted: #aab5d2;
    --line: #2c3a63;
    --wash: #1f2b52;
    --danger: #ff9b92;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--cobalt);
  color: var(--ink);
  font: 400 1.125rem/1.5 "Atkinson", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: min(100%, 60rem);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 0;
}

h1, h2, .wordmark, .recipe-title, .current-step { font-family: "Bricolage", "Atkinson", sans-serif; text-wrap: balance; }

h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); font-weight: 700; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h2 { font-size: 1.5rem; font-weight: 650; margin: 2rem 0 0.75rem; }

a { color: inherit; }

:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }

/* The cobalt page edge with one big white enamel sheet is the app's rim. */
.rim {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1.5rem 1rem 1.25rem;
  color: var(--rim-text);
}

.rim.compact { align-items: center; padding-block: 0.75rem; }

.wordmark { font-size: clamp(3.25rem, 15vw, 5.5rem); font-weight: 800; letter-spacing: -0.04em; line-height: 0.9; margin: 0; }

.sheet {
  flex: 1;
  background: var(--enamel);
  border-radius: 2rem 2rem 0 0;
  padding: 1.75rem 1rem calc(2.5rem + env(safe-area-inset-bottom));
}

.back { color: inherit; font-weight: 700; text-decoration: none; padding: 0.5rem 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.button:disabled { opacity: 0.35; cursor: default; }
.button.primary { background: var(--butter); border-color: var(--butter); color: #14203f; }
.button.wide { width: 100%; }
.button.add { flex: none; padding-inline: 1rem; border-color: currentColor; color: var(--rim-text); }

.link {
  display: block;
  margin: 2rem auto 0;
  padding: 0.5rem;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link.danger { color: var(--danger); }

label { display: block; margin: 1.25rem 0 0.35rem; font-weight: 700; }

input, textarea, select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--line);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; line-height: 1.45; }

.search { border-radius: 999px; padding-inline: 1.25rem; background: var(--wash); border-color: transparent; }

.tags { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.85rem 0 0.15rem; scrollbar-width: none; }
.tag {
  flex: none;
  padding: 0.35rem 0.85rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.tag[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--enamel); }

.recipe-list { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.recipe-list a { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; text-decoration: none; }
.recipe-text { min-width: 0; }
.thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  overflow: hidden;
  border-radius: 1.1rem;
  background: var(--wash);
  color: var(--cobalt);
  font: 700 1.5rem/1 "Bricolage", sans-serif;
}
@media (prefers-color-scheme: dark) { .thumb { color: var(--butter); } }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.category-title { margin: 1.5rem 0 0; font-size: 1.15rem; color: var(--muted); }
.count { color: var(--muted); }
.tag[aria-pressed="true"] .count { color: inherit; }
.tags.small { padding-top: 0.45rem; }
.tags.small .tag { padding: 0.15rem 0.7rem; font-size: 0.95rem; border-width: 1px; }
.credit { margin: 0.35rem 0 1.25rem; color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.hero { display: block; width: 100%; max-height: 22rem; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 1.25rem; }
.photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; margin-top: 2.5rem; }
.photo-actions .link { margin: 0; font-weight: 400; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.photo-actions + .link { margin-top: 0.75rem; }
.recipe-title { display: block; font-size: 1.6rem; font-weight: 650; line-height: 1.12; letter-spacing: -0.01em; }
.recipe-meta { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 1rem; }

.empty { color: var(--muted); }
.empty.first { padding: 2rem 0; }
.empty.first p { font-size: 1.35rem; color: var(--ink); max-width: 28rem; margin-top: 0; }

.lead { font-size: 1.2rem; color: var(--muted); max-width: 40rem; margin: 0 0 1rem; }
.meta { margin: 0.1rem 0; color: var(--muted); }
.cook { width: 100%; margin-top: 1.25rem; font-size: 1.2rem; min-height: 3.5rem; }

.columns { display: grid; gap: 0 3rem; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 0.75rem; }
.section-head h2 { margin: 0; }

.stepper { display: flex; align-items: center; gap: 0.25rem; }
.stepper button {
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font: 700 1.4rem/1 "Atkinson", sans-serif;
  cursor: pointer;
}
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output { min-width: 6.5rem; text-align: center; font-family: "Bricolage", sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li.group, .steps li.group { font-family: "Bricolage", sans-serif; font-weight: 650; font-size: 1.2rem; padding: 1rem 0 0.25rem; list-style: none; }

.ingredient {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 2px solid var(--wash);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.amount:empty { display: none; }
.amount:empty + .name { grid-column: 1 / -1; }
.amount { font-family: "Bricolage", sans-serif; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ingredient[aria-pressed="true"] { color: var(--muted); }
.ingredient[aria-pressed="true"] .name { text-decoration: line-through; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step { counter-increment: step; position: relative; padding: 0 0 1.1rem 2.75rem; max-width: 40rem; }
.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.2rem;
  font: 800 1.75rem/1.2 "Bricolage", sans-serif;
  color: var(--cobalt);
}
@media (prefers-color-scheme: dark) { .step::before { color: var(--butter); } }

.notes { white-space: pre-line; max-width: 40rem; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.recipe-form .button { margin-top: 1.75rem; }
form .button { margin-top: 0.85rem; }

.help { margin-top: 2rem; }
.help summary { cursor: pointer; font-weight: 700; padding: 0.25rem 0; }
.help pre { overflow-x: auto; white-space: pre-wrap; padding: 0.85rem; border-radius: 0.75rem; background: var(--wash); font: 0.95rem/1.4 "Atkinson", sans-serif; }

/* Cooking mode reads from arm's length: all cobalt, one step, very large. */
.cooking {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100dvh;
  margin-top: calc(-1 * env(safe-area-inset-top));
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
  color: #fff;
}
.cooking header { display: flex; justify-content: space-between; align-items: center; }
.progress { font-variant-numeric: tabular-nums; }
.current { flex: 1; }
.current h2 { margin: 0 0 0.75rem; font-size: 1.15rem; color: var(--butter); }
.current-step.long { font-size: clamp(1.45rem, 5.6vw, 2.25rem); line-height: 1.25; }
.timer-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.cooking .timer-start { min-height: 3.25rem; font: 700 1.1rem/1 "Bricolage", sans-serif; }
.current-step { text-wrap: pretty; margin: 0; font-size: clamp(1.9rem, 7.5vw, 3.25rem); font-weight: 600; line-height: 1.16; letter-spacing: -0.01em; }
.cooking nav { display: grid; grid-template-columns: 1fr 2fr; gap: 0.75rem; }
.cooking .button { border-color: #fff; color: #fff; min-height: 4rem; font-size: 1.2rem; }
.cooking .button.next { background: var(--butter); border-color: var(--butter); color: #14203f; }
.cook-ingredients summary { cursor: pointer; font-weight: 700; padding: 0.5rem 0; }
.cook-ingredients .ingredient { border-color: rgb(255 255 255 / 0.2); }
.cook-ingredients .ingredient[aria-pressed="true"] { color: rgb(255 255 255 / 0.6); }

.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2rem; padding: 2rem 1rem; color: #fff; max-width: 28rem; width: 100%; margin: 0 auto; }
.login form { background: var(--enamel); color: var(--ink); border-radius: 1.5rem; padding: 0.25rem 1.25rem 1.25rem; }
.login .button { width: 100%; }

#timers {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  padding: 0 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
}
.timer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 36rem);
  margin: 0 auto;
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--enamel);
}
.timer.done { background: var(--butter); color: #14203f; }
.timer-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timer-time { font: 700 1.25rem/1 "Bricolage", sans-serif; font-variant-numeric: tabular-nums; }
.timer button {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
body.has-timers #app { padding-bottom: 4.5rem; }
body.has-timers .cooking { min-height: calc(100dvh - 4.5rem); }
body.has-timers #toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }

#toast {
  z-index: 3;
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 1rem);
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.65rem 1.1rem;
  border-radius: 1rem;
  background: var(--ink);
  color: var(--enamel);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 48rem) {
  .rim, .sheet { padding-inline: 2.5rem; }
  .sheet { border-radius: 2rem 2rem 0 0; }
  .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .recipe-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
  .cook { width: auto; }
  .cooking { padding-inline: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}
