:root {
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f3ece2;
  --text: #2a2420;
  --muted: #6b6159;
  --line: #e7ddd0;
  --brand: #2f6b4f;
  --brand-dark: #234f3b;
  --brand-soft: #e3efe8;
  --accent: #d9734e;
  --accent-soft: #fbe7dd;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(60, 40, 20, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --surface: #211d1a; --surface-2: #2a2521; --text: #f1ebe4; --muted: #b3a89c;
    --line: #3a332d; --brand: #6fbf95; --brand-dark: #8fd3ae; --brand-soft: #1f3329;
    --accent: #ef9a78; --accent-soft: #3a261d; --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 Inter, system-ui, sans-serif; }
img { max-width: 100%; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 1.7rem; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.2rem; margin: 1.4rem 0 .5rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 50; }

/* Header and footer */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.3rem; color: var(--text); text-decoration: none; margin: 0; }
.main-nav { display: flex; gap: 20px; font-weight: 600; font-size: .95rem; }
.main-nav a { color: var(--muted); text-decoration: none; }
.main-nav a:hover { color: var(--text); }
.site-foot { background: var(--surface-2); margin-top: 64px; padding: 40px 0 24px; font-size: .95rem; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; align-content: start; }
.foot-links a { color: var(--text); text-decoration: none; }
.fine { font-size: .82rem; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }

/* Page header */
.page-head { background: var(--brand-soft); padding: 48px 0 40px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 6px 0 10px; }
.dek { font-size: 1.15rem; color: var(--muted); max-width: 680px; margin: 0; }
.byline { font-size: .9rem; color: var(--muted); margin: 14px 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0; }

/* Layout */
main { padding-top: 32px; }
.layout-with-toc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; }
.layout-single .body { max-width: 760px; }
.kind-home .body { max-width: none; }
.toc { position: sticky; top: 88px; align-self: start; font-size: .92rem; }
.toc p { font-weight: 700; margin: 0 0 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; }
.toc li a:hover { color: var(--brand); }

/* Content blocks */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); }
.callout { background: var(--accent-soft); border-radius: 12px; padding: 14px 18px; margin: 20px 0; }
.note { font-size: .88rem; color: var(--muted); }
.ad-slot:empty { display: none; }
.btn { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; padding: 12px 22px; border-radius: 999px; text-decoration: none; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { color: #fff; filter: brightness(.95); }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.card-title { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 1.2rem; }
.card-dek { color: var(--muted); font-size: .92rem; line-height: 1.5; }

/* Photos */
.card.has-img { padding-top: 0; overflow: hidden; }
.card-img { width: calc(100% + 36px); max-width: none; margin: 0 -18px 8px; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-2); }
.card-note { font-size: .85rem; color: var(--brand); font-weight: 600; }
.breed-photo { margin: 0 0 20px; }
.breed-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.breed-photo figcaption { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.breed-photo figcaption a { color: var(--muted); }

/* Comparisons */
.vs-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.vs-photo { position: relative; display: block; border-radius: var(--radius); overflow: hidden; color: #fff; text-decoration: none; }
.vs-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.vs-photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 10px; font-weight: 700; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.compare-table th[scope="col"] { vertical-align: bottom; }
.compare-table th[scope="col"] img { width: 100%; max-width: 160px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; margin-bottom: 6px; }
.compare-table th[scope="row"] { font-weight: 500; white-space: nowrap; }
.choose section { padding-bottom: 8px; }
.versus { font-size: .95rem; }
.vs-list { columns: 2; padding-left: 1.2em; }
.vs-list li { break-inside: avoid; margin-bottom: 6px; }
.cmp-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.cmp-pick span, .calc-field span { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
select { width: 100%; font: inherit; font-size: .95rem; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 9px 10px; }
select:focus { border-color: var(--brand); outline: none; }

/* Family rating */
.family-badge { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; align-self: flex-start; }
.family-badge.great { background: var(--brand-soft); color: var(--brand); }
.family-badge.good { background: var(--surface-2); color: var(--brand); }
.family-badge.caution { background: var(--accent-soft); color: var(--accent); }
.family-box { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; border-radius: 12px; padding: 12px 16px; margin: 4px 0 8px; }
.family-box strong { font-size: 1.05rem; }
.family-box span { color: var(--muted); }
.family-box.great, .family-box.good { background: var(--brand-soft); }
.family-box.caution { background: var(--accent-soft); }

/* Gear (affiliate) */
.gear { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.gear-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.gear-item p { margin: 0; font-size: .9rem; color: var(--muted); line-height: 1.5; flex: 1; }
.gear-link { margin-top: 8px; font-weight: 700; font-size: .9rem; }

/* Ads */
.layout-with-toc.has-rail { grid-template-columns: 200px minmax(0, 1fr) 300px; gap: 36px; }
.ad-rail { position: sticky; top: 88px; align-self: start; }
.ad-slot.ad-on { margin: 28px 0; text-align: center; }
.ad-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.ad-preview { display: grid; place-items: center; min-height: 250px; margin: 28px 0; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .85rem; }
.ad-rail .ad-preview { min-height: 600px; margin: 0; }
@media (max-width: 1180px) { .layout-with-toc.has-rail { grid-template-columns: 200px minmax(0, 1fr); } .ad-rail { display: none; } }
main.has-rail { max-width: 1280px; }
.layout-single.has-rail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; }
@media (max-width: 1180px) { .layout-single.has-rail { display: block; } }

/* Breed filters */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 8px 0 4px; }
.filters fieldset { border: 0; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters legend { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; width: 100%; }
.filters label { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .9rem; cursor: pointer; }
.filters label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
.filters input { accent-color: var(--brand); margin: 0; }
.filter-count { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.card[hidden], .breed-group[hidden] { display: none; }

/* Cost calculator */
.calc { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.calc-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 8px; }
.calc-totals div { background: var(--brand-soft); border-radius: 14px; padding: 14px 16px; }
.calc-totals span { display: block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.calc-totals strong { display: block; font-family: Fraunces, Georgia, serif; font-size: 1.35rem; margin: 2px 0; }
.calc-totals small { color: var(--muted); }
.calc-result td:last-child { text-align: right; white-space: nowrap; }

/* Breed pages */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facts span { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts strong { font-size: 1rem; }
.traits th { font-weight: 500; width: 55%; }
.meter { display: inline-flex; gap: 5px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--brand); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.two-col section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 12px; }
.pros h3 { color: var(--brand); }
.cons h3 { color: var(--accent); }
.directory { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 22px 16px; }
.dir-empty { background: var(--surface-2); border-radius: 12px; padding: 4px 18px; }
.dir-cta { font-size: .95rem; }
.quiz-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--brand-soft); border-radius: var(--radius); padding: 18px 22px; margin: 28px 0; }
.quiz-cta p { margin: 0; flex: 1 1 300px; }

/* Home */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 24px 0 8px; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); margin: 8px 0 14px; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 24px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { background: var(--brand-soft); border-radius: 28px; aspect-ratio: 1; display: grid; place-items: center; }
.hero-art svg { width: 70%; height: auto; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.step b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; margin-bottom: 8px; }
.step h3 { margin: 4px 0; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Quiz */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); max-width: 640px; }
.quiz-progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.quiz-progress span { display: block; height: 100%; background: var(--brand); transition: width .25s; }
.quiz-step { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin: 0; }
.quiz h2 { margin: 6px 0 16px; font-size: 1.45rem; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option { text-align: left; background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 13px 16px; font: inherit; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.quiz-option:hover, .quiz-option:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.quiz-option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.quiz-option[aria-pressed="true"]::after { content: " ✓"; color: var(--brand); }
.quiz-hint { margin: -8px 0 14px; color: var(--muted); font-size: .95rem; }
.quiz-continue { margin-top: 14px; }
.quiz-continue[disabled] { opacity: .45; cursor: not-allowed; }
.quiz-back { background: none; border: 0; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; margin-top: 14px; padding: 4px 0; }
.quiz-result .match { background: var(--brand-soft); border-radius: 14px; padding: 16px 18px; margin: 12px 0; }
.quiz-result .match h3 { margin: 0 0 4px; font-size: 1.5rem; }
.quiz-result .score { font-weight: 700; color: var(--brand); font-size: .9rem; }
.quiz-result .runners { display: grid; gap: 8px; margin: 12px 0 16px; }
.quiz-result .runner { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 8px 8px; color: var(--text); text-decoration: none; }
.quiz-result .runner img { width: 72px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; }
.runner-name { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.runner-name small { color: var(--muted); font-size: .8rem; }
.runner-pct { font-weight: 700; color: var(--brand); }
.quiz-result .match { padding: 0; overflow: hidden; }
.match-img { width: 100%; aspect-ratio: 16 / 9; max-height: 280px; object-fit: cover; }
.match-body { padding: 16px 18px; }
.match-body .family-badge { display: inline-block; }
.reasons-title { font-weight: 700; font-size: .85rem; margin: 14px 0 4px; }
.reasons { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; font-size: .95rem; }
.reasons.good li::before { content: "✓ "; color: var(--brand); font-weight: 700; }
.reasons.bad li::before { content: "! "; color: var(--accent); font-weight: 700; }
.match-body .quiz-actions { margin-top: 14px; }
.quiz-result .runner:hover { border-color: var(--brand); }
.quiz-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Pop-up */
.fq-launcher { position: fixed; right: 18px; bottom: 18px; z-index: 30; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; }
.fq-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(20, 15, 10, .55); display: grid; place-items: center; padding: 16px; }
.fq-overlay[hidden] { display: none; }
.fq-dialog { position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 20px; }
.fq-dialog .quiz { max-width: none; }
.fq-dialog .quiz-progress { margin-right: 44px; }
.fq-close { position: absolute; top: 10px; right: 12px; z-index: 1; background: var(--surface-2); color: var(--text); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }

/* Embed */
body.embed { background: transparent; padding: 8px; }
body.embed .quiz { box-shadow: none; max-width: none; }
.powered { text-align: center; font-size: .82rem; color: var(--muted); }
.code { background: var(--surface-2); border-radius: 12px; padding: 14px; font: .85rem/1.5 ui-monospace, Menlo, monospace; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 860px) {
  .layout-with-toc { display: block; }
  .toc { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .main-nav { gap: 14px; font-size: .9rem; }
  .facts { grid-template-columns: 1fr 1fr; }
  .cmp-controls, .calc, .calc-totals { grid-template-columns: 1fr; }
  .vs-list { columns: 1; }
  .main-nav { gap: 12px; }
  .two-col, .foot-grid { grid-template-columns: 1fr; }
  .quiz { padding: 18px; }
  .fq-launcher { right: 12px; bottom: 12px; padding: 10px 14px; }
}
