/* ==================================================
   CookerWeb — Core Stylesheet
   Editorial, encyclopedic, ad-friendly, static site
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.25rem; }
button { font-family: inherit; }

/* No-flash theme boot: html gets data-theme before paint via inline script in <head> */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }

p, li { font-family: 'Lora', serif; color: var(--color-text-soft); }

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.section-intro { max-width: 640px; margin: 0 auto 2.5rem; text-align: center; }
.section-intro p { font-size: 1.05rem; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
main { display: block; }
section { padding: 3.5rem 0; }
.section-tight { padding: 2rem 0; }
hr.rule { border: none; border-top: 1px solid var(--color-border); margin: 0; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1180px;
  margin: 0 auto;
  gap: 1rem;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}
.logo span { color: var(--color-accent); }

.main-nav { display: flex; }
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.main-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-soft);
}
.main-nav a:hover, .main-nav a.active { color: var(--color-accent); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
}
.theme-toggle:hover { border-color: var(--color-accent); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 40px;
  height: 40px;
  color: var(--color-text);
  cursor: pointer;
}

.search-link {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  color: var(--color-text-soft);
}
.search-link:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-contrast); }
.btn-primary:hover { background: var(--color-accent-soft); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
}
.hero h1 { margin-bottom: 0.75rem; }
.hero p.lede { font-size: 1.15rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 0.9rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero-image { border-radius: 10px; overflow: hidden; box-shadow: 0 12px 30px var(--color-shadow); }
.hero-image img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }

.page-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  text-align: center;
}
.page-hero .eyebrow { display: block; }
.page-hero p { max-width: 640px; margin: 0.75rem auto 0; }

/* ---------- Section headers ---------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-header h2 { margin: 0; }
.view-all { font-size: 0.9rem; font-weight: 600; white-space: nowrap; }

/* ---------- Card grids ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
}
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: 0 10px 24px var(--color-shadow); transform: translateY(-2px); }
.card-image { aspect-ratio: 4/3; overflow: hidden; background: var(--color-bg-alt); }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-accent); font-weight: 600; margin-bottom: 0.4rem; }
.card h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.card p { font-size: 0.92rem; margin: 0 0 0.8rem; flex: 1; }
.card-meta { display: flex; gap: 0.9rem; font-size: 0.78rem; color: var(--color-text-faint); font-family: 'Inter', sans-serif; margin-top: auto; }
.card-link { margin-top: 0.9rem; font-size: 0.85rem; font-weight: 600; }

/* Compact list card (ingredient, glossary etc.) */
.tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  transition: box-shadow 0.2s ease;
}
.tile:hover { box-shadow: 0 8px 20px var(--color-shadow); }
.tile h3 { margin-bottom: 0.3rem; font-size: 1.05rem; }
.tile p { font-size: 0.88rem; margin: 0; }

/* ---------- Filters / search bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1.4rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 2rem;
  align-items: center;
}
.filter-bar input[type="text"],
.filter-bar select {
  font-family: 'Inter', sans-serif;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  color: var(--color-text);
  font-size: 0.9rem;
}
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.results-count { font-size: 0.85rem; color: var(--color-text-faint); margin: 1rem 0; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--color-text-faint);
  padding: 1rem 0 0;
}
.breadcrumb a { color: var(--color-text-faint); }
.breadcrumb a:hover { color: var(--color-accent); }

/* ---------- Recipe detail ---------- */
.recipe-header { padding: 2.5rem 0 2rem; }
.recipe-title-row { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center; }
.recipe-header img { border-radius: 10px; aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.recipe-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-top: 1.5rem;
}
.recipe-meta-strip .meta-item { font-family: 'Inter', sans-serif; font-size: 0.85rem; }
.recipe-meta-strip .meta-item strong { display: block; font-size: 1.05rem; color: var(--color-text); }
.recipe-meta-strip .meta-item span { color: var(--color-text-faint); }

.recipe-body { display: grid; grid-template-columns: 300px 1fr; gap: 3rem; padding: 2.5rem 0; align-items: start; }
.recipe-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.5rem;
  position: sticky;
  top: 90px;
}
.recipe-sidebar h3 { font-size: 1rem; margin-bottom: 0.8rem; }
.recipe-sidebar ul { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.recipe-sidebar li { font-size: 0.92rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--color-border); color: var(--color-text-soft); }
.recipe-sidebar li:last-child { border-bottom: none; }

.recipe-main article > section { padding: 0 0 2.2rem; }
.instructions-list { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.instructions-list li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.4rem 2.6rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--color-border);
}
.instructions-list li:last-child { border-bottom: none; }
.instructions-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 1.9rem; height: 1.9rem;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 0.85rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1.5rem; }
.tag-pill {
  font-size: 0.78rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-soft);
  font-family: 'Inter', sans-serif;
}
.tag-pill:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }

.faq-item { border-bottom: 1px solid var(--color-border); padding: 1.1rem 0; }
.faq-item h4 { margin-bottom: 0.4rem; }
.faq-item p { margin: 0; }

/* ---------- Related grid strips ---------- */
.related-strip { padding: 2.5rem 0; border-top: 1px solid var(--color-border); }

/* ---------- Blog article ---------- */
.article-body { max-width: 720px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.article-body h2 { margin-top: 2rem; }
.article-body p { font-size: 1.05rem; margin-bottom: 1.1rem; }
.article-meta { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--color-text-faint); margin-bottom: 1.5rem; font-family: 'Inter', sans-serif; }
.article-hero-image { border-radius: 10px; overflow: hidden; margin-bottom: 1.5rem; }
.article-hero-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.pull-quote {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.35rem;
  border-left: 3px solid var(--color-accent);
  padding: 0.3rem 0 0.3rem 1.4rem;
  margin: 2rem 0;
  color: var(--color-text);
}

/* ---------- Ingredient / Cuisine / Meal type detail ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; padding: 2.5rem 0; align-items: start; }
.detail-grid .side-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}
.detail-grid .side-card h3 { font-size: 1rem; margin-bottom: 0.6rem; }
.detail-grid .side-card ul { list-style: none; padding: 0; margin: 0; }
.detail-grid .side-card li { padding: 0.3rem 0; font-size: 0.9rem; }

/* ---------- Shop / product ---------- */
.price-tag { font-family: 'Inter', sans-serif; font-weight: 700; color: var(--color-text); }
.affiliate-note { font-size: 0.78rem; color: var(--color-text-faint); margin-top: 0.5rem; }

/* ---------- Glossary / FAQ index ---------- */
.alpha-jump { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem; }
.alpha-jump a {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  color: var(--color-text-soft);
}
.alpha-jump a:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.glossary-entry { padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.glossary-entry dt { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; color: var(--color-text); }
.glossary-entry dd { margin: 0.3rem 0 0; font-family: 'Lora', serif; color: var(--color-text-soft); }

/* ---------- Ad slots ---------- */
.ad-slot {
  max-width: 1180px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
  min-height: 0;
}
.ad-slot .ad-container {
  display: none; /* hidden until an ad actually loads; JS reveals it */
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-alt);
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-faint);
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
  min-height: 90px;
}
.ad-slot .ad-container.is-filled { display: flex; }
.ad-slot:empty, .ad-slot .ad-container:not(.is-filled) { margin: 0; padding: 0; }

/* ---------- Newsletter / CTA band ---------- */
.cta-band {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 3rem 0;
  text-align: center;
}
.cta-band h2 { margin-bottom: 0.5rem; }
.cta-band p { max-width: 500px; margin: 0 auto 1.5rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 3rem 0 1.5rem;
  margin-top: 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 2rem;
  padding-bottom: 2rem;
}
.footer-col h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: 0.9rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { font-size: 0.9rem; color: var(--color-text-soft); }
.footer-col a:hover { color: var(--color-accent); }
.footer-brand .logo { display: inline-block; margin-bottom: 0.7rem; }
.footer-brand p { font-size: 0.88rem; max-width: 32ch; }
.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 1.3rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: var(--color-text-faint);
  font-family: 'Inter', sans-serif;
}
.footer-bottom a { color: var(--color-text-faint); }
.footer-bottom a:hover { color: var(--color-accent); }

/* ---------- Forms (contact) ---------- */
.form-field { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.form-field label { font-family: 'Inter', sans-serif; font-size: 0.88rem; font-weight: 600; }
.form-field input, .form-field textarea, .form-field select {
  font-family: 'Inter', sans-serif;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  color: var(--color-text);
  font-size: 0.92rem;
}
.form-field textarea { resize: vertical; min-height: 130px; }
.form-note { font-size: 0.82rem; color: var(--color-text-faint); }

/* ---------- Legal pages ---------- */
.legal-body { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.legal-body h2 { margin-top: 2.2rem; }
.legal-body p, .legal-body li { font-size: 0.98rem; }
.legal-updated { font-size: 0.82rem; color: var(--color-text-faint); font-family: 'Inter', sans-serif; }

/* ---------- Learn hub ---------- */
.learn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.learn-card { padding: 1.6rem; }
.learn-card .eyebrow { display: block; }

/* ---------- Search page ---------- */
.search-hero { text-align: center; padding: 3rem 0 2rem; }
.search-input-wrap { max-width: 560px; margin: 0 auto; position: relative; }
.search-input-wrap input {
  width: 100%;
  padding: 1rem 1.3rem;
  font-size: 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
}
.search-results-group { margin-bottom: 2.5rem; }
.search-results-group h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-faint); font-family: 'Inter', sans-serif; margin-bottom: 1rem; }
.search-empty { text-align: center; padding: 3rem 0; color: var(--color-text-faint); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .recipe-title-row, .detail-grid { grid-template-columns: 1fr; }
  .recipe-body { grid-template-columns: 1fr; }
  .recipe-sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .learn-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-4, .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .main-nav { position: fixed; inset: 64px 0 0 0; background: var(--color-bg); border-top: 1px solid var(--color-border); padding: 1.5rem; transform: translateY(-110%); transition: transform 0.2s ease; z-index: 90; }
  .main-nav.is-open { transform: translateY(0); }
  .main-nav ul { flex-direction: column; gap: 0.2rem; }
  .main-nav a { display: block; padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--color-border); }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }
  .search-link span { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .learn-grid, .card-grid.cols-4, .card-grid.cols-3, .card-grid.cols-2 { grid-template-columns: 1fr; }
}

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