/* =========================================================================
   Poppa's Recipes — vintage cookbook stylesheet
   Cream paper · classic serif · warm red. Built to last, no build step.
   ========================================================================= */

:root {
  --paper:      #f8f1e0;   /* warm cream page            */
  --paper-2:    #fbf6ea;   /* lighter card cream         */
  --paper-edge: #efe4cc;   /* card edge / rules          */
  --ink:        #2c2620;   /* near-black warm ink        */
  --ink-soft:   #5b5044;   /* secondary text             */
  --red:        #b3271b;   /* deep cookbook red          */
  --red-bright: #cc0000;   /* the original accent        */
  --gold:       #b98a3c;   /* muted ochre — ornaments/rules only */
  --gold-text:  #8a6420;   /* darker ochre for small text (AA on cream) */
  --rule:       #d8c9a8;   /* hairline rules             */
  --shadow:     rgba(60, 44, 20, 0.14);

  --serif-display: "Playfair Display", "Hoefler Text", Georgia, "Times New Roman", serif;
  --serif-body:    "Lora", Georgia, "Times New Roman", serif;

  --maxw: 1120px;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--serif-body);
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(185,138,60,0.05), transparent 55%),
    radial-gradient(circle at 85% 80%, rgba(179,39,27,0.04), transparent 50%),
    repeating-linear-gradient(0deg, rgba(120,90,40,0.015) 0 2px, transparent 2px 4px);
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-bright); text-decoration: underline; }

/* shared keyboard focus indicator */
.chip:focus-visible, .btn:focus-visible, .card-link:focus-visible,
.topnav a:focus-visible, .breadcrumb a:focus-visible,
.site-footer a:focus-visible, .wordmark a:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--red); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

/* ---------------------------------------------------------------- header */
.site-header { padding: clamp(2.2rem, 6vw, 4rem) 0 1.4rem; text-align: center; position: relative; }
.site-header.compact { padding: 1.4rem 0 .8rem; }
.masthead-rule {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; color: var(--gold);
}
.masthead-rule::before, .masthead-rule::after {
  content: ""; height: 2px; flex: 0 1 90px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.wordmark {
  font-family: var(--serif-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  letter-spacing: .04em;
  line-height: 1.02;
  margin: 0;
  color: var(--ink);
}
.wordmark.small { font-size: clamp(1.7rem, 5vw, 2.5rem); }
.wordmark a { color: inherit; }
.wordmark a:hover { color: var(--ink); text-decoration: none; }
.tagline {
  font-family: var(--serif-body);
  font-style: italic;
  color: var(--red);
  font-size: clamp(1rem, 3vw, 1.25rem);
  margin: .5rem 0 0;
  letter-spacing: .02em;
}
.subtag {
  color: var(--ink-soft); font-size: .95rem; margin-top: .4rem;
  letter-spacing: .12em; text-transform: uppercase;
}

/* -------------------------------------------------------------- top nav */
.topnav {
  display: flex; justify-content: center; gap: clamp(1rem, 4vw, 2.4rem);
  flex-wrap: wrap;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: .5rem 0; margin-top: 1.4rem;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .18em;
}
.topnav a { color: var(--ink-soft); display: inline-block; padding: .5rem .35rem; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--red); text-decoration: none; }

/* ------------------------------------------------------------- controls */
.controls { margin: 2rem 0 1.2rem; }
.search-box { position: relative; max-width: 560px; margin: 0 auto; }
.search-box svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--gold); }
#search {
  width: 100%;
  font-family: var(--serif-body); font-size: 1.1rem; color: var(--ink);
  padding: .85rem 1rem .85rem 2.9rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(90,64,20,0.08);
}
#search::placeholder { color: #8a7a5e; font-style: italic; }
#search:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(179,39,27,.12); }

.category-bar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem .7rem;
  margin: 1.4rem auto 0; max-width: 900px;
}
.chip {
  font-family: var(--serif-body); font-size: .82rem;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .34rem .95rem; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center;
  transition: all .15s ease;
}
.chip .count { color: var(--gold-text); font-size: .74rem; margin-left: .3rem; }
.chip:hover { border-color: var(--red); color: var(--red); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip[aria-pressed="true"] .count { color: rgba(255,255,255,.8); }

.result-meta {
  text-align: center; color: var(--ink-soft); font-style: italic;
  margin: 1.4rem 0 .4rem; font-size: .95rem; min-height: 1.4em;
  scroll-margin-top: 1rem; /* breathing room when search.js scrolls results into view */
}

/* -------------------------------------------------------- section head */
.section-head {
  display: flex; align-items: baseline; gap: 1rem;
  margin: 2.4rem 0 1rem; padding-bottom: .4rem;
  border-bottom: 2px solid var(--ink);
}
.section-head h2 {
  font-family: var(--serif-display); font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 1.9rem); margin: 0; color: var(--ink);
}
.section-head .n { color: var(--red); font-size: .9rem; font-style: italic; margin-left: auto; }

/* ---------------------------------------------------------- card grid */
.recipe-grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: 1.2rem 0 3rem;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  box-shadow: 0 1px 2px var(--shadow);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px var(--shadow); border-color: var(--rule); }
.card:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.card a.card-link { color: inherit; text-decoration: none; display: flex; flex-direction: column; height: 100%; }
.card a.card-link:hover { text-decoration: none; }
.card a.card-link:focus-visible { outline: none; }  /* ring drawn on .card (outside the clip) */

.card-photo { aspect-ratio: 4 / 3; overflow: hidden; background: #e9dcc0; border-bottom: 1px solid var(--paper-edge); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-photo img { transform: scale(1.04); }

.card-body { padding: .85rem 1rem 1.05rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-kicker { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--red); font-weight: 600; }
.card-title { font-family: var(--serif-display); font-weight: 600; font-size: 1.14rem; line-height: 1.2; color: var(--ink); margin: 0; }
.card-meta { margin-top: auto; font-size: .78rem; color: var(--ink-soft); font-style: italic; }
.card-meta.group { color: var(--red); font-style: normal; font-weight: 600; letter-spacing: .02em; }
.card.has-photo .card-title { font-size: 1.06rem; }

/* dish (multi-version) cards */
.card.is-group { border-color: var(--rule); box-shadow: 0 1px 2px var(--shadow), 3px 3px 0 -1px var(--paper-2), 4px 4px 0 -1px var(--paper-edge); }
.card-ribbon {
  position: absolute; top: .6rem; right: .6rem; z-index: 2;
  font-size: .6rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
  color: #fff; background: var(--red); padding: .22rem .5rem; border-radius: 999px;
}

/* version switcher on a dish page */
.versions-intro { text-align: center; color: var(--ink); margin: 0 0 .35rem; font-size: 1.02rem; }
.versions-note { text-align: center; color: var(--ink-soft); font-style: italic; max-width: 46ch; margin: 0 auto 1.4rem; font-size: .95rem; line-height: 1.5; }
.versions-note em { color: var(--red); font-style: italic; }
.versions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem .6rem;
  margin: 0 auto 2rem; padding-bottom: 1.4rem; border-bottom: 1px dotted var(--rule); max-width: 640px;
}
.ver-pill {
  font-family: var(--serif-body); font-size: .82rem; letter-spacing: .02em;
  color: var(--ink-soft); background: var(--paper); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: .4rem 1rem;
  min-height: 44px; display: inline-flex; align-items: center;
}
.ver-pill:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.ver-pill[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.version-title {
  font-family: var(--serif-display); font-weight: 600; font-size: 1.3rem;
  text-align: center; color: var(--ink); margin: 0 0 1.2rem;
}
.version.single .version-title { display: none; }
.version:not([hidden]) + .version:not([hidden]) { margin-top: 2.4rem; padding-top: 2rem; border-top: 2px solid var(--paper-edge); }

.no-results { text-align: center; color: var(--ink-soft); font-style: italic; padding: 3rem 1rem; grid-column: 1 / -1; }

/* ------------------------------------------------------- recipe page */
.recipe {
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 10px var(--shadow);
  border-radius: 3px;
  padding: clamp(1.5rem, 5vw, 3.2rem);
  margin: 1.5rem auto 3rem;
  max-width: 860px;
}
.breadcrumb { font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); margin-bottom: 1rem; }
.breadcrumb a { color: var(--red); }
.recipe-title {
  font-family: var(--serif-display); font-weight: 800;
  font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.08; margin: 0;
  color: var(--ink); text-align: center;
}
.recipe-rule { width: 90px; height: 3px; margin: 1rem auto 1.2rem; background: var(--red); }
.recipe-servings { text-align: center; font-style: italic; color: var(--ink-soft); margin-bottom: 1.6rem; }
.recipe-photo {
  margin: 0 auto 1.8rem; max-width: 480px;
  border: 8px solid #fff; box-shadow: 0 4px 14px var(--shadow); transform: rotate(-.6deg);
}

.recipe-cols { display: grid; grid-template-columns: 300px 1fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: start; }

.ingredients h3, .method h3, .recipe-notes h3 {
  font-family: var(--serif-display); font-size: 1.05rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink);
  border-bottom: 2px solid var(--red); padding-bottom: .35rem; margin: 0 0 1rem;
}
.ingredients { position: sticky; top: 1rem; }
.ingredients ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: max-content 1fr; }
.ingredients li {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; column-gap: .8rem;
  padding: .38rem 0; border-bottom: 1px dotted var(--rule); font-size: .98rem;
}
.ingredients li .qty { color: var(--red); font-weight: 600; white-space: nowrap; }
.ingredients li.ing-heading {
  display: block; grid-column: 1 / -1; font-style: italic; color: var(--ink-soft);
  border-bottom: none; padding-top: .8rem;
}

.method ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.method li { position: relative; padding: 0 0 1.1rem 3rem; counter-increment: step; }
.method li::before {
  content: counter(step);
  position: absolute; left: 0; top: -.15rem;
  font-family: var(--serif-display); font-weight: 700; font-size: 1.5rem; color: var(--red);
  width: 2rem; text-align: right;
}
.method li:last-child { padding-bottom: 0; }
.method .single-block { padding-left: 0; }
.method .single-block::before { content: none; }

.recipe-notes { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.recipe-notes .note { font-style: italic; color: var(--ink-soft); margin: .5rem 0; }
.recipe-notes .source { font-size: .88rem; color: var(--ink-soft); margin: .5rem 0 0; }

.print-source { display: none; }

.recipe-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 2.4rem; padding-top: 1.4rem; border-top: 2px solid var(--ink); }
.btn {
  font-family: var(--serif-body); font-size: .82rem; text-transform: uppercase; letter-spacing: .12em;
  border: 1px solid var(--red); color: var(--red); background: transparent;
  padding: .6rem 1.2rem; border-radius: 2px; cursor: pointer; text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center;
}
.btn:hover { background: var(--red); color: #fff; text-decoration: none; }

/* -------------------------------------------------------- about page */
.about { max-width: 760px; margin: 1.5rem auto 3rem; }
.about-photo {
  float: none; margin: 0 auto 1.8rem; max-width: 300px;
  border: 8px solid #fff; box-shadow: 0 4px 14px var(--shadow); transform: rotate(-1.2deg);
  background: #e9dcc0; aspect-ratio: 4/5;
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-style: italic; text-align: center;
}
.about-photo.has-photo { aspect-ratio: auto; background: none; padding: 0; }
.about-photo.has-photo img { display: block; width: 100%; height: auto; }
.about h1 { font-family: var(--serif-display); font-size: clamp(2rem,6vw,3rem); text-align: center; margin: 0 0 .3rem; }
.about p { font-size: 1.1rem; }
.about .placeholder-note { background: rgba(179,39,27,.06); border-left: 3px solid var(--red); padding: .8rem 1rem; font-size: .92rem; font-style: italic; color: var(--ink-soft); }

/* ---------------------------------------------------------- footer */
.site-footer {
  text-align: center; padding: 2.5rem 0 3rem; margin-top: 2rem;
  border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: .88rem;
}
.site-footer .heart { color: var(--red); }
.site-footer a { color: var(--red); display: inline-block; padding: .3rem .2rem; }

/* ------------------------------------------------ Original / Enhanced */
.mode-toggle {
  position: absolute; top: 1rem; right: 1rem; z-index: 5;
  display: inline-flex; border: 1px solid var(--rule); border-radius: 999px;
  overflow: hidden; background: var(--paper-2); box-shadow: 0 1px 2px var(--shadow);
}
.mode-toggle button {
  font-family: var(--serif-body); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .1em; border: none; background: transparent; color: var(--ink-soft);
  padding: .45rem .85rem; cursor: pointer; min-height: 38px;
}
.mode-toggle button:hover { color: var(--red); }
.mode-toggle button[aria-pressed="true"] { background: var(--red); color: #fff; }

/* mode visibility: html[data-mode] drives the index; .recipe[data-view] wins on a recipe */
.only-enhanced { display: none; }
html[data-mode="enhanced"] .only-enhanced { display: block; }
html[data-mode="enhanced"] .only-original { display: none; }
.recipe[data-view="original"] .only-original { display: block; }
.recipe[data-view="original"] .only-enhanced { display: none; }
.recipe[data-view="enhanced"] .only-enhanced { display: block; }
.recipe[data-view="enhanced"] .only-original { display: none; }

.view-tabs { display: flex; justify-content: center; gap: .4rem; margin: 0 0 1.2rem; }
.view-tab {
  font-family: var(--serif-body); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft); text-decoration: none; border: 1px solid var(--rule); border-radius: 999px;
  padding: .35rem .95rem; min-height: 38px; display: inline-flex; align-items: center;
}
.view-tab:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.view-tab[aria-selected="true"], .view-tab[aria-selected="true"]:hover { background: var(--red); border-color: var(--red); color: #fff; }

.recipe-intro { max-width: 60ch; margin: 0 auto 1.6rem; text-align: center; font-style: italic; color: var(--ink-soft); font-size: 1.06rem; }
.photo-credit { text-align: center; font-size: .72rem; color: var(--ink-soft); margin: .45rem 0 0; font-style: italic; }
.photo-credit a { color: var(--ink-soft); }

.crosslinks { margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.crosslinks h3 { font-family: var(--serif-display); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); border-bottom: 2px solid var(--red); padding-bottom: .35rem; margin: 0 0 1rem; }
.crosslinks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem .7rem; }
.crosslinks li a { display: inline-block; border: 1px solid var(--rule); border-radius: 999px; padding: .4rem 1rem; font-size: .92rem; color: var(--red); }
.crosslinks li a:hover { border-color: var(--red); background: var(--red); color: #fff; text-decoration: none; }

/* -------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .recipe-cols { grid-template-columns: 1fr; }
  .ingredients { position: static; }
  .recipe-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
  .category-bar { gap: .5rem .5rem; }
}

/* ------------------------------------------------------------ print */
@media print {
  body { background: #fff; color: #000; }
  .topnav, .controls, .site-header .masthead-rule, .recipe-foot, .site-footer, .skip-link,
  .mode-toggle, .view-tabs { display: none !important; }
  .recipe { border: none; box-shadow: none; padding: 0; max-width: 7.2in; margin: 0 auto; background: transparent; }
  .method { max-width: 34em; }
  .recipe-photo { box-shadow: none; transform: none; }
  .recipe-title { color: #000; }
  .method li::before, .ingredients li .qty, .breadcrumb a { color: #000; }
  a { color: #000; text-decoration: none; }
  .recipe-cols { grid-template-columns: 260px 1fr; }
  .ingredients { position: static; }
  .ingredients li, .method li { break-inside: avoid; page-break-inside: avoid; }
  .ingredients h3, .method h3, .recipe-title { break-after: avoid; page-break-after: avoid; }
  .print-source { display: block; text-align: center; font-size: .78rem; color: #555; margin-top: 1.2rem; }
}
