@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 900;
  font-display: optional;
  src: url("/fonts/fraunces-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 900;
  font-display: optional;
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
}

:root {
  --bg: #faf9f7;
  --panel: #ffffff;
  --text: #141414;
  --text-muted: #5c5c5c;
  --border: #e7e3df;
  --accent: #a35a0a;
  --radius: 12px;
  --invert: 0;
  --font-display: "Fraunces", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --panel: #f2f2f2;
    --text: #f2f2f2;
    --text-muted: #a3a3a3;
    --border: #262626;
    --accent: #e0932a;
    --invert: 1;
  }
}

/* Explicit choice from the theme toggle wins over the system preference above. */
:root[data-theme="light"] {
  --bg: #faf9f7;
  --panel: #ffffff;
  --text: #141414;
  --text-muted: #5c5c5c;
  --border: #e7e3df;
  --accent: #a35a0a;
  --invert: 0;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --panel: #f2f2f2;
  --text: #f2f2f2;
  --text-muted: #a3a3a3;
  --border: #262626;
  --accent: #e0932a;
  --invert: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nav nav a::after { transition: none; }
  .theme-toggle { transition: none; }
  .tooltip::after { transition: none; }
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

.nav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.wordmark { font-family: var(--font-display); font-weight: 600; text-decoration: none; }

.nav nav { display: flex; gap: 1.5rem; }

.nav nav a {
  position: relative;
  text-decoration: none;
  color: var(--text-muted);
  padding-bottom: 0.2rem;
  transition: color 0.2s ease;
}

.nav nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transition: right 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav nav a:hover { color: var(--accent); }
.nav nav a:hover::after { right: 0; }

.nav nav a[aria-current="page"] { color: var(--accent); }
.nav nav a[aria-current="page"]::after { right: 0; }

a:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.nav nav a:focus-visible { color: var(--accent); }
.nav nav a:focus-visible::after { right: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 3px;
  margin: -3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle:hover { color: var(--accent); }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.75rem;
  padding: 1.5rem 0 2.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 4.25rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
}

@media (max-width: 420px) {
  .hero h1 { font-size: clamp(1.75rem, 9vw, 2rem); }
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  line-height: 1.15;
  padding-bottom: 0.15em;
  display: inline-block;
}

.tooltip {
  position: relative;
  color: var(--accent);
  font-size: 0.5em;
  cursor: help;
}

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

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -8px);
  width: max-content;
  max-width: 260px;
  padding: 0.6rem 0.85rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.tooltip:hover::after,
.tooltip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -12px);
}

.hero p {
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0;
}

.hero-cta a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.hero-cta a:hover,
.hero-cta a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-art {
  width: 100%;
  max-width: 560px;
  transform: rotate(-1.5deg) translateX(10px);
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  filter: invert(var(--invert));
}

@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .hero-art {
    animation-name: rise-tilt;
    animation-delay: 0.08s;
  }
  .hero p { animation-delay: 0.14s; }
  .hero-cta { animation-delay: 0.2s; }
}

@keyframes rise-tilt {
  from { opacity: 0; transform: translateY(16px) rotate(-1.5deg) translateX(10px); }
  to { opacity: 1; transform: translateY(0) rotate(-1.5deg) translateX(10px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.stack-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.stack-section h2 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.page-section {
  border-top: none;
  padding-top: 2.5rem;
}

.page-section h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.section-lede {
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 0 1.5rem;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.empty-state p { margin: 0; }

.empty-state .empty-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.item-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.item-list-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.item-list-row:first-child { padding-top: 0; }
.item-list-row:last-child { border-bottom: none; }

.item-list-thumb {
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  transition: border-color 0.2s ease;
}

.item-list-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: invert(var(--invert));
}

.item-list-row:hover .item-list-thumb { border-color: var(--accent); }

.card-tag {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.item-list-row h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.item-list-row:hover h2 { color: var(--accent); }

.item-list-row p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover { color: var(--accent); }

.recipe-intro {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2rem;
}

.recipe-art {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.recipe-art img {
  display: block;
  width: 100%;
  height: auto;
  filter: invert(var(--invert));
}

@media (max-width: 640px) {
  .recipe-intro { grid-template-columns: 1fr; }
  .recipe-art {
    max-width: min(220px, 45vw);
    padding: 1rem;
    margin: 0 auto;
  }
}

.recipe-meta {
  max-width: 760px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 2rem;
}

.recipe-meta a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.recipe-body {
  max-width: 760px;
}

.recipe-body h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
}

.recipe-body h2:first-child { margin-top: 0; }

.recipe-body ul,
.recipe-body ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.recipe-body li { margin-bottom: 0.4rem; }

.recipe-note {
  border-left: 2px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.note-body {
  max-width: 760px;
}

.note-body h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
}

.note-body h2:first-child { margin-top: 0; }

.note-body p { line-height: 1.6; }

.note-body ol,
.note-body ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.note-body li { margin-bottom: 0.4rem; }

.prompt-block {
  margin: 0 0 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.prompt-block code {
  display: block;
  white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.recipe-source {
  max-width: 760px;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ref-section h2 {
  font-size: 1.25rem;
  margin: 2.5rem 0 1rem;
}

.ref-section:first-of-type h2 { margin-top: 0; }

.jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.jump-nav a {
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.75;
}

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

.table-wrap { overflow-x: auto; }

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.ref-table th,
.ref-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ref-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.site-footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .nav { padding: 1rem; }
  main { padding: 0 1rem; }
}
