/* bookery – Rechtstexte (Datenschutz, Impressum) im Design der Startseite.
   Farben: Salbei aus der App; legal.js übernimmt die auf der Startseite gewählte Farbwelt. */
:root {
  --paper:#E6F6E8; --card:#FAFCF6; --border:#D6EDDA; --chip:#E7F6E9; --ink:#283C34; --muted:#7D8379;
  --accent:#47785B; --soft:#A4BC9C; --accent-card:#D2F2DD; --on-accent:#FAFCF6;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
  --radius: 24px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --paper:#16241B; --card:#26382D; --border:#3D5744; --chip:#314434; --ink:#FAFBFA; --muted:#BFC4BD;
  --accent:#AFD0BB; --soft:#799D72; --accent-card:#223E2A; --on-accent:#16241B; color-scheme: dark } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; touch-action: manipulation; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 var(--sans);
  min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12px/1 var(--sans); letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); }

/* ---------- Kopfzeile (wie Startseite) ---------- */
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  background: color-mix(in srgb, var(--paper) 72%, transparent); border-bottom: 1px solid transparent; transition: border-color .3s; }
.nav.scrolled { border-bottom-color: var(--border); }
.nav .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 400 1.35rem/1 var(--serif); margin-right: auto; }
.brand img { width: 34px; height: 34px; border-radius: 22.5%; box-shadow: 0 2px 8px rgb(0 0 0 / .15); }
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.pill { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; background: var(--accent);
  color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: .95rem; transition: transform .15s; }
.pill:hover { transform: translateY(-1px); }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ---------- Kopf der Seite ---------- */
.page-head { position: relative; padding: clamp(48px, 9vw, 104px) 0 clamp(36px, 6vw, 64px); isolation: isolate; }
/* Verlauf statt filter: blur, sonst zeigt Safari ein helles Rechteck */
.page-head::before, .page-head::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.page-head::before { width: 720px; height: 720px; opacity: .7; top: -280px; right: -180px; background: radial-gradient(closest-side, var(--accent-card), transparent); }
.page-head::after { width: 560px; height: 560px; opacity: .22; top: -80px; left: -280px; background: radial-gradient(closest-side, var(--soft), transparent); }
.page-head .wrap { display: grid; gap: 18px; justify-items: start; }
h1 { font: 400 clamp(2.6rem, 6vw, 4.4rem)/1.04 var(--serif); letter-spacing: -.01em; margin: 0; }
h1 em { font-style: italic; color: var(--accent); }
.lede { margin: 0; max-width: 34em; color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.2rem); text-wrap: pretty; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.chips li { padding: 6px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: .85rem; font-weight: 600; }

/* ---------- Kurz gesagt ---------- */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.summary div { background: var(--accent-card); border-radius: var(--radius); padding: 24px 26px; }
.summary svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 10px; }
.summary b { display: block; font: 400 1.3rem/1.25 var(--serif); margin-bottom: 4px; }
.summary p { margin: 0; color: var(--muted); font-size: .95rem; }
@media (max-width: 820px) { .summary { grid-template-columns: 1fr; } }

/* ---------- Text mit Inhaltsverzeichnis ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; padding-bottom: clamp(64px, 10vw, 112px); }
.layout.single { grid-template-columns: minmax(0, 1fr); }
.toc { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 4px 0; }
.toc .eyebrow { margin: 6px 0 14px 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: grid; grid-template-columns: 24px 1fr; gap: 6px; padding: 7px 12px; border-radius: 12px; color: var(--muted);
  text-decoration: none; font-size: .9rem; line-height: 1.35; transition: background-color .2s, color .2s; }
.toc a::before { counter-increment: toc; content: counter(toc); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.toc a:hover { color: var(--ink); background: var(--chip); }
.toc a.active { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.toc-mobile { display: none; }

.doc { background: var(--card); border: 1px solid var(--border); border-radius: 32px; padding: clamp(24px, 5vw, 56px); }
.doc section + section { border-top: 1px solid var(--border); margin-top: 36px; padding-top: 36px; }
.doc h2 { display: flex; align-items: baseline; gap: 14px; margin: 0 0 14px; font: 400 clamp(1.45rem, 2.6vw, 1.85rem)/1.2 var(--serif); letter-spacing: -.005em; }
.doc h2 .num { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; transform: translateY(-3px);
  background: var(--chip); color: var(--accent); font: 600 .9rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.doc p { margin: 0 0 1em; max-width: 68ch; text-wrap: pretty; }
.doc p:last-child, .doc ul:last-child { margin-bottom: 0; }
.doc ul { margin: 0 0 1em; padding: 0; list-style: none; display: grid; gap: 10px; max-width: 68ch; }
.doc li { position: relative; padding-left: 22px; }
.doc li::before { content: ""; position: absolute; left: 4px; top: .7em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.doc strong { font-weight: 600; }
/* Verantwortlicher: Anschrift zurückhaltend, Kontakt groß (wie im Impressum) */
.doc .anschrift { margin-bottom: 8px; font-size: 12px; line-height: 1.55; }
.doc .mail-big a { font: 400 clamp(1.3rem, 3.4vw, 1.9rem)/1.2 var(--serif); color: var(--ink); text-decoration: none; word-break: break-word;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat; padding-bottom: 4px; }
.doc .mail-big a:hover { color: var(--accent); }
.doc .note { color: var(--muted); font-size: .95rem; }

/* ---------- Impressum: Karten ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding-bottom: clamp(64px, 10vw, 112px); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(24px, 4vw, 34px); display: grid; align-content: start; gap: 10px; }
.card.accent { background: var(--accent-card); border-color: transparent; }
.card.wide { grid-column: 1 / -1; }
.card.wide .big { font-size: clamp(1.6rem, 5.4vw, 2.8rem); }
.card h2 { margin: 0; font: 600 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.card p { margin: 0; color: var(--muted); }
.card address { font: 400 12px/1.55 var(--sans); font-style: normal; color: var(--ink); } /* Anschrift bewusst zurückhaltend */
.card .big { font: 400 clamp(1.3rem, 3.4vw, 1.9rem)/1.2 var(--serif); color: var(--ink); text-decoration: none; word-break: break-word;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat; padding-bottom: 4px; justify-self: start; }
.card .big:hover { color: var(--accent); }
@media (max-width: 720px) { .cards { grid-template-columns: 1fr; } }

/* ---------- Fuß (wie Startseite) ---------- */
footer { border-top: 1px solid var(--border); padding: 32px 0 48px; }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
footer nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
footer nav a:hover, footer nav a[aria-current="page"] { color: var(--ink); }
footer small { color: var(--muted); }

/* ---------- Schmale Fenster: Inhaltsverzeichnis zum Aufklappen ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toc { display: none; }
  .toc-mobile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 0 20px; }
  .toc-mobile summary { list-style: none; cursor: pointer; padding: 16px 32px 16px 0; position: relative; font-weight: 600; }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after { content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center; background: var(--chip); color: var(--accent); font: 500 1.3rem/1 var(--sans); transition: transform .25s; }
  .toc-mobile[open] summary::after { transform: translateY(-50%) rotate(45deg); }
  .toc-mobile ol { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
  .toc-mobile a { display: grid; grid-template-columns: 26px 1fr; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: .95rem; }
  .toc-mobile a::before { counter-increment: toc; content: counter(toc); font-weight: 600; color: var(--accent); }
}

/* ---------- iPhone: eine Nummer kleiner, wie auf der Startseite ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .nav .wrap { height: 56px; }
  .brand { font-size: 1.2rem; } .brand img { width: 30px; height: 30px; }
  .pill { padding: 8px 14px; font-size: .88rem; }
  .page-head { padding: 36px 0 28px; }
  .page-head .wrap { gap: 14px; }
  h1 { font-size: clamp(2.2rem, 10.5vw, 2.8rem); }
  .lede { font-size: 1rem; }
  .summary { gap: 12px; }
  .summary div { padding: 18px 20px; border-radius: 20px; }
  .summary b { font-size: 1.15rem; }
  .doc { border-radius: 24px; padding: 22px 18px; }
  .doc section + section { margin-top: 28px; padding-top: 28px; }
  .doc h2 { gap: 12px; font-size: 1.35rem; }
  .doc h2 .num { width: 30px; height: 30px; font-size: .82rem; }
  .card { border-radius: 20px; padding: 22px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Nach oben (wie auf dustingotte.de: erscheint nach knapp einer Bildschirmhöhe) ---------- */
.to-top { position: fixed; z-index: 40; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 26px rgb(0 0 0 / .22); opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none;
  transition: opacity .3s cubic-bezier(.2,.7,.2,1), transform .3s cubic-bezier(.2,.7,.2,1); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:active { transform: scale(.94); }
.to-top svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .to-top { right: 28px; bottom: 28px; width: 52px; height: 52px; } }

/* ---------- Kontakt: Formular links, direkte Wege rechts ---------- */
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; padding-bottom: clamp(64px, 10vw, 112px); }
.contact-form { background: var(--card); border: 1px solid var(--border); border-radius: 32px; padding: clamp(22px, 4vw, 40px); display: grid; gap: 22px; }
.contact-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.contact-form legend, .f-label { display: block; padding: 0; margin: 0 0 10px; font-weight: 600; font-size: .95rem; }
.f-label .opt { color: var(--muted); font-weight: 400; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topics label { position: relative; cursor: pointer; }
.topics input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.topics span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--paper); font-weight: 600; font-size: .95rem; color: var(--muted); transition: background-color .15s, border-color .15s, color .15s; }
.topics svg { width: 16px; height: 16px; }
.topics label:hover span { color: var(--ink); }
.topics input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.topics input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f-field { display: grid; align-content: start; }
.f-field input, .f-field textarea { width: 100%; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--paper);
  color: var(--ink); font: 400 1.05rem/1.45 var(--sans); transition: border-color .2s, box-shadow .2s; }
.f-field input { min-height: 52px; }
.f-field textarea { min-height: 180px; resize: vertical; }
.f-field ::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.f-field input:focus, .f-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.f-field [aria-invalid="true"] { border-color: #C2453A; }
.f-hint { display: flex; justify-content: space-between; gap: 12px; margin: 6px 4px 0; color: var(--muted); font-size: .85rem; }
.f-hint:not(:has(span:not(:empty))) { display: none; }
.f-hint .err { color: #C2453A; }
.f-hint .count { margin-left: auto; font-variant-numeric: tabular-nums; }
.f-hint .count.near { color: #C2453A; }
.f-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding-top: 22px; border-top: 1px solid var(--border); }
.f-foot p { margin: 0; flex: 1 1 220px; color: var(--muted); font-size: .88rem; }
.f-foot p.error { color: #C2453A; }
.send { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: 600 1rem/1 var(--sans); cursor: pointer;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .18s ease, box-shadow .18s ease; }
.send:hover { transform: translateY(-2px); }
.send:active { transform: scale(.98); }
.send[disabled] { opacity: .7; cursor: progress; transform: none; }
.send svg { width: 18px; height: 18px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (prefers-color-scheme: dark) { .f-field [aria-invalid="true"] { border-color: #F08A80; } .f-hint .err, .f-hint .count.near, .f-foot p.error { color: #F08A80; } }

.sent-box { display: grid; justify-items: start; gap: 12px; padding: 8px 0; }
.sent-box[hidden] { display: none; }
.sent-box .check { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.sent-box .check svg { width: 24px; height: 24px; }
.sent-box h2 { margin: 0; font: 400 clamp(1.6rem, 3vw, 2rem)/1.2 var(--serif); }
.sent-box p { margin: 0; color: var(--muted); max-width: 34em; }
.sent-box button { background: none; border: 0; padding: 0; color: var(--accent); font: 600 1rem/1.4 var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.contact-form.sent > :not(.sent-box) { display: none; }

.contact-side { display: grid; gap: 16px; }
.contact-side .card { padding: clamp(22px, 3vw, 30px); }
.contact-side .big { font-size: clamp(1.2rem, 2.2vw, 1.45rem); }

@media (max-width: 860px) { .contact-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .contact-form { border-radius: 24px; padding: 22px 18px; gap: 20px; }
  .f-row { grid-template-columns: 1fr; gap: 20px; }
  .topics { gap: 6px; }
  .topics span { padding: 8px 12px; font-size: .9rem; }
  .f-field input, .f-field textarea { font-size: 16px; } /* sonst zoomt Safari auf dem iPhone hinein */
  .send { width: 100%; }
}

/* ---------- 404 (Caddy liefert die Seite über handle_errors aus; alle Pfade absolut) ---------- */
.nf { display: grid; align-content: center; }
.nf-book { width: 56px; height: 56px; color: var(--accent); opacity: .8; }
.nf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 8px 0 0; }
.nf-actions a:not(.pill) { font-weight: 500; }
