:root {
  color-scheme: light;
  --page: #f4ebd8;
  --page-strong: #fbf6ec;
  --paper: rgba(255, 250, 241, 0.88);
  --paper-strong: rgba(255, 252, 246, 0.96);
  --ink: #243127;
  --muted: #5d6d60;
  --line: rgba(36, 49, 39, 0.12);
  --accent: #a54c29;
  --accent-strong: #7d3418;
  --sage: #667a5f;
  --shadow: 0 18px 40px rgba(71, 53, 32, 0.12);
  --bg-radial-top: rgba(198, 155, 83, 0.24);
  --bg-radial-bottom: rgba(102, 122, 95, 0.16);
  --bg-linear: linear-gradient(135deg, #f5ecd8, #efe3cb 58%, #e8d9bf);
  --grid-line-y: rgba(255, 255, 255, 0.1);
  --grid-line-x: rgba(255, 255, 255, 0.08);
  --hero-border: rgba(255, 255, 255, 0.4);
  --hero-bg: linear-gradient(135deg, rgba(255, 249, 240, 0.94), rgba(247, 239, 225, 0.82));
  --panel-border: rgba(255, 255, 255, 0.48);
  --chip-bg: rgba(255, 255, 255, 0.68);
  --hero-divider: rgba(36, 49, 39, 0.08);
  --card-divider: rgba(36, 49, 39, 0.08);
  --card-active-bg: rgba(165, 76, 41, 0.06);
  --accent-soft: rgba(165, 76, 41, 0.14);
  --chip-active-ink: #fff7f2;
  --favorite-border: rgba(102, 122, 95, 0.18);
  --favorite-bg: rgba(102, 122, 95, 0.14);
  --favorite-ink: #334734;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--page);
  background:
    radial-gradient(circle at top left, var(--bg-radial-top), transparent 36%),
    radial-gradient(circle at bottom right, var(--bg-radial-bottom), transparent 32%),
    var(--bg-linear);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line-y) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-x) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.2;
}

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

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 30px;
  border: 1px solid var(--hero-border);
  border-radius: 32px;
  background: var(--hero-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-main {
  display: block;
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.7rem, 5vw, 5rem);
  line-height: 0.95;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-nav {
  display: block;
  padding-top: 18px;
  border-top: 1px solid var(--hero-divider);
}

.empty-state p,
.recipe-path,
.recipe-meta {
  color: var(--muted);
}

.recipe-path {
  margin: 0;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.panel {
  padding: 22px;
}

.detail-toolbar,
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip,
.ghost-button,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--ink);
}

.filter-chip,
.ghost-button {
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.filter-chip:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--chip-active-ink);
}

.ghost-button {
  justify-content: center;
}

.list-panel {
  padding: 10px 22px 16px;
}

.recipe-list {
  display: grid;
  gap: 0;
  max-height: 72vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.recipe-card {
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--card-divider);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 160ms ease, padding-left 160ms ease, background 160ms ease;
}

.recipe-card.is-active {
  padding-left: 12px;
  background: var(--card-active-bg);
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.recipe-card h3,
.detail-panel h2,
.empty-state h2,
.section-block h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.recipe-card h3 {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.detail-panel {
  min-height: 72vh;
  padding: 28px;
}

.detail-header {
  display: grid;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.detail-panel h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

.detail-copy {
  max-width: 70ch;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.pill {
  padding: 8px 12px;
  font-size: 0.92rem;
  font-weight: 600;
}

.pill.is-accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pill.is-favorite {
  border: 1px solid var(--favorite-border);
  background: var(--favorite-bg);
  color: var(--favorite-ink);
}

.detail-body {
  display: grid;
  gap: 28px;
  padding-top: 28px;
}

.section-block {
  display: grid;
  gap: 18px;
}

.section-block > h3 {
  font-size: 1.55rem;
}

.subsection {
  display: grid;
  gap: 12px;
}

.subsection h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage);
}

.ingredient-list,
.note-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 10px;
}

.step-list {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 14px;
}

.ingredient-list li::marker,
.step-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.note-list {
  list-style: disc;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 56vh;
  text-align: center;
}

.empty-state h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 12px;
}

.empty-state p {
  max-width: 42ch;
  margin: 0 auto;
  line-height: 1.7;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #161a17;
    --page-strong: #1d221e;
    --paper: rgba(24, 28, 25, 0.9);
    --paper-strong: rgba(30, 35, 31, 0.96);
    --ink: #edf0e6;
    --muted: #afb7aa;
    --line: rgba(237, 240, 230, 0.14);
    --accent: #cc7a55;
    --accent-strong: #f0b798;
    --sage: #95a991;
    --shadow: 0 20px 44px rgba(0, 0, 0, 0.32);
    --bg-radial-top: rgba(204, 122, 85, 0.2);
    --bg-radial-bottom: rgba(117, 144, 108, 0.14);
    --bg-linear: linear-gradient(135deg, #121613, #1a1f1b 58%, #212721);
    --grid-line-y: rgba(255, 255, 255, 0.04);
    --grid-line-x: rgba(255, 255, 255, 0.03);
    --hero-border: rgba(255, 255, 255, 0.08);
    --hero-bg: linear-gradient(135deg, rgba(27, 32, 28, 0.96), rgba(21, 25, 22, 0.9));
    --panel-border: rgba(255, 255, 255, 0.08);
    --chip-bg: rgba(34, 39, 35, 0.92);
    --hero-divider: rgba(237, 240, 230, 0.08);
    --card-divider: rgba(237, 240, 230, 0.08);
    --card-active-bg: rgba(204, 122, 85, 0.14);
    --accent-soft: rgba(204, 122, 85, 0.16);
    --chip-active-ink: #181311;
    --favorite-border: rgba(149, 169, 145, 0.24);
    --favorite-bg: rgba(149, 169, 145, 0.16);
    --favorite-ink: #d8e4d2;
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .recipe-list {
    max-height: 40vh;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 24px;
  }

  .hero-nav {
    padding-top: 16px;
  }

  .detail-toolbar,
  .detail-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .recipe-list {
    max-height: 34vh;
  }
}
