/* Aussehen der Werkschau. Hell und dunkel, eine Datei, kein Framework.
   Ziel: ein langer Fachtext soll lesbar und navigierbar wirken, nicht wie
   eine Wand. Die Mittel dafuer sind Raum, Typografie und ein mitlaufendes
   Inhaltsverzeichnis -- keine Bilder und keine Emojis. JavaScript gibt es
   genau eines: die Schaltflaeche, die einen Prompt in die Zwischenablage
   legt. Ohne sie bleibt die Seite vollstaendig benutzbar. */

:root {
  --grund: #fbfaf8;
  --flaeche: #ffffff;
  --flaeche-leise: #f6f3ee;
  --rand: #e3ded6;
  --rand-leise: #ece7df;
  --text: #22201d;
  --text-leise: #6b655d;
  --akzent: #8a5a2b;
  --akzent-flaeche: #f5efe6;
  --code-grund: #f4f1ec;

  --mass: 39rem;          /* Lesebreite des Textes */
  --inhalt-breite: 14rem; /* mitlaufendes Inhaltsverzeichnis am Rand */

  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #15171a;
    --flaeche: #1c1f23;
    --flaeche-leise: #20242a;
    --rand: #30353b;
    --rand-leise: #272c32;
    --text: #e7e4df;
    --text-leise: #9c978f;
    --akzent: #d8a46a;
    --akzent-flaeche: #26231d;
    --code-grund: #21252a;
  }
}

:root[data-theme="dark"] {
  --grund: #15171a;
  --flaeche: #1c1f23;
  --flaeche-leise: #20242a;
  --rand: #30353b;
  --rand-leise: #272c32;
  --text: #e7e4df;
  --text-leise: #9c978f;
  --akzent: #d8a46a;
  --akzent-flaeche: #26231d;
  --code-grund: #21252a;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.75rem; /* Platz fuer die stehende Leiste */
}

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

body {
  margin: 0;
  padding: 0 0 5rem;
  background: var(--grund);
  color: var(--text);
  font: 400 1.09rem/1.72 var(--serif);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Alles liegt in derselben Spur: Lesebreite plus Rand links und rechts.
   Die Leiste und die Fusslinie selbst gehen ueber die volle Breite. */
main, .kopf, .leiste-inhalt, .fuss-inhalt {
  max-width: calc(var(--mass) + 2.5rem);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

::selection { background: var(--akzent-flaeche); color: var(--text); }

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

/* --- Lesefortschritt ---------------------------------------------------
   Reiner CSS-Balken oben am Rand, nur in Browsern mit scroll()-Zeitachse.
   Ohne Unterstuetzung bleibt er unsichtbar, nicht voll. */

.fortschritt {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: 2px;
  background: var(--akzent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

@supports (animation-timeline: scroll()) {
  .fortschritt {
    animation: fortschritt linear;
    animation-timeline: scroll(root block);
  }
}

@keyframes fortschritt {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Sprungmarke fuer die Tastatur: unsichtbar, bis sie den Fokus bekommt. */
.sprung {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--akzent);
  border-radius: 0 0 8px 0;
  background: var(--flaeche);
  color: var(--text);
  font: 500 0.9rem/1 var(--sans);
  text-decoration: none;
}

.sprung:focus { left: 0; }

/* --- Leiste oben -------------------------------------------------------- */

.leiste {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--grund);
  background: color-mix(in srgb, var(--grund) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rand-leise);
}

.leiste-inhalt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 3.25rem;
}

.marke {
  color: var(--text);
  font: 600 0.78rem/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.marke:hover { color: var(--akzent); }

.menue {
  display: flex;
  gap: 1.25rem;
  font: 500 0.88rem/1 var(--sans);
}

.menue a {
  color: var(--text-leise);
  text-decoration: none;
  white-space: nowrap;
}

.menue a:hover { color: var(--akzent); }

.menue a[aria-current="page"] { color: var(--text); }

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

.kopf { padding-top: 2.5rem; }

.hero { padding: 1.5rem 0 2.5rem; border-bottom: 1px solid var(--rand); }

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.untertitel {
  max-width: 30rem;
  margin: 1rem 0 0;
  color: var(--text-leise);
  font-size: 1.12rem;
  line-height: 1.5;
}

/* --- Beitragsliste ------------------------------------------------------ */

.beitragsliste { margin: 0; padding: 0; list-style: none; }

.beitragsliste > li { padding: 2.25rem 0; border-bottom: 1px solid var(--rand-leise); }

.beitragsliste h2 {
  margin: 0.5rem 0 0;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.beitragsliste h2 a { color: var(--text); text-decoration: none; }

.beitragsliste h2 a:hover { color: var(--akzent); }

.beitragsliste p { margin: 0.55rem 0 0; color: var(--text-leise); }

.weiter {
  display: inline-block;
  margin-top: 1rem;
  color: var(--akzent);
  font: 500 0.92rem/1 var(--sans);
  text-decoration: none;
}

.beitragsliste > li:hover .weiter { text-decoration: underline; text-underline-offset: 3px; }

/* --- Metazeile (Datum, Lesedauer) -------------------------------------- */

.meta {
  margin: 0;
  color: var(--text-leise);
  font: 400 0.8rem/1.5 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* --- Beitrag ------------------------------------------------------------ */

article { padding-top: 2.5rem; }

article h1 {
  margin: 0.6rem 0 0;
  font-size: clamp(1.75rem, 5.5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

article h1 + .meta { margin-top: 1rem; }

article h2 {
  margin: 3.25rem 0 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rand-leise);
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  scroll-margin-top: 1.5rem;
  text-wrap: balance;
}

article h3 {
  margin: 2.25rem 0 0.6rem;
  font-size: 1.12rem;
  line-height: 1.35;
  scroll-margin-top: 1.5rem;
}

article p, article li { overflow-wrap: break-word; }

article p { margin: 0 0 1.2rem; }

/* Erster Absatz nach Kasten oder Verzeichnis: etwas groesser, als Einstieg. */
.kurz + p, .inhalt + p { font-size: 1.1em; line-height: 1.6; color: var(--text); }

article ul, article ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }

article li { margin-bottom: 0.5rem; }

article li::marker { color: var(--text-leise); }

article a { color: var(--akzent); text-decoration: underline; text-underline-offset: 2px; }

article strong { font-weight: 650; }

blockquote {
  margin: 1.75rem 0;
  padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 2px solid var(--akzent);
  color: var(--text-leise);
  font-style: italic;
}

blockquote p:last-child { margin-bottom: 0; }

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

/* --- Inhaltsverzeichnis ------------------------------------------------
   Im Text ein Kasten; ab genug Platz schwebt es als schmale Spalte im
   rechten Rand mit und bleibt beim Scrollen stehen. */

.inhalt {
  margin: 2.25rem 0 2.75rem;
  padding: 1.1rem 1.3rem 1.2rem;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche-leise);
  font-family: var(--sans);
}

.inhalt h2 {
  margin: 0 0 0.7rem;
  padding: 0;
  border: 0;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.inhalt ol { margin: 0; padding: 0; list-style: none; }

.inhalt li { margin: 0 0 0.35rem; font-size: 0.9rem; line-height: 1.4; }

.inhalt li.t3 { padding-left: 0.9rem; font-size: 0.85rem; }

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

.inhalt a:hover { color: var(--akzent); text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 1200px) {
  .inhalt {
    float: right;
    position: sticky;
    top: 5rem;
    width: var(--inhalt-breite);
    margin: 0 calc(-1 * (var(--inhalt-breite) + 1.75rem)) 1.5rem 0;
    padding: 0 0 0 1.1rem;
    border: 0;
    border-left: 1px solid var(--rand);
    border-radius: 0;
    background: none;
  }

  .inhalt + p { font-size: 1em; line-height: 1.72; }
}

/* --- Kasten "Das Wichtigste in Kuerze" --------------------------------- */

.kurz {
  margin: 2.25rem 0 2.75rem;
  padding: 1.3rem 1.5rem 0.8rem;
  border: 1px solid var(--rand);
  border-left: 3px solid var(--akzent);
  border-radius: 8px;
  background: var(--akzent-flaeche);
  font-family: var(--sans);
  font-size: 0.97rem;
  line-height: 1.6;
}

.kurz > p:first-child {
  margin: 0 0 0.8rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.kurz > p:first-child strong { font-weight: inherit; }

.kurz ul { margin: 0; padding-left: 1.1rem; }

.kurz li { margin-bottom: 0.65rem; }

/* --- Prompt zum Mitnehmen ---------------------------------------------- */

.prompt {
  position: relative;
  margin: 2.5rem 0;
  padding: 1.25rem 1.4rem 0.6rem;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche-leise);
  font-family: var(--sans);
  font-size: 0.95rem;
}

.prompt > p:first-of-type {
  margin: 0 0 0.5rem;
  padding-right: 7rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.prompt > p:first-of-type strong { font-weight: inherit; }

.prompt pre {
  margin: 0.8rem 0 1rem;
  background: var(--grund);
  white-space: pre-wrap;
  font-size: 0.84rem;
}

.prompt > p:last-child { margin-bottom: 1rem; color: var(--text-leise); font-size: 0.88rem; }

.kopieren {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--rand);
  border-radius: 6px;
  background: var(--flaeche);
  color: var(--text);
  font: 500 0.8rem/1 var(--sans);
  cursor: pointer;
}

.kopieren:hover { border-color: var(--akzent); color: var(--akzent); }

.kopieren.fertig { border-color: var(--akzent); color: var(--akzent); }

@media (max-width: 34rem) {
  .kopieren { position: static; display: block; margin: 0 0 0.9rem; }
  .prompt > p:first-of-type { padding-right: 0; }
}

/* --- Code und Tabellen -------------------------------------------------- */

code, pre { font-family: var(--mono); font-size: 0.875em; }

code {
  padding: 0.12em 0.36em;
  border-radius: 4px;
  background: var(--code-grund);
}

pre {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--code-grund);
  line-height: 1.55;
  tab-size: 2;
}

pre code { padding: 0; background: none; }

table {
  width: 100%;
  margin: 1.75rem 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
}

th, td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rand);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 650;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-leise);
  background: var(--flaeche-leise);
}

/* --- Fuss --------------------------------------------------------------- */

.zurueck {
  display: inline-block;
  margin-top: 3.5rem;
  color: var(--text-leise);
  font: 500 0.92rem/1 var(--sans);
  text-decoration: none;
}

.zurueck:hover { color: var(--akzent); }

.fuss {
  margin-top: 4.5rem;
  border-top: 1px solid var(--rand);
  color: var(--text-leise);
  font: 400 0.85rem/1.6 var(--sans);
}

.fuss-inhalt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.5rem;
}

.fuss p { margin: 0; }

.fuss-menue { display: flex; gap: 1.25rem; }

.fuss a { color: var(--text-leise); text-decoration: none; }

.fuss a:hover { color: var(--akzent); text-decoration: underline; text-underline-offset: 3px; }

/* --- Telefon ------------------------------------------------------------ */

@media (max-width: 34rem) {
  body { font-size: 1.04rem; padding-bottom: 3.5rem; }
  .leiste-inhalt { gap: 0.9rem; min-height: 3rem; }
  .marke { font-size: 0.68rem; letter-spacing: 0.06em; }
  .menue { gap: 0.9rem; font-size: 0.8rem; }
  .kopf { padding-top: 2rem; }
  .hero { padding-bottom: 2rem; }
  .untertitel { font-size: 1.05rem; }
  .beitragsliste > li { padding: 1.75rem 0; }
  .beitragsliste h2 { font-size: 1.3rem; }
  article h2 { margin-top: 2.5rem; }
  .kurz { padding: 1.1rem 1.2rem 0.6rem; }
  table { display: block; overflow-x: auto; }
}

/* --- Druck -------------------------------------------------------------- */

@media print {
  body { padding: 0; font-size: 11pt; background: #fff; color: #000; }
  .fortschritt, .inhalt, .zurueck, .marke, .sprung, .kopieren, .menue, .fuss-menue { display: none; }
  main { max-width: none; }
  article h2 { break-after: avoid; }
  pre, table, blockquote, .kurz { break-inside: avoid; }
  article a { color: #000; }
}
