/* planr-Dokumentation
 *
 * Die Palette stammt aus dem lehrr-Systemplan (Papier, Tafelgrün) und trägt als
 * Akzent das Indigo, das planr dort schon hat. Alle Farben stehen als Variablen
 * auf :root; der dunkle Satz überschreibt nur die Werte, nie die Regeln. */

:root {
  color-scheme: light;

  --papier: #f4f6f3;
  --blatt: #ffffff;
  --blatt-2: #fafbfa;
  --tinte: #15201b;
  --tinte-weich: #3c4a44;
  --grau: #5f6d67;
  --grau-hell: #8a978f;
  --linie: #dde4df;
  --linie-zart: #e9eeeb;

  --tafel: #1c6047;
  --akzent: #4f46e5;
  --akzent-weich: #6d64f0;
  --akzent-blass: #eeecfd;
  --gelb: #b07d0c;
  --code-grund: #f3f5f2;

  --schrift: "Nunito", "Avenir Next", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --kopf-hoehe: 3.75rem;
  --leiste-breite: 17rem;
  --schatten: 0 1px 2px rgb(21 32 27 / .05), 0 8px 24px -12px rgb(21 32 27 / .18);
  --schatten-tief: 0 24px 60px -20px rgb(21 32 27 / .3);

  /* highlight.js */
  --hl-kommentar: #74857c;
  --hl-schluessel: #9a3d8f;
  --hl-text: #1f6f4f;
  --hl-zahl: #b3591b;
  --hl-titel: #2a5fb8;
  --hl-attribut: #7a5c00;
}

:root[data-thema="dunkel"],
:root:not([data-thema="hell"]) {
  /* Der dunkle Satz gilt für die ausdrückliche Wahl und - über die Media-Regel
   * weiter unten - für Systeme ohne Wahl. */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) { color-scheme: dark; }
}

:root[data-thema="dunkel"] { color-scheme: dark; }

/* Ein Satz Werte, zwei Auslöser. Doppelt notiert, weil CSS keine Variablen-
 * Vererbung über Selektorlisten mit @media hinweg kennt. */
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --papier: #10151a;
    --blatt: #171d24;
    --blatt-2: #1c232b;
    --tinte: #e8eef0;
    --tinte-weich: #b7c3c6;
    --grau: #93a1a5;
    --grau-hell: #6d7c81;
    --linie: #2a333c;
    --linie-zart: #222a32;
    --tafel: #4fb08a;
    --akzent: #9b95ff;
    --akzent-weich: #b4aeff;
    --akzent-blass: #23233d;
    --gelb: #e0aa3e;
    --code-grund: #12181e;
    --schatten: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
    --schatten-tief: 0 24px 60px -20px rgb(0 0 0 / .75);
    --hl-kommentar: #6f8087;
    --hl-schluessel: #e08bd4;
    --hl-text: #7fd6a6;
    --hl-zahl: #f0a86a;
    --hl-titel: #82b4ff;
    --hl-attribut: #e2c275;
  }
}

:root[data-thema="dunkel"] {
  --papier: #10151a;
  --blatt: #171d24;
  --blatt-2: #1c232b;
  --tinte: #e8eef0;
  --tinte-weich: #b7c3c6;
  --grau: #93a1a5;
  --grau-hell: #6d7c81;
  --linie: #2a333c;
  --linie-zart: #222a32;
  --tafel: #4fb08a;
  --akzent: #9b95ff;
  --akzent-weich: #b4aeff;
  --akzent-blass: #23233d;
  --gelb: #e0aa3e;
  --code-grund: #12181e;
  --schatten: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
  --schatten-tief: 0 24px 60px -20px rgb(0 0 0 / .75);
  --hl-kommentar: #6f8087;
  --hl-schluessel: #e08bd4;
  --hl-text: #7fd6a6;
  --hl-zahl: #f0a86a;
  --hl-titel: #82b4ff;
  --hl-attribut: #e2c275;
}

/* --------------------------------------------------------------- Grundlagen */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--kopf-hoehe) + 1.5rem);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--akzent); text-decoration-color: color-mix(in srgb, var(--akzent) 35%, transparent); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }

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

.sprung {
  position: absolute; left: .5rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; border-radius: .5rem;
  background: var(--akzent); color: #fff; font-weight: 700; text-decoration: none;
  transition: top .15s;
}
.sprung:focus { top: .5rem; }

/* --------------------------------------------------------------------- Kopf */

.kopf {
  position: sticky; top: 0; z-index: 50;
  height: var(--kopf-hoehe);
  background: color-mix(in srgb, var(--blatt) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--linie);
}

.kopf-innen {
  height: 100%;
  max-width: 88rem; margin: 0 auto;
  padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1.5rem;
}

.marke { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; flex-shrink: 0; }
.marke-zeichen { width: 1.75rem; height: 1.75rem; }
.marke-zeichen rect { fill: var(--tafel); }
.marke-text { display: flex; align-items: baseline; gap: .5rem; line-height: 1; }
.marke-text b { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; }
.marke-zusatz { font-size: .82rem; color: var(--grau); font-weight: 600; }

/* Der Kopf trägt zwei Ebenen: lehrr führt auf die Übersicht über alle sechs
 * Werkzeuge, planr auf die Startseite dieser Dokumentation. */
.marke-trenner { color: var(--grau-hell); font-weight: 400; flex-shrink: 0; margin: 0 -.35rem; }

.marke-doku {
  display: flex; align-items: baseline; gap: .5rem;
  line-height: 1; text-decoration: none; color: inherit; flex-shrink: 0;
}
.marke-doku b { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; color: var(--akzent); }
.marke-doku:hover b { text-decoration: underline; text-underline-offset: .2em; }

.nav { display: flex; gap: .25rem; margin-right: auto; }

.nav-tab {
  padding: .45rem .8rem; border-radius: .5rem;
  font-size: .92rem; font-weight: 700; color: var(--grau);
  text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--linie-zart); color: var(--tinte); }
.nav-tab.ist-aktiv { background: var(--akzent-blass); color: var(--akzent); }

.kopf-werkzeuge { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

.suche-oeffnen {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem .4rem .55rem;
  min-width: 12rem;
  border: 1px solid var(--linie); border-radius: .55rem;
  background: var(--blatt-2); color: var(--grau);
  font: inherit; font-size: .88rem; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.suche-oeffnen:hover { border-color: var(--akzent); color: var(--tinte); }
.suche-oeffnen svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.suche-oeffnen span { margin-right: auto; }
.suche-oeffnen kbd {
  font-family: var(--mono); font-size: .72rem;
  padding: .1rem .35rem; border: 1px solid var(--linie); border-radius: .25rem;
  background: var(--blatt); color: var(--grau-hell);
}

.thema-schalter, .menue-schalter {
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--linie); border-radius: .55rem;
  background: var(--blatt-2); color: var(--grau);
  cursor: pointer; padding: 0;
  transition: border-color .15s, color .15s;
}
.thema-schalter:hover, .menue-schalter:hover { border-color: var(--akzent); color: var(--tinte); }
.thema-schalter svg, .menue-schalter svg {
  width: 1.15rem; height: 1.15rem;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.thema-schalter .mond { display: none; }
:root[data-thema="dunkel"] .thema-schalter .sonne { display: none; }
:root[data-thema="dunkel"] .thema-schalter .mond { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) .thema-schalter .sonne { display: none; }
  :root:not([data-thema="hell"]) .thema-schalter .mond { display: block; }
}

.menue-schalter { display: none; }

/* ------------------------------------------------------------------ Aufbau */

.rahmen {
  max-width: 88rem; margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: var(--leiste-breite) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.leiste {
  position: sticky; top: var(--kopf-hoehe);
  max-height: calc(100vh - var(--kopf-hoehe));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 2.25rem 0 3rem;
}

.kapitel-kopf {
  margin: 0 0 .75rem; padding-left: .85rem;
  font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--grau-hell);
}

.kapitel ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--linie); }

.kapitel li a {
  display: block;
  padding: .3rem 0 .3rem .85rem;
  margin-left: -2px; border-left: 2px solid transparent;
  font-size: .89rem; line-height: 1.45; color: var(--grau);
  text-decoration: none;
  transition: color .12s, border-color .12s;
}
.kapitel li a:hover { color: var(--tinte); }
.kapitel .ebene-3 a { padding-left: 1.7rem; font-size: .84rem; color: var(--grau-hell); }
.kapitel li a.ist-hier { color: var(--akzent); border-left-color: var(--akzent); font-weight: 700; }

.inhalt { min-width: 0; padding: 2.25rem 0 4rem; }
.dokument { max-width: 48rem; }

/* Fließtext liest sich am besten schmal; Tabellen und Codeblöcke tragen aber
 * Zeilen, die dort nicht hineinpassen - sie duerfen auf breiten Bildschirmen
 * ueber den Satzspiegel hinausragen. */
@media (min-width: 90rem) {
  .tabelle, .codeblock, .diagramm { width: min(58rem, calc(100vw - var(--leiste-breite) - 8rem)); }
}

/* ----------------------------------------------------------------- Typografie */

.brotkrume { margin: 0 0 .5rem; font-size: .85rem; font-weight: 600; color: var(--grau-hell); }
.brotkrume a { color: var(--grau); text-decoration: none; }
.brotkrume a:hover { color: var(--akzent); }
.brotkrume span { margin: 0 .35rem; }

.dokument h1 {
  margin: 0 0 .6rem;
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem); font-weight: 800;
  letter-spacing: -.025em; line-height: 1.12;
}

.anriss {
  margin: 0 0 2.25rem;
  font-size: 1.1rem; line-height: 1.6; color: var(--grau);
  max-width: 40rem;
}

.dokument h2, .dokument h3, .dokument h4 {
  position: relative;
  scroll-margin-top: calc(var(--kopf-hoehe) + 1.5rem);
  letter-spacing: -.015em;
}

.dokument h2 {
  margin: 3.25rem 0 1rem;
  padding-top: 1.75rem; border-top: 1px solid var(--linie);
  font-size: 1.6rem; font-weight: 800; line-height: 1.25;
}
/* Die Quellen trennen ihre Kapitel mit "---". Zusammen mit der Linie an h2
 * stuenden dort zwei Striche untereinander. */
.dokument hr + h2 { border-top: 0; padding-top: 0; margin-top: 1.75rem; }

.dokument h3 { margin: 2.25rem 0 .75rem; font-size: 1.2rem; font-weight: 700; }
.dokument h4 { margin: 1.75rem 0 .5rem; font-size: 1.02rem; font-weight: 700; color: var(--tinte-weich); }

.anker {
  position: absolute; left: -1.2rem; top: 50%; translate: 0 -50%;
  color: var(--grau-hell); text-decoration: none; font-weight: 400;
  opacity: 0; transition: opacity .12s;
}
h2:hover .anker, h3:hover .anker, h4:hover .anker, .anker:focus-visible { opacity: 1; }
@media (max-width: 60rem) { .anker { display: none; } }

.dokument p { margin: 0 0 1.15rem; }
.dokument strong { font-weight: 800; color: var(--tinte); }

.dokument ul, .dokument ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
.dokument li { margin-bottom: .45rem; }
.dokument li::marker { color: var(--grau-hell); }
.dokument ul ul, .dokument ol ol { margin-top: .45rem; margin-bottom: 0; }

.dokument hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--linie); }

blockquote {
  margin: 0 0 1.15rem; padding: .1rem 0 .1rem 1.15rem;
  border-left: 3px solid var(--tafel);
  color: var(--tinte-weich); font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

/* Code im Fließtext, und Pfade, die auf ein Dokument zeigen, das diese Website
 * nicht führt - beide sind Kennungen und keine Links. */
.dokument :not(pre) > code, .pfad {
  font-family: var(--mono); font-size: .855em;
  padding: .12em .38em; border-radius: .3rem;
  background: var(--code-grund);
  border: 1px solid var(--linie-zart);
  /* break-word statt break-all: ein Paketname bricht am Schrägstrich und nicht
   * mitten im Wort - "@neondatabase/a uth" war unlesbar. */
  overflow-wrap: break-word;
}
.pfad { color: var(--tinte-weich); border-style: dashed; cursor: help; }

/* --------------------------------------------------------------- Codeblöcke */

.codeblock {
  position: relative;
  margin: 0 0 1.5rem; padding: 0;
  background: var(--code-grund);
  border: 1px solid var(--linie);
  border-radius: .7rem;
  overflow: hidden;
}

/* Das Sprach-Label steht am Kasten, der Code scrollt darunter durch. Ohne
 * eigenen Grund läge es auf einer langen Zeile und beide wären unlesbar. */
.codeblock::before {
  content: attr(data-sprache);
  position: absolute; top: .5rem; right: .6rem; z-index: 1;
  padding: .1rem .4rem; border-radius: .3rem;
  background: var(--code-grund);
  font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--grau-hell); pointer-events: none;
}

.codeblock pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; }
/* Platz für Label und Kopieren-Knopf, damit kurzer Code nicht darunter liegt. */
.codeblock[data-sprache] pre { padding-right: 4.5rem; }
.codeblock code { font-family: var(--mono); font-size: .855rem; line-height: 1.65; }

.kopieren {
  position: absolute; top: .45rem; right: .5rem; z-index: 2;
  padding: .25rem .55rem;
  border: 1px solid var(--linie); border-radius: .35rem;
  background: var(--blatt); color: var(--grau);
  font: inherit; font-size: .75rem; font-weight: 700;
  cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
.codeblock:hover .kopieren, .kopieren:focus-visible { opacity: 1; }
.kopieren:hover { color: var(--akzent); border-color: var(--akzent); }
.kopieren[data-stand="fertig"] { opacity: 1; color: var(--tafel); border-color: var(--tafel); }

.hljs-comment, .hljs-quote { color: var(--hl-kommentar); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: var(--hl-schluessel); }
.hljs-string, .hljs-meta .hljs-string { color: var(--hl-text); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--hl-zahl); }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: var(--hl-titel); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--hl-attribut); }
.hljs-meta { color: var(--grau); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------------------------------------------------------------- Tabellen */

.tabelle {
  margin: 0 0 1.6rem;
  border: 1px solid var(--linie); border-radius: .7rem;
  overflow-x: auto;
  background: var(--blatt);
}

table { width: 100%; border-collapse: collapse; font-size: .93rem; }

th {
  padding: .7rem .9rem; text-align: left;
  font-weight: 800; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--grau); background: var(--blatt-2);
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}
td { padding: .7rem .9rem; border-bottom: 1px solid var(--linie-zart); vertical-align: top; line-height: 1.6; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--akzent) 4%, transparent); }
td :not(pre) > code { font-size: .8em; }

/* --------------------------------------------------------------- Diagramme */

.diagramm {
  position: relative;
  margin: 0 0 1.6rem; padding: 1.5rem 1rem;
  background: var(--blatt); border: 1px solid var(--linie); border-radius: .7rem;
  overflow-x: auto; overscroll-behavior-x: contain;
}
.diagramm pre.mermaid {
  margin: 0; text-align: center;
  font-family: var(--mono); font-size: .8rem; color: var(--grau-hell);
}
.diagramm pre.mermaid[data-processed] { font-size: inherit; }
.diagramm svg { height: auto; }

/* Ein Diagramm, das breiter ist als der Kasten, sagt das - sonst sieht der
 * angeschnittene rechte Rand nach Fehler aus statt nach Fortsetzung. */
.diagramm.ist-breit { padding-top: 2.9rem; }
.diagramm.ist-breit::after {
  content: "";
  position: sticky; right: 0; top: 0; float: right;
  width: 3rem; height: 100%;
  margin-right: -1rem;
  background: linear-gradient(to right, transparent, var(--blatt));
  pointer-events: none;
}

.diagramm-gross {
  position: sticky; left: 0; top: 0; z-index: 2;
  float: left;
  margin: -1rem 0 .5rem;
  padding: .3rem .65rem;
  border: 1px solid var(--linie); border-radius: .4rem;
  background: var(--blatt-2); color: var(--grau);
  font: inherit; font-size: .78rem; font-weight: 700;
  cursor: pointer;
}
.diagramm-gross:hover { color: var(--akzent); border-color: var(--akzent); }

.diagramm-buehne {
  position: fixed; inset: 0; z-index: 95;
  display: flex; flex-direction: column;
  background: var(--papier);
}
.buehne-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--linie);
  background: var(--blatt);
  font-size: .88rem; font-weight: 700; color: var(--grau);
}
.buehne-zu {
  padding: .35rem .8rem;
  border: 1px solid var(--linie); border-radius: .45rem;
  background: var(--blatt-2); color: var(--tinte);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.buehne-zu:hover { border-color: var(--akzent); color: var(--akzent); }
.buehne-flaeche { flex: 1; overflow: auto; padding: 1.5rem; display: grid; place-items: center start; }
.buehne-flaeche svg { max-width: none; }

/* ------------------------------------------------------------------ Karten */

.karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 0 0 2.5rem; }

/* Bei genau vier Karten wäre die vierte allein in der zweiten Reihe. Zwei mal
 * zwei liest sich ruhiger - aber erst, wenn zwei Spalten auch Platz haben. */
@media (min-width: 46rem) {
  .karten:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.karte {
  position: relative;
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.25rem 1.25rem 1.4rem;
  background: var(--blatt); border: 1px solid var(--linie); border-radius: .8rem;
  text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.karte:hover { border-color: var(--akzent); transform: translateY(-2px); box-shadow: var(--schatten); }

.karte-marke {
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--akzent);
}
.karte-titel { font-size: 1.08rem; font-weight: 800; letter-spacing: -.01em; }
.karte-text { font-size: .89rem; line-height: 1.55; color: var(--grau); }
.karte-pfeil { margin-top: .5rem; color: var(--akzent); font-size: 1.1rem; transition: translate .15s; }
.karte:hover .karte-pfeil { translate: .25rem 0; }

.weiter { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--linie); }
.weiter-kopf {
  margin: 0 0 1rem;
  font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--grau-hell);
}

/* -------------------------------------------------------------------- Fuß */

.fuss {
  max-width: 48rem;
  margin-top: 3rem; padding-top: 1.75rem;
  border-top: 1px solid var(--linie);
  font-size: .88rem; color: var(--grau);
}
.fuss p { margin: 0 0 .4rem; }
.fuss b { color: var(--tafel); font-weight: 800; }
.fuss-lehrr { color: var(--tafel); font-weight: 800; text-decoration-color: color-mix(in srgb, var(--tafel) 35%, transparent); }
.fuss-stand { color: var(--grau-hell); font-size: .82rem; }

/* ------------------------------------------------------------------ Suche */

.suche { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: 10vh 1rem 1rem; }
.suche[hidden] { display: none; }
.suche-hinter { position: absolute; inset: 0; background: rgb(10 16 13 / .45); backdrop-filter: blur(3px); }

.suche-fenster {
  position: relative; width: min(40rem, 100%);
  background: var(--blatt); border: 1px solid var(--linie); border-radius: .9rem;
  box-shadow: var(--schatten-tief);
  overflow: hidden;
  animation: auftauchen .16s ease-out;
}
@keyframes auftauchen { from { opacity: 0; transform: translateY(-6px); } }

.suche-zeile { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-bottom: 1px solid var(--linie); }
.suche-zeile svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; fill: none; stroke: var(--grau-hell); stroke-width: 1.8; stroke-linecap: round; }
.suche-zeile input {
  flex: 1; min-width: 0;
  border: 0; background: none; color: var(--tinte);
  font: inherit; font-size: 1.02rem;
}
.suche-zeile input:focus { outline: none; }
.suche-zeile input::-webkit-search-cancel-button { display: none; }

.suche-schliessen {
  padding: .2rem .45rem; border: 1px solid var(--linie); border-radius: .3rem;
  background: var(--blatt-2); color: var(--grau-hell);
  font-family: var(--mono); font-size: .72rem; cursor: pointer;
}
.suche-schliessen:hover { color: var(--tinte); }

.suche-treffer { max-height: min(26rem, 55vh); overflow-y: auto; padding: .4rem; }

.treffer {
  display: block; padding: .65rem .8rem; border-radius: .5rem;
  text-decoration: none; color: inherit;
}
.treffer:hover, .treffer.ist-gewaehlt { background: var(--akzent-blass); }

.treffer-kopf { display: flex; align-items: baseline; gap: .5rem; }
.treffer-bereich {
  font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--akzent); flex-shrink: 0;
}
.treffer-titel { font-weight: 700; font-size: .95rem; }
.treffer-text {
  margin: .15rem 0 0;
  font-size: .84rem; line-height: 1.5; color: var(--grau);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.treffer mark { background: color-mix(in srgb, var(--gelb) 30%, transparent); color: inherit; border-radius: .15rem; padding: 0 .1em; }

.suche-leer { padding: 2rem 1rem; text-align: center; color: var(--grau); font-size: .92rem; }

/* ------------------------------------------------------------ Schmale Geräte */

@media (max-width: 68rem) {
  :root { --leiste-breite: 14rem; }
  .rahmen { gap: 2rem; }
  .suche-oeffnen { min-width: 0; }
  .suche-oeffnen span, .suche-oeffnen kbd { display: none; }
  .suche-oeffnen { width: 2.25rem; height: 2.25rem; padding: 0; display: grid; place-items: center; }
}

@media (max-width: 56rem) {
  .kopf-innen { gap: .75rem; }
  .marke-zusatz { display: none; }
  .marke-trenner { margin: 0 -.15rem; }
  .marke-doku b { font-size: 1.05rem; }
  .menue-schalter { display: grid; }

  .nav {
    position: fixed; left: 0; right: 0; top: var(--kopf-hoehe);
    padding: .5rem 1.25rem;
    background: var(--blatt); border-bottom: 1px solid var(--linie);
    overflow-x: auto; gap: .35rem;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .rahmen { grid-template-columns: minmax(0, 1fr); gap: 0; }

  .leiste {
    position: fixed; inset: calc(var(--kopf-hoehe) + 3rem) 0 0 auto;
    z-index: 40; width: min(20rem, 82vw);
    max-height: none;
    padding: 1.25rem 1.25rem 2rem;
    background: var(--blatt); border-left: 1px solid var(--linie);
    box-shadow: var(--schatten-tief);
    translate: 100% 0; visibility: hidden;
    transition: translate .2s ease, visibility .2s;
  }
  .leiste.ist-offen { translate: 0 0; visibility: visible; }

  .inhalt { padding-top: 4.5rem; }
  .dokument h2 { margin-top: 2.5rem; }
}

@media (max-width: 30rem) {
  .rahmen, .kopf-innen { padding-inline: 1rem; }
  .nav { padding-inline: 1rem; }
  body { font-size: .97rem; }
  .karten { grid-template-columns: 1fr; }
  th, td { padding: .55rem .65rem; }
}

@media print {
  .kopf, .leiste, .suche, .weiter, .kopieren, .anker { display: none !important; }
  .rahmen { display: block; }
  .inhalt { padding: 0; }
  .dokument { max-width: none; }
  body { background: #fff; color: #000; }
}
