/* Enzo's traditional Italian dishes. Mobile-first: base styles are for phones,
   min-width media queries add columns on wider screens. */

:root {
  --paper: #f7f0e3;
  --paper-2: #efe4d0;
  --card: #fffaf1;
  --ink: #2a1f17;
  --ink-soft: #5e4f42;
  --tomato: #b5321e;
  --tomato-deep: #8f2414;
  --olive: #4f5f26;
  --olive-soft: #e3e6cf;
  --line: #dccdb4;
  --shadow: 0 1px 2px rgba(60, 35, 15, .08), 0 8px 24px rgba(60, 35, 15, .10);
  --gingham-a: #b5321e;
  --gingham-b: rgba(181, 50, 30, .45);
  --radius: 14px;
  --glow: rgba(255, 255, 255, .35);
  --gutter: 16px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-hand: "Caveat", "Segoe Print", cursive;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1813;
    --paper-2: #26201a;
    --card: #2a231c;
    --ink: #f2e8d8;
    --ink-soft: #c3b4a0;
    --tomato: #e8664d;
    --tomato-deep: #f08a74;
    --olive: #b7c77a;
    --olive-soft: #343a22;
    --line: #43382d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --gingham-a: #b5321e;
    --gingham-b: rgba(181, 50, 30, .5);
    --glow: rgba(255, 220, 170, .03);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1d1813; --paper-2: #26201a; --card: #2a231c; --ink: #f2e8d8; --ink-soft: #c3b4a0;
  --tomato: #e8664d; --tomato-deep: #f08a74; --olive: #b7c77a; --olive-soft: #343a22; --line: #43382d;
  --glow: rgba(255, 220, 170, .03);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, var(--glow), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(120, 80, 30, .05), transparent 50%);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--font-body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tomato); text-underline-offset: 3px; }
a:hover { color: var(--tomato-deep); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; font-weight: 450; color: var(--tomato); }
p { margin: 0 0 1em; }
figure { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }

.eyebrow { font-family: var(--font-hand); font-size: 1.5rem; color: var(--olive); margin: 0 0 .1em; line-height: 1.1; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 36em; }

/* Tablecloth strip */
.gingham {
  height: 14px;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, var(--gingham-b) 50%, transparent 50%),
    linear-gradient(var(--gingham-b) 50%, transparent 50%);
  background-size: 14px 14px;
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .gingham { height: 8px; background-size: 8px 8px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; line-height: 1.15; }
.brand em { font-weight: 450; color: var(--tomato); }
.brand-mark { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--tomato); color: #fff; font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; }
.site-header nav { display: flex; gap: 4px; margin-left: -10px; }
.site-header nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 10px; border-radius: 999px; font-size: .95rem; min-height: 40px; display: inline-flex; align-items: center; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--tomato); background: var(--paper-2); }

/* ---------- Buttons ---------- */
.button, .print-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; background: var(--tomato); color: #fff; text-decoration: none; border: 0; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; box-shadow: var(--shadow); transition: transform .15s, background .15s;
}
.button:hover, .print-btn:hover { background: var(--tomato-deep); color: #fff; transform: translateY(-1px); }
.print-btn { background: transparent; color: var(--tomato); border: 2px solid var(--tomato); box-shadow: none; min-height: 44px; font-size: .95rem; }
.print-btn:hover { color: #fff; }
.text-link { font-family: var(--font-display); font-weight: 600; text-decoration: none; }

[data-lightbox] { cursor: zoom-in; }

/* ---------- Home ---------- */
.home-hero { display: grid; gap: 28px; padding-top: 28px; padding-bottom: 36px; }
.home-hero h1 { font-size: clamp(2.4rem, 9vw, 4.4rem); }

.history { padding-top: 24px; padding-bottom: 48px; }
.history-text { max-width: 40em; }
.history-text p:first-child::first-letter { font-family: var(--font-display); float: left; font-size: 3.6em; line-height: .85; padding: 4px 8px 0 0; color: var(--tomato); font-weight: 700; }

/* Three finished dishes, overlapping like plates on a table */
.hero-plates { position: relative; height: 300px; max-width: 460px; width: 100%; justify-self: center; }
.plate { position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: var(--shadow), 0 0 0 7px var(--card); }
.plate img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.14); }
.plate.p0 { left: 0; top: 4%; z-index: 2; }
.plate.p1 { right: 0; top: 0; z-index: 1; width: 52%; }
.plate.p2 { left: 30%; bottom: 0; z-index: 3; width: 50%; }
.history h2, .section-head h2, .notes h2, .method h2 { font-size: clamp(1.8rem, 6vw, 2.6rem); }

.recipes { padding-top: 40px; padding-bottom: 48px; border-top: 1px dashed var(--line); }
.section-head { max-width: 40em; margin-bottom: 24px; }
.section-head p:last-child { color: var(--ink-soft); }
.recipe-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; }
.recipe-card a { display: flex; flex-direction: column; height: 100%; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.recipe-card a:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(60,35,15,.1), 0 16px 36px rgba(60,35,15,.16); }
.recipe-card figure { aspect-ratio: 4 / 3; overflow: hidden; background: #fff; }
.recipe-card figure img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.recipe-card a:hover figure img { transform: scale(1.04); }
.card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.card-body .name-en { font-size: 1.6rem; }
.blurb { color: var(--ink-soft); font-size: 1rem; }
.cta { margin-top: auto; font-family: var(--font-display); font-weight: 600; color: var(--tomato); }

.tags { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--olive-soft); color: var(--olive); font-family: var(--font-display); font-weight: 600; }

/* Three names */
.names { margin-bottom: 14px; }
.name-it { font-family: var(--font-display); font-style: italic; color: var(--ink-soft); margin: 0; font-size: 1.05rem; }
.name-en { margin: .05em 0 .1em; }
.name-dialect { font-family: var(--font-hand); font-size: 1.6rem; color: var(--tomato); margin: 0; line-height: 1.1; }
.as-mum { display: block; font-family: var(--font-body); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }

.notes { padding-top: 40px; padding-bottom: 56px; border-top: 1px dashed var(--line); }
.notes-grid { display: grid; gap: 18px; }
.note { background: var(--card); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); border-left: 5px solid var(--olive); }
.note h3 { font-size: 1.3rem; }
.note p { margin: 0; }

/* ---------- Recipe page ---------- */
.recipe-hero { display: grid; gap: 24px; padding-top: 24px; padding-bottom: 28px; }
.recipe-title .name-en { font-size: clamp(2.3rem, 9vw, 4rem); }
.recipe-title .name-dialect { font-size: 2rem; }
.intro p { font-size: 1.08rem; }
.hero-plate { border-radius: 50%; overflow: hidden; aspect-ratio: 1; max-width: 420px; width: 88%; justify-self: center; box-shadow: var(--shadow), 0 0 0 10px var(--card); background: #fff; }
.hero-plate img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); }

.recipe-body { display: grid; gap: 32px; padding-bottom: 32px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.6rem; margin-bottom: .1em; }
.card h3 { font-family: var(--font-hand); font-size: 1.5rem; color: var(--olive); margin: 14px 0 2px; font-weight: 700; }
.serves { color: var(--ink-soft); font-style: italic; margin-bottom: 8px; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { border-bottom: 1px dashed var(--line); }
.ing-list li:last-child { border-bottom: 0; }
.ing-list label { display: flex; align-items: center; gap: 12px; padding: 9px 0; cursor: pointer; min-height: 44px; }
.ing-list input { appearance: none; flex: none; width: 22px; height: 22px; border: 2px solid var(--olive); border-radius: 6px; display: grid; place-items: center; margin: 0; cursor: pointer; background: transparent; }
.ing-list input::after { content: "✓"; color: #fff; font-size: 14px; font-weight: 700; transform: scale(0); transition: transform .15s; }
.ing-list input:checked { background: var(--olive); }
.ing-list input:checked::after { transform: scale(1); }
.ing-list input:checked + span { text-decoration: line-through; color: var(--ink-soft); }

/* Starburst tip: a nod to the green stars on the original site */
.tip { position: relative; margin-top: 28px; padding: 15% 15%; min-height: 260px; display: grid; place-items: center; text-align: center; }
.burst { position: absolute; inset: 0; width: 100%; height: 100%; }
.burst polygon { fill: var(--card); stroke: var(--olive); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
.tip-inner { position: relative; font-size: .98rem; line-height: 1.5; }
.tip-label { font-family: var(--font-hand); font-size: 1.7rem; color: var(--olive); margin: 0 0 .1em; line-height: 1; font-weight: 700; }
.tip-inner p:last-child { margin: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
.step { display: grid; gap: 14px; }
.step-photo { position: relative; }
.step-photo > img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 237 / 209; object-fit: cover; }
.inset { position: absolute; right: -6px; bottom: -14px; width: 38%; background: #fff; padding: 5px; box-shadow: var(--shadow); transform: rotate(3deg); border-radius: 3px; }
.step-text { position: relative; padding-left: 52px; }
.step-num { position: absolute; left: 0; top: -2px; width: 40px; height: 40px; border-radius: 50%; background: var(--tomato); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.step-text p:last-child { margin-bottom: 0; }

.serve { margin-top: 36px; display: grid; gap: 16px; background: var(--olive-soft); border-radius: var(--radius); padding: 18px; }
.serve figure img { border-radius: 10px; width: 100%; }
.serve h3 { font-size: 1.5rem; color: var(--olive); }
.serve p:last-child { margin: 0; }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 0 48px; border-top: 1px dashed var(--line); margin-top: 8px; }
.prevnext a { display: block; padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
.prevnext small { display: block; font-family: var(--font-body); font-weight: 400; color: var(--ink-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.prevnext .next { text-align: right; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 24px; background: var(--paper-2); border-top: 1px solid var(--line); text-align: center; }
.site-footer .wrap { padding-top: 32px; padding-bottom: 24px; }
.site-footer .sign { font-family: var(--font-hand); font-size: 2.2rem; color: var(--tomato); margin-bottom: .2em; }
.site-footer .small { font-size: .85rem; color: var(--ink-soft); }

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; }
.lightbox::backdrop { background: rgba(20, 14, 10, .88); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { max-width: min(92vw, 900px); text-align: center; }
.lightbox img { max-height: 78vh; width: auto; margin: 0 auto; border: 8px solid #fff; border-radius: 3px; image-rendering: auto; }
.lightbox figcaption { color: #f2e8d8; margin-top: 12px; font-size: 1rem; padding: 0 16px; }
.lightbox button { position: fixed; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 2rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  :root { --gutter: 28px; }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .notes-grid { grid-template-columns: repeat(2, 1fr); }
  .step { grid-template-columns: minmax(200px, 42%) 1fr; gap: 24px; align-items: start; }
  .serve { grid-template-columns: 220px 1fr; align-items: center; padding: 22px; }
}

@media (min-width: 900px) {
  .site-header nav { margin-left: 0; }
  .home-hero { grid-template-columns: 1.1fr 1fr; align-items: center; padding-top: 56px; padding-bottom: 56px; gap: 48px; }
  .history-text { max-width: none; columns: 2; column-gap: 48px; }
  .hero-plates { height: 440px; }
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .recipe-hero { grid-template-columns: 1.15fr 1fr; align-items: center; gap: 48px; padding-top: 48px; padding-bottom: 48px; }
  .hero-plate { width: 100%; }
  .recipe-body { grid-template-columns: 330px 1fr; gap: 48px; align-items: start; }
  .ingredients { align-self: stretch; display: flex; flex-direction: column; }
  .ingredients .tip { order: -1; margin: 0 0 28px; }
  .ingredients .card { position: sticky; top: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Print: just the recipe ---------- */
@media print {
  :root { --paper: #fff; --card: #fff; --ink: #000; --shadow: none; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .prevnext, .print-btn, .skip, .lightbox, .hero-plate, .serve figure, .tags { display: none !important; }
  .recipe-hero, .recipe-body { display: block; padding: 0; }
  .ingredients { position: static; margin-bottom: 16pt; }
  .card { padding: 0; }
  .tip { min-height: 0; padding: 10pt; border: 1.5pt solid #4f5f26; border-radius: 10pt; display: block; text-align: left; }
  .burst { display: none; }
  .step { grid-template-columns: 1.6in 1fr; display: grid; gap: 12pt; break-inside: avoid; }
  .steps { gap: 12pt; }
  .step-num { background: none; color: #000; border: 1pt solid #000; }
  .serve { background: none; padding: 0; display: block; }
}
