/* wohngeld-rechner.info – "Das Haushaltsbuch" (design/DESIGN.md): paper, Königsblau ink, one highlighter.
   Every colour, size and space is a token on :root, light and dark; body text is 7:1 or better
   everywhere (measured: design/tools/contrast.py). The class names are the templates' own (header.php,
   footer.php, template-parts/entry.php, functions.php); the explainer kit and each calculator module
   style only their own (.wgr-kit-…, .wgr-<module>). Phone first: nothing under 15 px, nothing sideways. */

@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("../fonts/atkinson-next-var.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; src: url("../fonts/atkinson-mono-var.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Vollkorn"; src: url("../fonts/vollkorn-var.woff2") format("woff2"); font-weight: 500 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Playwrite DE Grund"; src: url("../fonts/playwrite-de-grund.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
	color-scheme: light dark;
	--paper: #F5F2EA;      /* the page: recycled paper */
	--sheet: #FFFFFF;      /* every panel that carries text */
	--ink: #1B1B21;        /* 17.1:1 on sheet, 15.3:1 on paper */
	--ink-2: #45464F;      /* 9.4:1 / 8.4:1 */
	--blue: #2A3593;       /* Königsblau: links, the reader's own figures, hand notes (10.4:1 / 9.3:1) */
	--blue-soft: #E6E9F6;
	--marker: #F2EB6B;     /* the highlighter under an answer (ink 13.8:1) */
	--rule: #D8D3C6;       /* lines only, never text */
	--line: #6A6963;       /* field outlines (5.5:1, non-text) */
	--cut: #8A3306;        /* the 2027 bill only (8.2:1 / 7.3:1) */
	--cut-soft: #FCEEE6;
	--s1: #E2E6F4; --s2: #C9D0EE; --s3: #A9B4E4; --s4: #8695D6; --s5: #6070C4; --s6: #3E4EA9; --s7: #222D82;
	--s-edge: #FFFFFF;
	--on-blue: #FFFFFF;
	--dm1: #E9A47E;        /* map of changes: one level lower */
	--y-edge: #B9AE1E;     /* the edge of an income note (Y) */
	--fill-strong: #222D82; --on-fill-strong: #FFFFFF;   /* the one level colour with words on it (11.9:1) */
	--bleed: 16px;         /* how far a calculator sheet reaches into the gutter on a phone */
	--foot: #1B1B21; --foot-ink: #F0EDE5; --foot-ink-2: #D2CEC4; --foot-rule: #3A3934;
	--shadow: 0 1px 0 rgba(27, 27, 33, .06), 0 2px 6px rgba(27, 27, 33, .06);

	--font-text: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-head: "Vollkorn", Georgia, "Times New Roman", serif;
	--font-num: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	--font-hand: "Playwrite DE Grund", "Atkinson Hyperlegible Next", system-ui, sans-serif;

	--sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
	--gutter: 16px;
	--measure: 42rem;
	--wide: 74rem;
	--radius: 4px;
}
@media (prefers-color-scheme: dark) {
	:root {
		--paper: #141413; --sheet: #1E1E1C; --ink: #F0EDE5; --ink-2: #C8C4BA;
		--blue: #AAB6FF; --blue-soft: #262B48; --marker: #4E4A18; --rule: #3A3934; --line: #9C9A92;
		--cut: #F4A57A; --cut-soft: #3A2418;
		--s1: #2A2F45; --s2: #33405F; --s3: #3F5083; --s4: #5468AE; --s5: #7489D2; --s6: #9FB0EE; --s7: #CDD5FF;
		--s-edge: #141413;
		--on-blue: #141413;
		--dm1: #8A4A28; --y-edge: #C9BE45;
		--fill-strong: #9FB0EE; --on-fill-strong: #141413;   /* 8.7:1 */
		--foot: #0B0B0A;
		--shadow: 0 1px 0 rgba(0, 0, 0, .4);
	}
}
@media (min-width: 720px) { :root { --gutter: 32px; --bleed: 0px; } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
	margin: 0; background: var(--paper); color: var(--ink);
	font: 400 17px/1.55 var(--font-text);
	font-variant-numeric: lining-nums tabular-nums;
	hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 10 4 4;
	overflow-wrap: break-word; font-synthesis: none;
}
@media (min-width: 720px) { body { font-size: 18px; line-height: 1.6; } }
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; hyphens: manual; -webkit-hyphens: manual; } /* a link's text is often an address: "gesetze-im-interne-t.de" must not happen */
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 650; line-height: 1.15; letter-spacing: -.005em; hyphens: manual; -webkit-hyphens: manual; text-wrap: balance; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--sheet); color: var(--ink); padding: var(--sp-2) var(--sp-4); z-index: 10; }
.skip:focus { left: var(--gutter); }

/* ---------- masthead ---------- */
.site-head { background: var(--sheet); border-bottom: 1px solid var(--rule); }
.site-head__in { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--sp-1) var(--sp-4); padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__mark path, .site-foot__mark path { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand__name { font: 700 19px/1 var(--font-head); letter-spacing: -.01em; white-space: nowrap; }
.brand__tld { font: 400 15px/1 var(--font-text); color: var(--ink-2); letter-spacing: 0; }
@media (min-width: 400px) { .brand__name { font-size: 21px; } }
.site-head__menu { display: inline-flex; align-items: center; gap: 6px; padding: var(--sp-2) 0 var(--sp-2) var(--sp-3); color: var(--ink); font-weight: 700; font-size: 16px; text-decoration: none; }
.site-head__menu svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.indep { grid-column: 1 / -1; margin: 0; font-size: 15px; line-height: 1.4; color: var(--ink-2); max-width: 46rem; }
.site-nav { grid-column: 1 / -1; display: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 var(--sp-5); margin: 0; padding: 0; list-style: none; }
.site-nav a { display: inline-block; padding: var(--sp-2) 0; color: var(--ink); text-decoration: none; font-size: 16px; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--ink-2); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--blue); font-weight: 700; }
@media (min-width: 1000px) {
	/* Two rows: the name and the independence line, then every calculator on a row of its own (the menu
	   grows with each calculator a module adds; beside the line it squeezed the line into a thin column). */
	.site-head__in { grid-template-columns: auto 1fr; padding-top: var(--sp-4); padding-bottom: 0; column-gap: var(--sp-5); }
	.site-head__menu { display: none; }
	.indep { grid-column: auto; padding-left: var(--sp-5); border-left: 1px solid var(--rule); }
	.site-nav { grid-column: 1 / -1; display: block; margin-top: var(--sp-3); border-top: 1px solid var(--rule); }
	.site-nav a { padding: var(--sp-3) 0 calc(var(--sp-3) - 2px); }
}

/* ---------- page head: trail, title, summary, picture RIGHT UNDER THEM, byline ---------- */
.page-head { padding: var(--sp-5) 0 0; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px var(--sp-1); margin: 0 0 var(--sp-3); padding: 0; list-style: none; font-size: 15px; color: var(--ink-2); }
.crumbs li + li::before { content: "›"; margin-right: var(--sp-1); }
.crumbs a { color: var(--ink-2); }
.page-head__title { margin: 0; font-size: 31px; font-weight: 700; max-width: 24ch; }
.lede { margin: var(--sp-4) 0 0; font-size: 19px; line-height: 1.5; max-width: 38rem; }
.lead-pic { margin: var(--sp-5) calc(-1 * var(--gutter)) 0; }
.lead-pic img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--blue-soft); }
.lead-pic figcaption, .fig figcaption { padding: var(--sp-2) var(--gutter) 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.page-meta { display: flex; flex-direction: column; gap: 2px; margin: var(--sp-4) 0 0; font-size: 15px; color: var(--ink-2); }
.page-meta a { color: var(--ink-2); }
@media (min-width: 720px) {
	.page-head { padding-top: var(--sp-7); }
	.page-head__title { font-size: 46px; max-width: 30ch; }
	.lede { font-size: 21px; }
	.lead-pic { margin: var(--sp-5) 0 0; max-width: 56rem; }
	.lead-pic img { border-radius: var(--radius); box-shadow: var(--shadow); }
	.lead-pic figcaption { padding-left: 0; padding-right: 0; }
	.page-meta { flex-direction: row; flex-wrap: wrap; gap: 0 var(--sp-3); }
	.page-meta > span + span::before { content: "·"; margin-right: var(--sp-3); color: var(--line); }
}

/* ---------- the calculator band: one white sheet under the page head ---------- */
.tool-band { margin: var(--sp-6) 0 var(--sp-4); }
.tool-band__label { margin: 0 0 var(--sp-3); font: 700 15px/1.3 var(--font-text); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.tool-band__label span { font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: var(--sp-2); }

/* ---------- the text ---------- */
.prose { max-width: var(--measure); padding: var(--sp-5) 0 var(--sp-7); }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: var(--sp-7) 0 var(--sp-4); font-size: 26px; }
.prose h3 { margin: var(--sp-6) 0 var(--sp-3); font: 700 20px/1.3 var(--font-text); letter-spacing: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--sp-4); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: 0 0 var(--sp-2); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: var(--sp-6) 0; }
.prose blockquote { margin: 0 0 var(--sp-4); border-left: 4px solid var(--rule); background: var(--sheet); padding: var(--sp-3) var(--sp-4); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { width: 100%; border-collapse: collapse; background: var(--sheet); font-size: 16px; line-height: 1.4; margin: 0 0 var(--sp-4); }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose thead th { font-size: 15px; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
.prose figure { margin: 0 0 var(--sp-5); }
.prose .fig img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.checked { font-size: 15px; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: var(--sp-3); margin-top: var(--sp-6); }
.prose h3.qa__q { font-family: var(--font-text); }
@media (min-width: 720px) { .prose h2 { font-size: 34px; } .prose h3 { font-size: 22px; } }
@media (max-width: 599px) { .prose table { display: block; overflow-x: auto; } }

/* ---------- the reading map, "Auf dieser Seite" (functions.php wgr_map_margin(), wgr_map_box()) ----------
   A ledger's index of the page's sections: each entry numbered in the left column, the column rule
   beside the words, which fills with ink as the reader goes down (assets/js/lesekarte.js), and the
   section being read marked with a stroke of ink. From 1080 px it stands in the margin beside the
   42 rem text (42 rem + two 32 px gutters + a 40 px gap + a 15 rem column + a scroll bar come to about
   1035 px); below that it is a closed box right before the first section. Without script, both are plain links. A link
   jumps at once: no smooth scrolling (Chrome took 2.2 s to glide the 19 600 px of a long guide). */
.prose h2[id], .prose h3[id] { scroll-margin-top: var(--sp-5); }
.admin-bar .prose h2[id], .admin-bar .prose h3[id] { scroll-margin-top: calc(var(--sp-5) + 46px); }   /* signed-in editors: below WordPress's bar */
.lesekarte .lesekarte__liste, .lesekarte-klein .lesekarte__liste { --nr: 1.5rem; --spalte: calc(var(--nr) + 7px); position: relative; margin: 0; padding: 0; list-style: none; }
.lesekarte__liste::before, .lesekarte--lebt .lesekarte__liste::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--spalte); width: 2px; background: var(--rule); }
.lesekarte--lebt .lesekarte__liste::after { background: var(--blue); transform-origin: 50% 0; transform: scaleY(var(--tinte, 0)); transition: transform .25s ease-out; }
.lesekarte__liste .lesekarte__eintrag { margin: 0; }
.lesekarte__liste a { position: relative; display: grid; grid-template-columns: var(--nr) minmax(0, 1fr); column-gap: 16px; padding: 5px 0; color: var(--ink); text-decoration: none; font-size: 16px; line-height: 22px; }
.lesekarte__nr { font: 400 15px/22px var(--font-num); color: var(--ink-2); text-align: right; }
.lesekarte__liste a:hover .lesekarte__text { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.lesekarte__liste a[aria-current]::after { content: ""; position: absolute; top: 4px; bottom: 4px; left: calc(var(--spalte) - 1px); width: 4px; background: var(--blue); }
.lesekarte__liste a[aria-current] .lesekarte__text, .lesekarte__liste a[aria-current] .lesekarte__nr { color: var(--blue); }
.lesekarte__titel { margin: 0 0 var(--sp-2); padding-bottom: var(--sp-2); border-bottom: 2px solid var(--ink); font: 700 15px/1.3 var(--font-text); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.lesekarte { display: none; }
/* "Zum Text springen": the margin map comes before the text, so its first stop for a keyboard jumps over the entries.
   Hidden until it has the focus; then it lies over the title, on the title's rule. */
.lesekarte__weiter { position: absolute; top: 0; left: 0; z-index: 2; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lesekarte__weiter:focus { right: 0; width: auto; height: auto; overflow: visible; clip-path: none; padding: 4px 9px; background: var(--sheet); font: 700 15px/1.3 var(--font-text); outline-offset: -3px; }
.lesekarte-klein { margin: var(--sp-6) 0 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.lesekarte-klein > summary { display: block; min-height: 48px; padding: var(--sp-3) calc(var(--sp-4) + 22px) var(--sp-3) var(--sp-4); position: relative; cursor: pointer; list-style: none; font: 700 17px/1.35 var(--font-text); color: var(--ink); }
.lesekarte-klein > summary::-webkit-details-marker { display: none; }
/* "Auf dieser Seite · 9 Abschnitte"; where it must wrap, the dot that would start the second line falls in the clipped margin */
.lesekarte-klein__kopf { display: block; overflow: hidden; }
.lesekarte-klein__zeile { display: flex; flex-wrap: wrap; margin-left: -1em; }
.lesekarte-klein__titel, .lesekarte-klein__zahl { position: relative; padding-left: 1em; }
.lesekarte-klein__zahl { font-weight: 400; color: var(--ink-2); }
.lesekarte-klein__punkt { position: absolute; left: 0; width: 1em; text-align: center; }
.lesekarte-klein > summary svg { position: absolute; right: var(--sp-4); top: 50%; width: 14px; height: 14px; margin-top: -7px; }
.lesekarte-klein > summary svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lesekarte-klein[open] > summary svg { transform: rotate(180deg); }
.lesekarte-klein > summary:focus-visible { outline-offset: -3px; }
.lesekarte-klein nav { border-top: 1px solid var(--rule); padding: var(--sp-2) var(--sp-4) var(--sp-3); }
.lesekarte-klein .lesekarte__liste a { padding: 11px 0; }
@media (min-width: 1080px) {
	.entry__text--karte { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(15rem, 18rem); column-gap: clamp(2.5rem, 4vw, 4rem); align-items: start; }
	.entry__text--karte > .prose { grid-column: 1; grid-row: 1; }
	/* A box that scrolls cuts off whatever reaches past its edges: 6 px each side (given back by the margin) hold an
	   entry's focus ring, 3 px wide and 2 px out, and an entry brought into view stops below the title, not under it. */
	.lesekarte { display: block; grid-column: 2; grid-row: 1; position: sticky; top: var(--sp-6); max-height: calc(100vh - 2 * var(--sp-6)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: var(--sp-5) -6px 0; padding: 0 6px var(--sp-2); scroll-padding: 2.75rem 0 var(--sp-2); }
	.lesekarte .lesekarte__text { hyphens: auto; -webkit-hyphens: auto; }   /* a narrow column: long compounds break at a syllable (links are hyphens: manual elsewhere) */
	.admin-bar .lesekarte { top: calc(var(--sp-6) + 32px); max-height: calc(100vh - 2 * var(--sp-6) - 32px); }
	.lesekarte__titel { position: sticky; top: 0; z-index: 1; background: var(--paper); }   /* a long list scrolls under its title */
	.entry__text--karte .lesekarte-klein { display: none; }
}
/* A touch screen (a tablet held sideways is 1080 px and more): every entry at least 44 px tall to tap, as in the
   phone's box. The entries touch, so a bigger target means taller rows; with a mouse alone the list stays at 32 px. */
@media (min-width: 1080px) and (any-pointer: coarse) { .lesekarte .lesekarte__liste a { padding: 11px 0; } }
@media (prefers-reduced-motion: reduce) { .lesekarte--lebt .lesekarte__liste::after { transition: none; } }

/* ---------- lists of articles, and the other calculators (rows, never tiles) ---------- */
.more, .cards { padding: var(--sp-6) 0 var(--sp-7); border-top: 1px solid var(--rule); }
.more__h, .cards__h { margin: 0 0 var(--sp-4); font-size: 26px; }
.post-list, .cards__list { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }
.post-list__item { padding: var(--sp-4) 0; border-top: 1px solid var(--rule); }
.post-list__item:last-child { border-bottom: 1px solid var(--rule); }
.post-list__title { font: 650 21px/1.25 var(--font-head); color: var(--ink); text-decoration: none; }
.post-list__title:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.post-list__summary { margin: var(--sp-1) 0 0; color: var(--ink-2); font-size: 16px; }
.post-list__date { margin: var(--sp-1) 0 0; color: var(--ink-2); font-size: 15px; }
.card { border-top: 1px solid var(--rule); }
.card:last-child { border-bottom: 1px solid var(--rule); }
.card a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px var(--sp-3); padding: var(--sp-3) 0; color: var(--ink); text-decoration: none; }
.card a:hover .card__name { text-decoration: underline; }
.card__name { font: 650 20px/1.25 var(--font-head); }
.card__part { font-size: 15px; color: var(--ink-2); white-space: nowrap; }

/* ---------- footer ---------- */
.site-foot { background: var(--foot); color: var(--foot-ink); margin-top: var(--sp-7); padding: var(--sp-7) 0 var(--sp-6); font-size: 16px; }
@media (prefers-color-scheme: dark) { .site-foot { border-top: 1px solid var(--foot-rule); } }
.site-foot a { color: var(--foot-ink); }
.site-foot__grid { display: grid; gap: var(--sp-6); grid-template-columns: 1fr; }
@media (min-width: 720px) { .site-foot__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .site-foot__grid { grid-template-columns: 22rem repeat(3, 1fr); } }
.site-foot__name { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--sp-3); font: 700 21px/1.1 var(--font-head); }
.site-foot__mark { width: 30px; height: 30px; flex: none; }
.site-foot__mark path { stroke: var(--foot-ink); }
.site-foot__name .brand__tld { color: var(--foot-ink-2); }
.site-foot p { margin: 0 0 var(--sp-3); color: var(--foot-ink-2); max-width: 32rem; }
.site-foot__small { font-size: 15px; }
.site-foot__h { margin: 0 0 var(--sp-3); font: 700 15px/1.3 var(--font-text); letter-spacing: .05em; text-transform: uppercase; color: var(--foot-ink-2); }
.site-foot__nav ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-2); }
.site-foot__nav a { text-decoration: none; }
.site-foot__nav a:hover { text-decoration: underline; }
.site-foot__base { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--foot-rule); color: var(--foot-ink-2); font-size: 15px; }
.site-foot__base a { color: var(--foot-ink-2); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
