
:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --primary-light: #cffafe;
  --accent: #ea580c;
  --accent-light: #fed7aa;
  --text: #1e293b;
  --text-muted: #475569;
  --text-light: #64748b;
  --bg: #fefefe;
  --bg-soft: #f8fafc;
  --bg-warm: #fef6ee;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #10b981; --warn: #f59e0b; --danger: #ef4444;
  --radius: 8px; --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 12px 24px rgba(0,0,0,0.04);
  --max-width: 1200px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;
}
[data-theme="dark"] {
  --primary: #22d3ee;
  --primary-dark: #67e8f9;
  --primary-light: #164e63;
  --accent: #fb923c;
  --accent-light: #431407;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-light: #64748b;
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --bg-warm: #1c1917;
  --border: #334155;
  --border-strong: #475569;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.6), 0 12px 24px rgba(0,0,0,0.4);
}


*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body); line-height: 1.65;
  color: var(--text); background: var(--bg); margin: 0;
  transition: background 0.2s, color 0.2s;
}
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: white; padding: 0.75rem 1rem;
  text-decoration: none; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Focus */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

/* App shell — topbar + left sidebar + main */
:root { --topbar-h: 56px; --sidebar-w: 240px; }
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* Topbar */
.topbar {
  grid-area: topbar;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
[data-theme="dark"] .topbar { background: var(--bg); }

.sidebar-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text-muted);
  width: 40px; height: 40px; border-radius: var(--radius); cursor: pointer;
}
.sidebar-toggle:hover { background: var(--bg-soft); color: var(--primary-dark); }
.sidebar-toggle .i { width: 22px; height: 22px; }

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand svg.i-brand { width: 30px; height: 30px; flex-shrink: 0; }
.brand-name {
  display: block; font-family: var(--font-heading);
  font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); line-height: 1.1;
}
.brand-tagline { display: block; font-size: 0.72rem; color: var(--text-muted); }

.topbar .header-search {
  flex: 1; max-width: 500px; margin: 0 auto;
}
.topbar .lang-toggle, .topbar .theme-toggle {
  flex-shrink: 0;
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  position: sticky; top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.sidebar-inner {
  display: flex; flex-direction: column;
  padding: 0.75rem 0.5rem 1.25rem;
  min-height: 100%;
  gap: 0.5rem;
}
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group-bottom { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
.side-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700;
  padding: 0.35rem 0.75rem 0.25rem; margin-top: 0.5rem;
}
.sidebar a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-size: 0.92rem; font-weight: 500;
  border-left: 3px solid transparent; margin-left: -3px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sidebar a .i { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.sidebar a:hover { background: var(--bg-warm); color: var(--primary-dark); }
.sidebar a:hover .i { color: var(--primary-dark); }
.sidebar a.active {
  background: var(--primary-light); color: var(--primary-dark);
  border-left-color: var(--primary); font-weight: 600;
}
[data-theme="dark"] .sidebar a.active { background: rgba(34,211,238,0.10); }
.sidebar a.active .i { color: var(--primary-dark); }
.sidebar a.side-cta {
  color: var(--accent); font-weight: 700;
  background: var(--bg); border: 1px solid var(--accent-light);
}
.sidebar a.side-cta:hover { background: var(--accent-light); color: var(--accent); }
.sidebar a.side-cta .i { color: var(--accent); }
.sidebar a.side-cta.active { border-color: var(--accent); }

.sidebar-backdrop { display: none; }

/* Main */
.main { grid-area: main; }
.main-inner {
  max-width: 1000px; margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.theme-toggle {
  background: none; border: 1px solid var(--border-strong); color: var(--text-muted);
  padding: 0.35rem 0.6rem; border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: 0.85rem;
}
.theme-toggle:hover { color: var(--primary-dark); border-color: var(--primary); }

.header-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 9999px; padding: 0.3rem 0.9rem;
  min-width: 220px;
}
.header-search input {
  border: 0; background: transparent; outline: none; flex: 1;
  color: var(--text); font-family: inherit; font-size: 0.9rem;
}
.header-search:focus-within { border-color: var(--primary); background: var(--bg); }

/* Main */
main { padding: 2rem 0 3rem; min-height: 60vh; }

h1, h2, h3, h4 {
  font-family: var(--font-heading); color: var(--text);
  line-height: 1.25; margin-top: 2rem; margin-bottom: 0.75rem;
}
h1 { font-size: 2.25rem; margin-top: 0; }
h2 { font-size: 1.6rem; color: var(--primary-dark); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; margin: 0 0 1rem; }
li { margin: 0.35rem 0; }
a { color: var(--primary-dark); }
a:hover { color: var(--accent); }
mark { background: var(--accent-light); color: var(--text); padding: 0 0.15rem; border-radius: 2px; }
code { font-family: "SF Mono", Consolas, monospace; background: var(--bg-soft);
       padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

table {
  width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.95rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
th, td { padding: 0.7rem 0.9rem; text-align: left;
         border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; color: var(--text);
     font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-warm); }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-warm) 100%);
  border-radius: var(--radius-lg); padding: 2.5rem 1.5rem;
  margin-bottom: 1.5rem; text-align: center;
}
.hero h1 { font-size: 2.5rem; color: var(--primary-dark); margin-bottom: 0.5rem; }
.hero .subtitle { font-size: 1.15rem; color: var(--text-muted);
                   max-width: 700px; margin: 0 auto 1.25rem; }
.hero-search { max-width: 500px; margin: 0 auto; }
.hero-search input {
  width: 100%; padding: 0.9rem 1.25rem; font-size: 1.05rem;
  border: 2px solid var(--primary); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-family: inherit; outline: none;
  box-shadow: var(--shadow);
}
.hero-search input:focus { border-color: var(--accent); }
.hero .stats {
  display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem;
}
.hero .stat-value {
  display: block; font-family: var(--font-heading); font-size: 2.25rem;
  font-weight: 700; color: var(--accent); line-height: 1;
}
.hero .stat-label {
  display: block; font-size: 0.8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem;
}

/* Seasonal banner */
.season-banner {
  background: var(--bg-warm); border-left: 4px solid var(--accent);
  color: var(--text); padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.95rem;
}
.season-banner a { color: var(--accent); text-decoration: underline; font-weight: 600; }
[data-theme="dark"] .season-banner { background: rgba(234,88,12,0.10); }

/* Feature CTAs */
.feature-cta {
  display: grid; gap: 1rem; margin: 1.5rem 0;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.feature-cta a {
  background: var(--bg); border: 2px solid var(--primary-light); padding: 1.25rem;
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.feature-cta a:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-cta .fc-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.feature-cta strong { display: block; color: var(--primary-dark); margin-bottom: 0.25rem; }
.feature-cta small { color: var(--text-muted); font-size: 0.85rem; }

/* Grid + cards */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-decoration: none; color: inherit; display: block; position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover);
              border-color: var(--primary-light); }

/* --- Richer breed cards: group accent bar + at-a-glance stat pills --- */
.breed-card { border-left: 4px solid var(--gc, var(--border)); }
.breed-card:hover { border-left-color: var(--gc, var(--primary-light)); }
.card-stats { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.55rem; }
.pill {
  font-size: 0.7rem; font-weight: 600; line-height: 1.55; white-space: nowrap;
  padding: 0.08rem 0.5rem; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border);
}
.pill-excellent { background: rgba(5,150,105,0.13); color: #047857; border-color: transparent; }
.pill-good      { background: rgba(2,132,199,0.13); color: #0369a1; border-color: transparent; }
.pill-poor      { background: rgba(220,38,38,0.12); color: #b91c1c; border-color: transparent; }
[data-theme="dark"] .pill-excellent { color: #34d399; background: rgba(5,150,105,0.20); }
[data-theme="dark"] .pill-good { color: #7dd3fc; background: rgba(2,132,199,0.22); }
[data-theme="dark"] .pill-poor { color: #fca5a5; background: rgba(220,38,38,0.22); }

/* --- Breed page: at-a-glance stat strip --- */
.glance {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem; margin: 0 0 1.5rem;
}
.glance-item {
  display: flex; align-items: center; gap: 0.55rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.8rem;
}
.glance-item .i { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }
.glance-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.glance-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); }
.glance-val { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* --- Readable measure for long-form prose (keep tables/cards/hero full width) --- */
.main-inner p { max-width: 74ch; }
.card p, .disclaimer-box p, .glance p, td p, .today p, .hero p, .feature-cta p { max-width: none; }

/* --- Hero live-search type-ahead dropdown --- */
.hero-search { position: relative; }
.hero-ac {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  overflow: hidden; text-align: left; display: none;
}
.hero-ac.open { display: block; }
.hero-ac a {
  display: flex; align-items: baseline; gap: 0.6rem; padding: 0.55rem 0.85rem;
  text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border);
}
.hero-ac a:last-of-type { border-bottom: 0; }
.hero-ac a:hover, .hero-ac a.sel { background: var(--bg-warm); }
.hero-ac .ac-kind {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-light); flex-shrink: 0; width: 64px; padding-top: 0.1rem;
}
.hero-ac .ac-name { font-weight: 600; }
.hero-ac .ac-more { padding: 0.5rem 0.85rem; color: var(--text-muted); font-size: 0.8rem; background: var(--bg-soft); }
.card h3 { margin: 0 0 0.35rem; color: var(--primary-dark);
           font-family: var(--font-body); font-size: 1.1rem; font-weight: 600; }
.card .card-meta { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.card .card-desc { color: var(--text); font-size: 0.88rem; line-height: 1.5; }
.card .breed-svg {
  width: 100%; height: 140px; margin-bottom: 0.75rem;
  background: var(--bg-soft); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card .breed-svg svg { width: 70px; height: 60px; }
.card .breed-svg img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  position: relative; z-index: 1;
}
/* Show the WHOLE dog (contain), and fill the empty space with a blurred,
   zoomed copy of the same photo so there are no bare letterbox bars. Uses
   ::after so it coexists with the ::before load-shimmer below; --breed-bg is
   set per-image on the wrap by breed_image(). */
.breed-img-wrap::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--breed-bg) center / cover no-repeat;
  filter: blur(16px) brightness(0.96); transform: scale(1.15);
}
.breed-img-wrap .fallback { display: none; }
.breed-img-wrap.errored img { display: none; }
.breed-img-wrap.errored::after { display: none; }
.breed-img-wrap.errored .fallback { display: flex; position: relative; z-index: 1; }
.img-credit {
  font-size: 0.7rem; color: var(--text-light); margin-top: 0.35rem;
  text-align: right;
}
.img-credit a { color: var(--text-light); }

.tag {
  display: inline-block; font-size: 0.68rem; padding: 0.15rem 0.5rem;
  background: var(--bg-warm); color: var(--accent); border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  margin-right: 0.35rem;
}
.tag.indian { background: var(--accent-light); color: var(--accent); }
.tag.urgent { background: #fee2e2; color: var(--danger); }
.tag.emergency { background: var(--danger); color: white; }
.tag.routine { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] .tag.urgent { background: #7f1d1d; color: #fecaca; }
[data-theme="dark"] .tag.routine { background: var(--primary-light); color: var(--primary-dark); }

/* Urgency badges */
.urgency-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.75rem; border-radius: 9999px;
  font-size: 0.85rem; font-weight: 600;
}
.urgency-badge.emergency { background: var(--danger); color: white; }
.urgency-badge.urgent { background: var(--warn); color: white; }
.urgency-badge.routine { background: var(--primary); color: white; }

/* Breed/condition headers */
.detail-header {
  display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem;
  border-left: 4px solid var(--primary); padding-left: 1.25rem;
  margin-bottom: 1.5rem; align-items: center;
}
.detail-header .hero-svg {
  width: 240px; height: 200px; background: var(--bg-soft);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.detail-header .hero-svg svg { width: 120px; height: 100px; }
.detail-header .hero-svg img { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; }

/* --- Breed vocalization "▶ Listen" control (next to the breed image) --- */
.breed-audio { margin: 0.5rem 0 0.4rem; }
.listen-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 600; line-height: 1;
  padding: 0.42rem 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-soft);
  color: var(--text); text-decoration: none; transition: border-color .15s, background .15s, color .15s;
}
.listen-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.listen-btn .listen-ico { color: var(--primary); font-size: 0.8em; }
.listen-btn .listen-kind { color: var(--text-muted); font-weight: 500; }
.listen-btn.empty { border-style: dashed; }
.listen-btn.empty:hover { border-color: var(--accent); color: var(--accent); }
.listen-btn.empty .listen-ico { color: var(--text-light); }
.listen-btn.playing { border-color: var(--primary); background: var(--primary-light);
  color: var(--primary-dark); animation: bark-pulse 1s ease-in-out infinite; }
@keyframes bark-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(8,145,178,0.35); } 50% { box-shadow: 0 0 0 5px rgba(8,145,178,0); } }
@media (prefers-reduced-motion: reduce) { .listen-btn.playing { animation: none; } }
.listen-credit { display: block; font-size: 0.72rem; color: var(--text-light); margin-top: 0.25rem; }
.detail-header h1 { margin: 0; font-size: 2rem; }
.detail-header .group {
  color: var(--accent); font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; margin-bottom: 0.25rem;
}
.detail-header .origin { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.35rem; }

.detail-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem;
}
.action-btn {
  padding: 0.4rem 0.85rem; font-size: 0.85rem; background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; font-family: inherit;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.action-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Disclaimer */
.disclaimer-box {
  background: var(--bg-warm); border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem; border-radius: var(--radius);
  font-size: 0.9rem; color: var(--text); margin: 1.5rem 0;
}
.disclaimer-box strong { color: var(--accent); }
.disclaimer-box.warn { border-left-color: var(--warn); background: rgba(217,119,6,0.08); }
.disclaimer-box.danger { border-left-color: var(--danger); background: rgba(220,38,38,0.05); }

/* Breadcrumbs */
.breadcrumbs { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary-dark); }

/* Filter chips */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.5rem;
  padding: 0.75rem; background: var(--bg-soft); border-radius: var(--radius);
}
.filter-group { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.filter-group-label {
  font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; margin-right: 0.35rem;
}
.chip {
  padding: 0.35rem 0.8rem; font-size: 0.82rem; background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 9999px;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  text-decoration: none; font-family: inherit; user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.active {
  background: var(--primary); color: white; border-color: var(--primary);
}
.chip.chip-danger.active { background: var(--danger); border-color: var(--danger); }
.chip.chip-warn.active { background: var(--warn); border-color: var(--warn); }

/* Search results */
.search-box { position: relative; margin: 1.5rem 0; }
.search-box input {
  width: 100%; padding: 0.9rem 1.25rem; font-size: 1.05rem;
  border: 2px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-family: inherit; outline: none;
}
.search-box input:focus { border-color: var(--primary); }
.search-results { margin-top: 1.5rem; }
.search-results h3 {
  color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.05em; margin-top: 1.5rem;
}
.search-result {
  padding: 0.75rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; display: block;
}
.search-result:hover { background: var(--bg-warm); }
.search-result strong { color: var(--primary-dark); }
.search-result .snippet { font-size: 0.9rem; color: var(--text-muted); }

/* Chapter layout */
.chapter-layout { display: grid; grid-template-columns: 200px 1fr; gap: 2.5rem; }
.toc-sidebar { position: sticky; top: 72px; align-self: start; font-size: 0.9rem; }
.toc-sidebar h4 {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-top: 0; margin-bottom: 0.75rem;
}
.toc-sidebar ul { list-style: none; padding: 0; margin: 0; }
.toc-sidebar li { margin: 0.35rem 0; line-height: 1.4; }
.toc-sidebar a { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; }
.toc-sidebar a:hover { color: var(--primary-dark); }

/* Wizard */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-progress {
  display: flex; gap: 4px; margin-bottom: 1.5rem;
}
.wizard-progress > span {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px;
}
.wizard-progress > span.done { background: var(--primary); }
.wizard-step h2 { margin-top: 1rem; }
.wizard-options {
  display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 1.5rem 0;
}
.wizard-options button {
  padding: 1rem; background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: left;
  font-family: inherit; font-size: 0.95rem; color: var(--text);
  transition: border-color 0.15s;
}
.wizard-options button:hover { border-color: var(--primary); }
.wizard-options button.selected { border-color: var(--primary); background: var(--primary-light); }
.wizard-controls {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem;
}

/* Print */
@media print {
  .topbar, .sidebar, .sidebar-backdrop, .site-footer,
  .theme-toggle, .lang-toggle, .sidebar-toggle,
  .header-search, .breadcrumbs, .filter-bar, .detail-actions, .action-btn,
  .toc-sidebar, .mini-toc, .season-banner, .feature-cta, .hero-search,
  .wizard-controls, .search-box, .back-to-top, .useful { display: none !important; }
  body { background: white; color: black; }
  .app-shell { display: block; }
  .main-inner { max-width: none; padding: 0; }
  .card, table, .disclaimer-box { border-color: #999; }
  a { color: black; text-decoration: underline; }
  h1, h2, h3 { color: black; page-break-after: avoid; }
  .chapter-layout, .detail-with-toc { grid-template-columns: 1fr; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); padding: 2rem 0;
  background: var(--bg-soft); margin-top: 3rem;
  font-size: 0.85rem; color: var(--text-muted);
}
.site-footer p { margin: 0.35rem 0; }
.site-footer .disclaimer { font-size: 0.75rem; line-height: 1.5;
                            max-width: 800px; margin: 0.75rem auto; }
.site-footer .footer-links { text-align: center; margin-top: 1rem; }
.site-footer .footer-links a { color: var(--text-muted); margin: 0 0.35rem; }

/* Responsive */
@media (max-width: 800px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  .hero { padding: 1.75rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero .stats { gap: 1rem; }
  .hero .stat-value { font-size: 1.75rem; }
  .chapter-layout { grid-template-columns: 1fr; }
  .toc-sidebar { position: static; margin-bottom: 1rem; }
  .detail-header { grid-template-columns: 1fr; }
  .detail-header .hero-svg { width: 100%; height: 120px; }
  table { font-size: 0.85rem; }
  .main-inner { padding: 1.25rem 1rem 2rem; }
}
@media (max-width: 600px) {
  .brand-name { font-size: 1.05rem; }
  .brand-tagline { display: none; }
  .brand svg.i-brand { width: 26px; height: 26px; }
}

/* ==========================================================================
   UI v3 additions — card polish, iconography, personalisation, i18n
   ========================================================================== */

/* Card copy — CSS clamp instead of char truncation */
.card { cursor: pointer; }
.card .card-meta {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.card .card-desc {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image skeleton shimmer while Wikimedia loads */
.breed-img-wrap { position: relative; width: 100%; height: 100%; }
.breed-img-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--border) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}
.breed-img-wrap img { position: relative; z-index: 1; }
.breed-img-wrap.loaded::before,
.breed-img-wrap.errored::before { display: none; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .breed-img-wrap::before { animation: none; }
}

/* Inline SVG icon sizing */
.i { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em;
     fill: currentColor; flex-shrink: 0; }
.i-lg { width: 1.75rem; height: 1.75rem; color: var(--primary-dark); }
.i-xl { width: 2rem; height: 2rem; }
.brand svg.i-brand { width: 32px; height: 32px; }
.season-banner .i { color: var(--accent); width: 1.25rem; height: 1.25rem; }
.header-search .i { color: var(--text-muted); }
.theme-toggle .i { width: 1rem; height: 1rem; }

/* Header nav: keep top row clean; extra items go into "More" popover */
.nav-more { position: relative; }
.nav-more-btn {
  background: none; border: 0; font: inherit; color: var(--text-muted);
  cursor: pointer; padding: 0.35rem 0; font-size: 0.9rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.nav-more-btn:hover { color: var(--primary-dark); }
.nav-more-panel {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  padding: 0.5rem; z-index: 20;
}
.nav-more-panel.open { display: block; }
.nav-more-panel a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.nav-more-panel a:hover { background: var(--bg-soft); color: var(--primary-dark); }
.nav-more-panel .nav-sep {
  height: 1px; background: var(--border); margin: 0.35rem 0.25rem;
}

/* Sidebar as off-canvas drawer on mobile */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: 280px; height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%); transition: transform 0.22s ease;
    z-index: 45; box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,0.35); z-index: 44;
  }
  .sidebar-backdrop.open { display: block; }
  .topbar { padding: 0 0.75rem; }
  .brand-tagline { display: none; }
  .topbar .header-search { max-width: none; margin-left: 0; }
}
@media (min-width: 901px) {
  .sidebar-toggle { display: none; }
}

/* Header typeahead */
.header-search { position: relative; }
.typeahead {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  max-height: 60vh; overflow-y: auto; z-index: 30; padding: 0.35rem;
}
.typeahead.open { display: block; }
.typeahead a {
  display: block; padding: 0.55rem 0.75rem; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
  line-height: 1.35;
}
.typeahead a:hover, .typeahead a.hl { background: var(--bg-soft); color: var(--primary-dark); }
.typeahead .ta-kind {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-right: 0.5rem; font-weight: 600;
}
.typeahead .ta-empty { padding: 0.75rem; color: var(--text-muted); font-size: 0.85rem; }

/* Hero-lite for persona/landing pages */
.hero-lite {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
  border-radius: var(--radius-lg); padding: 2rem 1.5rem 1.5rem;
  margin-bottom: 1.5rem;
}
.hero-lite h1 { margin-top: 0; color: var(--primary-dark); }
.hero-lite .lead {
  font-size: 1.1rem; color: var(--text-muted); max-width: 700px; margin: 0.5rem 0 0;
}

/* Back-to-top */
.back-to-top {
  position: fixed; bottom: 20px; right: 20px; z-index: 20;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: white; border: 0;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-hover);
  transition: transform 0.15s;
}
.back-to-top.visible { display: inline-flex; }
.back-to-top:hover { transform: translateY(-3px); background: var(--primary-dark); }
.back-to-top svg { width: 20px; height: 20px; fill: currentColor; }

/* Was this useful? widget */
.useful {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 2rem 0 1rem; text-align: center;
}
.useful strong { display: block; margin-bottom: 0.5rem; color: var(--text); }
.useful button {
  padding: 0.5rem 1rem; margin: 0 0.25rem; font-family: inherit; font-size: 0.9rem;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  cursor: pointer;
}
.useful button:hover { border-color: var(--primary); color: var(--primary-dark); }
.useful button.chose { background: var(--primary); color: white; border-color: var(--primary); }
.useful .thanks { color: var(--success); font-weight: 600; }
.useful textarea {
  display: block; width: 100%; margin: 0.75rem 0 0; padding: 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 0.9rem; resize: vertical; min-height: 60px;
  background: var(--bg); color: var(--text);
}

/* Mini-TOC on breed detail pages */
.detail-with-toc { display: grid; grid-template-columns: 1fr 200px; gap: 2rem; }
.mini-toc {
  position: sticky; top: 72px; align-self: start; font-size: 0.85rem;
  border-left: 2px solid var(--border); padding-left: 0.75rem;
}
.mini-toc h4 {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin: 0 0 0.5rem;
}
.mini-toc ul { list-style: none; padding: 0; margin: 0; }
.mini-toc li { margin: 0.35rem 0; }
.mini-toc a { color: var(--text-muted); text-decoration: none; }
.mini-toc a:hover, .mini-toc a.active { color: var(--primary-dark); font-weight: 600; }
.mini-toc a.active { border-left: 2px solid var(--primary); margin-left: -0.85rem; padding-left: 0.75rem; }
@media (max-width: 900px) { .detail-with-toc { grid-template-columns: 1fr; } .mini-toc { display: none; } }

/* Body map on symptom checker */
.body-map {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin: 1.5rem 0;
  text-align: center;
}
.body-map h3 { margin-top: 0; }
.body-map svg { max-width: 100%; height: auto; max-height: 260px; }
.body-map .region {
  fill: var(--primary-light); stroke: var(--primary); stroke-width: 1.5;
  cursor: pointer; transition: fill 0.15s;
}
.body-map .region:hover, .body-map .region:focus {
  fill: var(--accent-light); stroke: var(--accent); outline: none;
}
.body-map .region-label { pointer-events: none; font-size: 12px; font-weight: 600; fill: var(--text); }
[data-theme="dark"] .body-map .region { fill: var(--primary-dark); }
[data-theme="dark"] .body-map .region-label { fill: white; }

/* Compare page — sticky first column on mobile */
.cmp-scroll { overflow-x: auto; position: relative; }
.cmp-scroll table { min-width: 640px; margin: 0; }
@media (max-width: 640px) {
  .cmp-scroll table th:first-child, .cmp-scroll table td:first-child {
    position: sticky; left: 0; background: var(--bg-soft); z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
  }
}

/* Lang toggle */
.lang-toggle {
  background: none; border: 1px solid var(--border-strong); color: var(--text-muted);
  padding: 0.3rem 0.55rem; border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
}
.lang-toggle:hover { color: var(--primary-dark); border-color: var(--primary); }
.lang-toggle.on { background: var(--primary); color: white; border-color: var(--primary); }

/* Today widget (personalised homepage card) */
.today {
  background: linear-gradient(135deg, var(--bg-warm) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  margin: 1.5rem 0; border: 1px solid var(--border);
}
.today-empty { display: none; }
.today .today-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary-dark); font-weight: 700; margin-bottom: 0.35rem;
}
.today h3 { margin: 0 0 0.35rem; color: var(--text); }
.today p { margin: 0.35rem 0; color: var(--text); }
.today .today-cta { margin-top: 0.75rem; }
.today .today-cta a { margin-right: 0.5rem; }

/* "Continue reading" resume panel — lives in the sidebar, under a toggle button */
.side-resume { margin-bottom: 0.25rem; }
.side-resume-toggle {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.55rem 0.75rem; border: 0; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary-dark);
  font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; text-align: left;
}
.side-resume-toggle:hover { background: var(--primary); color: #fff; }
.side-resume-toggle:hover .i { color: #fff; }
.side-resume-toggle .i { width: 18px; height: 18px; color: var(--primary-dark); flex-shrink: 0; }
.side-resume-toggle .i:last-child { margin-left: auto; transition: transform 0.15s; }
.side-resume-toggle.collapsed .i:last-child { transform: rotate(-90deg); }
.today-panel { margin: 0.5rem 0 0; padding: 0.85rem 0.9rem; }
.today-panel h3 { font-size: 0.95rem; }
.today-panel p { font-size: 0.85rem; }
.today-panel .today-cta { margin-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.today-panel .today-cta a { margin: 0; }

/* Print-as-PDF button — same visual as action-btn */
.print-btn { }

/* Focus-visible ring inside typeahead & body-map */
.typeahead a:focus-visible, .body-map .region:focus-visible {
  outline-offset: 1px;
}
