/* haustiersache.de: design system v1 (2026-11-09).
   Tokens and rules are documented in EA/projects/de-pet-site/design/DESIGN.md.
   One file, no web fonts, no JS dependencies. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark;

  /* colour (light) - every text pair is WCAG AA or better, see DESIGN.md */
  --bg: #faf7f2;          /* warm paper */
  --surface: #ffffff;
  --surface-2: #f3eee6;   /* table head, zebra, quiet boxes */
  --text: #1d2826;
  --muted: #55615e;
  --border: #ddd5c8;
  --border-strong: #c3b9a9;
  --accent: #0e5c55;      /* deep teal */
  --accent-strong: #0a4742;
  --accent-tint: #e6f0ee;
  --on-accent: #ffffff;
  --warn: #8a4b0f;        /* ochre, for "Bitte vorher anrufen" */
  --warn-tint: #fbf0e2;
  --focus: #b4530f;

  /* map classes (sequential teal, light to dark) */
  --map-0: #d7ebe7;
  --map-1: #9fcfc6;
  --map-2: #5aa79b;
  --map-3: #2b7b70;
  --map-4: #0e5c55;
  --map-none: #ece6dc;

  /* type */
  --font-head: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", "Noto Serif", Cambria, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Noto Sans Mono", Menlo, Consolas, monospace;
  --fs-0: 0.875rem;   /* small: Stand line, captions */
  --fs-1: 1.0625rem;  /* body 17px */
  --fs-2: 1.25rem;
  --fs-3: 1.5rem;
  --fs-4: clamp(1.75rem, 1.35rem + 1.8vw, 2.5rem);
  --lh-body: 1.65;
  --lh-head: 1.2;

  /* space and shape */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;   --s-7: 3rem;    --s-8: 4rem;
  --radius: 10px;
  --radius-sm: 6px;
  --measure: 42rem;   /* prose width */
  --wide: 70rem;      /* page width, tables */
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111816;
    --surface: #18211f;
    --surface-2: #1f2a28;
    --text: #e6ece9;
    --muted: #a3b1ad;
    --border: #2e3b38;
    --border-strong: #42524e;
    --accent: #6fc9bc;
    --accent-strong: #93dacf;
    --accent-tint: #15302c;
    --on-accent: #0d1513;
    --warn: #f0b46e;
    --warn-tint: #2e2214;
    --focus: #f0b46e;
    --map-0: #1d3a36;
    --map-1: #245a52;
    --map-2: #2f7c70;
    --map-3: #4aa597;
    --map-4: #6fc9bc;
    --map-none: #24302d;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-1);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: var(--lh-head);
  font-weight: 700;
  margin: var(--s-6) 0 var(--s-3);
  letter-spacing: -0.005em;
}
h1 { font-size: var(--fs-4); margin-top: var(--s-3); }
h2 { font-size: var(--fs-3); }
h3 { font-size: var(--fs-2); }
p, ul, ol, dl, table, blockquote { margin: 0 0 var(--s-4); }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: var(--s-1); }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
strong { font-weight: 650; }
small, .small { font-size: var(--fs-0); }
abbr[title] { text-decoration: underline dotted; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: var(--gutter); top: -3rem; background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); z-index: 10; }
.skip-link:focus { top: var(--s-2); }

/* ---------- 3. Layout ---------- */
.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: var(--measure); }
main { padding-bottom: var(--s-7); }
.page-head { max-width: var(--measure); }

/* ---------- 4. Header and nav ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); padding-top: var(--s-3); padding-bottom: var(--s-3); }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--text); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand svg { width: 30px; height: 30px; flex: none; color: var(--accent); }
.brand-tld { color: var(--muted); font-weight: 400; }
.site-nav { flex: 1 1 auto; min-width: 0; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-1) var(--s-4); overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.site-nav li { margin: 0; flex: none; }
.site-nav a { display: inline-block; padding: var(--s-1) 0; color: var(--text); text-decoration: none; font-size: 0.97rem; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current] { border-bottom-color: var(--accent); color: var(--accent); }
@media (max-width: 720px) {
  .site-nav { flex-basis: 100%; }
  .site-nav ul { flex-wrap: wrap; overflow: visible; gap: 0 var(--s-4); }
}

/* ---------- 5. Breadcrumbs, Stand line ---------- */
.breadcrumbs { font-size: var(--fs-0); color: var(--muted); margin: var(--s-4) 0 0; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-1); }
.breadcrumbs li { margin: 0; }
.breadcrumbs li + li::before { content: "\203A"; margin-right: var(--s-1); color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); }
.stand {
  font-size: var(--fs-0); color: var(--muted);
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4);
  margin: 0 0 var(--s-5); padding-bottom: var(--s-3); border-bottom: 1px solid var(--border);
}
.stand strong { color: var(--text); font-weight: 600; }
.stand-line { font-size: var(--fs-0); color: var(--muted); margin: var(--s-2) 0 0; }
.stand-line a { color: var(--muted); }
.lede { font-size: 1.15rem; color: var(--text); max-width: var(--measure); }

/* ---------- 6. Answer box ---------- */
.answer {
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: 0 0 var(--s-5);
  max-width: var(--measure);
}
.answer-label { font-size: var(--fs-0); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 var(--s-1); }
.answer-figure { font-family: var(--font-head); font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); font-weight: 700; line-height: 1.15; margin: 0 0 var(--s-2); }
.answer-figure small { font-family: var(--font-body); font-size: 1rem; font-weight: 400; color: var(--muted); }
.answer p:last-child, .answer ul:last-child, .answer dl:last-child { margin-bottom: 0; }
.answer ul { padding-left: 1.2em; }
.answer .stand-line { border-top: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); padding-top: var(--s-2); margin-top: var(--s-3); }

/* ---------- 7. Boxes ---------- */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-5); max-width: var(--measure); }
.box > h2, .box > h3 { margin-top: 0; font-size: var(--fs-2); }
.box > :last-child { margin-bottom: 0; }
.box--warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 35%, transparent); border-left: 5px solid var(--warn); }
.box--warn > h2, .box--warn > h3 { color: var(--warn); }
.box--quiet { background: var(--surface-2); }
.facts { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: var(--s-2) var(--s-4); margin: 0 0 var(--s-4); }
.facts dt { font-weight: 600; color: var(--muted); font-size: 0.95rem; }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: 0; } .facts dd { margin-bottom: var(--s-3); } }
.yes { color: var(--accent); font-weight: 650; }
.no { color: var(--muted); font-weight: 650; }
.phone { font-size: 1.2rem; font-weight: 700; white-space: nowrap; }
.btn {
  display: inline-block; background: var(--accent); color: var(--on-accent); text-decoration: none;
  padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm); font-weight: 600; border: 0; font: inherit; cursor: pointer;
}
.btn:hover { background: var(--accent-strong); color: var(--on-accent); }

/* ---------- 8. Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 var(--s-5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.97rem; margin: 0; }
caption { caption-side: top; text-align: left; padding: var(--s-3) var(--s-4) var(--s-2); font-weight: 600; font-family: var(--font-head); font-size: 1.05rem; }
th, td { padding: var(--s-2) var(--s-4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface-2); font-weight: 650; font-size: 0.9rem; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child > * , tfoot tr:last-child > * { border-bottom: 0; }
tbody tr:nth-child(even) > * { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
tfoot th, tfoot td { background: var(--surface-2); font-weight: 650; border-top: 2px solid var(--border-strong); }
.table-wrap td:not(.r) { min-width: 9rem; }
td.r, th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* sticky first column (mobile readability) */
th:first-child, td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
thead th:first-child { z-index: 2; background: var(--surface-2); }
tbody tr:nth-child(even) > :first-child { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
tfoot > tr > :first-child { background: var(--surface-2); }
@media (max-width: 720px) {
  th:first-child, td:first-child { box-shadow: 1px 0 0 var(--border); max-width: 11rem; }
  th, td { padding: var(--s-2) var(--s-3); }
}
td .muted, .muted { color: var(--muted); }
.table-note { font-size: var(--fs-0); color: var(--muted); margin: calc(-1 * var(--s-4)) 0 var(--s-5); }
/* sortable (markup from /static/js/sort-table.js: th > button.sort-btn, aria-sort on th) */
th .sort-btn {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  display: inline-flex; gap: 0.3em; align-items: center; text-align: inherit; white-space: nowrap;
}
th .sort-btn::after { content: "\2195"; color: var(--muted); font-size: 0.85em; }
th[aria-sort="ascending"] .sort-btn::after { content: "\2191"; color: var(--accent); }
th[aria-sort="descending"] .sort-btn::after { content: "\2193"; color: var(--accent); }
th.r .sort-btn { flex-direction: row-reverse; }
tbody th .sort-btn::after { content: none; }
.table-filter { display: flex; gap: var(--s-2); align-items: center; margin: 0 0 var(--s-3); flex-wrap: wrap; }

/* ---------- 9. Quotes (Wortlaut), sources ---------- */
.wortlaut { margin: 0 0 var(--s-5); max-width: var(--measure); }
.wortlaut summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.95rem; }
.wortlaut ul { list-style: none; padding: 0; margin: var(--s-3) 0 0; }
.wortlaut li { margin: 0 0 var(--s-3); }
blockquote, .quote {
  margin: var(--s-2) 0 var(--s-3); padding: var(--s-2) var(--s-4);
  border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.95rem;
}
.quote cite, blockquote cite { display: block; font-style: normal; font-size: var(--fs-0); color: var(--muted); margin-top: var(--s-1); }
.sources { max-width: var(--measure); }
.sources ol { padding-left: 1.4em; font-size: 0.95rem; }
.sources li { margin-bottom: var(--s-2); }
.sources .src-date { color: var(--muted); font-size: var(--fs-0); }

/* ---------- 10. FAQ, related, korrektur ---------- */
.faq { max-width: var(--measure); }
.faq details { border-bottom: 1px solid var(--border); padding: var(--s-3) 0; }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: 650; list-style-position: outside; }
.faq summary h3 { display: inline; font-family: var(--font-body); font-size: 1.02rem; margin: 0; }
.faq details > div { margin-top: var(--s-2); }
.faq details > div > :last-child { margin-bottom: 0; }
.related ul, .link-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--s-2) var(--s-4); }
.related li, .link-list li { margin: 0; }
.link-list .meta { color: var(--muted); font-size: var(--fs-0); display: block; }
.korrektur { font-size: 0.95rem; color: var(--muted); max-width: var(--measure); border-top: 1px solid var(--border); padding-top: var(--s-4); margin-top: var(--s-6); }

/* ---------- 11. Cards (home, hubs) ---------- */
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s-4); margin: var(--s-5) 0; }
.cards li { margin: 0; }
.card { display: block; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4) var(--s-5); text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--accent); color: var(--text); }
.card h2, .card h3 { margin: 0 0 var(--s-1); font-size: var(--fs-2); color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- 12. Calculator, forms ---------- */
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-6); max-width: var(--measure); }
.calc h2 { margin-top: 0; font-size: var(--fs-2); }
.calc-row { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); align-items: end; margin-bottom: var(--s-3); }
.calc label, .field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: var(--s-1); }
select, input[type="number"], input[type="text"], input[type="email"], input[type="search"], input[type="date"], textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: var(--s-2) var(--s-3); min-height: 2.75rem; max-width: 100%;
}
input[type="number"] { width: 6rem; }
.calc-result { font-family: var(--font-head); font-size: var(--fs-3); font-weight: 700; margin: var(--s-3) 0 var(--s-1); }
.calc-detail { color: var(--muted); font-size: 0.95rem; margin: 0; }
/* Hundesteuer-Rechner (DOM built by /static/js/hundesteuer-rechner.js) */
.hst-form { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: end; margin: 0 0 var(--s-3); }
.hst-field { margin: 0; }
.hst-field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: var(--s-1); }
.hst-field input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); vertical-align: middle; margin-right: var(--s-2); }
.hst-result { border-top: 1px solid var(--border); padding-top: var(--s-3); }
.hst-total { font-family: var(--font-head); font-size: var(--fs-3); margin: 0 0 var(--s-2); }
.hst-lines { margin: 0 0 var(--s-2); color: var(--muted); font-size: 0.95rem; }
.hst-note, .hst-missing, .hst-link { font-size: 0.95rem; margin: 0 0 var(--s-2); }
.hst-missing { color: var(--warn); }

/* ---------- 13. Map (tile cartogram) ---------- */
.map { max-width: 26rem; margin: 0 0 var(--s-5); }
.map svg { display: block; width: 100%; }
.map .tile { stroke: var(--bg); stroke-width: 3; }
.map a:focus-visible .tile, .map a:hover .tile { stroke: var(--focus); }
.map text { font: 600 13px var(--font-body); fill: var(--text); pointer-events: none; }
.map .c0 { fill: var(--map-0); } .map .c1 { fill: var(--map-1); } .map .c2 { fill: var(--map-2); }
.map .c3 { fill: var(--map-3); } .map .c4 { fill: var(--map-4); } .map .cn { fill: var(--map-none); }
.map .c3 + text, .map .c4 + text { fill: var(--surface); }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-0); }
.legend li { margin: 0; display: inline-flex; align-items: center; gap: var(--s-2); }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.legend .c0 { background: var(--map-0); } .legend .c1 { background: var(--map-1); } .legend .c2 { background: var(--map-2); }
.legend .c3 { background: var(--map-3); } .legend .c4 { background: var(--map-4); } .legend .cn { background: var(--map-none); }

/* ---------- 14. Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); font-size: 0.95rem; color: var(--muted); padding: var(--s-6) 0 var(--s-7); }
.site-footer a { color: var(--text); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-5); }
.site-footer h2 { font-size: 1rem; font-family: var(--font-body); margin: 0 0 var(--s-2); color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer p { margin: 0 0 var(--s-2); }

/* ---------- 15. Notices ---------- */
.notice { font-size: 0.95rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-5); max-width: var(--measure); background: var(--surface-2); }
.preview-flag { background: var(--warn-tint); color: var(--warn); text-align: center; font-size: var(--fs-0); padding: var(--s-1) var(--gutter); border-bottom: 1px solid var(--border); }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 650; padding: 0.1em 0.55em; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge--ok { background: var(--accent-tint); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- 16. Motion, print ---------- */
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  .site-header, .site-nav, .site-footer, .korrektur, .calc, .skip-link, .preview-flag { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .table-wrap { overflow: visible; border: 0; }
  th:first-child, td:first-child { position: static; }
}

/* ---------- 17. Map figures (SVG from site_build/maps.py; light artwork, so it sits on a light card) ---------- */
.map-figure { margin: 0 0 var(--s-5); max-width: 30rem; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-3); }
.map-figure img { display: block; width: 100%; height: auto; }
.map-figure figcaption { font-size: var(--fs-0); color: #55615e; margin-top: var(--s-2); }

/* Contact form (content/core/kontakt.md, posts to /api/kontakt) */
.contact-form .field { margin: 0 0 var(--s-3); }
.contact-form input[type="text"], .contact-form input[type="email"], .contact-form select, .contact-form textarea { width: 100%; }
.contact-form .field--check { display: flex; gap: var(--s-2); align-items: flex-start; }
.contact-form .field--check input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; accent-color: var(--accent); flex: none; }
.contact-form .field--check label { font-weight: 400; }
.contact-form .hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form h3 { margin-top: 0; }
