/* creature_feast_styles.css — v4 Landscape Theme
   CSS gradient sunrise/night parallax, wood-grain content panels */

/* Font Awesome & Google Fonts loaded via <link> tags in base.html for reliability behind CDN/Cloudflare */

/* ==========================================================================
   THEME VARIABLES
   ========================================================================== */
:root {
  --sky-blue: #87CEEB;
  --sky-light: #c5e8f7;
  --sky-pale: #e4f2fa;
  --sky-deep: #4a90b8;
  --sky-gradient: linear-gradient(180deg, #a8d8f0 0%, #d4edf8 40%, #e8f4fc 100%);

  --green-deep: #1a3a1a;
  --green-forest: #2d5a27;
  --green-leaf: #4a8c3f;
  --green-fresh: #6bbf59;
  --green-bright: #8fd47e;
  --green-pale: #c8e0c0;

  --text-primary: #1a2a1a;
  --text-secondary: #3a4a3a;
  --text-muted: #6a7a6a;
  --surface: rgba(255,255,255,0.85);
  --surface-solid: #ffffff;
  --border: #c0d4c0;
  --border-subtle: #d8e8d8;

  --header-bg: #fff3ea;
  --header-text: #2a1a0a;
  --header-secondary: #6a5040;
  --footer-bg: #fff3ea;
  --footer-text: #2a1a0a;
  --footer-secondary: #6a5040;
  --footer-links: #8a5a2a;

  --accent-gradient: linear-gradient(90deg, #32CD32, #7CFC00);
  --accent-color: #4a8c3f;

  --safe-color: #2d5a27; --safe-bg: #d4edcf;
  --caution-color: #7a5a0a; --caution-bg: #fef3c7;
  --limited-context-color: #5b3fa0; --limited-context-bg: #e0d8f0;
  --avoid-color: #a01c1c; --avoid-bg: #f0d0d0;
  --trust-color: #195faf; --trust-bg: #e8f0fa;
}

.dark-mode {
  --sky-gradient: linear-gradient(180deg, #0b1520 0%, #101e2a 40%, #152530 100%);
  --text-primary: #d8e8d8;
  --text-secondary: #a8b8a8;
  --text-muted: #708070;
  --surface: rgba(18,28,22,0.88);
  --surface-solid: #1a2820;
  --border: #2a3a2a;
  --border-subtle: #223022;
  --header-bg: #0d1a1e;
  --header-text: #d8e8d8;
  --header-secondary: #8a9a8a;
  --footer-bg: #0d1a1e;
  --footer-text: #d8e8d8;
  --footer-secondary: #8a9a8a;
  --footer-links: #FFD700;
  --accent-color: #6bbf59;
  --safe-color: #6bbf59; --safe-bg: #1a2e18;
  --caution-color: #e8c040; --caution-bg: #302408;
  --limited-context-color: #a78bfa; --limited-context-bg: #201540;
  --avoid-color: #f07070; --avoid-bg: #380808;
  --trust-color: #5ba0e0; --trust-bg: #0e1a28;
}

/* ==========================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #84b0d1;
  transition: background-color 1s ease;
}

.dark-mode { background-color: #0b1520; }

a { color: var(--green-forest); }
.dark-mode a { color: var(--green-bright); }

/* ==========================================================================
   SCENE BACKGROUND — CSS gradient sunrise / night sky with parallax
   ========================================================================== */
.scene-bg {
  position: fixed;
  /* Tall enough for parallax travel without exposing edges */
  top: -10%;
  left: 0;
  right: 0;
  height: 160%;
  z-index: -1;
  will-change: transform;

  /* Full sky-to-ground gradient — single seamless layer */
  background: linear-gradient(180deg,
    #84b0d1  0%,     /* soft blue sky */
    #a1c4dc  6%,
    #b0c5dd 12%,     /* hazy blue */
    #bcbcd6 20%,     /* lavender transition */
    #cfb8c4 28%,     /* pink warmth */
    #e3bb96 36%,     /* golden horizon */
    #cf976b 44%,     /* warm amber */
    #b08050 50%,     /* deeper amber */
    #8a9a58 56%,     /* sky-to-green transition */
    #585c46 64%,     /* dark olive */
    #475c2b 74%,     /* deep green canopy */
    #3d5d2f 86%,     /* forest floor */
    #315032 100%     /* dark foliage */
  );
  transition: background 0.8s ease;
}

.dark-mode .scene-bg {
  background: linear-gradient(180deg,
    #0a0e1a  0%,     /* deep night sky */
    #0f1628  8%,
    #141e38 18%,     /* dark navy */
    #1a2848 30%,     /* midnight blue */
    #1e2f52 40%,     /* hint of deep blue */
    #192842 50%,     /* transition */
    #152238 56%,     /* darker */
    #1a3325 64%,     /* blue-to-green */
    #1e3a20 72%,     /* dark canopy — more visible green */
    #193018 82%,     /* forest */
    #14281a 92%,     /* deep forest */
    #102214 100%     /* forest floor at night */
  );
}


/* ==========================================================================
   CONTENT PANELS — Semi-transparent with wood grain
   ========================================================================== */
.content-panel {
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
  max-width: 960px;
  margin: 16px auto;
  overflow: hidden;
}


/* Wood grain overlay — horizontal streaks via SVG turbulence */
.content-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  opacity: 0.14;
  background:
    repeating-linear-gradient(
      2deg,
      transparent,
      transparent 10px,
      rgba(120,80,40,0.3) 11px,
      rgba(110,70,35,0.15) 12px,
      transparent 14px
    ),
    repeating-linear-gradient(
      -1deg,
      transparent,
      transparent 28px,
      rgba(100,65,30,0.2) 29px,
      transparent 31px
    ),
    repeating-linear-gradient(
      3deg,
      transparent,
      transparent 55px,
      rgba(140,90,50,0.25) 56px,
      rgba(130,85,45,0.1) 58px,
      transparent 60px
    );
  filter: url(#wood-grain);
}

/* Ensure panel content sits above the grain overlay */
.content-panel > * {
  position: relative;
  z-index: 1;
}

.dark-mode .content-panel::before {
  opacity: 0.10;
  background:
    repeating-linear-gradient(
      2deg,
      transparent,
      transparent 10px,
      rgba(180,140,90,0.3) 11px,
      rgba(170,130,80,0.15) 12px,
      transparent 14px
    ),
    repeating-linear-gradient(
      -1deg,
      transparent,
      transparent 28px,
      rgba(160,120,70,0.2) 29px,
      transparent 31px
    ),
    repeating-linear-gradient(
      3deg,
      transparent,
      transparent 55px,
      rgba(200,160,100,0.25) 56px,
      rgba(190,150,90,0.1) 58px,
      transparent 60px
    );
}

/* ==========================================================================
   HEADER — Stationary + mini on scroll
   ========================================================================== */
.stationary-header {
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 12px 15px 15px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(18px, 1.7vw, 28px);
  position: relative;
  max-width: 960px;
  margin: 16px auto 0;
  border-radius: 12px 12px 0 0;
}

/* Brand: Creature [logo] Feast */
.brand-link {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
  margin: 6px 0 2px 0;
}

.brand-word {
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stationary-header .logo {
  height: clamp(18px, 3vw, 26px);
  width: auto;
  margin: 0;
}

/* Gentle rocking animation on logo */
.logo-rock {
  animation: rock 5s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes rock {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(3deg); }
  75%      { transform: rotate(-3deg); }
}

/* Gentle breathing animation on animal cards — uses `scale` to compose with transform tilts/hovers */
@keyframes breathe {
  0%, 100% { scale: 1; }
  50%      { scale: 1.035; }
}

.tagline-pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.tagline-pages .tagline {
  font-size: clamp(12px, 1.5vw, 20px);
  color: var(--header-secondary);
}

.tagline-accent {
  color: var(--accent-color);
  font-weight: 700;
}

/* Nav links */
.pages, .mini-pages {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sketch circle links */
.sketch-link {
  position: relative;
  display: inline-block;
  padding: 0.2em 0.5em;
  text-decoration: none;
  color: var(--header-secondary);
  font-weight: 600;
  font-size: clamp(10px, 1.1vw, 14px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.sketch-link:hover { color: var(--text-primary); }

.sketch-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140%;
  height: 240%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: visible;
}

.sketch-circle path {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
}

.sketch-link.drawing .sketch-circle path {
  animation: drawCircle 0.5s ease-out forwards;
}

.sketch-link:not(:hover) .sketch-circle path {
  animation: eraseCircle 0.25s ease-in forwards;
}

@keyframes drawCircle {
  0%   { stroke-dashoffset: var(--path-len); }
  100% { stroke-dashoffset: 0; }
}

@keyframes eraseCircle {
  0%   { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: var(--path-len); opacity: 0; }
}

.divider {
  color: var(--header-text);
  margin: 0 2px;
}

/* Theme toggle — paw */
.theme-toggle {
  position: absolute;
  top: 25px;
  right: 20px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
}

.theme-toggle .sun,
.theme-toggle .moon { font-size: 0.9rem; }

.theme-toggle .paw {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  font-size: 0.8rem;
  transition: left 0.08s ease, transform 0.2s ease, text-shadow 0.3s ease;
}

.dark-mode .theme-toggle .paw {
  left: 65%;
  transform: translateY(-50%) scale(1.1);
  text-shadow: 0 0 6px #fff8;
}

.theme-toggle .sun { transition: text-shadow 0.3s ease; }
body:not(.dark-mode) .theme-toggle .sun { text-shadow: 0 0 6px #FFD700; }

/* Mini header */
#mini-header {
  position: fixed;
  top: -50px;
  left: 0;
  width: 100%;
  height: clamp(2rem, 5vw, 3rem);
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(0.5rem, 3vw, 1rem);
  font-size: clamp(12px, 1.3vw, 18px);
  z-index: 998;
  gap: 10px;
  transition: top 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#mini-header.visible { top: 0; }

#mini-header .mini-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#mini-header .mini-left .mini-logo {
  height: 16px;
  width: auto;
}

#mini-header .mini-left .mini-brand {
  color: var(--header-text);
  text-decoration: none;
  font-weight: 600;
}

/* Mini header search — desktop only */
.mini-search {
  flex-shrink: 1;
  min-width: 0;
}

/* Hamburger button — hidden on desktop, visible on mobile */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--header-text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile menu overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu.open {
  display: flex;
  opacity: 1;
}

/* Close button — top right */
.mobile-menu-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu-close:hover {
  background: rgba(0,0,0,0.08);
}

.dark-mode .mobile-menu-close:hover {
  background: rgba(255,255,255,0.1);
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.mobile-menu-nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 600;
  transition: color 0.2s;
}

.mobile-menu-nav a:hover {
  color: var(--accent-color);
}

/* Mobile menu search */
.search-form--mobile {
  width: 80%;
  max-width: 320px;
  position: relative;
}

.search-form--mobile input {
  width: 100%;
  padding: 0.7rem 3rem 0.7rem 1.2rem;
  font-size: 1rem;
  border-radius: 28px;
}

.search-form--mobile button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* Show hamburger, hide desktop search on mobile */
@media (max-width: 640px) {
  .hamburger { display: flex; }
  .mini-search--desktop { display: none; }
}

/* ==========================================================================
   SEARCH BAR — "The Grotto"
   ========================================================================== */
.search-form {
  display: flex;
  align-items: center;
  position: relative;
}

.search-form input {
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-form input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(74,140,63,0.15);
}

.search-form input::placeholder {
  color: var(--text-muted);
  transition: opacity 0.3s;
}

/* Search autocomplete dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 5px;
  right: 5px;
  z-index: 50;
  background: var(--surface-solid, #fff);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.search-dropdown.active {
  max-height: 400px;
  opacity: 1;
}
.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.06));
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover,
.search-dropdown-item.highlighted {
  background: rgba(74,140,63,0.1);
}
.search-dropdown-type {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-dropdown-type--animal { background: rgba(74,140,63,0.15); color: #2d7a3a; }
.search-dropdown-type--food { background: rgba(245,158,11,0.15); color: #b8860b; }
.search-dropdown-type--recipe { background: rgba(139,92,246,0.15); color: #7c3aed; }
.dark-mode .search-dropdown-type--animal { background: rgba(74,140,63,0.25); color: #6bbb59; }
.dark-mode .search-dropdown-type--food { background: rgba(245,158,11,0.2); color: #f5a623; }
.dark-mode .search-dropdown-type--recipe { background: rgba(139,92,246,0.2); color: #a78bfa; }
.search-dropdown-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-dropdown-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-dropdown-empty {
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}
.dark-mode .search-dropdown {
  background: var(--surface-solid, #1a2a1a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Hero search — large, centered, "Grotto" style */
.search-form--hero {
  justify-content: center;
  margin: 1.2rem auto 0.8rem;
  max-width: 480px;
}

/* The Grotto: inset cave slot behind the input */
.grotto-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.grotto-slot {
  position: relative;
  border-radius: 32px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0,0,0,0.12) 0%, transparent 70%),
    linear-gradient(180deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.02) 100%);
  box-shadow:
    inset 0 4px 12px rgba(0,0,0,0.18),
    inset 0 1px 3px rgba(0,0,0,0.12),
    0 1px 0 rgba(255,255,255,0.15);
  padding: 5px;
}

.dark-mode .grotto-slot {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0,0,0,0.25) 0%, transparent 70%),
    linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.08) 100%);
  box-shadow:
    inset 0 4px 14px rgba(0,0,0,0.35),
    inset 0 1px 4px rgba(0,0,0,0.25),
    0 1px 0 rgba(255,255,255,0.05);
}

/* The River Stone: the actual input inside the grotto */
.grotto-slot .search-form--hero {
  margin: 0;
  max-width: none;
}

.grotto-slot .search-form--hero input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1.3rem;
  font-size: 1.05rem;
  border-radius: 28px;
  border: 1.5px solid rgba(180,160,140,0.3);
  background:
    linear-gradient(145deg, var(--surface-solid) 0%, color-mix(in srgb, var(--surface-solid) 94%, #d4c8b8) 100%);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.08),
    0 1px 2px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.7);
  transition:
    border-color 0.3s,
    box-shadow 0.4s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Subtle grain texture on the stone */
.grotto-slot .search-form--hero input::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.04;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Focus: Blue liquid glow */
.grotto-slot .search-form--hero input:focus {
  border-color: var(--trust-color);
  transform: scale(1.015);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--trust-color) 20%, transparent),
    0 0 18px color-mix(in srgb, var(--trust-color) 15%, transparent),
    0 4px 12px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.5);
  animation: grottoWobble 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes grottoWobble {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.025) rotate(0.3deg); }
  60%  { transform: scale(1.01) rotate(-0.2deg); }
  100% { transform: scale(1.015) rotate(0deg); }
}

/* Emoji particle layer */
.grotto-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.grotto-particle {
  position: absolute;
  font-size: 1.2rem;
  opacity: 0;
  pointer-events: none;
  animation: grottoParticleFly 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  will-change: transform, opacity;
}

@keyframes grottoParticleFly {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  15%  { opacity: 1; transform: translate(var(--dx-mid), var(--dy-mid)) scale(1.1) rotate(var(--rot-mid)); }
  100% { opacity: 0; transform: translate(var(--dx-end), var(--dy-end)) scale(0.3) rotate(var(--rot-end)); }
}

/* Daily Specials dropdown — foundation for future (Redis popular foods) */
.grotto-specials {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 90%;
  max-width: 420px;
  background:
    linear-gradient(170deg, #faf3e8 0%, #f0e6d4 100%);
  border-radius: 10px;
  box-shadow:
    0 8px 28px rgba(0,0,0,0.15),
    0 2px 6px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.6);
  padding: 1rem 1.2rem;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
  transform: translateX(-50%) translateY(10px);
  font-family: 'Caveat', cursive;
}

.dark-mode .grotto-specials {
  background: linear-gradient(170deg, #1e2a22 0%, #162018 100%);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.35),
    0 2px 6px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.grotto-specials.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(4px);
}

.grotto-specials-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--green-forest);
  margin-bottom: 0.5rem;
  text-align: center;
}

.grotto-specials-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.grotto-specials-item {
  padding: 0.4rem 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border-subtle);
}

.grotto-specials-item:last-child { border-bottom: none; }

/* Fallback: hero search without grotto wrapper still works */
.search-form--hero input {
  width: 100%;
  padding: 0.7rem 3rem 0.7rem 1.2rem;
  font-size: 1.05rem;
  border-radius: 28px;
}

.search-form--hero button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.search-form--hero button:hover {
  background: var(--green-forest);
}

/* Mini header search — compact */
.search-form--mini input {
  width: clamp(120px, 20vw, 220px);
  padding: 0.3rem 0.8rem;
  font-size: clamp(11px, 1.1vw, 14px);
  border-radius: 16px;
}

/* ==========================================================================
   SAFETY CHECKER  — "Can they eat it?" hero widget
   ========================================================================== */
.safety-checker {
  max-width: 540px;
  margin: 1.5rem auto;
  padding: 1.5rem 1.8rem;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
}

.safety-checker__heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.safety-checker__subtext {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0 0 1.1rem;
}

.safety-checker__form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.safety-checker__select,
.safety-checker__input {
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  border: 2px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.safety-checker__select:focus,
.safety-checker__input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.safety-checker__select { flex: 0 1 160px; cursor: pointer; }
.safety-checker__input  { flex: 1 1 160px; min-width: 120px; }

.safety-checker__btn {
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-color);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.safety-checker__btn:hover  { background: var(--green-forest); }
.safety-checker__btn:active { transform: scale(0.97); }

/* Score bar color variables */
:root {
  --score-safe: #22c55e;
  --score-ok: #84cc16;
  --score-caution: #eab308;
  --score-limited: #f97316;
  --score-avoid: #ef4444;
}

/* Result area */
.safety-checker__result {
  margin-top: 1.4rem;
  padding: 1.2rem 1.4rem;
  border-radius: 14px;
  background: var(--card-bg);
  animation: scFadeIn 0.35s ease;
}

.safety-checker__food-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.9rem;
  text-transform: capitalize;
}

/* The gradient bar */
.safety-checker__bar-wrap {
  margin: 0 auto;
  max-width: 100%;
}

.safety-checker__bar {
  position: relative;
  height: 36px;
  border-radius: 18px;
  background: linear-gradient(to right,
    var(--score-avoid) 0%,
    var(--score-limited) 30%,
    var(--score-caution) 50%,
    var(--score-ok) 70%,
    var(--score-safe) 100%
  );
  overflow: visible;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.safety-checker__bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 14px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.safety-checker__bar-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.safety-checker__bar-score {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: #000;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: none;
  border: none;
}

/* Score number text shadow for readability on gradient */
.safety-checker__bar-score {
  text-shadow: 0 1px 3px rgba(255,255,255,0.8);
}

/* Bar labels */
.safety-checker__bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  padding: 0 0.2rem;
}

.safety-checker__bar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

/* Tier verdict text */
.safety-checker__tier-label {
  margin-top: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.safety-checker__tier-label--safe    { color: var(--score-safe); }
.safety-checker__tier-label--ok      { color: var(--score-ok); }
.safety-checker__tier-label--caution { color: var(--score-caution); }
.safety-checker__tier-label--limited { color: var(--score-limited); }
.safety-checker__tier-label--avoid   { color: var(--score-avoid); }

/* Disambiguation list */
.safety-checker__matches {
  margin-top: 1rem;
  text-align: left;
  animation: scFadeIn 0.3s ease;
}

.safety-checker__matches-prompt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}

.safety-checker__matches-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.safety-checker__match-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.safety-checker__match-btn:hover { transform: scale(1.03); }

.safety-checker__match-btn--safe    { border-color: var(--score-safe); }
.safety-checker__match-btn--ok      { border-color: var(--score-ok); }
.safety-checker__match-btn--caution { border-color: var(--score-caution); }
.safety-checker__match-btn--limited { border-color: var(--score-limited); }
.safety-checker__match-btn--avoid   { border-color: var(--score-avoid); }

.match-name { font-weight: 500; }
.match-score {
  font-weight: 700;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Error */
.safety-checker__error {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  animation: scFadeIn 0.3s ease;
}

@keyframes scFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Inline variant (animal pages — no dropdown, less padding) */
.safety-checker--inline {
  padding: 1rem 1.2rem;
  margin: 1rem auto 1.5rem;
  max-width: 480px;
}
.safety-checker--inline .safety-checker__heading {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

/* Mobile: stack inputs */
@media (max-width: 480px) {
  .safety-checker__form { flex-direction: column; }
  .safety-checker__select,
  .safety-checker__input { flex: 1 1 100%; }
  .safety-checker__bar-score { width: 34px; height: 34px; font-size: 0.8rem; }
}

/* ==========================================================================
   HERO — Sky gradient with clouds
   ========================================================================== */
.hero {
  padding: 4rem 2rem 3rem;
  text-align: center;
  background: var(--sky-gradient);
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 12px 12px;
}

/* Hero silhouette shadows — animals eating from hands */
.hero-shadows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hero-shadow {
  position: absolute;
  width: clamp(120px, 18vw, 200px);
  height: auto;
  opacity: 0;
  filter: blur(1.5px);
  transition: none;
  pointer-events: none;
}

@keyframes shadow-breathe {
  0%   { opacity: 0; transform: scale(0.92) rotate(var(--rot)); }
  30%  { opacity: var(--peak-opacity); transform: scale(1) rotate(var(--rot)); }
  70%  { opacity: var(--peak-opacity); transform: scale(1.03) rotate(var(--rot)); }
  100% { opacity: 0; transform: scale(0.95) rotate(var(--rot)); }
}

.dark-mode .hero-shadow {
  filter: blur(1.5px) invert(1) brightness(0.9);
}

.hero-shadow--active {
  animation: shadow-breathe var(--duration) ease-in-out forwards;
}

/* Hide on mobile — save bandwidth and avoid clutter */
@media (max-width: 767px) {
  .hero-shadows { display: none; }
}

.cloud {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
  animation: cloudDrift linear infinite;
}

.cloud-1 { width: 350px; height: 110px; top: 12%; filter: blur(35px); opacity: 0.7; animation-duration: 35s; animation-delay: 0s; }
.cloud-2 { width: 260px; height: 85px; top: 55%; filter: blur(28px); opacity: 0.6; animation-duration: 45s; animation-delay: -12s; }
.cloud-3 { width: 420px; height: 120px; top: 28%; filter: blur(40px); opacity: 0.55; animation-duration: 55s; animation-delay: -25s; }
.cloud-4 { width: 230px; height: 80px; top: 70%; filter: blur(26px); opacity: 0.45; animation-duration: 40s; animation-delay: -8s; }

@keyframes cloudDrift {
  0%   { left: -20%; }
  100% { left: 110%; }
}

.dark-mode .cloud { background: rgba(180,200,220,0.18); }

.hero h1, .hero p, .hero .cta-btn {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.hero p {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero .cta-btn {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.7rem 2rem;
  background: var(--green-forest);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 4px 12px rgba(45, 90, 39, 0.25);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.hero .cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 90, 39, 0.35);
}

/* Ripple blur on buttons */
.ripple-btn { position: relative; overflow: hidden; }

.ripple-btn .ripple-blur {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  filter: blur(12px);
  transform: scale(0);
  animation: rippleSpread 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleSpread {
  0%   { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

/* ==========================================================================
   CONTENT
   ========================================================================== */
.content-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Big bold headline above content sections */
.section-headline {
  font-family: 'Caveat', cursive;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--green-forest);
  text-align: center;
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.dark-mode .section-headline {
  color: var(--green-leaf);
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--green-pale);
}

/* ==========================================================================
   ANIMAL CARDS — Mobile-first, tap to toggle, glow
   ========================================================================== */
.animal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 1rem 0;
  cursor: url('/static/images/paw-cursor.svg') 16 16, pointer;
}

.animal-card {
  position: relative;
  aspect-ratio: 1 / 1.2;
  background: var(--surface-solid);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  cursor: pointer;
  border: 4px solid white;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 1px 3px rgba(0,0,0,0.12);
}



.animal-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.3s ease;
}

.animal-card:hover, .animal-card:active, .animal-card.active {
  border-color: transparent;
}
.animal-card.active {
  box-shadow: 0 0 20px rgba(74,140,63,0.3), 0 0 40px rgba(74,140,63,0.15), 0 8px 24px rgba(0,0,0,0.12);
  z-index: 2;
}

.animal-card.active::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  background: linear-gradient(135deg, #32CD32, #7CFC00, #32CD32);
  background-size: 200% 200%;
  animation: glowShift 2s ease infinite;
  z-index: -1;
  opacity: 0.6;
}

@keyframes glowShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animal-card.active img { filter: brightness(0.7); transform: scale(1.05); }

.animal-card .card-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.75rem 0.5rem;
  background: linear-gradient(transparent, rgba(20,30,20,0.88));
  color: #fff;
  text-align: center;
  transform: translateY(55%);
  transition: transform 0.35s ease;
}

.animal-card.active .card-overlay { transform: translateY(0); }

@media (hover: hover) {
  .animal-card:hover:not(.active) { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
  .animal-card:hover:not(.active) img { transform: scale(1.06); filter: brightness(0.75); }
  .animal-card:hover:not(.active) .card-overlay { transform: translateY(0); }
}

/* Quote wrapper + peek-from-behind effect */
.animal-card-wrap {
  position: relative;
}
.animal-card-wrap .animal-card {
  position: relative;
  z-index: 2;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.3s ease;
}
.animal-card-wrap:hover .animal-card,
.animal-card-wrap:has(.animal-card.active) .animal-card {
  transform: translateY(-56px);
}
.animal-card-wrap .card-quote {
  position: absolute;
  bottom: -8px;
  left: 2px;
  right: 2px;
  z-index: 1;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #4a2800;
  text-align: center;
  padding: 10px 10px 8px;
  background: rgba(255, 180, 80, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 160, 60, 0.3);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 12px rgba(180, 100, 20, 0.15);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease 0.1s, transform 0.35s ease 0.1s;
  line-height: 1.3;
}
.dark-mode .animal-card-wrap .card-quote {
  background: rgba(200, 130, 40, 0.25);
  color: #f0d0a0;
  border-color: rgba(200, 130, 40, 0.2);
}
.animal-card-wrap:hover .card-quote,
.animal-card-wrap:has(.animal-card.active) .card-quote {
  opacity: 1;
  transform: translateY(8px);
}
.animal-card .card-name {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animal-card .card-links {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.animal-card .card-links a {
  color: #fff;
  text-decoration: none;
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.animal-card .card-links a:hover { background: rgba(107,191,89,0.4); border-color: rgba(107,191,89,0.5); }

@media (min-width: 480px) { .animal-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .animal-grid { grid-template-columns: repeat(5, 1fr); gap: 18px; } }

/* ==========================================================================
   ANIMAL ORBIT — Circular layout (homepage)
   ========================================================================== */
.animal-orbit {
  position: relative;
  width: 700px;
  height: 700px;
  margin: 1rem auto;
  animation: orbit-spin 120s linear infinite;
}

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Counter-rotate cards and plate title so they stay upright */
.orbit-slot {
  animation: orbit-counter-spin 120s linear infinite;
}

@keyframes orbit-counter-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

/* Pause orbit on hover so users can click */
.animal-orbit:hover {
  animation-play-state: paused;
}

.animal-orbit:hover .orbit-slot {
  animation-play-state: paused;
}

.animal-orbit:hover .feast-plate__title {
  animation-play-state: paused;
}

.orbit-slot {
  --angle: calc(var(--i) * 36deg);
  --radius: 270px;
  --card-w: 120px;
  position: absolute;
  left: calc(50% + var(--radius) * sin(var(--angle)) - var(--card-w) / 2);
  top: calc(50% - var(--radius) * cos(var(--angle)) - var(--card-w) * 0.6);
  width: var(--card-w);
}

.animal-orbit .animal-card {
  width: 100%;
}

/* ==========================================================================
   FEAST PLATE — Center of the orbit
   ========================================================================== */
.feast-plate {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  border-radius: 50%;
  z-index: 0;
  border: 3px solid rgba(196, 168, 122, 0.45);
  box-shadow:
    0 10px 40px rgba(59, 40, 23, 0.25),
    0 2px 8px rgba(59, 40, 23, 0.12);
}

.plate-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 30deg,
    #f5efe6, #ede4d4, #f8f2ea, #e8dfd0,
    #f5efe6, #ede4d4, #f8f2ea, #e8dfd0, #f5efe6
  );
}

/* Radial spin lines on the outer rim */
.plate-rim::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(180, 160, 130, 0.08) 0deg 1.5deg,
    transparent 1.5deg 9deg
  );
  mask: radial-gradient(
    circle,
    transparent 70%,
    black 71%,
    black 93%,
    transparent 94%
  );
  -webkit-mask: radial-gradient(
    circle,
    transparent 70%,
    black 71%,
    black 93%,
    transparent 94%
  );
}

/* Inner decorative ring */
.plate-rim::after {
  content: '';
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1.5px solid rgba(180, 160, 130, 0.22);
  box-shadow: 0 0 4px 1px rgba(59, 40, 23, 0.03);
}

.plate-well {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  /* Default: bulging OUT — bright top-left, shaded bottom-right */
  background: radial-gradient(
    ellipse at 35% 32%,
    #fefcf8 0%,
    #f5efe6 25%,
    #ede4d4 55%,
    #ddd3c0 80%,
    #d0c5ad 100%
  );
  box-shadow:
    inset -8px -10px 25px rgba(59, 40, 23, 0.15),
    inset -3px -4px 10px rgba(59, 40, 23, 0.08),
    0 0 6px 2px rgba(59, 40, 23, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Faint throwing rings in the well */
.plate-well::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at center,
    transparent 0px,
    transparent 8px,
    rgba(180, 160, 130, 0.04) 8px,
    rgba(180, 160, 130, 0.04) 9px
  );
  pointer-events: none;
}

.plate-title {
  font-family: 'Caveat', cursive;
  font-size: 2.2rem;
  font-weight: 700;
  color: #5a3a1a;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 2;
  animation: orbit-counter-spin 120s linear infinite;
}

/* Gloss shine overlay */
.plate-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.06) 30%,
    transparent 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* Dark mode plate adjustments */
.dark-mode .feast-plate {
  border-color: rgba(160, 130, 90, 0.35);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 3px 6px rgba(255, 255, 255, 0.15),
    inset 0 -4px 8px rgba(0, 0, 0, 0.15),
    inset 0 0 20px 5px rgba(0, 0, 0, 0.06);
}

.dark-mode .plate-rim {
  background: conic-gradient(
    from 30deg,
    #d4cabb, #c9bfae, #d8d0c3, #c4baab,
    #d4cabb, #c9bfae, #d8d0c3, #c4baab, #d4cabb
  );
}

.dark-mode .plate-well {
  background: radial-gradient(
    ellipse at 38% 35%,
    #e8e0d4 0%,
    #d8d0c3 35%,
    #c9bfae 75%,
    #bdb3a2 100%
  );
}

.dark-mode .plate-title {
  color: #3d2810;
}

.dark-mode .plate-shine {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.03) 30%,
    transparent 50%,
    transparent 100%
  );
}

/* Tablet orbit — smaller */
@media (max-width: 899px) and (min-width: 768px) {
  .animal-orbit {
    width: 560px;
    height: 560px;
  }
  .orbit-slot {
    --radius: 210px;
    --card-w: 100px;
  }
  .feast-plate {
    width: 340px;
    height: 340px;
  }
  .plate-title {
    font-size: 1.9rem;
  }
}

/* Mobile — fall back to grid */
@media (max-width: 767px) {
  .animal-orbit {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    width: auto;
    height: auto;
    padding: 1rem 0;
    animation: none;
  }
  .orbit-slot {
    position: static;
    width: auto;
    transform: none;
    animation: none;
  }
  .feast-plate {
    display: none;
  }
}
@media (max-width: 767px) and (min-width: 480px) {
  .animal-orbit {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   FOOD LIST
   ========================================================================== */
.food-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  cursor: url('/static/images/magnifier-cursor.svg') 12 12, pointer;
}

@media (min-width: 520px) { .food-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 800px) { .food-grid { grid-template-columns: repeat(3, 1fr); } }

.coming-soon-note {
  text-align: center;
  color: var(--text-muted);
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  margin-top: 1.5rem;
  opacity: 0.7;
}

.food-card {
  background: linear-gradient(135deg, #f5edd4 0%, #f0e6c8 25%, #ede0be 50%, #f2e8cb 75%, #f5edd4 100%);
  border: none;
  border-left: 4px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1rem 1.1rem 1rem 1.25rem;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, border-color 0.25s;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
  will-change: transform;
  cursor: url('/static/images/magnifier-cursor.svg') 12 12, pointer;
}

/* Staggered offsets — vertical + horizontal, margin-based to avoid conflicting with JS tilt */
.food-card:nth-child(4n+1) { margin-top: 0;    margin-left: 4px;  }
.food-card:nth-child(4n+2) { margin-top: 10px;  margin-left: -2px; }
.food-card:nth-child(4n+3) { margin-top: 4px;   margin-left: 6px;  }
.food-card:nth-child(4n+4) { margin-top: 14px;  margin-left: -3px; }

/* Irregular border-radius per card */
.food-card:nth-child(3n+1) { border-radius: 10px 6px 12px 8px; }
.food-card:nth-child(3n+2) { border-radius: 8px 12px 6px 10px; }
.food-card:nth-child(3n+3) { border-radius: 12px 8px 10px 6px; }

/* Pencil-drawn border — wobbly outline via SVG displacement filter on pseudo-element */
.food-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1.8px solid rgba(120,90,60,0.35);
  border-left: none;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  filter: url(#pencil-border);
}
/* Vary pencil thickness per card */
.food-card:nth-child(5n+1)::before { border-width: 1.2px; }
.food-card:nth-child(5n+2)::before { border-width: 1.8px; }
.food-card:nth-child(5n+3)::before { border-width: 1.4px; }
.food-card:nth-child(5n+4)::before { border-width: 2px; }
.food-card:nth-child(5n+5)::before { border-width: 1.6px; }

/* Reveal toggle button — mobile only */
.reveal-toggle {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 5px 10px;
  border: 2px solid var(--green-forest);
  border-radius: 18px;
  background: var(--surface-solid);
  color: var(--green-forest);
  font-family: 'Caveat', cursive;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.reveal-toggle.mode-all {
  background: var(--green-forest);
  color: white;
}
.reveal-toggle.mode-off {
  background: var(--surface-solid);
  color: var(--text-muted);
  border-color: var(--text-muted);
}
@media (pointer: coarse) {
  .reveal-toggle { display: flex; }
}

/* Background image layer — muted ghost by default, full color on reveal */
.food-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  z-index: 0;
  border-radius: inherit;
  filter: grayscale(1) brightness(0.8);
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.food-card-bg.revealed {
  opacity: 0.6;
  filter: none;
}
.food-card-bg.muted-back {
  transition: opacity 0.5s ease, filter 0.5s ease;
}

/* Keep text above image */
.food-card .food-name,
.food-card .food-meta,
.food-card .safety-badge { position: relative; z-index: 1; }

/* Safety tier left stripe */
.food-card.tier-safe { border-left-color: var(--safe-color); }
.food-card.tier-caution { border-left-color: var(--caution-color); }
.food-card.tier-limited-context { border-left-color: var(--limited-context-color); }
.food-card.tier-avoid { border-left-color: var(--avoid-color); }

/* Dark mode — ghost slightly brighter against dark parchment */
.dark-mode .food-card-bg {
  opacity: 0.22;
  filter: grayscale(1) brightness(0.9);
}
.dark-mode .food-card-bg.revealed {
  opacity: 0.55;
  filter: none;
}

/* Dark mode — aged paper becomes dark parchment */
.dark-mode .food-card {
  background: linear-gradient(135deg, #2a2318 0%, #272015 25%, #252018 50%, #282215 75%, #2a2318 100%);
}

.food-card:hover {
  border-color: var(--green-leaf);
}
.food-card:hover:not(.tilt-active) {
  transform: perspective(600px) rotateX(2deg) translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.food-card .food-name { font-family: 'Caveat', cursive; font-size: 1.35rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.2rem; }
.food-card .food-meta { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.4rem; }

.safety-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.safety-badge.safe { color: var(--safe-color); background: var(--safe-bg); }
.safety-badge.caution { color: var(--caution-color); background: var(--caution-bg); }
.safety-badge.limited-context { color: var(--limited-context-color); background: var(--limited-context-bg); }
.safety-badge.avoid { color: var(--avoid-color); background: var(--avoid-bg); }

.filter-bar { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.filter-bar--category { margin-top: -0.4rem; }

.filter-bar a,
.filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-bar a:hover,
.filter-bar a.active,
.filter-btn:hover,
.filter-btn.active {
  color: var(--green-forest);
  border-color: var(--green-leaf);
  background: var(--green-pale);
}

/* Tier-colored active states */
.filter-safe.active    { color: var(--safe-color); border-color: var(--safe-color); background: var(--safe-bg); }
.filter-caution.active { color: var(--caution-color); border-color: var(--caution-color); background: var(--caution-bg); }
.filter-limited.active { color: var(--limited-context-color); border-color: var(--limited-context-color); background: var(--limited-context-bg); }
.filter-avoid.active   { color: var(--avoid-color); border-color: var(--avoid-color); background: var(--avoid-bg); }

/* Foods page inline search */
.search-form--foods {
  margin-bottom: 1rem;
}

.search-form--foods input {
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

/* Hide cards that don't match filter/search */
.food-card.hidden { display: none; }

/* ==========================================================================
   FOOD DETAIL — Tabs + Bark panels
   ========================================================================== */
/* Detail header — above tabs */
.detail-header { margin-bottom: 1rem; }
.detail-header h1 { font-size: clamp(1.5rem, 4vw, 2rem); color: var(--text-primary); margin-bottom: 0.25rem; }
.detail-header .scientific { font-style: italic; color: var(--text-muted); font-size: 0.9rem; }
.detail-header .description {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 0.75rem;
  font-size: 1.02rem;
  font-style: italic;
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
}

/* Specimen photo — polaroid + washi tape field journal look */
/* ==========================================================================
   PHOTO-NAV — Specimen photo with stacked pages behind it
   ========================================================================== */
.photo-nav {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.photo-nav .back-arrow { margin-top: 50px; }

.photo-stack {
  position: relative;
  width: 200px;
  min-height: 210px;
  overflow: visible;
}

/* Each stacked page — positioned absolutely, layered */
.stack-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 180px;
  height: 180px;
  background: #fffdf8;
  border: 5px solid white;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  text-decoration: none;
  display: block;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.3s ease;
  cursor: pointer;
}

/* Tab label — rotated 90deg on left edge of back pages, horizontal on front */
.stack-page-tab {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--green-forest);
  white-space: nowrap;
}
.stack-page:not(.stack-page-front) .stack-page-tab {
  position: absolute;
  left: 0;
  top: 50%;
  transform: rotate(-90deg) translateX(-50%);
  transform-origin: top left;
  padding: 2px 6px;
  letter-spacing: 0.03em;
}
.stack-page-front .stack-page-tab {
  display: block;
  padding: 3px 10px;
  text-align: center;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stagger the pages behind — barely peeking out */
.stack-page:nth-child(1) { z-index: 1; transform: rotate(-3deg) translate(-4px, 4px); }
.stack-page:nth-child(2) { z-index: 2; transform: rotate(-1.5deg) translate(-1px, 2px); }
.stack-page:nth-child(3) { z-index: 3; transform: rotate(0.5deg) translate(2px, 0px); }
.stack-page-front { z-index: 4; transform: rotate(-2deg); }

/* On hover: pages slide out just enough to show their tabs */
.photo-stack:hover .stack-page:nth-child(1) {
  transform: rotate(-2deg) translate(-12px, -4px);
  box-shadow: 2px 3px 8px rgba(0,0,0,0.14);
}
.photo-stack:hover .stack-page:nth-child(2) {
  transform: rotate(-0.5deg) translate(18px, -6px);
  box-shadow: 2px 3px 8px rgba(0,0,0,0.14);
}
.photo-stack:hover .stack-page:nth-child(3) {
  transform: rotate(1deg) translate(44px, -3px);
  box-shadow: 2px 3px 8px rgba(0,0,0,0.14);
}
.photo-stack:hover .stack-page-front {
  transform: rotate(-2deg) translate(66px, 0px);
}

/* Individual page hover — subtle highlight, stays behind front */
.stack-page:hover:not(.stack-page-front) {
  box-shadow: 3px 5px 12px rgba(0,0,0,0.18) !important;
  filter: brightness(1.03);
}

/* Visuals inside back pages */
.stack-page-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100% - 24px);
  padding: 6px;
  overflow: hidden;
}
.stack-page-visual img {
  width: 80%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  opacity: 0.5;
  filter: grayscale(0.3);
}
.stack-page-visual .stack-icon {
  width: 60%;
  height: auto;
  color: var(--text-muted);
}

/* Foods page mini-grid */
.stack-visual-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 12px;
}
.stack-visual-grid span {
  aspect-ratio: 1;
  border-radius: 4px;
  opacity: 0.25;
}
.stack-visual-grid span:nth-child(1) { background: var(--safe-color); }
.stack-visual-grid span:nth-child(2) { background: var(--caution-color); }
.stack-visual-grid span:nth-child(3) { background: var(--safe-color); }
.stack-visual-grid span:nth-child(4) { background: var(--safe-color); }
.stack-visual-grid span:nth-child(5) { background: var(--avoid-color); }
.stack-visual-grid span:nth-child(6) { background: var(--caution-color); }

/* Specimen photo inside the front page */
.specimen-photo {
  padding: 4px;
}
.specimen-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

/* Washi tape on front page */
.stack-page-front::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -6px;
  width: 55px;
  height: 18px;
  background: rgba(160, 200, 160, 0.55);
  transform: rotate(-35deg);
  z-index: 5;
  border-radius: 1px;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  box-shadow: 0 0.5px 2px rgba(0,0,0,0.06);
}

/* Dark mode */
.dark-mode .stack-page {
  background: var(--surface-solid, #1a2a22);
  border-color: rgba(255,255,255,0.15);
}
.dark-mode .stack-page-front::before {
  background: rgba(140, 185, 140, 0.4);
}
.dark-mode .stack-page-tab { color: var(--green-leaf); }
.dark-mode .stack-page-front .stack-page-tab { color: var(--text-muted); }
.dark-mode .stack-page-visual img { opacity: 0.35; filter: grayscale(0.5); }

/* Leaf-shaped tabs — organic, nature-inspired */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 1.2rem 0;
  padding: 0.4rem 0;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar button {
  padding: 0.5rem 1.1rem;
  border: 2px solid var(--border);
  background: var(--surface-solid);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-muted);
  /* Leaf shape — asymmetric rounded corners */
  border-radius: 18px 4px 18px 4px;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
  position: relative;
}

.tab-bar button:hover {
  color: var(--green-forest);
  border-color: var(--green-pale);
  background: var(--green-pale);
  transform: translateY(-1px);
}

.tab-bar button.active {
  color: #fff;
  background: var(--green-forest);
  border-color: var(--green-forest);
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(45,90,39,0.3);
  transform: translateY(-2px);
  animation: tabPlop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shrink-then-plop animation */
@keyframes tabPlop {
  0%   { transform: translateY(-2px) scale(0.6); opacity: 0.4; background: var(--border-subtle); }
  50%  { transform: translateY(-4px) scale(1.08); opacity: 1; }
  100% { transform: translateY(-2px) scale(1); }
}

/* Deactivating tab shrinks away */
.tab-bar button.tab-leaving {
  animation: tabShrink 0.25s ease-in forwards;
}

@keyframes tabShrink {
  0%   { transform: translateY(-2px) scale(1); }
  100% { transform: translateY(0) scale(0.92); opacity: 0.6; }
}

.dark-mode .tab-bar button {
  border-color: var(--border);
  background: var(--surface-solid);
}

.dark-mode .tab-bar button:hover {
  background: rgba(107,191,89,0.12);
  border-color: var(--green-bright);
}

.dark-mode .tab-bar button.active {
  background: var(--green-forest);
  border-color: var(--green-bright);
  color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: panelReveal 0.3s ease; }

@keyframes panelReveal {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typewriter cursor while typing — paw print */
.tab-content.typewriter-active .bark-panel::after {
  content: '\1F43E';
  color: #ccaa7a;
  font-size: 0.75em;
  animation: cursorBlink 0.55s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Engraved bark panel */
.bark-panel {
  position: relative;
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  overflow: hidden;
  background:
    repeating-linear-gradient(177deg, transparent 0px, transparent 3px, rgba(0,0,0,0.05) 3px, rgba(0,0,0,0.05) 4px, transparent 4px, transparent 10px),
    repeating-linear-gradient(181deg, transparent 0px, transparent 15px, rgba(255,200,120,0.03) 15px, rgba(255,200,120,0.03) 16px, transparent 16px, transparent 35px),
    linear-gradient(165deg, #3e2a1a 0%, #4a3424 20%, #3b2816 45%, #4d3828 70%, #3e2a1a 100%);
  box-shadow:
    inset 0 4px 10px rgba(0,0,0,0.5),
    inset 0 -2px 4px rgba(255,200,120,0.05),
    inset 4px 0 10px rgba(0,0,0,0.35),
    inset -3px 0 6px rgba(255,200,120,0.03),
    0 2px 0 rgba(255,200,120,0.06),
    0 -2px 4px rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.15);
  border: 1px solid rgba(0,0,0,0.3);
  border-top-color: rgba(0,0,0,0.4);
  border-bottom-color: rgba(100,70,40,0.12);
}

/* Animal face watermark — branded into the wood */
.bark-panel::before {
  content: '';
  position: absolute;
  right: -2%;
  top: 50%;
  transform: translateY(-50%);
  width: 45%;
  height: 90%;
  background: var(--animal-watermark, none) no-repeat center center;
  background-size: contain;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  filter: invert(1);
}

.bark-panel h3, .bark-panel p, .bark-panel ul, .bark-panel table,
.bark-panel .engraved-label, .bark-panel strong { position: relative; z-index: 1; }

.bark-panel h3 {
  font-size: 1rem; margin: 1.8rem 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* Carved/woodburned into the bark — text nearly matches panel bg */
  color: #332214;
  text-shadow:
    /* Dark cut — shadow falls inside the carved groove (upper-left light source) */
    -1px -1px 1px rgba(0,0,0,0.7),
    -0.5px -0.5px 0px rgba(0,0,0,0.5),
    /* Light catch — bottom-right edge catches the light */
    1px 1px 1px rgba(255,220,160,0.3),
    0.5px 0.5px 0px rgba(255,200,140,0.15);
  font-weight: 700;
}
.bark-panel h3:first-child { margin-top: 0; }

/* Difficulty labels styled as sub-headers */
.bark-difficulty {
  display: block;
  color: #ddc090;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.5), 0 1px 0 rgba(255,200,120,0.12);
}

/* Play Ideas difficulty labels — carved into wood */
.play-difficulty {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #d4bc82;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.55), 0 1px 0 rgba(255,200,120,0.06);
}

.bark-panel p, .bark-panel ul, .bark-panel li {
  color: #ccaa7a; line-height: 1.8; font-size: 0.9rem;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4), 0 1px 0 rgba(255,200,120,0.04);
}
.bark-panel p { margin: 0.6rem 0; }
.bark-panel strong { color: #ddc090; }
.bark-panel ul { padding-left: 1.2rem; margin: 0.6rem 0; }
.bark-panel li { margin-bottom: 0.4rem; }
.bark-panel li::marker { color: #7a5a3a; }
.bark-panel a, .bark-link { color: #ddc090; text-decoration: none; }
.bark-panel a:hover, .bark-link:hover { color: #f0e0b8; text-decoration: underline; }

/* Nutrition table inside bark panel */
.nutrition-table { width: 100%; font-size: 0.9rem; color: #ccaa7a; }
.nutrition-table th { text-align: left; padding: 0.2rem 0.5rem; }

/* Engraved difficulty/label badges inside bark panels */
.bark-panel .engraved-label {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c9a868;
  background: rgba(0,0,0,0.3);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 1px 0 rgba(255,200,120,0.08);
  margin-right: 0.3rem;
}

/* Recipe meta chips */
.engraved-chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-card, rgba(0,0,0,0.06));
  border: 1px solid var(--border-subtle);
}
.dark-mode .engraved-chip {
  background: rgba(255,255,255,0.06);
  color: #bba87a;
  border-color: rgba(255,200,120,0.1);
}

/* Health score bars */
/* ── Nutrition Snapshot (recipe tab) ── */
.nutrition-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
}
.nutri-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bark-bg, #f5f0eb);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1rem 0.5rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nutri-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.nutri-calories {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--green-forest), #2d7a4a);
  color: #fff;
  border: none;
}
.nutri-calories .nutri-label { color: rgba(255,255,255,0.8); }
.nutri-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
.nutri-calories .nutri-value {
  font-size: 2rem;
  color: #fff;
}
.nutri-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.health-bars { margin-top: 0.5rem; }
.health-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.6rem;
}
.health-bar-label {
  min-width: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ccaa7a;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
  text-align: right;
}
.health-bar-track {
  flex: 1;
  height: 18px;
  background: rgba(0,0,0,0.35);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  position: relative;
}
.health-bar-fill {
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, #38b820, #5fda42, #7ef05a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 3px rgba(0,0,0,0.3), 0 0 6px rgba(95,218,66,0.3);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  min-width: 28px;
}
.health-bar-value {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* Color tiers for health bars */
.health-bar-fill[data-score^="9"],
.health-bar-fill[data-score="100"] { background: linear-gradient(90deg, #22c50e, #50ef35, #70ff55); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 8px rgba(80,239,53,0.4); }
.health-bar-fill[data-score^="7"],
.health-bar-fill[data-score^="8"] { background: linear-gradient(90deg, #38b820, #5fda42, #7ef05a); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 6px rgba(95,218,66,0.3); }
.health-bar-fill[data-score^="5"],
.health-bar-fill[data-score^="6"] { background: linear-gradient(90deg, #c4a820, #e8cc30, #f5e050); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 6px rgba(232,204,48,0.3); }
.health-bar-fill[data-score^="3"],
.health-bar-fill[data-score^="4"] { background: linear-gradient(90deg, #d48a20, #f0a830, #ffc050); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 6px rgba(240,168,48,0.3); }

/* Ingredient list inside bark panel */
/* ── Recipe Ingredient List (clean, scannable) ── */
.ingr-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.3rem;
}
.ingr-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.ingr-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.ingr-row:last-child { border-bottom: none; }
.ingr-optional { opacity: 0.7; }
.ingr-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--green-forest);
  margin-top: 0.4rem;
}
.ingr-optional .ingr-dot {
  background: transparent;
  border: 2px solid var(--text-muted);
}
.ingr-body { flex: 1; }
.ingr-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
}
.ingr-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-decoration: none;
}
a.ingr-name:hover { color: var(--green-forest); }
.ingr-qty {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}
.ingr-opt {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
}
.ingr-prep {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.ingr-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}
.ingr-chip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bark-bg, #f5f0eb);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
}

/* ==========================================================================
   RECIPE LIST — Cookbook journal (weathered paper, ribbons, taped cards)
   ========================================================================== */

/* ==========================================================================
   BOOK — 3D flippable book wrapper
   ========================================================================== */
.book-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 1400px;
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
}

.book {
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 85vh;
  min-height: 600px;
  max-height: 900px;
  perspective: 1800px;
  display: flex;
}

/* Static background pages (always visible behind leaves) */
.book-page--static {
  flex: 1;
  height: 100%;
}

/* Each leaf — the flippable unit with front + back */
.book-leaf {
  position: absolute;
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.8s ease-in-out;
  cursor: pointer;
}
.book-leaf--flipped {
  transform: rotateY(-180deg);
}
/* Cover flips slower for dramatic effect */
.book-leaf[data-leaf="0"] {
  transition: transform 1.3s ease-in-out;
}

/* Front and back faces */
.book-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.book-face--back {
  transform: rotateY(180deg);
}

/* Shadow during flip — grows at midpoint */
.book-leaf::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.4s ease;
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
}
.book-leaf--flipped::after {
  background: rgba(0,0,0,0);
}

/* Nav arrows */
.book-nav {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.book-nav:hover:not(:disabled) {
  background: var(--green-pale);
  border-color: var(--green-forest);
  color: var(--green-forest);
  transform: scale(1.1);
}
.book-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Scrollable page content — independent scroll per page */
.book-page-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,90,43,0.2) transparent;
}
.book-page-scroll::-webkit-scrollbar { width: 4px; }
.book-page-scroll::-webkit-scrollbar-thumb { background: rgba(139,90,43,0.25); border-radius: 2px; }

/* ==========================================================================
   COVER — terracotta & charcoal rustic design
   ========================================================================== */
.book-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem 1.8rem 2rem 3rem;
  border-radius: inherit;
  position: relative;
  overflow: hidden;
}

/* Back arrow on book cover */
.cover-back {
  position: absolute;
  top: 1rem;
  left: 3.2rem;
  z-index: 10;
}

/* Override overflow on the cookbook that holds the spine */
.cookbook-has-spine { overflow: visible; }

/* Book spine — binding strip flush with left edge of the cookbook */
.book-spine {
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 2.2rem;
  z-index: 5;
  /* Velvet texture — fine fabric weave + per-animal color via CSS vars */
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.015) 0px,
      transparent 1px,
      transparent 2px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,0.04) 0px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(180deg,
      var(--spine-dark, #5a1212) 0%,
      var(--spine-mid, #7e1c1c) 5%,
      var(--spine-light, #8b2222) 15%,
      var(--spine-mid, #7e1c1c) 30%,
      var(--spine-light, #8b2222) 50%,
      var(--spine-mid, #7e1c1c) 70%,
      var(--spine-light, #8b2222) 85%,
      var(--spine-mid, #7e1c1c) 95%,
      var(--spine-dark, #5a1212) 100%
    );
  border-radius: 10px 0 0 10px;
  /* Depth: crease on right (where spine meets page), shadow cast left */
  box-shadow:
    inset -4px 0 8px rgba(0,0,0,0.45),
    inset 0 3px 6px rgba(0,0,0,0.3),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    inset 3px 0 3px rgba(255,200,150,0.05),
    -4px 0 10px rgba(0,0,0,0.25),
    -2px 0 4px rgba(0,0,0,0.15);
}
/* Raised horizontal bands — gold accent lines */
.book-spine::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 5%;
  bottom: 5%;
  border-top: 2px solid rgba(210,170,90,0.22);
  border-bottom: 2px solid rgba(210,170,90,0.22);
  background:
    linear-gradient(180deg,
      transparent 45%,
      rgba(210,170,90,0.14) 47%,
      rgba(210,170,90,0.2) 50%,
      rgba(210,170,90,0.14) 53%,
      transparent 55%
    );
}
/* Vertical crease where spine meets parchment */
.book-spine::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(90deg,
    rgba(0,0,0,0.25),
    rgba(0,0,0,0.08)
  );
}
/* Right-side spine (back cover) — mirrored */
.book-spine--right {
  left: auto;
  right: -1px;
  border-radius: 0 6px 6px 0;
  box-shadow:
    inset 3px 0 8px rgba(0,0,0,0.45),
    inset 0 3px 6px rgba(0,0,0,0.3),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    inset -3px 0 3px rgba(255,200,150,0.05),
    4px 0 10px rgba(0,0,0,0.25),
    2px 0 4px rgba(0,0,0,0.15);
}
.book-spine--right::after {
  right: auto;
  left: -1px;
  background: linear-gradient(90deg, rgba(0,0,0,0.08), rgba(0,0,0,0.25));
}

.dark-mode .book-spine {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.01) 0px, transparent 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0px, transparent 1px, transparent 3px),
    linear-gradient(180deg,
      color-mix(in srgb, var(--spine-dark, #5a1212) 70%, black) 0%,
      color-mix(in srgb, var(--spine-mid, #7e1c1c) 70%, black) 5%,
      color-mix(in srgb, var(--spine-light, #8b2222) 70%, black) 15%,
      color-mix(in srgb, var(--spine-mid, #7e1c1c) 70%, black) 30%,
      color-mix(in srgb, var(--spine-light, #8b2222) 70%, black) 50%,
      color-mix(in srgb, var(--spine-mid, #7e1c1c) 70%, black) 70%,
      color-mix(in srgb, var(--spine-light, #8b2222) 70%, black) 85%,
      color-mix(in srgb, var(--spine-mid, #7e1c1c) 70%, black) 95%,
      color-mix(in srgb, var(--spine-dark, #5a1212) 70%, black) 100%
    );
}

/* Decorative inner border frame — shifted right to clear spine */
.book-cover::before {
  content: '';
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  left: 6px;
  border: 2px solid rgba(139,90,43,0.2);
  border-radius: 4px;
  pointer-events: none;
}
.book-cover::after {
  content: '';
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  left: 10px;
  border: 1px solid rgba(139,90,43,0.1);
  border-radius: 3px;
  pointer-events: none;
}
.dark-mode .book-cover::before { border-color: rgba(200,160,80,0.15); }
.dark-mode .book-cover::after { border-color: rgba(200,160,80,0.08); }

/* Small scattered paw prints */
.cover-paws {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.cover-paws span {
  position: absolute;
  font-size: 0.9rem;
  opacity: 0.07;
  color: #5a3a1a;
}
.dark-mode .cover-paws span { color: #c4a060; opacity: 0.06; }

/* Animal image frame — slightly broken circle */
.cover-frame {
  position: relative;
  width: 130px;
  height: 130px;
  border-radius: 50% 48% 52% 46%;
  overflow: visible;
  margin-bottom: 1.2rem;
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  border: 3px solid rgba(60,30,10,0.3);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  /* Image peeks slightly over the frame */
  transform: scale(1.08) translateY(-4px);
}
/* Video profile — same styling as cover-img, no controls */
video.cover-img { display: block; background: transparent; }

/* Ornamental divider */
.cover-ornament {
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,90,43,0.3), transparent);
  margin: 0.8rem 0;
  position: relative;
}
.cover-ornament::before {
  content: '\2766'; /* floral heart */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.9rem;
  color: rgba(139,90,43,0.35);
  background: inherit;
  padding: 0 6px;
}
.dark-mode .cover-ornament { background: linear-gradient(90deg, transparent, rgba(200,160,80,0.2), transparent); }
.dark-mode .cover-ornament::before { color: rgba(200,160,80,0.25); }

/* Title — bold, large */
.cover-title {
  font-family: 'Caveat', cursive;
  font-size: 2.1rem;
  font-weight: 700;
  color: #2c1a0a;
  margin: 0;
  line-height: 1.15;
  text-shadow: 1px 1px 0 rgba(255,200,140,0.3);
  position: relative;
  z-index: 1;
}
.dark-mode .cover-title { color: #f0d8b0; text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }

.cover-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #4a2a10;
  margin: 0.3rem 0 0;
  opacity: 0.85;
  line-height: 1.4;
  max-width: 85%;
  position: relative;
  z-index: 1;
}
.dark-mode .cover-subtitle { color: #c4a070; }

.cover-signature {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: #5a3010;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
  padding: 0.2rem 0.8rem;
  border-top: 1px solid rgba(120,80,30,0.18);
  border-bottom: 1px solid rgba(120,80,30,0.18);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.dark-mode .cover-signature { color: #d4b080; border-color: rgba(200,160,80,0.18); }

/* Recipe count badge */
.cover-badge {
  margin-top: 0.8rem;
  padding: 0.5rem 1.2rem;
  border: 2px solid rgba(60,30,10,0.2);
  border-radius: 4px;
  font-family: 'Caveat', cursive;
  font-size: 0.8rem;
  color: #3a1e08;
  line-height: 1.4;
  background: rgba(255,240,200,0.15);
  transform: rotate(-2deg);
  position: relative;
  z-index: 1;
}
.cover-badge-num {
  font-size: 2rem;
  font-weight: 700;
  display: block;
  line-height: 1;
  color: #2c1a0a;
}
.dark-mode .cover-badge { border-color: rgba(200,160,80,0.15); color: #d4b080; background: rgba(0,0,0,0.1); }
.dark-mode .cover-badge-num { color: #f0d8b0; }

/* Branding at bottom */
.cover-branding {
  position: absolute;
  bottom: 22px;
  font-family: 'Caveat', cursive;
  font-size: 0.75rem;
  color: rgba(90,60,30,0.35);
  letter-spacing: 0.1em;
}
.dark-mode .cover-branding { color: rgba(200,160,80,0.2); }

/* ==========================================================================
   BACK COVER — blurb page
   ========================================================================== */
.book-back-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 3rem 2.5rem;
  position: relative;
  /* Darker, richer parchment */
  background:
    linear-gradient(180deg,
      rgba(120,80,30,0.06) 0%,
      rgba(120,80,30,0.02) 30%,
      rgba(120,80,30,0.04) 70%,
      rgba(120,80,30,0.08) 100%
    );
}
.back-cover-ornament {
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,90,43,0.3), transparent);
  margin: 1.2rem 0;
}
.back-cover-ornament::before {
  content: '\2767';
  display: block;
  text-align: center;
  margin-top: -0.55em;
  font-size: 0.85rem;
  color: rgba(139,90,43,0.3);
}
.dark-mode .back-cover-ornament { background: linear-gradient(90deg, transparent, rgba(200,160,80,0.2), transparent); }
.dark-mode .back-cover-ornament::before { color: rgba(200,160,80,0.2); }

.back-cover-blurb { max-width: 85%; }
.back-cover-tagline {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: #2c1a0a;
  line-height: 1.3;
  margin: 0 0 1rem;
  text-shadow: 1px 1px 0 rgba(255,200,140,0.3);
}
.dark-mode .back-cover-tagline { color: #f0d8b0; text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }

.back-cover-desc {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #5a3a18;
  line-height: 1.5;
  margin: 0;
  opacity: 0.85;
}
.dark-mode .back-cover-desc { color: #c4a070; }

.back-cover-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.back-cover-logo {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: #3a2010;
  text-shadow: 1px 1px 0 rgba(255,200,140,0.2);
}
.dark-mode .back-cover-logo { color: #ddc090; }
.back-cover-url {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: rgba(90,60,30,0.4);
  text-transform: lowercase;
}
.dark-mode .back-cover-url { color: rgba(200,160,80,0.25); }

/* ==========================================================================
   TABLE OF CONTENTS
   ========================================================================== */
.toc-heading {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: #3a2810;
  margin: 1rem 0 1rem;
  text-align: center;
  border-bottom: 2px solid rgba(139,90,43,0.2);
  padding-bottom: 0.5rem;
}
.dark-mode .toc-heading { color: #d4bc88; border-bottom-color: rgba(200,160,80,0.15); }

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}
.toc-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.5rem 0.3rem;
  border-bottom: 1px dotted rgba(139,90,43,0.12);
  cursor: pointer;
  transition: background 0.15s ease;
  counter-increment: toc;
}
.toc-item:hover { background: rgba(139,90,43,0.06); }
.toc-item::before {
  content: counter(toc) ".";
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 0.9rem;
  color: #8a6a40;
  min-width: 22px;
}
.dark-mode .toc-item { border-bottom-color: rgba(200,160,80,0.08); }
.dark-mode .toc-item:hover { background: rgba(200,160,80,0.04); }
.dark-mode .toc-item::before { color: #a08050; }

.toc-name {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  font-weight: 600;
  color: #3a2810;
}
.dark-mode .toc-name { color: #d4bc88; }

.toc-dots {
  flex: 1;
  border-bottom: 1px dotted rgba(139,90,43,0.2);
  min-width: 20px;
  align-self: flex-end;
  margin-bottom: 4px;
}
.dark-mode .toc-dots { border-bottom-color: rgba(200,160,80,0.1); }

.toc-diff {
  font-family: 'Caveat', cursive;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.toc-diff--easy { color: #2d6a1e; }
.toc-diff--medium { color: #8a6a10; }
.toc-diff--hard { color: #9b2335; }
.dark-mode .toc-diff--easy { color: #5fda42; }
.dark-mode .toc-diff--medium { color: #d4a020; }
.dark-mode .toc-diff--hard { color: #e85a6e; }

/* ==========================================================================
   BOOK — Cover-mode (single centered page before first flip)
   The cover leaf (data-leaf="0") is normally at right:0, width:50%.
   In cover mode we use translateX to shift it to the center of the book.
   The shift = -50% of its own width = centers it in the full-width book.
   ========================================================================== */
.book--cover-mode .book-page--static {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.5s, opacity 0.5s ease;
}
/* Shift the cover leaf to center: it's width:50% positioned at right:0.
   translateX(-50%) moves it left by half its own width, centering it. */
.book--cover-mode .book-leaf[data-leaf="0"] {
  transform: translateX(-50%);
  transition: transform 0.5s ease;
}
/* Hide other leaves — they sit behind and won't be visible anyway */
.book--cover-mode .book-leaf:not([data-leaf="0"]) {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.5s, opacity 0.5s ease;
}
/* The cover page gets rounded corners on both sides (standalone book) */
.book--cover-mode .book-leaf[data-leaf="0"] .cookbook-page--right {
  border-radius: 10px;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.25),
    inset 0 0 60px rgba(120,80,30,0.15);
  transition: border-radius 0.4s ease, box-shadow 0.4s ease;
}
/* Hide spine gutter shadow on left side (no adjacent page in cover mode) */
.book--cover-mode .book-leaf[data-leaf="0"] .cookbook-page--right::before {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* --- Transition: cover-mode → spread (book--cover-opening) --- */
.book--cover-opening .book-page--static {
  visibility: visible;
  opacity: 0;
  animation: fadeInStatic 0.5s ease both;
}
@keyframes fadeInStatic {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.book--cover-opening .book-leaf:not([data-leaf="0"]) {
  visibility: visible;
  opacity: 0;
  animation: fadeInStatic 0.4s ease 0.1s both;
}
.book--cover-opening .book-leaf[data-leaf="0"] {
  transform: translateX(0) rotateY(-180deg);
  transition: transform 0.5s ease;
}
.book--cover-opening .book-leaf[data-leaf="0"] .cookbook-page--right::before {
  opacity: 1;
  transition: opacity 0.3s ease 0.2s;
}
.book--cover-opening .book-leaf[data-leaf="0"] .cookbook-page--right {
  border-radius: 2px 10px 10px 2px;
  transition: border-radius 0.4s ease, box-shadow 0.4s ease;
}

/* When the cover is flipped (rotateY(-180deg)), the transform set by
   cover-opening should not interfere. The leaf's normal transition handles it. */

/* --- Back cover mode: single centered page (mirrored cover mode) --- */
.book--back-cover-mode .book-page--static {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.5s, opacity 0.5s ease;
}
.book--back-cover-mode .book-leaf {
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s 0.5s, opacity 0.5s ease;
}
.book--back-cover-mode .book-leaf.book-leaf--back-cover {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%);
  transition: transform 0.5s ease, opacity 0.3s ease;
}
.book--back-cover-mode .book-leaf.book-leaf--back-cover .cookbook-page--right {
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25), inset 0 0 60px rgba(120,80,30,0.15);
  padding-right: 3rem;
}

/* Page indicator + mobile track: hidden on desktop */
.book-page-indicator { display: none; }
.book-mobile-track { display: none; }

/* Tablet: stack vertically */
@media (max-width: 1024px) {
  .book-wrapper { flex-direction: column; padding: 0 0.5rem; }
  .book { perspective: 1200px; min-height: 60vh; max-width: 700px; }
  .book-nav { display: none; }
}

/* ==========================================================================
   MOBILE BOOK — Single page at a time with swipe (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .book-wrapper {
    flex-direction: column;
    padding: 0;
    gap: 0.5rem;
    margin: 0.5rem auto 1rem;
  }
  .book-nav { display: none; }

  .book {
    perspective: none;
    display: block;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    height: 82vh;
    min-height: 480px;
    max-height: none;
    position: relative;
  }

  /* Hide static background pages on mobile */
  .book .book-page--static { display: none; }

  /* Mobile page container — horizontal sliding track */
  .book-mobile-track {
    display: flex;
    transition: transform 0.35s ease;
    will-change: transform;
    height: 100%;
  }

  /* Each mobile page is a full-width slide */
  .book-mobile-page {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }

  /* Override leaf positioning for mobile flat layout */
  .book .book-leaf {
    position: static;
    width: 100%;
    transform: none !important;
    transform-style: flat;
    display: none; /* hidden — content extracted into mobile pages */
  }
  .book .book-leaf .book-face {
    position: static;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    transform: none;
  }
  .book .book-leaf .book-face--back {
    transform: none;
  }
  .book .book-leaf::after { display: none; }

  /* Cover mode not needed on mobile (always single page) */
  .book--cover-mode .book-page--static,
  .book--cover-mode .book-leaf:not([data-leaf="0"]) {
    display: none;
  }
  .book--cover-mode .book-leaf[data-leaf="0"] {
    position: static;
    width: 100%;
  }

  /* Page indicator */
  .book-page-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0 0.3rem;
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: #6a4a2a;
  }
  .dark-mode .book-page-indicator { color: #b09060; }

  .book-page-dots {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .book-page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(139,90,43,0.2);
    transition: all 0.25s ease;
  }
  .dark-mode .book-page-dot { background: rgba(200,160,80,0.15); }
  .book-page-dot--active {
    background: rgba(139,90,43,0.6);
    transform: scale(1.3);
  }
  .dark-mode .book-page-dot--active { background: rgba(200,160,80,0.5); }

  /* Page number text fallback (when too many pages for dots) */
  .book-page-text {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: #6a4a2a;
  }
  .dark-mode .book-page-text { color: #b09060; }

  /* Cookbook pages on mobile: full border-radius, no spine gutter */
  .book-mobile-page .cookbook {
    border-radius: 8px;
    min-height: 0;
    height: 100%;
  }
  /* Cover page needs full height to show all content */
  .book-mobile-page:first-child .cookbook {
    min-height: 90vh;
  }
  .book-mobile-page .cookbook-page--left::before,
  .book-mobile-page .cookbook-page--right::before {
    display: none;
  }
  .book-mobile-page .cookbook-page--left,
  .book-mobile-page .cookbook-page--right {
    border-radius: 8px;
  }
}

/* Mobile small: further adjustments */
@media (max-width: 640px) {
  .book { min-height: 400px; }
  .book { height: 78vh; }
  .book-mobile-page .cookbook { min-height: 0; }
}

/* Individual book page (used inside both static pages and leaf faces) */
.cookbook {
  position: relative;
  height: 100%;
  padding: 2rem 2rem 2rem 2rem;
  /* Weathered parchment */
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(139,90,43,0.06) 28px,
      rgba(139,90,43,0.06) 29px
    ),
    linear-gradient(135deg,
      #f5e6c8 0%, #e8d5a8 15%, #f0dbb0 30%, #dcc89a 50%,
      #e8d0a0 65%, #f2dfb5 80%, #e0c890 100%
    );
  box-shadow:
    inset 0 0 60px rgba(120,80,30,0.15),
    inset 0 0 15px rgba(0,0,0,0.05),
    4px 4px 20px rgba(0,0,0,0.2),
    -2px 0 8px rgba(0,0,0,0.08);
  /* Rough paper edge */
  border: 1px solid #c4a870;
  overflow: hidden;
}
.dark-mode .cookbook {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(200,160,80,0.04) 28px,
      rgba(200,160,80,0.04) 29px
    ),
    linear-gradient(135deg,
      #3a2e1e 0%, #2e2418 15%, #352a1c 30%, #2a2016 50%,
      #332818 65%, #3a2e20 80%, #2c2214 100%
    );
  border-color: #4a3a28;
  border-right-color: #5a4a38;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.3),
    4px 4px 20px rgba(0,0,0,0.4);
}

/* Left page — spine gutter on right */
.cookbook-page--left {
  border-radius: 10px 2px 2px 10px;
}
.cookbook-page--left::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 25px;
  background: linear-gradient(to left, rgba(0,0,0,0.15), rgba(0,0,0,0.03) 60%, transparent);
  pointer-events: none;
  z-index: 3;
}
.dark-mode .cookbook-page--left::before {
  background: linear-gradient(to left, rgba(0,0,0,0.3), rgba(0,0,0,0.06) 60%, transparent);
}

/* Right page — spine gutter on left */
.cookbook-page--right {
  border-radius: 2px 10px 10px 2px;
}
.cookbook-page--right::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 25px;
  background: linear-gradient(to right, rgba(0,0,0,0.15), rgba(0,0,0,0.03) 60%, transparent);
  pointer-events: none;
  z-index: 3;
}
.dark-mode .cookbook-page--right::before {
  background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0.06) 60%, transparent);
}

/* Ink splatters — random decorative blobs */
.ink-splatter {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50% 40% 55% 45%;
  background: radial-gradient(ellipse, rgba(30,20,10,0.2) 0%, rgba(30,20,10,0.08) 60%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}
.ink-splat-1 { width: 25px; height: 18px; }
.ink-splat-2 { width: 12px; height: 14px; }
.ink-splat-3 { width: 30px; height: 22px; border-radius: 45% 55% 40% 60%; }
.dark-mode .ink-splatter {
  background: radial-gradient(ellipse, rgba(200,160,80,0.1) 0%, rgba(200,160,80,0.03) 60%, transparent 80%);
}

/* ==========================================================================
   SILK RIBBON BOOKMARKS — hanging inline below header
   ========================================================================== */
.ribbon-bookmarks {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  position: relative;
  z-index: 10;
}

.ribbon {
  position: relative;
  width: 40px;
  padding: 8px 0 16px;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f5ead4;
  background: var(--ribbon-color, #8b4513);
  border: none;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border-radius: 0 0 3px 3px;
  box-shadow:
    2px 3px 8px rgba(0,0,0,0.25),
    inset 0 0 8px rgba(255,255,255,0.08);
  transition: padding-bottom 0.3s ease, box-shadow 0.2s ease;
  /* Silk sheen */
  background-image: linear-gradient(
    180deg,
    rgba(255,255,255,0.15) 0%,
    transparent 30%,
    rgba(255,255,255,0.06) 50%,
    transparent 70%,
    rgba(0,0,0,0.1) 100%
  );
  /* V-notch cut at bottom */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), 50% 100%, 0 calc(100% - 10px));
}
.ribbon:hover {
  padding-bottom: 24px;
  box-shadow: 2px 5px 12px rgba(0,0,0,0.35);
}
.ribbon.active {
  padding-bottom: 30px;
  box-shadow:
    2px 5px 14px rgba(0,0,0,0.35),
    inset 0 0 12px rgba(255,255,255,0.15);
}

/* ==========================================================================
   COOKBOOK HEADER
   ========================================================================== */
.cookbook-header {
  position: relative;
  z-index: 2;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(139,90,43,0.2);
}
.cookbook-title {
  font-family: 'Caveat', cursive;
  font-size: 2.2rem;
  font-weight: 700;
  color: #4a3520;
  margin: 0;
  line-height: 1.2;
  text-shadow: 1px 1px 0 rgba(255,240,200,0.4);
}
.dark-mode .cookbook-title {
  color: #d4b880;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}
.cookbook-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #8a6a40;
  margin: 0.2rem 0 0;
  font-style: italic;
}
.dark-mode .cookbook-subtitle { color: #a08050; }

/* Override page-nav colors for paper background */
.cookbook .page-nav .page-leaf,
.cookbook .page-nav .back-arrow { color: #6a4a2a; }
.dark-mode .cookbook .page-nav .page-leaf,
.dark-mode .cookbook .page-nav .back-arrow { color: #b09060; }

/* ==========================================================================
   COOKBOOK CARD GRID
   ========================================================================== */
.cookbook-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  position: relative;
  z-index: 2;
}

/* ==========================================================================
   COOKBOOK CARD — taped note on paper
   ========================================================================== */
.cookbook-card {
  position: relative;
  cursor: pointer;
  animation: cardSlideIn 0.4s ease both;
  transition: transform 0.2s ease;
  /* Scrapbook imperfection — random tilt set by JS on load */
  --card-tilt: 0deg;
}

.cookbook-card:hover {
  transform: scale(1.02) rotate(calc(var(--card-tilt) - 0.3deg));
}
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(15px) rotate(calc(var(--card-tilt) + 2deg)); }
  to   { opacity: 1; transform: rotate(var(--card-tilt)); }
}

.cookbook-card--hidden { display: none !important; }

.cookbook-card-inner {
  background:
    linear-gradient(135deg,
      rgba(255,252,240,0.9) 0%,
      rgba(248,240,220,0.95) 50%,
      rgba(255,248,230,0.9) 100%
    );
  border: 1px solid rgba(139,90,43,0.2);
  border-radius: 3px;
  padding: 1.1rem 1.2rem 0.9rem;
  box-shadow:
    1px 2px 8px rgba(0,0,0,0.12),
    inset 0 0 20px rgba(139,90,43,0.04);
  position: relative;
  z-index: 1;
}
.dark-mode .cookbook-card-inner {
  background:
    linear-gradient(135deg,
      rgba(60,48,32,0.95) 0%,
      rgba(50,40,28,0.98) 50%,
      rgba(55,44,30,0.95) 100%
    );
  border-color: rgba(200,160,80,0.15);
  box-shadow:
    1px 2px 8px rgba(0,0,0,0.3),
    inset 0 0 20px rgba(200,160,80,0.03);
}

/* Tape strips on corners */
.tape {
  position: absolute;
  width: 42px;
  height: 16px;
  background: rgba(200,180,140,0.55);
  border: 1px solid rgba(180,150,100,0.15);
  z-index: 3;
  pointer-events: none;
  /* Frosted tape look */
  backdrop-filter: blur(1px);
}
.tape-tl { top: -8px; left: -14px; transform: rotate(-35deg); }
.tape-tr { top: -8px; right: -14px; transform: rotate(30deg); }
.tape-bl { bottom: -8px; left: -14px; transform: rotate(25deg); }
.tape-br { bottom: -8px; right: -14px; transform: rotate(-32deg); }
.dark-mode .tape {
  background: rgba(120,100,60,0.4);
  border-color: rgba(200,160,80,0.1);
}

/* Card content — fountain pen style */
.cookbook-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
  gap: 0.5rem;
}
.cookbook-card-name {
  font-family: 'Caveat', cursive;
  font-size: 1.25rem;
  font-weight: 700;
  color: #2c1e0a;
  opacity: 0.9;
  margin: 0;
  line-height: 1.25;
}
.dark-mode .cookbook-card-name { color: #d4bc88; opacity: 0.92; }

/* Difficulty badge — handwritten circle */
.cookbook-diff {
  flex-shrink: 0;
  font-family: 'Caveat', cursive;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: 50% 45% 55% 40%;
  border: 1.5px solid;
  white-space: nowrap;
}
.cookbook-diff--easy {
  color: #2d6a1e;
  border-color: #2d6a1e;
  background: rgba(45,106,30,0.08);
}
.cookbook-diff--medium {
  color: #8a6a10;
  border-color: #b8860b;
  background: rgba(184,134,11,0.08);
}
.cookbook-diff--hard {
  color: #9b2335;
  border-color: #9b2335;
  background: rgba(155,35,53,0.08);
}
.dark-mode .cookbook-diff--easy  { color: #5fda42; border-color: #5fda42; background: rgba(95,218,66,0.1); }
.dark-mode .cookbook-diff--medium { color: #d4a020; border-color: #d4a020; background: rgba(212,160,32,0.1); }
.dark-mode .cookbook-diff--hard  { color: #e85a6e; border-color: #e85a6e; background: rgba(232,90,110,0.1); }

.cookbook-card-desc {
  font-size: 0.82rem;
  color: #3a3020;
  opacity: 0.85;
  margin: 0 0 0.5rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dark-mode .cookbook-card-desc { color: #a89060; }

.cookbook-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.cookbook-detail {
  font-family: 'Caveat', cursive;
  font-size: 0.82rem;
  color: #7a5a30;
  padding: 0.1rem 0.4rem;
  border-bottom: 1px dashed rgba(139,90,43,0.25);
}
.dark-mode .cookbook-detail {
  color: #a08050;
  border-bottom-color: rgba(200,160,80,0.15);
}

/* Score bar */
.cookbook-card-score {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.cookbook-score-cat {
  font-family: 'Caveat', cursive;
  font-size: 0.78rem;
  color: #6a5030;
  min-width: 60px;
}
.dark-mode .cookbook-score-cat { color: #a08050; }
.cookbook-score-bar {
  flex: 1;
  height: 5px;
  background: rgba(139,90,43,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.dark-mode .cookbook-score-bar { background: rgba(200,160,80,0.1); }
.cookbook-score-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #6a8a40, #8ab050);
}
.cookbook-score-val {
  font-family: 'Caveat', cursive;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4a3a20;
  min-width: 20px;
  text-align: right;
}
.dark-mode .cookbook-score-val { color: #c4a060; }

.cookbook-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px dotted rgba(139,90,43,0.15);
}
.cookbook-icon { font-size: 1.2rem; }
.cookbook-tap {
  font-family: 'Caveat', cursive;
  font-size: 0.75rem;
  color: #9a7a50;
  font-style: italic;
}
.dark-mode .cookbook-tap { color: #8a6a40; }
.dark-mode .cookbook-card-footer { border-top-color: rgba(200,160,80,0.1); }

/* Empty state */
.cookbook-empty {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: #8a6a40;
  text-align: center;
  grid-column: 1 / -1;
  padding: 2rem;
}

/* ==========================================================================
   COOKBOOK PAGINATION — page flip
   ========================================================================== */
.cookbook-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 2px solid rgba(139,90,43,0.15);
  position: relative;
  z-index: 2;
}
.cookbook-page-num {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #6a4a2a;
}
.dark-mode .cookbook-page-num { color: #b09060; }
.cookbook-page-btn {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  font-weight: 600;
  color: #5a3a1a;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border: 1px dashed rgba(139,90,43,0.3);
  border-radius: 3px;
  background: rgba(255,240,200,0.3);
  transition: all 0.2s ease;
}
.cookbook-page-btn:hover {
  background: rgba(139,90,43,0.1);
  border-style: solid;
  transform: translateY(-1px);
}
.dark-mode .cookbook-page-btn {
  color: #c4a060;
  border-color: rgba(200,160,80,0.2);
  background: rgba(200,160,80,0.06);
}

/* (Arrival animation handled in CF_script.js) */

/* Mobile */
@media (max-width: 640px) {
  .cookbook { padding: 1.5rem 1rem 1.5rem; }
  .cookbook-title { font-size: 1.7rem; }
  .cookbook-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .ribbon { width: 30px; font-size: 0.65rem; }
}
@media (max-width: 480px) {
  .ribbon-bookmarks { gap: 0.3rem; justify-content: center; flex-wrap: wrap; }
  .ribbon { writing-mode: horizontal-tb; width: auto; padding: 0.3rem 0.7rem; clip-path: none; border-radius: 4px; }
  .ribbon.active { padding-bottom: 0.3rem; }
}

/* ==========================================================================
   RECIPE — Difficulty badge colors
   ========================================================================== */
.recipe-difficulty {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.recipe-difficulty--easy {
  background: rgba(16,185,129,0.15);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.25);
}
.recipe-difficulty--medium {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.25);
}
.recipe-difficulty--hard {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
}
/* Difficulty inside bark panels / dark contexts */
.bark-panel .recipe-difficulty--easy,
.dark-mode .recipe-difficulty--easy {
  background: rgba(16,185,129,0.2);
  color: #34d399;
}
.bark-panel .recipe-difficulty--medium,
.dark-mode .recipe-difficulty--medium {
  background: rgba(245,158,11,0.2);
  color: #fbbf24;
}
.bark-panel .recipe-difficulty--hard,
.dark-mode .recipe-difficulty--hard {
  background: rgba(239,68,68,0.2);
  color: #f87171;
}
/* Difficulty on engraved-chip */
.engraved-chip.recipe-difficulty--easy { background: rgba(16,185,129,0.15); color: #10b981; border-color: rgba(16,185,129,0.25); }
.engraved-chip.recipe-difficulty--medium { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.engraved-chip.recipe-difficulty--hard { background: rgba(239,68,68,0.15); color: #ef4444; border-color: rgba(239,68,68,0.25); }
.dark-mode .engraved-chip.recipe-difficulty--easy { background: rgba(16,185,129,0.2); color: #34d399; border-color: rgba(16,185,129,0.3); }
.dark-mode .engraved-chip.recipe-difficulty--medium { background: rgba(245,158,11,0.2); color: #fbbf24; border-color: rgba(245,158,11,0.3); }
.dark-mode .engraved-chip.recipe-difficulty--hard { background: rgba(239,68,68,0.2); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Old ingredient expand/collapse removed — now card-based layout */

/* ==========================================================================
   RECIPE — Paw bullet paragraphs (Safety, Tips tabs)
   ========================================================================== */
.bark-paw-bullets p {
  position: relative;
  padding-left: 1.3rem;
  margin-bottom: 0.6rem;
}
.bark-paw-bullets p::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25em;
  width: 0.7rem;
  height: 0.7rem;
  background: currentColor;
  -webkit-mask: var(--foot-icon) no-repeat center / contain;
  mask: var(--foot-icon) no-repeat center / contain;
  opacity: 0.45;
}

/* ==========================================================================
   RECIPE — Preparation steps (numbered, shadowed)
   ========================================================================== */
.prep-step {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
  padding: 0.7rem 0.8rem;
  background: rgba(0,0,0,0.12);
  border-radius: 0.5rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,200,120,0.05);
  border: 1px solid rgba(255,200,120,0.06);
}
.prep-step-num {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,200,120,0.18), rgba(255,200,120,0.08));
  border: 1px solid rgba(255,200,120,0.15);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ddc090;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  margin-top: 0.15rem;
}
.prep-step p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #ccaa7a;
}

/* ==========================================================================
   RECIPE — Health bar overall row
   ========================================================================== */
.health-overall-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255,200,120,0.1);
}
.health-overall-label {
  min-width: 100px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ddc090;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
  text-align: right;
}
.health-bar-overall-track {
  height: 24px;
  border-radius: 12px;
}
.health-bar-overall {
  height: 100%;
  border-radius: 12px;
}
.health-bar-overall .health-bar-value {
  font-size: 0.8rem;
}

/* ==========================================================================
   RECIPE — Compatibility section
   ========================================================================== */
.compat-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.compat-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,200,120,0.08);
}
.compat-item:last-child { border-bottom: none; }
.compat-animal {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 120px;
  text-decoration: none;
}
.compat-animal:hover .compat-name {
  color: #f0e0b8;
}
.compat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,200,120,0.15);
}
.compat-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #ddc090;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
}
.compat-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.compat-direct {
  background: rgba(16,185,129,0.2);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}
.compat-adjust {
  background: rgba(245,158,11,0.2);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
}
.compat-caution {
  background: rgba(239,68,68,0.2);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.compat-snack_only {
  background: rgba(139,92,246,0.2);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
}
.compat-moderate {
  background: rgba(59,130,246,0.2);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.3);
}
.compat-notes {
  width: 100%;
  font-size: 0.82rem;
  color: #b89860;
  margin: 0.2rem 0 0;
  line-height: 1.5;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
}
.compat-link {
  font-size: 0.82rem;
}

/* Breadcrumb */
/* ==========================================================================
   PAGE-NAV — Stacked page tabs + cartoonish back arrow
   ========================================================================== */
.page-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: nowrap;
}

/* Cartoonish back arrow — left side */
.back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-solid, #fffdf8);
  border: 2.5px solid var(--green-forest);
  color: var(--green-forest);
  text-decoration: none;
  box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s;
  flex-shrink: 0;
}
.back-arrow:hover {
  transform: scale(1.15) translateX(-3px);
  background: var(--safe-bg, #d4edcf);
  box-shadow: 3px 4px 0 rgba(0,0,0,0.15);
}
.back-arrow:active {
  transform: scale(0.95);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}
.back-arrow svg { width: 20px; height: 20px; }

/* Page stack — always visible, overlapping tabs */
.page-stack {
  display: flex;
  align-items: stretch;
  position: relative;
}

/* Each page leaf — overlapping stacked look */
.page-leaf {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px 5px 18px;
  font-size: 0.78rem;
  color: var(--green-forest);
  text-decoration: none;
  background: var(--surface-solid, #fffdf8);
  border: 1px solid rgba(0,0,0,0.1);
  border-right: none;
  margin-right: -6px;
  position: relative;
  box-shadow: 2px 1px 3px rgba(0,0,0,0.06);
  transition: background 0.2s, transform 0.15s ease, z-index 0s;
  cursor: pointer;
}
/* Stacked depth — each page sits behind the next */
.page-leaf:nth-child(1) { z-index: 4; border-radius: 6px 0 0 6px; padding-left: 12px; }
.page-leaf:nth-child(2) { z-index: 3; }
.page-leaf:nth-child(3) { z-index: 2; }
.page-leaf:nth-child(4) { z-index: 1; border-radius: 0 6px 6px 0; border-right: 1px solid rgba(0,0,0,0.1); margin-right: 0; }
/* When only 3 pages, last child gets the end cap */
.page-leaf:last-child { border-radius: 0 6px 6px 0; border-right: 1px solid rgba(0,0,0,0.1); margin-right: 0; }
.page-leaf:first-child { border-radius: 6px 0 0 6px; padding-left: 12px; }

/* Hover: page lifts slightly */
a.page-leaf:hover {
  background: var(--safe-bg, #d4edcf);
  transform: translateY(-2px);
  z-index: 10;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.1);
  text-decoration: none;
}

/* Current page — muted, not clickable */
.page-leaf.page-current {
  color: var(--text-muted);
  font-weight: 600;
  cursor: default;
  background: rgba(0,0,0,0.03);
}

/* Subtle separator between pages */
.page-leaf + .page-leaf::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(0,0,0,0.1);
}

/* Dark mode */
.dark-mode .page-leaf {
  background: var(--surface-solid, #1a2a22);
  border-color: rgba(255,255,255,0.1);
}
.dark-mode .page-leaf.page-current { background: rgba(255,255,255,0.04); }
.dark-mode a.page-leaf:hover { background: rgba(107,191,89,0.15); }
.dark-mode .back-arrow {
  background: var(--surface-solid, #1a2a22);
  border-color: var(--green-leaf);
  color: var(--green-leaf);
}

/* ==========================================================================
   BLOG — Coming soon preview cards
   ========================================================================== */
.coming-soon-msg {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.blog-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 560px) {
  .blog-preview-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 840px) {
  .blog-preview-grid { grid-template-columns: repeat(3, 1fr); }
}

.blog-card {
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.blog-card--placeholder {
  opacity: 0.7;
  border-style: dashed;
}

.blog-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.blog-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

/* Indented image placeholder — looks like an empty picture frame */
.blog-img-placeholder {
  width: 100%;
  height: 100px;
  border-radius: 6px;
  background: var(--border-subtle);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.15), inset 0 -1px 4px rgba(0,0,0,0.08);
  margin-bottom: 0.8rem;
}

.dark-mode .blog-img-placeholder {
  background: var(--border);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.35), inset 0 -1px 4px rgba(0,0,0,0.2);
}

.blog-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.blog-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.blog-tag--safety {
  background: var(--score-avoid, #ef4444);
  color: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Blog card — live post (not placeholder) */
.blog-card--live {
  opacity: 1;
  border-style: solid;
  cursor: pointer;
}
.blog-card--live:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.blog-card--live a {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ==========================================================================
   BLOG POST
   ========================================================================== */

/* Emergency callout */
.blog-callout {
  padding: 1rem 1.2rem;
  border-radius: 10px;
  margin-bottom: 1.8rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.blog-callout--danger {
  background: #fef2f2;
  border: 2px solid #fca5a5;
  color: #991b1b;
}
.dark-mode .blog-callout--danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Section labels */
.blog-section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--border-subtle);
}
.blog-section-label--toxic { border-color: #ef4444; color: #dc2626; }
.blog-section-label--junk { border-color: #f59e0b; color: #d97706; }
.dark-mode .blog-section-label--toxic { color: #fca5a5; border-color: #b91c1c; }
.dark-mode .blog-section-label--junk { color: #fcd34d; border-color: #b45309; }
.blog-section-icon { font-size: 1.5rem; }

/* Food card grid */
.blog-food-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

/* Individual food card */
.blog-food-card {
  display: flex;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: 12px;
  border-left: 5px solid;
  background: var(--card-bg);
}
.blog-food-card--toxic {
  border-left-color: #ef4444;
}
.blog-food-card--junk {
  border-left-color: #f59e0b;
}

.blog-food-card__number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  margin-top: 0.1rem;
}
.blog-food-card--toxic .blog-food-card__number { background: #ef4444; }
.blog-food-card--junk .blog-food-card__number { background: #f59e0b; }

.blog-food-card__body { flex: 1; min-width: 0; }
.blog-food-card__body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
  color: var(--text-primary);
}

.blog-food-card__compound {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.blog-food-card__body p {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-primary);
}
.blog-food-card__body p:last-child { margin-bottom: 0; }
.blog-food-card__body em {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* Divider between sections */
.blog-divider {
  text-align: center;
  margin: 2.5rem 0;
  position: relative;
}
.blog-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
}
.blog-divider span {
  position: relative;
  background: var(--bg-primary, #fff);
  padding: 0 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dark-mode .blog-divider span {
  background: var(--bg-primary, #1a1a2e);
}

/* Takeaway box */
.blog-takeaway {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}
.blog-takeaway h2 {
  font-size: 1.2rem;
  margin: 0 0 1rem;
  color: var(--text-primary);
}
.blog-takeaway__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.blog-takeaway__card {
  padding: 1rem;
  border-radius: 10px;
  border-left: 4px solid;
}
.blog-takeaway__card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.blog-takeaway__card p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}
.blog-takeaway__card--toxic {
  border-left-color: #ef4444;
  background: #fef2f2;
}
.blog-takeaway__card--junk {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
.dark-mode .blog-takeaway__card--toxic {
  background: rgba(239, 68, 68, 0.08);
}
.dark-mode .blog-takeaway__card--junk {
  background: rgba(245, 158, 11, 0.08);
}

@media (max-width: 600px) {
  .blog-food-card { flex-direction: column; gap: 0.6rem; }
  .blog-food-card__number { width: 30px; height: 30px; font-size: 0.8rem; }
  .blog-takeaway__grid { grid-template-columns: 1fr; }
  .blog-section-label { font-size: 1.15rem; }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 50px 30px;
  position: relative;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  max-width: 960px;
  margin: 16px auto;
  border-radius: 12px;
}

.footer .social-icons { position: absolute; bottom: 20px; right: 20px; text-align: right; }

.footer .social-icons a {
  color: var(--footer-text); margin-left: 10px; font-size: 1rem;
  transition: transform 0.2s ease;
}
.footer .social-icons a:hover { transform: scale(1.2); color: var(--accent-color); }

.footer-links a {
  color: var(--footer-links); text-decoration: none; margin: 0 6px;
  font-size: 0.9rem; position: relative;
}

.footer-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 0%; height: 2px; background: var(--accent-gradient);
  transition: width 0.3s ease;
}
.footer-links a:hover::after { width: 100%; }

.footer p:last-child { margin-top: 20px; font-size: 0.8rem; color: var(--footer-secondary); }

/* Portal dive removed — arrival animations only (see CF_script.js) */

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */
#backToTop {
  position: fixed; bottom: 24px; right: 24px;
  border: none; background: none; cursor: pointer;
  z-index: 900; display: flex; align-items: center; justify-content: center;
  padding: 0; opacity: 0; transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none; overflow: visible;
}
#backToTop.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#backToTop:hover { transform: translateY(-3px); }
#backToTop:active { transform: translateY(0) scale(0.93); }

.btt-logo {
  width: 28px; height: 28px; object-fit: contain;
  pointer-events: none; transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
#backToTop:hover .btt-logo { transform: scale(1.1); }

.btt-animal {
  position: absolute; bottom: 50%; left: 50%;
  transform: translateX(-50%) translateY(10px) scale(0);
  font-size: 1.6rem; pointer-events: none; opacity: 0; z-index: 901;
}

.btt-animal.popping {
  animation: animalPop 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes animalPop {
  0%   { transform: translateX(-50%) translateY(10px) scale(0) rotate(0deg); opacity: 0; }
  15%  { transform: translateX(-50%) translateY(-5px) scale(0.8) rotate(-5deg); opacity: 1; }
  35%  { transform: translateX(-50%) translateY(-35px) scale(1.2) rotate(8deg); opacity: 1; }
  55%  { transform: translateX(-50%) translateY(-50px) scale(1) rotate(-3deg); opacity: 1; }
  75%  { transform: translateX(-50%) translateY(-60px) scale(0.9) rotate(5deg); opacity: 0.7; }
  100% { transform: translateX(-50%) translateY(-80px) scale(0.3) rotate(15deg); opacity: 0; }
}

/* ==========================================================================
   AD PLACEMENT — Sidebar on wide screens, banner on narrow
   ========================================================================== */
.ad-slot {
  background:
    linear-gradient(165deg, #3e2a1a 0%, #4a3424 20%, #3b2816 45%, #4d3828 70%, #3e2a1a 100%);
  border: 2px solid #2a1c10;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
  overflow: hidden;
}
.ad-label {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: #c9a868;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4), 0 1px 0 rgba(255,200,120,0.08);
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* Sidebar ad — sticky, slides with scroll but stops at edges */
.ad-sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  right: calc((100vw - 960px) / 2 - 180px);
  position: fixed;
  width: 160px;
  min-height: 600px;
  z-index: 50;
}

/* Below 120% zoom / narrow screens: hide sidebar, show banner */
@media (max-width: 1340px) {
  .ad-sidebar { display: none; }
  .ad-banner { display: flex; }
}

@media (min-width: 1341px) {
  .ad-sidebar { display: flex; }
  .ad-banner { display: none; }
}

.ad-banner {
  max-width: 960px;
  margin: 12px auto;
  min-height: 90px;
  width: 100%;
}

/* ==========================================================================
   SCROLL REVEAL + PERSPECTIVE DEPTH — "Moving into the screen"
   ========================================================================== */

/* Each .reveal item gets its own perspective so depth doesn't break parent layout */
.reveal {
  opacity: 0;
  transform: perspective(900px) translateY(30px) translateZ(-40px) rotateX(2deg);
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform, opacity;
}

.reveal.revealed {
  opacity: 1;
  transform: perspective(900px) translateY(0) translateZ(0) rotateX(0deg);
}

/* Content panels also get a depth entrance */
.content-panel {
  transform: perspective(1000px) translateY(20px) rotateX(1.2deg);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.6s ease;
}

.content-panel.depth-visible {
  transform: perspective(1000px) translateY(0) rotateX(0deg);
  opacity: 1;
}

/* Stagger delay for grid children */
.reveal-stagger .reveal:nth-child(1) { transition-delay: 0s; }
.reveal-stagger .reveal:nth-child(2) { transition-delay: 0.06s; }
.reveal-stagger .reveal:nth-child(3) { transition-delay: 0.12s; }
.reveal-stagger .reveal:nth-child(4) { transition-delay: 0.18s; }
.reveal-stagger .reveal:nth-child(5) { transition-delay: 0.24s; }
.reveal-stagger .reveal:nth-child(6) { transition-delay: 0.30s; }
.reveal-stagger .reveal:nth-child(7) { transition-delay: 0.36s; }
.reveal-stagger .reveal:nth-child(8) { transition-delay: 0.42s; }
.reveal-stagger .reveal:nth-child(9) { transition-delay: 0.48s; }

/* Category emoji */
.food-emoji {
  font-size: 1.3rem;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* --- Tablets (max-width: 768px) --- */
@media (max-width: 768px) {
  /* Content panel uses more of the screen */
  .content-panel {
    margin-left: 8px;
    margin-right: 8px;
  }

  .stationary-header {
    margin-left: 8px;
    margin-right: 8px;
  }

  .footer {
    margin-left: 8px;
    margin-right: 8px;
    padding: 40px 20px;
  }

  .hero {
    padding: 3rem 1.5rem 2.5rem;
    margin-left: 0;
    margin-right: 0;
  }

  /* Ad banner tighter */
  .ad-banner {
    margin-left: 8px;
    margin-right: 8px;
  }

  /* Theme toggle — pull in slightly */
  .theme-toggle {
    top: 15px;
    right: 14px;
  }
}

/* --- Large phones (max-width: 640px) --- */
@media (max-width: 640px) {
  /* Content panel flush with small margin */
  .content-panel {
    margin-left: 6px;
    margin-right: 6px;
    border-radius: 10px;
  }

  .stationary-header {
    margin-left: 6px;
    margin-right: 6px;
    padding: 8px 12px 12px 12px;
    border-radius: 10px 10px 0 0;
  }

  .footer {
    margin-left: 6px;
    margin-right: 6px;
    border-radius: 10px;
    padding: 30px 16px;
  }

  /* Brand — slightly smaller */
  .brand-word {
    font-size: clamp(20px, 3vw, 32px);
  }

  /* Tagline row — stack on smaller screens */
  .tagline-pages {
    gap: 8px;
    justify-content: center;
  }

  .tagline-pages .tagline {
    font-size: clamp(11px, 1.4vw, 16px);
  }

  /* Mini header — hide tagline and divider to save space */
  #mini-header .mini-tagline,
  #mini-header .divider {
    display: none;
  }

  /* Mini header search input wider on small screens */
  .search-form--mini input {
    width: clamp(100px, 28vw, 180px);
  }

  /* Hero section */
  .hero {
    padding: 2.5rem 1.2rem 2rem;
  }

  .hero p {
    margin-bottom: 1.5rem;
  }

  /* Hero search form + grotto */
  .grotto-wrap { max-width: 100%; }
  .grotto-slot { border-radius: 26px; padding: 4px; }

  .search-form--hero {
    max-width: 100%;
    margin: 1rem auto 0.6rem;
  }

  .search-form--hero input {
    font-size: 0.95rem;
    padding: 0.6rem 2.8rem 0.6rem 1rem;
  }

  .search-form--hero button {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .grotto-particle { font-size: 1rem; }

  /* Tab bar — smaller on mobile */
  .tab-bar button {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
  }

  /* Bark panels */
  .bark-panel {
    padding: 1.1rem 1.2rem;
  }

  /* Watermark bigger on mobile so it's still visible */
  .bark-panel::before {
    width: 55%;
    opacity: 0.14;
  }

  /* Footer social icons */
  .footer .social-icons {
    position: static;
    text-align: center;
    margin-top: 1rem;
  }

  /* Back to top — smaller on mobile */
  #backToTop {
    bottom: 16px;
    right: 16px;
  }

  .btt-logo {
    width: 24px;
    height: 24px;
  }

  /* Content wrap */
  .content-wrap {
    padding: 1.5rem 1.15rem;
  }

  /* Section title */
  .section-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }

  /* Filter bar — smaller pills */
  .filter-bar a,
  .filter-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
  }
}

/* --- Small phones (max-width: 480px) --- */
@media (max-width: 480px) {
  /* Content panel near-flush */
  .content-panel {
    margin-left: 4px;
    margin-right: 4px;
    border-radius: 8px;
  }

  .stationary-header {
    margin-left: 4px;
    margin-right: 4px;
    padding: 6px 10px 10px 10px;
    border-radius: 8px 8px 0 0;
  }

  .footer {
    margin-left: 4px;
    margin-right: 4px;
    border-radius: 8px;
    padding: 24px 12px;
  }

  /* Brand — smallest size */
  .brand-word {
    font-size: clamp(18px, 5vw, 26px);
  }

  .stationary-header .logo {
    height: clamp(22px, 5vw, 30px);
  }

  /* Tagline — hide on very small screens to save vertical space */
  .tagline-pages .tagline {
    font-size: 10px;
  }

  /* Theme toggle — tighter position, avoid brand overlap */
  .theme-toggle {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
  }

  .theme-toggle .sun,
  .theme-toggle .moon {
    font-size: 0.8rem;
  }

  .theme-toggle .paw {
    font-size: 0.7rem;
  }

  /* Nav links — smaller */
  .sketch-link {
    font-size: clamp(11px, 1.2vw, 14px);
    padding: 0.15em 0.4em;
  }

  /* Mini header */
  #mini-header {
    padding: 0 0.4rem;
    gap: 6px;
  }

  #mini-header .mini-left .mini-logo {
    height: 18px;
  }

  #mini-header .mini-left .mini-brand {
    font-size: 0.8rem;
  }

  .search-form--mini input {
    width: clamp(90px, 30vw, 150px);
    padding: 0.25rem 0.6rem;
    font-size: 11px;
  }

  /* Hero — tighter */
  .hero {
    padding: 2rem 1rem 1.5rem;
  }

  .hero h1 {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }

  .hero p {
    font-size: clamp(0.82rem, 2vw, 0.95rem);
    margin-bottom: 1rem;
  }

  .hero .cta-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }

  /* Safety checker — stack on small screens */
  .safety-checker { padding: 1rem 1rem; }
  .safety-checker__form { flex-direction: column; }
  .safety-checker__select,
  .safety-checker__input { flex: 1 1 100%; width: 100%; }
  .safety-checker__btn { width: 100%; }

  /* Search hero */
  .search-form--hero input {
    font-size: 0.9rem;
    padding: 0.55rem 2.5rem 0.55rem 0.9rem;
  }

  /* Tab bar — smallest */
  .tab-bar button {
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
  }

  /* Bark panel — compact */
  .bark-panel {
    padding: 1rem 1rem;
  }

  .bark-panel h3 {
    font-size: 0.92rem;
  }

  .bark-panel p, .bark-panel ul, .bark-panel li {
    font-size: 0.84rem;
  }

  /* Content wrap — tightest */
  .content-wrap {
    padding: 1.25rem 0.85rem;
  }

  /* Detail header */
  .detail-header h1 {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .detail-header .description {
    font-size: 0.92rem;
    padding-left: 0.75rem;
  }

  /* Food cards — slightly less padding */
  .food-card {
    padding: 0.85rem 0.9rem 0.85rem 1rem;
  }

  /* Animal cards */
  .animal-card .card-name {
    font-size: 0.85rem;
  }

  .animal-card .card-links a,
  .animal-card .card-links span {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
  }

  /* Quote reveal — smaller slide on mobile */
  .animal-card-wrap:hover .animal-card,
  .animal-card-wrap:has(.animal-card.active) .animal-card {
    transform: translateY(-40px);
  }
  .animal-card-wrap .card-quote {
    font-size: 0.85rem;
    padding: 6px 6px 4px;
  }
  .section-headline {
    font-size: 1.8rem;
  }

  /* Breadcrumb */
  .page-nav .page-leaf {
    font-size: 0.7rem;
    padding: 3px 7px;
  }

  /* Blog cards */
  .blog-card {
    padding: 1rem;
  }

  .blog-img-placeholder {
    height: 75px;
  }

  /* Filter bar */
  .filter-bar {
    gap: 0.3rem;
  }

  .filter-bar a,
  .filter-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
  }

  /* Back to top — smallest */
  #backToTop {
    bottom: 10px;
    right: 10px;
  }

  .btt-logo {
    width: 22px;
    height: 22px;
  }
}

/* ==========================================================================
   REDUCED MOTION — Respect prefers-reduced-motion
   Disables decorative animations and transitions. Functional transitions
   (tab switches, theme toggle) are kept but made instant.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  /* Kill all keyframe animations */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
  }

  /* Flatten transitions to instant */
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  /* Parallax background — static, no transform */
  .scene-bg {
    transform: none !important;
  }

  /* Clouds — static, visible, no drift */
  .cloud {
    animation: none !important;
    opacity: 0.3 !important;
  }

  /* Scroll reveal — show everything immediately */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Content panel depth — show flat immediately */
  .content-panel {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Portal dive removed */

  /* Grotto particles — no emoji burst */
  .grotto-particle {
    display: none !important;
  }

  /* Food card image — stay in muted ghost state, no transitions */
  .food-card-bg {
    filter: grayscale(1) brightness(0.8) !important;
    opacity: 0.18 !important;
    transition: none !important;
  }

  /* Logo rock — static */
  .logo-rock {
    animation: none !important;
  }

  /* Card tilts + breathing — flat */
  .animal-card,
  .food-card {
    transform: none !important;
    animation: none !important;
    scale: 1 !important;
  }

  /* Back to top pop — no emoji animation */
  .btt-animal {
    animation: none !important;
    display: none !important;
  }
}


/* ==========================================================================
   NUTRITION — Hub, radar chart, pie chart, nutrient cards, detail pages
   ========================================================================== */

/* --- Dashboard (radar + pie side by side) --- */
.nutrition-dashboard {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.nutrition-chart-wrap {
  flex: 1;
  min-width: 220px;
  text-align: center;
}
.nutrition-chart-title {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* --- Nutrient Histogram (professional chart) --- */
.nutrient-histogram {
  position: relative;
  display: flex;
  gap: 0;
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1rem 0.5rem 0;
}

.nutrient-histogram__y-axis {
  position: relative;
  width: 42px;
  flex-shrink: 0;
  height: 340px;
}

.nutrient-histogram__y-label {
  position: absolute;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  transform: translateY(50%);
  white-space: nowrap;
}

.nutrient-histogram__chart {
  flex: 1;
  position: relative;
  height: 340px;
}

.nutrient-histogram__gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
  pointer-events: none;
}

.nutrient-histogram__x-axis {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-muted);
  opacity: 0.3;
}

.nutrient-histogram__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100%;
  padding: 0 2px;
}

.nutrient-histogram__col {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}

.nutrient-histogram__amount {
  position: absolute;
  bottom: calc(var(--bar-h, 0%) + 2px);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
}

.nutrient-histogram__bar {
  width: 70%;
  min-height: 4px;
  border-radius: 5px 5px 0 0;
  transition: filter 0.15s;
  display: block;
  text-decoration: none;
}

.nutrient-histogram__col:hover .nutrient-histogram__bar {
  filter: brightness(1.15);
}

.nutrient-histogram__x-labels {
  display: flex;
  gap: 2px;
  padding: 0 2px;
  margin-top: 0.4rem;
}

.nutrient-histogram__label {
  flex: 1;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

/* Chart.js scrollable canvas wrapper */
.cf-canvas-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.cf-canvas-scroll::-webkit-scrollbar {
  height: 6px;
}

.cf-canvas-scroll::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.cf-canvas-inner {
  min-width: 700px;
  height: 360px;
}

.nutrition-chart-dashboard {
  margin-bottom: 2rem;
  overflow: hidden;
}

/* Chart.js tooltip */
.cf-tooltip {
  position: absolute;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--text-primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
  min-width: 150px;
  max-width: 240px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.cf-tooltip.visible { opacity: 1; }
.cf-tooltip-name { font-weight: 600; font-size: 0.82rem; margin-bottom: 3px; }
.cf-tooltip-val { color: var(--text-secondary); }
.cf-tooltip-desc { color: var(--text-muted); font-size: 0.68rem; margin-top: 4px; line-height: 1.4; }

.cf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}

.cf-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: default;
}

.cf-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Zoom tooltip — appears on hover showing surrounding bars rescaled */
.nutrient-histogram__zoom {
  position: absolute;
  bottom: 60px;
  right: 12px;
  width: 220px;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  padding: 0.6rem;
  z-index: 10;
  pointer-events: none;
}

.nutrient-histogram__zoom-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  text-align: center;
}

.nutrient-histogram__zoom-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
}

.nutrient-histogram__zoom-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.nutrient-histogram__zoom-bar {
  width: 80%;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
}

.nutrient-histogram__zoom-label {
  font-size: 0.5rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  line-height: 1.1;
  word-break: break-word;
}

.nutrient-histogram__zoom-amount {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 1px;
}

@media (max-width: 600px) {
  .nutrient-histogram__chart,
  .nutrient-histogram__y-axis {
    height: 240px;
  }
  .nutrient-histogram__label {
    font-size: 0.52rem;
  }
  .nutrient-histogram {
    padding: 0.8rem 0.5rem 0.4rem 0;
  }
  .nutrient-histogram__zoom {
    width: 180px;
    bottom: 40px;
    right: 6px;
  }
}

/* --- Radar Chart (SVG) --- */
.radar-chart {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  display: block;
}
.radar-grid {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 1;
}
.radar-axis {
  stroke: var(--border-subtle);
  stroke-width: 0.5;
}
.radar-data {
  fill: rgba(74, 140, 63, 0.25);
  stroke: var(--green-leaf);
  stroke-width: 2;
  transition: all 0.5s ease;
}
.radar-dot {
  fill: var(--green-forest);
  stroke: var(--surface-solid);
  stroke-width: 2;
}
.radar-label {
  fill: var(--text-secondary);
  font-size: 11px;
  font-family: 'Lora', serif;
}

/* --- Pie Chart (CSS conic-gradient) --- */
:root {
  --pie-essential: #2d7a27;
  --pie-important: #4a8c3f;
  --pie-beneficial: #d4a020;
  --pie-contextual: #8a9a8a;
}
.importance-pie {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
  border: 2px solid var(--border-subtle);
}
.pie-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.pie-dot--essential { background: var(--pie-essential); }
.pie-dot--important { background: var(--pie-important); }
.pie-dot--beneficial { background: var(--pie-beneficial); }
.pie-dot--contextual { background: var(--pie-contextual); }

/* --- Nutrient Card Grid --- */
.nutrient-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .nutrient-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .nutrient-grid { grid-template-columns: repeat(3, 1fr); }
}

.nutrient-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  border-left: 4px solid var(--border);
  cursor: pointer;
}
.nutrient-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-color: var(--green-leaf);
}
.nutrient-card[data-tier="essential"] { border-left-color: var(--pie-essential); }
.nutrient-card[data-tier="important"] { border-left-color: var(--pie-important); }
.nutrient-card[data-tier="beneficial"] { border-left-color: var(--pie-beneficial); }
.nutrient-card[data-tier="contextual"] { border-left-color: var(--pie-contextual); }

.nutrient-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.nutrient-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: 'Caveat', cursive;
  color: var(--text-primary);
}
.nutrient-icon {
  font-size: 1.3rem;
}
.nutrient-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 0.5rem;
}
.nutrient-card-foods {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Importance chip variants --- */
.importance-essential {
  background: rgba(45, 122, 39, 0.15);
  color: var(--pie-essential);
  border-color: rgba(45, 122, 39, 0.3);
}
.importance-important {
  background: rgba(74, 140, 63, 0.12);
  color: var(--pie-important);
  border-color: rgba(74, 140, 63, 0.25);
}
.importance-beneficial {
  background: rgba(212, 160, 32, 0.12);
  color: #8a6a10;
  border-color: rgba(212, 160, 32, 0.25);
}
.importance-contextual {
  background: rgba(138, 154, 138, 0.12);
  color: var(--text-muted);
  border-color: rgba(138, 154, 138, 0.25);
}

/* --- Deficiency / Excess callout boxes --- */
.deficiency-callout, .excess-callout {
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  line-height: 1.75;
}
.deficiency-callout {
  background: var(--caution-bg);
  border-left: 4px solid var(--caution-color);
}
.deficiency-callout h4 { color: var(--caution-color); margin: 0 0 0.5rem; font-size: 0.95rem; }
.excess-callout {
  background: var(--avoid-bg);
  border-left: 4px solid var(--avoid-color);
}
.excess-callout h4 { color: var(--avoid-color); margin: 0 0 0.5rem; font-size: 0.95rem; }

/* --- Food Rank Bars (nutrient detail + best foods) --- */
.food-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.food-rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.food-rank-num {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--green-forest);
  min-width: 2rem;
  text-align: center;
}
.food-rank-info {
  flex: 1;
  min-width: 0;
}
.food-rank-name {
  font-weight: 600;
}
.food-rank-qty {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.food-rank-note {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.food-rank-note--clipped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* View full list button */
.view-full-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--green-forest);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(45,90,39,0.2);
}
.view-full-list-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(45,90,39,0.3);
  color: #fff;
  text-decoration: none;
}
.dark-mode .view-full-list-btn {
  background: var(--green-leaf);
}

/* --- Interaction cards --- */
.interaction-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.interaction-card {
  border-radius: 8px;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--border);
}
.interaction-card.interaction-synergy { border-left-color: var(--safe-color); background: var(--safe-bg); }
.interaction-card.interaction-antagonist { border-left-color: var(--avoid-color); background: var(--avoid-bg); }
.interaction-card.interaction-ratio { border-left-color: var(--caution-color); background: var(--caution-bg); }

.interaction-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.interaction-header strong {
  color: var(--text-primary);
  font-size: 1rem;
}
.interaction-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.interaction-badge--synergy { background: var(--safe-color); color: #fff; }
.interaction-badge--antagonist { background: var(--avoid-color); color: #fff; }
.interaction-badge--ratio { background: var(--caution-color); color: #fff; }

.interaction-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0.4rem 0;
  line-height: 1.8;
}
.interaction-card strong {
  color: var(--text-primary);
}
.interaction-tip { font-size: 0.82rem !important; }

/* --- Prev/Next navigation --- */
/* ── Cite this page ── */
.cite-section {
  margin-top: 2rem;
  text-align: center;
}
.cite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bark-bg, #f5f0eb);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.cite-toggle:hover {
  background: var(--bark-hover, #ece5dd);
  color: var(--text-primary);
}

/* Overlay + backdrop blur */
.cite-overlay[hidden] {
  display: none !important;
}
.cite-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition: background 0.25s, backdrop-filter 0.25s, -webkit-backdrop-filter 0.25s;
}
.cite-overlay.active {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Modal card */
.cite-modal {
  background: var(--panel-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 1.5rem 1.75rem;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.cite-overlay.active .cite-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.cite-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.cite-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.cite-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.cite-close:hover {
  background: var(--bark-hover, #ece5dd);
  color: var(--text-primary);
}

.cite-format {
  position: relative;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.cite-format:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.cite-format label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-forest);
  margin-bottom: 0.25rem;
}
.cite-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-primary);
  padding-right: 3.5rem;
}
.cite-text em {
  font-style: italic;
}
.cite-mono {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
}
.cite-copy {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--green-forest);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.cite-copy:hover {
  background: var(--green-leaf);
}

.prev-next-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}
.prev-next-link {
  color: var(--green-forest);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s;
}
.prev-next-link:hover { color: var(--green-leaf); }

/* --- Nutrition summary table --- */
.nutrition-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.nutrition-summary-table th {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 2px solid rgba(100,70,40,0.3);
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: #ddc090;
  white-space: nowrap;
}
.nutrition-summary-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid rgba(100,70,40,0.12);
  color: #ccaa7a;
  vertical-align: middle;
}
.nutrition-summary-table tr.quick-ref-row {
  cursor: pointer;
  transition: background 0.15s;
}
.nutrition-summary-table tr.quick-ref-row:hover td {
  background: rgba(45, 122, 39, 0.1);
}
.nutrition-summary-table tr:hover td {
  background: rgba(255,255,255,0.04);
}
.nutrition-summary-table tr.row-essential td {
  background: rgba(45, 122, 39, 0.06);
}
.nutrition-summary-table .engraved-chip {
  font-size: 0.68rem;
}
.td-nutrient {
  white-space: nowrap;
  font-size: 0.9rem;
}
.td-helps {
  font-size: 0.8rem;
  color: #b89a6a;
  max-width: 200px;
}
.td-sources {
  font-size: 0.78rem;
  color: #b89a6a;
  max-width: 220px;
}
.td-daily {
  font-size: 0.78rem;
  color: #b89a6a;
  max-width: 180px;
}
.td-category {
  font-size: 0.8rem;
  white-space: nowrap;
}
.source-row {
  white-space: nowrap;
  line-height: 1.6;
}
.source-rank {
  display: inline-block;
  font-weight: 700;
  color: #7ef05a;
  font-size: 0.72rem;
  min-width: 1.4em;
}
.td-link {
  white-space: nowrap;
  font-size: 0.8rem;
}

/* --- Dark mode overrides for nutrition --- */
.dark-mode .nutrient-card {
  background: var(--surface);
  border-color: var(--border);
}
.dark-mode .nutrient-card:hover {
  border-color: var(--green-fresh);
}
.dark-mode .nutrient-card-header h3 { color: var(--text-primary); }
.dark-mode .radar-label { fill: var(--text-secondary); }
.dark-mode .radar-data {
  fill: rgba(107, 191, 89, 0.25);
  stroke: var(--green-fresh);
}
.dark-mode .radar-dot { fill: var(--green-fresh); stroke: var(--surface-solid); }
.dark-mode .importance-pie { border-color: var(--border); }
.dark-mode .importance-beneficial { color: var(--caution-color); }
.dark-mode .food-rank-num { color: var(--green-fresh); }

/* ==========================================================================
   DARK PANTRY — Dangerous foods shelf on animal pages
   ========================================================================== */

/* --- Danger Alert (big red button + note at top of page) --- */
.danger-alert {
  text-align: center;
  margin: 1.5rem 0;
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #8b1a1a 0%, #6b1010 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2.2rem;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 0 20px rgba(180, 30, 30, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  animation: dangerPulse 2.5s ease-in-out infinite;
  letter-spacing: 0.02em;
}

.danger-btn:hover {
  background: linear-gradient(135deg, #a02020 0%, #801818 100%);
  box-shadow: 0 0 30px rgba(200, 40, 40, 0.5), 0 6px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
  color: #fff;
  text-decoration: none;
}

.danger-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 15px rgba(180, 30, 30, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
}

@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(180, 30, 30, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2); }
  50% { box-shadow: 0 0 28px rgba(180, 30, 30, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2); }
}

.danger-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.6rem;
  font-style: italic;
}

/* ==========================================================================
   ANIMAL HOMEPAGE
   ========================================================================== */

/* --- Hero Banner --- */
.animal-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 960px;
  margin: 16px auto 0;
  padding: 2rem 1.5rem 1.5rem;
  position: relative;
}

.animal-hero__img-wrap {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.18),
    0 0 0 4px rgba(255,255,255,0.3),
    0 0 0 8px rgba(45,90,39,0.15);
  background: var(--surface);
}

.animal-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.animal-hero__text {
  flex: 1;
  min-width: 0;
}

.animal-hero__nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.animal-hero__back-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.animal-hero__name {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0;
}

.animal-hero__sci {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* --- Quick Stats --- */
.animal-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-subtle);
}

.animal-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--safe-bg);
  color: var(--safe-color);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.animal-stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.animal-stat__num {
  font-weight: 800;
  font-size: 1rem;
}

.animal-stat--danger {
  background: var(--avoid-bg);
  color: var(--avoid-color);
}

/* --- Description --- */
.animal-desc {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  max-width: 680px;
}

/* --- Featured Foods --- */
.animal-featured {
  margin: 2rem 0;
}

.animal-featured__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Daily Feeding Guide */
.feeding-guide-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.feeding-guide-pie {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.feeding-guide-items {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface-solid);
}

.feeding-guide-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.feeding-guide-row:last-child {
  border-bottom: none;
}

.feeding-guide-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.feeding-guide-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 1.4rem;
  text-align: center;
}

.feeding-guide-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.feeding-guide-info strong {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.feeding-guide-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.feeding-guide-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 2.5rem;
  text-align: right;
}

.feeding-guide-extras {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.feeding-guide-extra {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
}

/* Stacked bar for simple 2-category splits (replaces pie) */
.feeding-guide-bar {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  height: 2.2rem;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.feeding-guide-bar__segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

.feeding-guide-bar__segment span {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Tiered extras */
.feeding-guide-extra--requirement {
  border-left: 3px solid var(--primary);
  font-weight: 500;
}

.feeding-guide-extra--warning {
  border-left: 3px solid var(--score-avoid);
  background: color-mix(in srgb, var(--score-avoid) 6%, var(--surface-solid));
}

.feeding-guide-extra--option {
  opacity: 0.85;
}

/* Disclaimer at bottom */
.feeding-guide-disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  opacity: 0.7;
  text-align: right;
}

/* Popular foods context line */
.animal-featured__context {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.5rem 0 1rem;
}

/* Nav cards grid wrapper */
.animal-nav-cards__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .animal-nav-cards__grid {
    grid-template-columns: 1fr;
  }
}

.feeding-guide-attracted {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.85;
}

.feeding-guide-seasonal {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feeding-guide-seasonal-tip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
}

.feeding-guide-seasonal-tip strong {
  color: var(--text-primary);
}

/* When bar is used instead of pie, stack vertically */
.feeding-guide-layout:has(.feeding-guide-bar) {
  flex-direction: column;
}

@media (max-width: 600px) {
  .feeding-guide-layout {
    flex-direction: column;
    align-items: center;
  }
  .feeding-guide-pie {
    width: 120px;
    height: 120px;
  }
}

.animal-featured__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.animal-food-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  padding: 0.75rem 0.5rem;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.animal-food-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.animal-food-card__img-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 0.5rem;
  background: var(--sky-pale);
}

.animal-food-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.animal-food-card__name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.animal-food-card__badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.badge-safe {
  background: var(--safe-bg);
  color: var(--safe-color);
}

/* --- Navigation Cards --- */
.animal-nav-cards {
  margin: 2rem 0;
}

.animal-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  padding: 1.5rem 1rem;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 2px solid var(--border-subtle);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.animal-nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--green-pale) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.animal-nav-card:hover {
  border-color: var(--green-leaf);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(45,90,39,0.12);
}

.animal-nav-card:hover::before {
  opacity: 1;
}

.animal-nav-card__icon {
  position: relative;
  z-index: 1;
  font-size: 1.6rem;
  color: var(--green-forest);
  margin-bottom: 0.6rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--safe-bg);
}

.dark-mode .animal-nav-card__icon {
  color: var(--green-bright);
}

.animal-nav-card__title {
  position: relative;
  z-index: 1;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.animal-nav-card__desc {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* "Dive in" prompt on nav cards */
.animal-nav-card__cta {
  position: relative;
  z-index: 1;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-forest);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.animal-nav-card:hover .animal-nav-card__cta {
  opacity: 1;
}

.animal-nav-card__foot {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  filter: var(--icon-filter, none);
}

.dark-mode .animal-nav-card__cta {
  color: var(--green-bright);
}

/* --- Per-Animal Accent Colors --- */
.animal-hero[data-animal="dog"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(192,120,48,0.25);
}
.animal-hero[data-animal="cat"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(138,107,191,0.25);
}
.animal-hero[data-animal="budgie"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(58,170,91,0.25);
}
.animal-hero[data-animal="chicken"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(212,136,58,0.25);
}
.animal-hero[data-animal="hamster"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(212,154,74,0.25);
}
.animal-hero[data-animal="guinea-pig"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(176,112,64,0.25);
}
.animal-hero[data-animal="freshwater-fish"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(42,138,160,0.25);
}
.animal-hero[data-animal="horse"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(122,90,58,0.25);
}
.animal-hero[data-animal="rabbit"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(160,128,112,0.25);
}
.animal-hero[data-animal="backyard-birds"] .animal-hero__img-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(90,154,58,0.25);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .animal-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding: 1.5rem 1rem 1rem;
  }

  .animal-hero__img-wrap {
    width: 120px;
    height: 120px;
  }

  .animal-hero__nav {
    justify-content: center;
  }

  .animal-stats {
    justify-content: center;
  }

  .animal-desc {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .animal-featured__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .animal-nav-cards__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .animal-hero__img-wrap {
    width: 100px;
    height: 100px;
  }

  .animal-hero__name {
    font-size: 1.6rem;
  }
}

/* --- Dark Pantry Container --- */
.dark-pantry {
  background:
    linear-gradient(
      180deg,
      #1a1008 0%,
      #231710 15%,
      #1e1208 40%,
      #1a0f08 70%,
      #0f0a04 100%
    );
  border-radius: 12px;
  padding: 2rem 1.5rem;
  position: relative;
  overflow: hidden;
  max-width: 960px;
  margin: 16px auto;
  box-shadow:
    inset 0 1px 0 rgba(139, 90, 43, 0.15),
    0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Subtle wood grain texture */
.dark-pantry::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 48px,
      rgba(139, 90, 43, 0.06) 48px,
      rgba(139, 90, 43, 0.06) 49px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 60px,
      rgba(139, 90, 43, 0.02) 60px,
      rgba(139, 90, 43, 0.02) 61px
    );
  pointer-events: none;
}

/* Shelf shadow lines — horizontal "shelves" */
.dark-pantry::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      transparent 0%,
      rgba(0, 0, 0, 0.15) 20%,
      transparent 21%,
      transparent 49%,
      rgba(0, 0, 0, 0.12) 50%,
      transparent 51%,
      transparent 79%,
      rgba(0, 0, 0, 0.1) 80%,
      transparent 81%
    );
  pointer-events: none;
}

.dark-pantry-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 1.5rem;
}

.dark-pantry-title {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  color: #d4a574;
  margin: 0 0 0.3rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dark-pantry-subtitle {
  color: #8a7060;
  font-size: 0.88rem;
  margin: 0;
}

/* --- Pantry Grid --- */
.dark-pantry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 560px) {
  .dark-pantry-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .dark-pantry-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Pantry Cards --- */
.pantry-card {
  background: linear-gradient(135deg, rgba(30, 15, 8, 0.92), rgba(45, 25, 12, 0.85));
  border: 1px solid rgba(100, 50, 25, 0.25);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: #d0c0b0;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  cursor: pointer;
}

.pantry-card:hover {
  transform: translateY(-3px);
  text-decoration: none;
  color: #e0d0c0;
}

/* Severity left stripes */
.pantry-card--toxic {
  border-left: 4px solid #c02020;
}
.pantry-card--toxic:hover {
  border-color: rgba(200, 50, 50, 0.4);
  box-shadow: 0 6px 24px rgba(180, 30, 30, 0.25);
}

.pantry-card--high_risk {
  border-left: 4px solid #d4840a;
}
.pantry-card--high_risk:hover {
  border-color: rgba(212, 132, 10, 0.4);
  box-shadow: 0 6px 24px rgba(180, 100, 10, 0.25);
}

.pantry-card--common_mistake {
  border-left: 4px solid #c4a020;
}
.pantry-card--common_mistake:hover {
  border-color: rgba(196, 160, 32, 0.4);
  box-shadow: 0 6px 24px rgba(180, 140, 10, 0.25);
}

.pantry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pantry-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #e8d0b8;
  line-height: 1.3;
}

/* Severity badges */
.severity-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.severity-badge--toxic {
  background: rgba(180, 30, 30, 0.25);
  color: #f07070;
  border: 1px solid rgba(180, 30, 30, 0.3);
}

.severity-badge--high_risk {
  background: rgba(180, 100, 10, 0.2);
  color: #f0a040;
  border: 1px solid rgba(180, 100, 10, 0.3);
}

.severity-badge--common_mistake {
  background: rgba(180, 140, 10, 0.2);
  color: #e0c040;
  border: 1px solid rgba(180, 140, 10, 0.3);
}

.pantry-card-desc {
  font-size: 0.82rem;
  line-height: 1.55;
  color: #a89888;
  margin: 0;
}

/* --- Footer warning --- */
.dark-pantry-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #8a6050;
  font-size: 0.82rem;
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(139, 90, 43, 0.15);
}

.dark-pantry-footer i {
  color: #c02020;
  margin-right: 0.3rem;
}

/* --- Smooth scroll for anchor links --- */
html {
  scroll-behavior: smooth;
}

/* --- Dark Pantry responsive --- */
@media (max-width: 640px) {
  .dark-pantry {
    padding: 1.5rem 1rem;
    border-radius: 10px;
  }

  .dark-pantry-title {
    font-size: 1.5rem;
  }

  .danger-btn {
    font-size: 0.9rem;
    padding: 0.75rem 1.8rem;
  }
}

@media (max-width: 480px) {
  .dark-pantry {
    padding: 1.2rem 0.8rem;
  }

  .dark-pantry-title {
    font-size: 1.3rem;
  }

  .pantry-card {
    padding: 0.85rem 0.9rem;
  }

  .pantry-card-title {
    font-size: 0.88rem;
  }

  .pantry-card-desc {
    font-size: 0.78rem;
  }

  .danger-btn {
    font-size: 0.85rem;
    padding: 0.7rem 1.5rem;
  }
}

/* --- Reduced motion: no pulse animation --- */
@media (prefers-reduced-motion: reduce) {
  .danger-btn {
    animation: none !important;
  }
}

/* ==========================================================================
   ARTICLES / FAQ
   ========================================================================== */
.article-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.article__header {
  margin-bottom: 1.5rem;
}

.article__title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0 0 0.6rem;
}

.article__meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article__animal-tag {
  background: var(--accent-color);
  color: #fff;
  padding: 0.2rem 0.7rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
}
.article__animal-tag:hover { opacity: 0.9; text-decoration: none; color: #fff; }

.article__summary {
  background: var(--card-bg);
  border-left: 4px solid var(--accent-color);
  padding: 1rem 1.2rem;
  border-radius: 0 10px 10px 0;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.article__score {
  margin-bottom: 1.5rem;
}

.article__score-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.article__content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.article__content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2rem 0 0.8rem;
  color: var(--text-primary);
}

.article__content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.6rem;
  color: var(--text-primary);
}

.article__content p {
  margin: 0 0 1rem;
}

.article__content ul, .article__content ol {
  margin: 0 0 1rem 1.5rem;
}

.article__content li {
  margin-bottom: 0.4rem;
}

.article__footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.article__footer a {
  color: var(--accent-color);
  font-weight: 600;
}

/* FAQ list page */
.faq-animal-section {
  margin-bottom: 2rem;
}

.faq-animal-heading {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.8rem;
}

.faq-animal-heading a {
  color: var(--text-primary);
  text-decoration: none;
}
.faq-animal-heading a:hover { color: var(--accent-color); }

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.8rem;
}

.faq-card {
  display: block;
  padding: 1rem 1.2rem;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.faq-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  text-decoration: none;
}

.faq-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.3rem;
}

.faq-card__summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 0.4rem;
  line-height: 1.5;
}

.faq-card__date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .article__title { font-size: 1.4rem; }
  .faq-grid { grid-template-columns: 1fr; }
}

/* FAQ Table — bark/wood themed */
.faq-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  background: var(--header-bg);
  border-radius: 14px;
  border: 1px solid rgba(138, 90, 42, 0.2);
  box-shadow: 0 2px 12px rgba(42, 26, 10, 0.06);
}

.faq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.faq-th {
  text-align: left;
  padding: 0.8rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--header-secondary);
  border-bottom: 2px solid rgba(138, 90, 42, 0.2);
  background: rgba(138, 90, 42, 0.06);
}

.faq-th--question { width: 35%; }
.faq-th--animal { width: 12%; }
.faq-th--answer { width: 43%; }
.faq-th--date { width: 10%; }

.faq-row {
  transition: background 0.15s;
}
.faq-row:hover {
  background: rgba(138, 90, 42, 0.08);
}

.faq-td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(138, 90, 42, 0.1);
  vertical-align: top;
}

.faq-td--question a {
  font-weight: 600;
  color: var(--header-text);
  text-decoration: none;
}
.faq-td--question a:hover {
  color: var(--footer-links);
}

.faq-td--answer {
  color: var(--header-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.faq-td--date {
  color: var(--header-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0.7;
}

.faq-animal-pill {
  display: inline-block;
  background: rgba(138, 90, 42, 0.1);
  border: 1px solid rgba(138, 90, 42, 0.2);
  padding: 0.18rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--header-secondary);
  white-space: nowrap;
}

/* Dark mode bark */
.dark-mode .faq-table-wrap {
  background: rgba(18, 28, 22, 0.6);
  border-color: rgba(106, 80, 64, 0.25);
}
.dark-mode .faq-th {
  background: rgba(106, 80, 64, 0.1);
  border-color: rgba(106, 80, 64, 0.2);
}
.dark-mode .faq-row:hover {
  background: rgba(106, 80, 64, 0.1);
}
.dark-mode .faq-td {
  border-color: rgba(106, 80, 64, 0.12);
}
.dark-mode .faq-animal-pill {
  background: rgba(106, 80, 64, 0.15);
  border-color: rgba(106, 80, 64, 0.25);
}

@media (max-width: 640px) {
  .faq-th--answer, .faq-td--answer { display: none; }
  .faq-th--date, .faq-td--date { display: none; }
  .faq-th--question { width: 65%; }
  .faq-th--animal { width: 35%; }
  .faq-table-wrap { border-radius: 10px; }
  .faq-th, .faq-td { padding: 0.6rem 0.7rem; }
}
