/* Theme: aged bone paper by day, charcoal by night, blood red throughout. */

:root {
  --bg: #efe7d8;
  --surface: #f8f3ea;
  --text: #1f1a17;
  --muted: #6e6158;
  --line: #d9cdb9;
  --accent: #9b1c1c;
  --accent-soft: #f1d9d3;
  --qty-bg: #ecdcc6;
  --warn: #c0392b;
  --grain: 0.06;
  --radius: 10px;
  --logo: "Anton", Impact, "Arial Narrow", sans-serif;        /* site name only, set in caps */
  --section: "Anton", Impact, "Arial Narrow", sans-serif;      /* h2: page sections, set in caps */
  --display: "Oswald", "Arial Narrow", sans-serif;             /* every other heading: pie names, h1, h3 */
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}

/* Dark tokens: follow the system unless the toggle picked light... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1b1e;
    --surface: #27242a;
    --text: #ece4d6;
    --muted: #a69a8e;
    --line: #3b363d;
    --accent: #e04a3a;
    --accent-soft: #3d2224;
    --qty-bg: #3a2c2a;
    --warn: #ff7b6b;
    --grain: 0.08;
    color-scheme: dark;
  }
}
/* ...or when the toggle picked dark. */
:root[data-theme="dark"] {
  --bg: #1d1b1e;
  --surface: #27242a;
  --text: #ece4d6;
  --muted: #a69a8e;
  --line: #3b363d;
  --accent: #e04a3a;
  --accent-soft: #3d2224;
  --qty-bg: #3a2c2a;
  --warn: #ff7b6b;
  --grain: 0.08;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Film grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

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

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; }
h2 { font-family: var(--section); font-weight: 400; text-transform: uppercase; letter-spacing: 0.01em; }
.intro h1 { font-family: var(--logo); font-weight: 400; text-transform: uppercase; letter-spacing: 0.01em; }
h1 { font-size: clamp(2.4rem, 8vw, 3.5rem); margin: 0 0 8px; }
h2 { font-size: 1.9rem; margin: 40px 0 12px; }
h3 { font-size: 1.4rem; margin: 0; }

/* Header and footer */

.site-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-title {
  font-family: var(--logo);
  font-size: 1.6rem;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
.site-title::before { content: "🍕 "; }
.theme-toggle {
  padding: 6px 12px;
  font: 500 0.8rem var(--mono);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.site-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 0.75rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

/* Landing page */

.intro { padding: 24px 0 8px; }
.intro p { color: var(--muted); margin: 0; }
.quotes { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.quotes:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.quote { margin: 24px 0 0; padding: 12px 0 12px 18px; border-left: 4px solid var(--accent); }
.quote blockquote { margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(1.3rem, 4vw, 1.6rem); line-height: 1.25; }
.quote figcaption { margin-top: 6px; color: var(--muted); font: 500 0.8rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

.section-note { color: var(--muted); margin: -8px 0 16px; }
.empty { color: var(--muted); font-style: italic; }

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
/* Cards look like VHS spine labels: a red stripe across the top. */
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px) rotate(-0.4deg); box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.5); }
.card.has-photo { overflow: hidden; }
.card-photo {
  display: block;
  width: calc(100% + 32px);
  max-width: none;
  margin: -14px -16px 8px;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.card-title { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.card-summary { color: var(--muted); font-size: 0.9rem; }
.card-badge { color: var(--accent); font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.card-meta { color: var(--accent); font: 600 0.75rem var(--mono); margin-top: auto; padding-top: 6px; }

/* Recipe photo: square, from assets/photos/ (see _tools/add_photo.py) */

.recipe-photo { margin: 8px 0 20px; }
.recipe-photo img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Movie pairing under the recipe title */

.pairs-with {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
}
.pairs-label { flex-basis: 100%; font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.pairs-movie { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.pairs-year { color: var(--muted); font-size: 0.9rem; }
.pairs-sep { display: none; }
.pairs-why { flex-basis: 100%; color: var(--muted); font-size: 0.95rem; }

/* Recipe header */

.recipe-header { padding: 16px 0 8px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font: 600 0.8rem var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.summary { color: var(--muted); margin: 0; font-size: 1.05rem; }
.uses-dough { margin: 8px 0 0; font-weight: 500; }

/* Calculator */

.calculator:empty { display: none; }
.calculator {
  margin: 20px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.calc-inputs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font: 600 0.75rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field input {
  width: 110px;
  padding: 10px 12px;
  font: 600 1.2rem var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.times { font-size: 1.4rem; color: var(--muted); padding-bottom: 8px; }
.reset {
  margin-left: auto;
  padding: 10px 14px;
  font: 500 0.85rem var(--mono);
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.reset:hover { color: var(--accent); border-color: var(--accent); }
.calc-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.calc-sizes > span { font: 600 0.75rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; }
.calc-sizes button {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 6px 10px;
  font: 600 1rem var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.calc-sizes button small { font: 500 0.7rem var(--mono); color: var(--muted); }
.calc-sizes button:hover, .calc-sizes button.active { border-color: var(--accent); }
.calc-sizes button.active { background: var(--accent-soft); }
.calc-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; }
.calc-stats:empty { display: none; }
.stat { display: flex; flex-direction: column; font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat strong { font: 600 1rem var(--sans); text-transform: none; letter-spacing: 0; color: var(--text); }

/* Ingredient tables */

.group {
  margin: 16px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.group-head span { color: var(--muted); font: 600 0.8rem var(--mono); }
.group-note { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th { text-align: left; font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; padding-left: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.num { font-weight: 600; }
td.muted { color: var(--muted); font-weight: 400; }
td small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.stage-ref td { font-style: italic; }
.optional td { color: var(--muted); }
.tag { font: 600 0.65rem var(--mono); font-style: normal; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 99px; }

/* Method */

.method h2 { border-top: 1px solid var(--line); padding-top: 24px; }
.method li { margin-bottom: 10px; }
.method li > ul { margin-top: 8px; }
/* .qty scales with the calculator; .qty-fixed is a per-pizza amount that doesn't. */
.qty { background: var(--qty-bg); padding: 0 4px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.qty-fixed { font-weight: 600; white-space: nowrap; border-bottom: 1px dotted var(--muted); cursor: help; }
.token-missing { color: var(--warn); font-weight: 600; text-decoration: wavy underline; }
.token-missing::before { content: "⚠ "; }
.method blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); }

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --grain: 0; }
  .reset, .theme-toggle, .site-header, .site-footer { display: none; }
}
