/*
 * Shared structure of every page (P2.3, P2.4), mobile first (coding-rules §2). Every colour, font, radius and
 * shadow is a variable. The defaults below are the plain prototype; each design direction sets all of them in
 * public/assets/direction-*.css (D50), and .agents/tools/contrast_check.py measures its pairs there.
 */

:root {
  /* Assumption (D48): P1.7 V2 requires at least 24 CSS px, main targets clearly more. */
  --tap-min: 48px;
  --width: 46rem;
  --gutter: max(1rem, calc((100% - var(--width)) / 2));

  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --text-soft: #333333;
  --link: #000000;
  --brand: #000000;
  --brand-hover: #333333;
  --on-brand: #ffffff;
  --accent: transparent;
  --tile-a: #ffffff;
  --tile-b: #ffffff;
  --tile-border: #767676;
  --line: #767676;
  --field-bg: #ffffff;
  --field-border: #767676;
  --selected-bg: #eeeeee;
  --selected-border: #000000;
  --focus: #000000;
  --error: #b00020;
  --error-soft: #ffffff;
  --header-bg: #ffffff;
  --header-text: #000000;
  --header-soft: #333333;
  --header-link: #000000;
  --header-focus: #000000;
  --header-brand: #000000;
  --wordmark-arc: transparent;
  --star: #000000;
  --star-empty: #cccccc;
  --footer-bg: #ffffff;
  --footer-text: #000000;
  --footer-link: #000000;

  --font-body: system-ui, sans-serif;
  --font-head: var(--font-body);
  --head-weight: 700;
  --wordmark-weight: 800;
  --strong-weight: 700;
  --head-spacing: normal;
  --radius: 0;
  --radius-small: 0;
  --photo-radius: 0;
  --shadow: none;
  --accent-bar: 0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* D104 (P1.8 V15): the light design only - "only" also asks Chrome on Android not to darken the page itself (SRC-832). */
  color-scheme: only light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  /* P1.8 V17: a word longer than its line breaks instead of widening the page (SC 1.4.10, 1.4.12; measured at 320 px, 2026-11-08). */
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

strong {
  font-weight: var(--strong-weight);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  top: 0.5rem;
  left: 1rem;
  z-index: 2;
  padding: 0.75rem 1rem;
  background: var(--surface);
}

/* Header and footer: full-width colour, content in the column. */

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  align-items: center;
  padding: 0.75rem var(--gutter);
  background: var(--header-bg);
  color: var(--header-text);
}

.site-header p {
  margin: 0;
}

/* D55, D62: the flyer wordmark (SRC-13) is the brand and leads the header. */
.wordmark {
  grid-column: 1;
  font-family: var(--font-head);
  font-weight: var(--wordmark-weight);
  font-size: clamp(1.875rem, 9vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: var(--head-spacing);
}

.wordmark a {
  color: var(--header-text);
  text-decoration: none;
}

/* P1.8 V17, SRC-4301 3.1: below 360 px wordmark, gap and the two 48 px symbols needed 316 px of 288 - the page scrolled 12 px
   sideways at 320 px (measured 2026-11-08). Smaller wordmark and gap only there; from 360 px on nothing changes. */
@media (max-width: 22.4375rem) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.5rem;
  }

  .wordmark {
    font-size: 1.625rem;
  }
}

.wordmark-name {
  position: relative;
  color: var(--header-brand);
}

/* Decoration only, like the yellow arc under "Bader" on the flyer. */
.wordmark-arc {
  position: absolute;
  left: 0;
  top: 80%;
  width: 100%;
  height: 0.24em;
  fill: none;
  stroke: var(--wordmark-arc);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* D62, D63: one line under the wordmark — name and place, about 8 px below the arc (measured 7.5 to 8.6 px from
   arc to capitals at 320 to 1000 px, 2026-10-30). ".site-header p" sets margin 0 and is more specific than ".site-name". */
/* D103 (second addendum): name and place a little smaller than the body text (was 17 px). */
.site-header .site-name {
  grid-column: 1;
  margin-top: 0.3rem;
  color: var(--header-soft);
  font-size: 1rem;
  line-height: 1.2;
}

/* D27 (a), D101: the status under name and place; D103 (second addendum): 15 px, below the 16 px of P1.8 V5 on the owner's wish. */
.site-header .site-status {
  grid-column: 1;
  color: var(--header-soft);
  font-size: 0.9375rem;
  line-height: 1.25;
}

/* D58: the WhatsApp glyph as large as the text before the word, never bigger (Meta brand guidelines). */
.whatsapp-glyph {
  width: 1em;
  height: 1em;
  margin-right: 0.2em;
  vertical-align: -0.15em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The honeypot of requirements §9.2 (P3.2 V1): off screen for people, still in the form for bots. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* D62: call and WhatsApp as two symbols, each a tap target of the main size (D48); the number stands in the footer. */
.site-icons {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  gap: 0.25rem;
}

.site-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  color: var(--header-text);
}

.site-icons .phone-glyph {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

.site-icons .whatsapp-glyph {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  vertical-align: 0;
}

.site-header :focus-visible {
  outline-color: var(--header-focus);
}

main {
  padding: 1.25rem var(--gutter) 2.5rem;
}

.site-footer {
  padding: 1.5rem var(--gutter) 2rem;
  background: var(--footer-bg);
  color: var(--footer-text);
  /* P1.8 V5: small text not under 16 px (was 0.95rem, 15.2 px). */
  font-size: 1rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.site-footer a {
  color: var(--footer-link);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  min-height: var(--tap-min);
  padding: 0.75rem 0;
}

/* Headings */

/* P1.8 V17: "Wohngebäudeversicherung" is wider than a 320 px line at heading size - hyphenated where the browser knows German
   (lang="de"), otherwise broken by overflow-wrap. P4.7a: only words of 14 characters or more - Chromium and Firefox broke
   "Si-cher" from 800 to 1920 px and "vorge-sorgt." from 390 to 600 px; with the limit none of the start page, long words still
   (measured 2026-11-25, Playwright). Safari ignores the limit (not measured: WebKit on Windows does not hyphenate). */
h1,
h2 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-spacing);
  line-height: 1.15;
  hyphens: auto;
  hyphenate-limit-chars: 14 4 4;
}

h1 {
  margin: 1rem 0 0.75rem;
  font-size: clamp(1.6rem, 6.5vw, 2.4rem);
}

/* A short decorative bar under the main heading; width 0 in directions without it. */
h1::after {
  content: "";
  display: block;
  width: var(--accent-bar);
  height: 0.3rem;
  margin-top: 0.6rem;
  border-radius: 1rem;
  background: var(--accent);
}

h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.35rem;
}

/* Start: top level, sentence with photo, entries */

/* D114, 2026-11-27: the buttons sat close to the heading - 20 px above them, 16 below (measured, 1280 px); now 24 and 28. */
.top-level {
  margin-top: 0.25rem;
}

.top-level + h1 {
  margin-top: 1.75rem;
}

.top-level ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.top-level a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0.5rem 1rem;
  border: 2px solid var(--field-border);
  border-radius: var(--radius-small);
  background: var(--field-bg);
  color: var(--text);
  font-weight: var(--strong-weight);
  text-decoration: none;
}

.top-level a[aria-current="page"] {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

/* D61: "Termin vereinbaren" needs 408 px for the three links in one row on direction B (measured 2026-10-30), plus the
   two 16 px gutters: below 440 px only "Termin" shows. The link is a flex box, which drops the space in front of
   "vereinbaren" — hence the margin. */
.nav-more {
  margin-left: 0.25em;
}

@media (max-width: 27.5rem) {
  .nav-more {
    display: none;
  }
}

/* §11.3: Termin recognisable as an action. */
.top-level a.action {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

/* D103: the sentence beside the photo is centred on it. */
.intro {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.intro img {
  flex: none;
  border-radius: var(--photo-radius);
  object-fit: cover;
}

/* min-width 0: a flex item may become narrower than its longest word, so that word breaks instead of widening the page. */
.intro p {
  min-width: 0;
  margin: 0;
}

/* minmax(0, ...) and "anywhere": with the text spacing of SC 1.4.12 a long question word must not widen the column (P1.8 V17). */
.topics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* SRC-4501, D101: the rows a little smaller than before (4rem, padding 0.875rem 1.125rem); still above the 48 px tap size (D48). */
.topics a {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 3.25rem;
  height: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  background: var(--tile-a);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: var(--strong-weight);
  text-decoration: none;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.topics li:nth-child(even) a {
  background: var(--tile-b);
}

.topics a::after {
  content: "→";
  content: "→" / "";
  flex: none;
  color: var(--link);
}

.topics a:hover {
  border-color: var(--brand);
}

/* D59: Steffen's special topic stands out by border, label and a second line, not by motion (P1.8 V1, V16). */
.topics .featured {
  grid-column: 1 / -1;
}

.topics .featured a {
  border: 2px solid var(--brand);
  background: var(--surface);
}

.badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-small);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.9rem;
}

.teaser {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-weight: normal;
}

/* D59, D103, direction B: a normal entry with a diagonal ribbon "Neu ab 2027" across the top right corner, without the arrow,
   which the ribbon replaces. */
.topics .ribbon a {
  position: relative;
  overflow: hidden;
  border-color: var(--brand);
}

.topics .ribbon a::after {
  content: none;
}

/* Keeps the question clear of the ribbon. */
.ribbon-text {
  padding-right: 3.5rem;
}

/* D103: "Neu 2027" in 14 px - below the 16 px of P1.8 V5, the owner's choice over the badge of D102. Measured 2026-11-08 at 360 px
   (rotated text box against the clipped corner): "Neu ab 2027" left the corner by 3.5 px (the cut "N" seen on the phone); "Neu 2027" stays
   6 px inside with this position. */
.ribbon-label {
  position: absolute;
  top: 1.25rem;
  right: -2.6rem;
  width: 10rem;
  padding: 0.15rem 0;
  transform: rotate(45deg);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.875rem;
  font-weight: var(--strong-weight);
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: center;
}

@media (min-width: 36rem) {
  .topics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* D114: wider where the text beside it has room - 13rem, the owner's choice of 2026-11-27 (20rem was too dominant); the sizes
     attribute in start.php names the same 208 px. */
  .intro img {
    width: 13rem;
    height: auto;
  }
}

/* D103, §11.3 block 4: the review box under the list, after the example the owner sent (value, stars, count as link). On the page
   background with a gold line at the left, not a white card, so it does not read as one more button. */
.reviews {
  margin-top: 1.75rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--accent);
}

.reviews p {
  margin: 0.25rem 0 0;
}

.reviews .reviews-score {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0;
}

.reviews-value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: var(--head-weight);
  line-height: 1;
}

/* Two rows of five stars on top of each other; the gold row is clipped to the share of the average (start.php). */
.stars {
  display: block;
  width: 7.5rem;
  height: 1.5rem;
}

.stars-empty {
  fill: var(--star-empty);
}

.stars-full {
  fill: var(--star);
}

/* D103 addendum: a note, smaller than the line above (17 px); 15 px like the footer, below the 16 px of P1.8 V5 on the owner's wish. */
.reviews .reviews-note {
  color: var(--text-soft);
  font-size: 0.9375rem;
}

/* D102, D103: the three points of SRC-4501 in the footer; a tick in the link colour, the text says it, not the colour. Normal
   weight like the contact lines around them (second addendum): bold made them the loudest thing in the footer. */
.footer-trust {
  display: grid;
  gap: 0.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.footer-trust li {
  display: flex;
  gap: 0.5rem;
}

.footer-trust li::before {
  content: "✓";
  content: "✓" / "";
  flex: none;
  color: var(--footer-link);
}

/* ST-24, D102: the PKV certificate as one plain line under the explanation. */
.credential {
  color: var(--text-soft);
}

/* Legal pages (FR-RE1 to FR-RE3): long text, one table; long web addresses must not widen the page on a phone. */

.legal {
  overflow-wrap: anywhere;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 0.5rem;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
}

.legal th,
.legal td {
  padding: 0.5rem 0.5rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

/* Entry: back link, call button, form */

.back {
  margin: 0.5rem 0 0;
}

.back a {
  display: inline-block;
  min-height: var(--tap-min);
  padding: 0.75rem 0;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-weight: var(--strong-weight);
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--brand-hover);
}

/* P1.8 V7, SRC-4301 3.2.2: pressed is visible at once (no transition) on everything that can be tapped; hover stays an extra. */
.button:active,
button:active,
.top-level a.action:active {
  background: var(--brand-hover);
}

.topics a:active,
.top-level a:not(.action):active,
.choice label:active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

/* P1.8 V7, V16: while the form is on its way (public/assets/site.js); after one second a small loop on the button - only
   without "reduce motion", otherwise the text "Wird gesendet …" alone. */
form.is-sending button {
  background: var(--brand-hover);
  cursor: progress;
}

@media (prefers-reduced-motion: no-preference) {
  form.is-slow button::after {
    content: "";
    width: 1em;
    height: 1em;
    margin-left: 0.6em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sending 0.8s linear infinite;
  }
}

@keyframes sending {
  to {
    transform: rotate(360deg);
  }
}

#anfrage {
  margin-top: 1.5rem;
  padding: 0.25rem 1.125rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

#anfrage h2 {
  margin-top: 1rem;
}

.field {
  margin: 1.25rem 0;
}

.field label,
.choice legend {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: var(--strong-weight);
}

/* D63: the one sentence on required and optional fields. */
.form-note {
  margin: 0 0 1rem;
  color: var(--text-soft);
}

input[type="text"],
input[type="tel"],
input[type="email"],
textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--field-border);
  border-radius: var(--radius-small);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}

[aria-invalid="true"],
[aria-invalid="true"] label {
  border-color: var(--error);
}

.choice {
  margin: 1.25rem 0;
  padding: 0;
  border: 0;
}

.choice legend {
  padding: 0;
}

.choice label {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: var(--tap-min);
  margin: 0.5rem 0;
  padding: 0.625rem 1rem;
  border: 2px solid var(--field-border);
  border-radius: var(--radius-small);
  background: var(--field-bg);
  font-weight: var(--strong-weight);
  cursor: pointer;
}

.choice input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--brand);
}

/* The radio stays visible: the state is not shown by colour alone (D18). */
.choice label:has(input:checked) {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.choice label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice input:focus-visible {
  outline: none;
}

.hint,
.error {
  margin: 0.25rem 0 0.4rem;
}

/* P1.8 V5: small text not under 16 px (was 0.95rem, 15.2 px) - "Unverbindlich und kostenlos" stands here (ST-38). */
.hint,
.privacy {
  color: var(--text-soft);
  font-size: 1rem;
}

.error {
  color: var(--error);
  font-weight: var(--strong-weight);
}

/* P1.8 V7: an error has text, frame and a symbol, not colour alone; the symbol is decoration, the text says it. */
.error::before {
  content: "!";
  content: "!" / "";
  display: inline-grid;
  place-items: center;
  width: 1.25em;
  height: 1.25em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--error);
  color: var(--on-brand);
  font-size: 0.9em;
  line-height: 1;
  vertical-align: 0.1em;
}

/* SRC-4301 3.2.4, P1.8 V7: the confirmation as its own calm card with a tick. */
.confirm {
  margin-top: 1rem;
  padding: 0.25rem 1.125rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
}

.confirm h1::before {
  content: "✓";
  content: "✓" / "";
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.8em;
  vertical-align: 0.15em;
}

.confirm p {
  margin: 0;
}

.failed {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--error);
  border-radius: var(--radius-small);
  background: var(--error-soft);
}

form button {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 1.125rem;
}

details {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

summary {
  min-height: var(--tap-min);
  padding: 0.75rem 0;
  font-weight: var(--strong-weight);
  cursor: pointer;
}

.prototype-note {
  padding: 0.75rem 1rem;
  border: 2px dashed var(--line);
}

/*
 * §11.4: the fields of the chosen channel only - with CSS instead of JavaScript (D48). A browser
 * without :has() skips this block and shows 3a to 3c, as the form does without JavaScript.
 */
@supports selector(:has(*)) {
  .if-call,
  .if-email {
    display: none;
  }

  form:has(#channel-call:checked) .if-call,
  form:has(#channel-email:checked) .if-email {
    display: block;
  }
}

.contact-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.contact-bar a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: 0.5rem;
  border: 2px solid var(--brand);
  border-radius: var(--radius-small);
  color: var(--link);
  font-weight: var(--strong-weight);
  text-decoration: none;
}

.contact-bar a:first-child {
  background: var(--brand);
  color: var(--on-brand);
}

.has-contact-bar {
  padding-bottom: 4.5rem;
}
