/* ==========================================================================
   Theme tokens
   ========================================================================== */

:root {
  --font-serif: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --font-sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 68rem;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --step: clamp(1rem, 0.85rem + 0.6vw, 1.0625rem);
  --transition: 160ms cubic-bezier(0.2, 0, 0.2, 1);
}

:root,
[data-theme="light"] {
  --bg: #faf9f5;
  --bg-subtle: #f2f0e8;
  --surface: #fffffd;
  --border: #e5e1d6;
  --border-strong: #d6d1c2;
  --text: #1f1e1b;
  --text-soft: #55534c;
  --text-muted: #858175;
  --accent: #c96442;
  --accent-hover: #b1543a;
  --accent-soft: #f6ece6;
  --accent-ring: rgba(201, 100, 66, 0.32);
  --shadow: 0 1px 2px rgba(31, 30, 27, 0.04), 0 8px 24px -16px rgba(31, 30, 27, 0.28);
  --shadow-lift: 0 2px 4px rgba(31, 30, 27, 0.05), 0 18px 40px -24px rgba(31, 30, 27, 0.4);
}

[data-theme="dark"] {
  --bg: #232320;
  --bg-subtle: #2b2b27;
  --surface: #2e2e2a;
  --border: #3d3d38;
  --border-strong: #4d4d46;
  --text: #f3f1ea;
  --text-soft: #c8c5ba;
  --text-muted: #97948a;
  --accent: #e08161;
  --accent-hover: #ef9377;
  --accent-soft: #3a2c26;
  --accent-ring: rgba(224, 129, 97, 0.36);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 8px 24px -16px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.75);
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 1.1em;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.18em;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 20;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ==========================================================================
   Header & footer
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.site-header.is-stuck {
  border-bottom-color: var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--bg) 88%, transparent);
  flex: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--text-soft);
  transition: background var(--transition), box-shadow var(--transition);
}

[data-theme="dark"] .theme-toggle-icon {
  background: transparent;
  box-shadow: inset -0.28rem -0.22rem 0 0 var(--text-soft);
}

.site-footer {
  margin-top: 5rem;
  padding: 2.25rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* ==========================================================================
   Hero & controls
   ========================================================================== */

.hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(1.75rem, 4vw, 2.75rem);
  max-width: 40rem;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4rem);
}

.lede {
  margin-top: 1.1rem;
  color: var(--text-soft);
  font-size: 1.075rem;
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  padding-bottom: 2rem;
}

.search {
  position: relative;
  flex: 1 1 18rem;
}

.search input {
  width: 100%;
  padding: 0.72rem 1rem 0.72rem 2.55rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search input::placeholder {
  color: var(--text-muted);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  margin-top: -0.44rem;
  border: 1.6px solid var(--text-muted);
  border-radius: 50%;
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  left: 1.72rem;
  top: 50%;
  width: 0.4rem;
  height: 1.6px;
  margin-top: 0.22rem;
  background: var(--text-muted);
  transform: rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter {
  padding: 0.42rem 0.85rem;
  font: inherit;
  font-size: 0.83rem;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.filter:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ==========================================================================
   Recipe cards
   ========================================================================== */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-item[hidden] {
  display: none;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.6rem 1.6rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
  color: inherit;
}

.card-title {
  font-size: 1.3rem;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-subtitle {
  margin: 0.35rem 0 0;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card-text {
  margin: 0.85rem 0 1.35rem;
  color: var(--text-soft);
  font-size: 0.925rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.card-cue {
  flex: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
}

.card-cue::after {
  content: " \2192";
}

.card:hover .card-cue {
  color: var(--accent);
  transform: translateX(2px);
}

.empty {
  padding: 3rem 0;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Tags & chips
   ========================================================================== */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 0.2rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: 999px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 1.1rem;
}

.chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.chip-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chip-value {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--text);
}

/* ==========================================================================
   Recipe page
   ========================================================================== */

.back {
  display: inline-block;
  margin-top: 2.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.back::before {
  content: "\2190\00a0";
}

.recipe-photo {
  margin: 1.75rem 0 0;
  max-width: 44rem;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.recipe-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.recipe-head {
  padding: 1.75rem 0 2.25rem;
  border-bottom: 1px solid var(--border);
  max-width: 44rem;
}

.recipe-head h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.1rem);
}

.recipe-subtitle {
  margin: 0.55rem 0 0;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-muted);
}

.recipe-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-top: 2.5rem;
}

/* Mobile: a compact, static row of pills. Sticking it here would only cover the
   recipe it links into, and it stays out of the way at the top of the article. */
.toc {
  font-size: 0.875rem;
}

.toc-title {
  margin: 0 0 0.7rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 0.3rem 0.7rem;
  color: var(--text-soft);
  background: var(--bg-subtle);
  border-radius: 999px;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}

.toc a:hover,
.toc a.is-current {
  color: var(--accent);
}

@media (min-width: 62rem) {
  .recipe-body {
    grid-template-columns: minmax(0, 1fr) 14rem;
  }

  /* Desktop: a sticky sidebar rail alongside the recipe. */
  .toc {
    order: 2;
    position: sticky;
    top: 6rem;
    align-self: start;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }

  .toc ol {
    flex-direction: column;
    gap: 0.5rem;
    padding-left: 0.9rem;
    border-left: 1px solid var(--border);
  }

  .toc a {
    padding: 0;
    background: none;
    border-radius: 0;
  }

  .toc a.is-current {
    font-weight: 500;
  }
}

/* ==========================================================================
   Prose
   ========================================================================== */

.prose {
  max-width: 42rem;
}

.prose .section + .section {
  margin-top: 2.75rem;
}

.prose h2 {
  font-size: 1.65rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.7rem;
}

.prose h4 {
  font-size: 1.03rem;
  margin: 1.5rem 0 0.5rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose li::marker {
  color: var(--text-muted);
}

.prose strong {
  font-weight: 600;
  color: var(--text);
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-soft);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.12em 0.36em;
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.prose th,
.prose td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

/* Ingredient lists become check-off lists via site.js. Scoped to direct
   children so callouts and nested notes keep normal list styling. */
.section.is-ingredients > ul {
  list-style: none;
  padding-left: 0;
}

.section.is-ingredients > ul > li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.85rem;
  cursor: pointer;
  transition: color var(--transition);
}

.section.is-ingredients > ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62rem;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
}

.section.is-ingredients > ul > li:hover::before {
  border-color: var(--accent);
}

.section.is-ingredients > ul > li.is-checked {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.section.is-ingredients > ul > li.is-checked::before {
  background: var(--accent);
  border-color: var(--accent);
}

.section.is-ingredients > ul > li.is-checked::after {
  content: "";
  position: absolute;
  left: 0.33rem;
  top: 0.82rem;
  width: 0.32rem;
  height: 0.58rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ==========================================================================
   Motion & print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toc,
  .back,
  .controls,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .recipe-body {
    display: block;
    padding-top: 1rem;
  }

  .prose,
  .recipe-head {
    max-width: none;
  }

  .card,
  .chip {
    box-shadow: none;
  }

  .prose .section {
    break-inside: avoid;
  }
}
