:root {
  --accent: #6d5dfc;
  --bg: #f6f5f2;
  --fg: #1d1c1a;
  --muted: #6b6862;
  --card: #ffffff;
  --border: #e4e1da;
  --on-tint: #1d1c1a;
  color-scheme: light;
}
/* Dunkel: per Gerät (falls nicht „hell“ gewählt) oder per Umschalter/Seiten-Standard */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #131315; --fg: #f1efea; --muted: #a9a6a0; --card: #1e1e22; --border: #3a3a42; --on-tint: #f1efea; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #131315; --fg: #f1efea; --muted: #a9a6a0; --card: #1e1e22; --border: #3a3a42; --on-tint: #f1efea; color-scheme: dark; }

* { box-sizing: border-box; }
/* Schriftgröße: Grundgröße der Instanz × Wahl des Besuchers (alles in rem skaliert mit) */
html { background: var(--bg); font-size: calc(var(--fs-base, 100%) * var(--fs-user, 1)); }
html[data-basefont="112"] { --fs-base: 112.5%; }
html[data-basefont="125"] { --fs-base: 125%; }
html[data-font="lg"] { --fs-user: 1.15; }
html[data-font="xl"] { --fs-user: 1.3; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(60rem 30rem at 50% -10rem, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--bg);
}

.page {
  max-width: 36rem;
  margin: 0 auto;
  padding: 3.5rem 1rem 4rem;
  text-align: center;
}

/* Logo: blitzt beim Aufruf genau einmal auf */
.logo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  object-fit: cover;
  animation: logo-flash 1.2s cubic-bezier(.2, .7, .2, 1) .1s 1 both;
}
@keyframes logo-flash {
  0%   { opacity: 0; transform: scale(.82); filter: brightness(1) drop-shadow(0 0 0 transparent); }
  30%  { opacity: 1; transform: scale(1.07); filter: brightness(2.4) drop-shadow(0 0 28px var(--accent)); }
  55%  { transform: scale(.98); filter: brightness(1.25) drop-shadow(0 0 12px var(--accent)); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .logo { animation: logo-fade .4s ease-out 1 both; }
  @keyframes logo-fade { from { opacity: 0; } to { opacity: 1; } }
}

h1 { margin: 0 0 .25rem; font-size: 1.5rem; letter-spacing: -.01em; }
.bio { margin: 0 auto 2rem; max-width: 28rem; color: var(--muted); white-space: pre-line; }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.links a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.links a:hover, .links a:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.links a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .links a { transition: none; } .links a:hover, .links a:focus-visible { transform: none; } }
.empty { color: var(--muted); }

/* Gruppen: aufklappbar per <details>, ohne JavaScript */
:root { interpolate-size: allow-keywords; }
.group details { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.group summary {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: 1rem 2.75rem; position: relative;
  font-weight: 700; cursor: pointer; list-style: none; user-select: none;
}
.group summary::-webkit-details-marker { display: none; }
.group summary::after {
  content: ""; position: absolute; right: 1.25rem; top: 50%;
  width: .55rem; height: .55rem; margin-top: -.4rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease;
}
.group details[open] summary::after { transform: rotate(225deg); margin-top: -.1rem; }
.group summary:hover { color: var(--accent); }
.group summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 14px; }
.group .count {
  min-width: 1.5rem; padding: 0 .45rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, var(--card)); color: var(--on-tint); font-weight: 700;
  font-size: .8rem; line-height: 1.5rem;
}
.group details::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size .25s ease, content-visibility .25s allow-discrete;
}
.group details[open]::details-content { block-size: auto; }
.links.sub { padding: 0 .75rem .75rem; gap: .5rem; }
.links.sub a { padding: .8rem 1rem; font-weight: 500; background: color-mix(in srgb, var(--fg) 4%, var(--card)); }
@media (prefers-reduced-motion: reduce) {
  .group details::details-content, .group summary::after { transition: none; }
}

/* Mit Hintergrundbild: kein Schleier, dafür heller Text mit dunklem Schatten */
/* Dunkle Ersatzfarbe unter dem Bild: weißer Text bleibt lesbar, auch solange das Bild lädt oder fehlt */
html:has(> body.has-bg) { background: #16161a; }
.has-bg { --shadow-strong: 0 1px 2px rgba(0, 0, 0, .9), 0 0 6px rgba(0, 0, 0, .7), 0 0 16px rgba(0, 0, 0, .45); }
.has-bg h1, .has-bg .bio, .has-bg .empty { color: #fff; text-shadow: var(--shadow-strong); }
.has-bg .logo { box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }

/* Freie Textzeilen */
.links .note {
  padding: .35rem 1rem; color: var(--fg); white-space: pre-line; overflow-wrap: anywhere; line-height: 1.45;
}
.links.sub .note { padding: .25rem .75rem; }
.has-bg .page > .links > .note { color: #fff; text-shadow: var(--shadow-strong); }

/* Zwischenüberschriften */
.links .heading { margin-top: .9rem; }
.links .heading:first-child { margin-top: 0; }
.links .heading h2 { margin: 0; font-size: 1.05rem; letter-spacing: .02em; color: var(--fg); }
.links.sub .heading { margin-top: .4rem; }
.links.sub .heading h2 { font-size: .95rem; }
.has-bg .page > .links > .heading h2 { color: #fff; text-shadow: var(--shadow-strong); }

/* Nur für Screenreader */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Hell/Dunkel-Umschalter */
.tools {
  position: absolute; top: max(.75rem, env(safe-area-inset-top)); right: .75rem; z-index: 5;
  display: flex; gap: .5rem; align-items: flex-start;
}
.theme-toggle, .tool-btn {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--fg); cursor: pointer;
}
.tool-btn svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tool-btn svg circle { fill: currentColor; stroke: none; }
.theme-toggle svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .i-moon { fill: currentColor; stroke: none; }
.theme-toggle[aria-pressed="true"] .i-moon, .theme-toggle[aria-pressed="false"] .i-sun, .theme-toggle:not([aria-pressed]) .i-sun { display: none; }
.theme-toggle:hover, .tool-btn:hover, .tool-btn[aria-expanded="true"] { border-color: var(--accent); }
.theme-toggle:focus-visible, .tool-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Fußzeile + Cookie-Seite */
.foot { padding: 0 1rem 2.5rem; text-align: center; font-size: .875rem; }
.foot ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.foot a, .legal a { color: var(--fg); text-underline-offset: 3px; }
.foot a { color: var(--muted); display: inline-block; padding: .3rem .25rem; min-height: 24px; }
.foot a:hover, .foot a:focus-visible { color: var(--fg); }
.foot a:focus-visible, .legal a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.has-bg .foot a { color: #fff; text-shadow: var(--shadow-strong); }
.legal-text { text-align: left; padding: 1.25rem 1.5rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.legal-text p { margin: 0 0 .9rem; }
.legal-text p:last-child { margin-bottom: 0; }
.legal .back { display: inline-block; margin-top: 1.5rem; font-weight: 600; }
.has-bg .legal h1, .has-bg .legal .back { color: #fff; text-shadow: var(--shadow-strong); }

/* Bedienhilfen-Menü */
.a11y { position: relative; }
.a11y-panel {
  position: absolute; right: 0; top: calc(100% + .5rem); width: min(18rem, calc(100vw - 1.5rem));
  padding: 1rem; text-align: left; border: 1px solid var(--border); border-radius: 14px;
  background: var(--card); color: var(--fg); box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .35);
}
.a11y-title { margin: 0 0 .75rem; font-weight: 700; }
.a11y-panel fieldset { margin: 0 0 .75rem; padding: 0; border: 0; }
.a11y-panel legend { padding: 0; margin-bottom: .4rem; font-size: .875rem; color: var(--muted); }
.seg { display: flex; gap: .35rem; flex-wrap: wrap; }
.seg label { flex: 1 1 auto; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label { display: block; padding: .45rem .5rem; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: .875rem; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--card)); font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.a11y-panel .opt { display: flex; align-items: center; gap: .6rem; min-height: 2.25rem; cursor: pointer; }
.a11y-panel .opt input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
.a11y-panel input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.a11y-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .875rem; }
.a11y-foot a { color: var(--fg); text-underline-offset: 3px; display: inline-block; min-height: 24px; padding: .2rem 0; }
.a11y-reset { min-height: 2rem; padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--fg); font: inherit; cursor: pointer; }
.a11y-reset:hover { border-color: var(--accent); }
.a11y-reset:focus-visible, .a11y-foot a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Animationen aus (Bedienhilfe) bzw. Logo-Aufblitzen in der Instanz abgeschaltet */
html[data-motion="on"] *, html[data-motion="on"] *::before, html[data-motion="on"] *::after { animation: none !important; transition: none !important; }
html[data-motion="on"] .links a:hover, html[data-motion="on"] .links a:focus-visible { transform: none; }
html[data-logo-anim="off"] .logo { animation: none; }

/* Links unterstreichen (Bedienhilfe) */
html[data-underline="on"] .links a, html[data-underline="on"] .foot a, html[data-underline="on"] .legal a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* Hoher Kontrast (Bedienhilfe): reine Schwarz/Weiß-Farben, kein Hintergrundbild, keine Wunschfarben */
html[data-contrast="on"] { --bg: #fff; --fg: #000; --muted: #000; --card: #fff; --border: #000; --on-tint: #000; --accent: #0000cc; }
@media (prefers-color-scheme: dark) {
  html[data-contrast="on"]:not([data-theme="light"]) { --bg: #000; --fg: #fff; --muted: #fff; --card: #000; --border: #fff; --on-tint: #fff; --accent: #ffff00; }
}
html[data-contrast="on"][data-theme="dark"] { --bg: #000; --fg: #fff; --muted: #fff; --card: #000; --border: #fff; --on-tint: #fff; --accent: #ffff00; }
html[data-contrast="on"], html[data-contrast="on"] body { background: var(--bg) !important; }
html[data-contrast="on"] body::before { display: none !important; }
html[data-contrast="on"] .page *, html[data-contrast="on"] .foot a { color: var(--fg) !important; text-shadow: none !important; }
html[data-contrast="on"] .links a, html[data-contrast="on"] .group details, html[data-contrast="on"] .legal-text, html[data-contrast="on"] .theme-toggle, html[data-contrast="on"] .tool-btn { border-width: 2px; border-color: var(--fg); }
html[data-contrast="on"] .links.sub a { background: var(--card); }
html[data-contrast="on"] .group .count { background: transparent; border: 1px solid var(--fg); }
html[data-contrast="on"] .logo { box-shadow: none; }

/* Erklärungsseite */
.legal-text h2 { margin: 1.25rem 0 .5rem; font-size: 1.05rem; }
.legal-text ul { margin: 0 0 .9rem; padding-left: 1.25rem; }
.legal-text li { margin: .25rem 0; }
.legal-text abbr { text-decoration: none; }
.page.legal { padding-top: 4.75rem; }

/* Kontakt */
.links .contact-link { border-style: dashed; }
.contact-form { display: grid; gap: .35rem; }
.contact-form label { font-weight: 600; margin-top: .6rem; }
.contact-form label small { font-weight: 400; color: var(--muted); }
.contact-form input, .contact-form textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--muted); border-radius: 10px;
}
.contact-form textarea { resize: vertical; min-height: 8rem; }
.contact-form input:focus-visible, .contact-form textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.contact-form [aria-invalid="true"] { border: 2px solid #c0182b; }
.field-error { color: #c0182b; font-size: .9rem; font-weight: 600; }
.contact-form button {
  justify-self: start; margin-top: 1rem; min-height: 2.75rem; padding: .7rem 1.4rem;
  border: 0; border-radius: 10px; background: var(--fg); color: var(--bg); font: inherit; font-weight: 700; cursor: pointer;
}
.contact-form button:hover { opacity: .9; }
.contact-form button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.req-note, .privacy-note { margin: 0; font-size: .875rem; color: var(--muted); }
.privacy-note { margin-top: .9rem; }
.privacy-note a { color: var(--fg); }
.form-errors { margin-bottom: 1rem; padding: .9rem 1rem; border: 2px solid #c0182b; border-radius: 10px; }
.form-errors p { margin: 0 0 .4rem; }
.form-errors ul { margin: 0; }
.form-errors a { color: inherit; }
.form-ok { padding: .25rem 0; }
.form-errors:focus, .form-ok:focus { outline: 3px solid var(--accent); outline-offset: 4px; }
.intro { white-space: pre-line; }
/* Falle für Bots: für Menschen unsichtbar, auch für Screenreader */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field-error, :root:not([data-theme="light"]) .form-errors { color: #ff8a8a; border-color: #ff8a8a; } :root:not([data-theme="light"]) .contact-form [aria-invalid="true"] { border-color: #ff8a8a; } }
:root[data-theme="dark"] .field-error, :root[data-theme="dark"] .form-errors { color: #ff8a8a; border-color: #ff8a8a; }
:root[data-theme="dark"] .contact-form [aria-invalid="true"] { border-color: #ff8a8a; }
