/* ==========================================================================
   Cheese Worm Farm — styles.css
   Mobile-first: everything outside a media query is the PHONE layout.
   `@media (min-width: ...)` blocks only ADD to it for larger screens. This
   way phones parse the least CSS, and nothing has to be "undone".
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. FONT — self-hosted Fraunces Bold (SIL Open Font License, see
   /fonts/Fraunces-OFL.txt). Served from our own domain: no Google Fonts
   request, so no third-party tracking and CSP font-src stays 'self'.
   font-display: swap shows text immediately in the fallback serif, then
   swaps when the 18 KB file arrives. Text is never invisible while loading.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS — the palette, sampled from the logo, defined ONCE.
   Contrast ratios are against --cream; WCAG AA needs 4.5:1 for text.
   -------------------------------------------------------------------------- */
:root {
  --soil:        #371204; /* dark brown lettering in the logo  · 14.9:1 → body text, dark sections */
  --soil-deep:   #220a03; /* footer */
  --bark:        #774c39; /* mid brown                         · 6.5:1  → secondary text */
  --denim:       #0d497e; /* overalls blue                     · ~8.9:1 → links */
  --worm:        #a8323e; /* worm pink, deepened for contrast  · 5.8:1  → CTA buttons */
  --worm-dark:   #8f2a37; /* CTA hover */
  --worm-pink:   #c9566b; /* DECORATION ONLY (illustrations) */
  --leaf:        #536126; /* laurel green                      · ~6:1   → accents, "Yes" pills */
  --leaf-light:  #8aa443; /* DECORATION ONLY */
  --straw:       #dba06f; /* straw hat — DECORATION ONLY (fails text contrast) */
  --straw-light: #f3d29f; /* light bands, "Sometimes" pills (with soil text) */
  --cream:       #fdf0d2; /* page background */
  --cream-light: #fef5db; /* cards, raised surfaces */

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  /* Fluid type: clamp(min, preferred, max) scales smoothly with viewport
     width instead of jumping at breakpoints. */
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --step-2: clamp(1.75rem, 1.4rem + 1.6vw, 2.6rem);
  --step-3: clamp(2.5rem, 1.7rem + 4vw, 4.5rem);

  --radius: 18px;
  --shadow: 0 2px 4px rgb(55 18 4 / 0.08), 0 10px 30px rgb(55 18 4 / 0.10);
  --header-h: 4rem;
  --gutter: 1rem;
  --wave-h: 36px;
}

/* --------------------------------------------------------------------------
   2. RESET / BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; } /* width includes padding: predictable sizing */

html {
  /* Anchor links (#about) land BELOW the sticky header instead of under it. */
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
  -webkit-text-size-adjust: 100%;
}
/* Smooth scrolling only for people who haven't asked their OS to reduce
   motion (vestibular disorders, motion sickness). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--soil);
  background: var(--cream);
}

img, picture { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; margin: 0 0 0.5em; color: var(--soil); letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p, ul, ol { margin: 0 0 1em; }

a { color: var(--denim); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

/* VISIBLE FOCUS. :focus-visible shows the ring for keyboard users without
   flashing it on every mouse click. Two-tone so it shows on light AND dark
   sections. Never `outline: none` without a replacement like this. */
:focus-visible {
  outline: 3px solid var(--denim);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--cream-light);
  border-radius: 4px;
}

/* Sprite holder: present in the DOM so <use> can reference its symbols,
   but takes no space. (display:none can break some SVG features.) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--soil);
  color: var(--cream);
  font-weight: 700;
  border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; }

.container { width: min(100% - 2 * var(--gutter), 1120px); margin-inline: auto; }
.narrow { width: min(100% - 2 * var(--gutter), 780px); }
.center { text-align: center; }

/* --------------------------------------------------------------------------
   3. HEADER — sticky from 640px up (see section 14). On phones the nav wraps
   to two rows; a tall sticky bar would eat the screen and hide headings
   that anchor links scroll to, so on phones it scrolls away normally.
   -------------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 10;
  background: rgb(254 245 219 / 0.96);
  border-bottom: 3px solid var(--straw);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.4rem;
}
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--soil); }
.brand img { width: 44px; height: 44px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }

.nav-list { display: flex; flex-wrap: wrap; gap: 0.1rem 0.2rem; list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: inline-block;
  padding: 0.6rem 0.55rem;
  min-height: 44px; /* WCAG 2.5.8 / Apple HIG tap target */
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--soil);
  text-decoration: none;
  border-radius: 999px;
}
.nav-list a:hover { background: var(--straw-light); }

/* --------------------------------------------------------------------------
   4. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-primary { background: var(--worm); color: var(--cream-light); box-shadow: 0 4px 0 var(--worm-dark); }
.btn-primary:hover { background: var(--worm-dark); }
.btn-secondary { background: var(--cream-light); color: var(--soil); border-color: var(--soil); }
.btn-secondary:hover { background: var(--straw-light); }
.btn-large { font-size: var(--step-1); overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) {
  .btn:hover { transform: translateY(-2px); }
  .btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--worm-dark); }
}

/* --------------------------------------------------------------------------
   5. HERO
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden; /* keeps the decorative blobs from causing sideways scroll */
  background:
    radial-gradient(circle at 85% 15%, var(--cream-light) 0 18%, transparent 40%),
    radial-gradient(circle at 10% 90%, rgb(138 164 67 / 0.18) 0 20%, transparent 45%),
    linear-gradient(180deg, var(--straw-light) 0%, var(--cream) 100%);
  padding-block: 2rem 2.5rem;
}
.hero-inner { display: grid; gap: 2rem; align-items: center; }
.hero-text { text-align: center; }
.eyebrow { margin: 0 0 0.5rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; color: var(--bark); }
.hero h1 { margin-bottom: 0.15em; }
.tagline { font-family: var(--font-display); font-size: var(--step-2); color: var(--worm); margin: 0 0 0.6rem; transform: rotate(-2deg); display: inline-block; }
.lede { max-width: 40ch; margin-inline: auto; font-size: 1.1em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 1.25rem; }

.hero-art { position: relative; width: min(72vw, 400px); margin: 0 auto 1rem; }
/* The hero is a vintage poster, so it's framed like one pinned to a barn
   wall: square-ish corners, cream border, slight tilt. (A rounded arch
   would clip the poster's title lettering.) */
.hero-photo img {
  width: 100%;
  border-radius: 10px;
  border: 8px solid var(--cream-light);
  box-shadow: var(--shadow), 0 0 0 1px rgb(55 18 4 / 0.08);
}
@media (min-width: 900px) {
  .hero-photo { transform: rotate(2deg); }
}
.hero-worm { position: absolute; right: -14%; top: 30%; width: 22%; height: auto; aspect-ratio: 1; }
.hero-leaf { position: absolute; left: -10%; bottom: 6%; width: 16%; aspect-ratio: 1; transform: rotate(-20deg); }

/* Gentle worm wiggle — only for people who haven't asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .hero-worm, .contact-worm { animation: wiggle 3.5s ease-in-out infinite; transform-origin: 50% 80%; }
  @keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg) translateY(-3px); } }
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}
.stats li {
  background: var(--cream-light);
  border: 2px solid var(--straw);
  border-radius: var(--radius);
  padding: 0.8rem 0.5rem;
  text-align: center;
  line-height: 1.25;
}
.stats strong { display: block; font-family: var(--font-display); font-size: var(--step-2); color: var(--worm); }
.stats span { font-size: 0.8rem; color: var(--bark); }

/* --------------------------------------------------------------------------
   6. SECTIONS
   -------------------------------------------------------------------------- */
.section { position: relative; padding-block: clamp(3rem, 7vw, 5.5rem); }
/* NOTE: an earlier version used `content-visibility: auto` here to skip
   rendering off-screen sections. Removed: off-screen sections then use a
   placeholder height, so nav links (#log, #faq...) computed their scroll
   target from wrong heights and landed in the wrong place on phones.
   Correct navigation beats a few ms of layout time. */
.section-alt { background: var(--cream-light); }
/* Dark "soil" sections: cream text on brown (15:1). Links and headings are
   recolored so everything inside stays readable. */
.section-soil { background: var(--soil); color: var(--cream); }
.section-soil h2, .section-soil > .container > .kicker { color: var(--cream); }
.section-soil a:not(.btn) { color: var(--straw-light); }

/* Wavy top edge, drawn inside the section in the cream of the section
   above and flipped, so the cream "drips" down into this section. */
.wave { position: absolute; top: -1px; left: 0; width: 100%; height: var(--wave-h); color: var(--cream); transform: scaleY(-1); pointer-events: none; }
.section-alt, .section-soil { padding-top: calc(clamp(3rem, 7vw, 5.5rem) + var(--wave-h) / 2); }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--leaf);
}
.kicker::before { content: ""; width: 1.6rem; height: 4px; border-radius: 4px; background: var(--worm-pink); }
.section-intro { max-width: 60ch; color: var(--bark); font-size: 1.05em; }
.section-soil .section-intro { color: var(--straw-light); }

.split { display: grid; gap: 2.5rem; align-items: center; }
.split-media { margin: 0; max-width: 420px; justify-self: center; width: 100%; }

.photo { margin: 0; }
.photo img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; border: 6px solid var(--cream-light); }
.photo figcaption { margin-top: 0.6rem; font-size: 0.95rem; color: var(--bark); text-align: center; font-style: italic; }
.photo-small { max-width: 300px; justify-self: center; }

/* About: two photos side by side, staggered and tilted like snapshots
   pinned to a board. No overlap, so each caption always stays readable at
   every width (an overlapping version hid a caption). */
.photo-pair {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  align-items: start;
  max-width: 460px;
  width: 100%;
  justify-self: center;
}
.photo-front { transform: rotate(-3deg); }
.photo-back { margin-top: 3rem; transform: rotate(3deg); }
@media (min-width: 900px) {
  .photo-tilt { transform: rotate(2deg); }
}

/* Icon lists (Why worms) */
.benefits { list-style: none; padding: 0; display: grid; gap: 1rem; }
.benefits li { display: grid; grid-template-columns: 48px 1fr; gap: 0.9rem; align-items: start; }
.benefits svg { width: 48px; height: 48px; }

/* --------------------------------------------------------------------------
   7. PRODUCT CARDS — auto-fit + minmax: as many 280px+ columns as fit.
   -------------------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.75rem;
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--cream-light);
  border: 2px solid var(--straw);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s;
}
@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-4px); }
}
.card-art {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 0.5rem;
  padding: 1.5rem 1rem 1rem;
  /* Cream circle behind the art: the straw-colored sack would vanish on straw. */
  background: radial-gradient(circle at 50% 120%, var(--cream) 0 45%, var(--straw-light) 46%);
}
.card-art svg { width: 96px; height: 96px; }
.card-art .card-art-2 { width: 72px; height: 72px; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 1.4rem; }
.card-actions { margin-top: auto; padding-top: 0.5rem; }
.price { font-family: var(--font-display); font-size: var(--step-2); margin: 0 0 0.5rem; color: var(--soil); }
.price-ask { font-size: var(--step-1); } /* text, not a number: keep it from wrapping into a giant headline */
.unit { font-family: var(--font-body); font-size: 1rem; color: var(--bark); }
.badge {
  align-self: flex-start;
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--leaf);
  color: var(--cream-light);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   8. WORM TOOLS
   -------------------------------------------------------------------------- */
.tools-grid { display: grid; gap: 1.5rem; margin-top: 1.5rem; }
.tool {
  background: var(--cream-light);
  color: var(--soil);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
}
.tool a:not(.btn) { color: var(--denim); }
.tool-intro { color: var(--bark); }
.tool-note { font-size: 0.9rem; color: var(--bark); }

.field { display: grid; gap: 0.3rem; margin-bottom: 1rem; }
.field label, .food-controls > label { font-weight: 700; }
input, select {
  font: inherit;
  color: var(--soil);
  background: var(--cream);
  border: 2px solid var(--bark);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  min-height: 48px;
  width: 100%;
}
input:focus-visible, select:focus-visible { border-color: var(--denim); }

.calc-result {
  background: var(--straw-light);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin: 0.5rem 0 1rem;
}
.calc-big { font-family: var(--font-display); font-size: var(--step-1); margin: 0 0 0.4rem; }
.calc-big strong { color: var(--worm); font-size: 1.35em; }
.calc-details { margin: 0; padding-left: 1.1rem; }

.food-controls { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.food-controls[hidden] { display: none; } /* author display:grid would otherwise override [hidden] */
.food-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 40px;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--soil);
  background: var(--cream);
  color: var(--soil);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--soil); color: var(--cream-light); }
.food-count { margin: 0; font-size: 0.9rem; color: var(--bark); }

/* The list scrolls inside its own box at every width, so 33 foods don't
   become eight phone-screens of scrolling. Search/filters narrow it fast. */
.foods {
  list-style: none; padding: 0 0.4rem 0 0; margin: 0; display: grid; gap: 0.5rem;
  max-height: 26rem; overflow-y: auto; overscroll-behavior: contain;
}
/* Phones: pill on its own line above the name, so text gets full width. */
.foods li { padding: 0.6rem 0.75rem; background: var(--cream); border-radius: 12px; }
.foods li[hidden] { display: none; }
.foods li > strong { display: block; margin-top: 0.3rem; }
.foods li > span:last-child { display: block; font-size: 0.92rem; color: var(--bark); }
/* Verdict pill. The WORD carries the meaning; color only reinforces it
   (WCAG 1.4.1: don't rely on color alone). All pairs pass 4.5:1. */
.verdict {
  display: inline-block;
  min-width: 6.2rem;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
[data-verdict="yes"] .verdict { background: var(--leaf); color: var(--cream-light); }
[data-verdict="some"] .verdict { background: var(--straw-light); color: var(--soil); border: 1px solid var(--straw); }
[data-verdict="no"] .verdict { background: var(--worm); color: var(--cream-light); }
.food-empty { margin: 0.75rem 0 0; }

/* --------------------------------------------------------------------------
   9. ORDERING STEPS — CSS counters number the steps automatically, so
   reordering the HTML never leaves a wrong number behind.
   -------------------------------------------------------------------------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1.25rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  background: var(--cream-light);
  border: 2px solid var(--straw);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  top: -0.9rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--worm);
  color: var(--cream-light);
  font-family: var(--font-display);
  font-weight: 700;
}
.steps svg { width: 56px; height: 56px; margin-bottom: 0.5rem; }
.steps h3 { margin-bottom: 0.3rem; }
.steps p { margin: 0; }
.split-tight { gap: 1.5rem; }
.note { padding: 1rem 1.25rem; background: var(--straw-light); border-left: 6px solid var(--leaf); border-radius: 12px; margin: 0; }

/* --------------------------------------------------------------------------
   10. WORM CARE
   -------------------------------------------------------------------------- */
.care-layout { display: grid; gap: 2rem; align-items: start; margin-top: 1.5rem; }
.care-layout .photo { max-width: 340px; justify-self: center; }
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.tips li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 1rem;
  align-items: start;
  background: var(--cream);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.tips svg { width: 52px; height: 52px; }
.tips h3 { font-size: 1.2rem; margin-bottom: 0.2rem; }
.tips p { margin: 0; }

/* --------------------------------------------------------------------------
   11. FARM LOG — a vertical timeline: the line is the list's border, the
   dots are each item's ::before.
   -------------------------------------------------------------------------- */
.log { list-style: none; padding: 0 0 0 1.75rem; margin: 1.5rem 0 0; border-left: 4px dotted var(--straw); }
.log li { position: relative; padding: 0 0 2rem 0.5rem; }
.log li::before {
  content: "";
  position: absolute;
  left: -2.45rem;
  top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--worm);
  border: 4px solid var(--cream);
  box-shadow: 0 0 0 2px var(--worm);
}
.log li.log-upcoming::before { background: var(--cream); }
.log-date { margin: 0 0 0.2rem; font-weight: 700; color: var(--bark); font-size: 0.9rem; letter-spacing: 0.05em; text-transform: uppercase; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.log-date .badge { margin: 0; text-transform: none; letter-spacing: 0; }
.log h3 { margin-bottom: 0.3rem; }

/* Blog: index cards and post pages. Posts use a comfortable reading
   width (narrow container, ~65 characters per line) and generous spacing. */
.blog-hero { padding-bottom: 1rem; background: linear-gradient(180deg, var(--straw-light), var(--cream)); }
.blog-list-section { padding-top: 1rem; }
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; }
.post-card { background: var(--cream-light); border: 2px solid var(--straw); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.post-card h2 { font-size: var(--step-1); margin-bottom: 0.4rem; }
.post-card h2 a { color: var(--soil); text-decoration: none; }
.post-card h2 a:hover { text-decoration: underline; }
.post-meta { margin: 0 0 0.3rem; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--bark); }
.read-more { font-weight: 700; }
.post-back { margin-bottom: 1.5rem; font-weight: 600; }
.post h2 { font-size: var(--step-1); margin-top: 2rem; }
.post-lede { font-size: 1.2em; color: var(--bark); }
.post-list-plain { padding-left: 1.2rem; }
.post-list-plain li { margin-bottom: 0.6rem; }
.post-end { margin-top: 3rem; padding-top: 2rem; border-top: 2px dashed var(--straw); text-align: center; }
.post-end svg { width: 64px; height: 64px; display: block; margin: 0 auto 1rem; }
.post-end .btn { margin: 0.25rem; }
.nav-list a[aria-current="page"] { background: var(--straw-light); }

/* --------------------------------------------------------------------------
   12. GALLERY + LIGHTBOX
   -------------------------------------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}
.gallery a { display: block; border-radius: var(--radius); }
.gallery img {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: no-preference) {
  .gallery img { transition: transform 0.2s; }
  .gallery a:hover img { transform: scale(1.03) rotate(-1deg); }
}

.lightbox {
  width: min(94vw, 900px);
  max-height: 94vh;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--cream-light);
  color: var(--soil);
}
.lightbox::backdrop { background: rgb(34 10 3 / 0.88); }
.lightbox-inner { display: grid; gap: 0.5rem; padding: 0.75rem; }
.lightbox-figure { margin: 0; display: grid; gap: 0.5rem; }
.lightbox-figure img { max-height: 72vh; width: auto; margin-inline: auto; border-radius: 10px; }
.lightbox-caption { font-size: 0.95rem; text-align: center; }
.lightbox-controls { display: flex; justify-content: center; gap: 0.75rem; }
.lb-btn {
  min-width: 48px;
  min-height: 48px;
  font-size: 1.5rem;
  line-height: 1;
  border: 2px solid var(--soil);
  border-radius: 999px;
  background: var(--cream);
  color: var(--soil);
  cursor: pointer;
}
.lb-btn:hover { background: var(--straw-light); }

/* --------------------------------------------------------------------------
   13. FAQ, CONTACT, FOOTER, 404
   -------------------------------------------------------------------------- */
.faq details {
  background: var(--cream-light);
  border: 2px solid var(--straw);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.faq summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 700; min-height: 48px; }
.faq details[open] summary { border-bottom: 1px dashed var(--straw); }
.faq details p { padding: 1rem 1.25rem 0.25rem; margin: 0 0 0.75rem; }

.contact { text-align: center; }
/* Round portrait of the real Cheese, with the SVG worm peeking over the
   edge. object-position keeps Cheese's face centered inside the circle. */
.contact-photo { position: relative; width: 160px; margin: 0 auto 1rem; }
.contact-photo img {
  width: 160px; height: 160px; object-fit: cover; object-position: 50% 30%;
  border-radius: 50%; border: 5px solid var(--straw-light); box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.contact-worm { position: absolute; right: -28px; bottom: 4px; width: 64px; height: 64px; }
.contact .btn-primary { box-shadow: 0 4px 0 var(--soil-deep); }

.site-footer { background: var(--soil-deep); color: var(--cream); padding-block: 2rem; }
.site-footer a { color: var(--straw-light); }
.footer-inner { display: grid; gap: 0.25rem; text-align: center; }
.footer-inner p { margin: 0; }
.social { display: flex; gap: 1rem; justify-content: center; list-style: none; padding: 0; }

.notfound { padding-block: 3rem; text-align: center; }
.notfound .photo { max-width: 320px; margin: 0 auto 1.5rem; }

/* --------------------------------------------------------------------------
   14. LARGER SCREENS — layout additions only.
   -------------------------------------------------------------------------- */
@media (min-width: 640px) {
  :root { --gutter: 1.5rem; --wave-h: 48px; }
  .site-header { position: sticky; top: 0; backdrop-filter: blur(6px); }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .stats { gap: 1rem; }
  .stats span { font-size: 0.9rem; }
}

@media (min-width: 900px) {
  .hero { padding-block: 3.5rem 3rem; }
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; gap: 3rem; }
  .hero-text { text-align: left; }
  .lede { margin-inline: 0; }
  .cta-row { justify-content: flex-start; }
  .split { grid-template-columns: 1.15fr 0.85fr; gap: 4rem; }
  .split-reverse .split-media { order: -1; } /* visual zig-zag; DOM order unchanged */
  .split-tight { grid-template-columns: 1fr auto; }
  .tools-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .foods { max-height: 30rem; }
  /* Wide screens: pill beside the name in a two-column grid. */
  .foods li { display: grid; grid-template-columns: auto 1fr; column-gap: 0.75rem; align-items: baseline; }
  .foods .verdict { grid-row: span 2; align-self: start; }
  .foods li > strong { margin-top: 0; }
  .foods li > span:last-child { grid-column: 2; }
  .care-layout { grid-template-columns: 1fr 340px; }
  .footer-inner { grid-template-columns: repeat(3, 1fr); text-align: left; }
  .footer-inner p:last-child { text-align: right; }
}

@media (min-width: 1100px) {
  .gallery { grid-template-columns: repeat(4, 1fr); }
}

/* Windows High Contrast / forced colors: keep buttons, pills and badges
   visible when the OS replaces our colors. */
@media (forced-colors: active) {
  .btn, .badge, .verdict, .chip, .lb-btn { border: 2px solid ButtonText; }
  .chip[aria-pressed="true"] { outline: 3px solid Highlight; }
}
