/* Anwenderhandbuch RAWCaptureBooth.
   Helle Grundflaeche, weil hier lange Texte gelesen und Seiten gedruckt
   werden; die Akzentfarbe ist dieselbe wie im Admin-Bereich. */

:root {
  color-scheme: light;
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #ececed;
  --border: rgba(15, 16, 24, 0.12);
  --text: #16171f;
  --muted: rgba(22, 23, 31, 0.65);
  --accent: #b57e03;
  --accent-flaeche: rgba(216, 153, 4, 0.12);
  --warnung: #b3392a;
  --warnung-flaeche: rgba(255, 111, 89, 0.14);
  --tipp: #1f7a6c;
  --tipp-flaeche: rgba(46, 196, 182, 0.14);
  --breite-inhalt: 46rem;
  --breite-nav: 17rem;
  --kopf-hoehe: 3.5rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--kopf-hoehe) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.sprungmarke {
  position: absolute;
  left: -999rem;
}

.sprungmarke:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 30;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

/* Kopfzeile ------------------------------------------------------------- */

.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--kopf-hoehe);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.kopf-titel {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.kopf-titel span {
  color: var(--muted);
  font-weight: 400;
}

.kopf-version {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Wird nur eingefuegt, wenn das Handbuch von der Fotobox selbst kommt. */
.kopf-zurueck {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.kopf-zurueck:hover {
  background: var(--surface-2);
}

.nav-schalter {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

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

.suche {
  position: relative;
  flex: 1 1 18rem;
  max-width: 28rem;
}

.suche input {
  width: 100%;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.suche input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.suche-treffer {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.suche-treffer a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.suche-treffer a:last-child {
  border-bottom: none;
}

.suche-treffer a:hover,
.suche-treffer a.aktiv {
  background: var(--accent-flaeche);
}

.suche-treffer .treffer-kapitel {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.suche-leer {
  padding: 0.6rem 0.75rem;
  color: var(--muted);
}

/* Grundgeruest ---------------------------------------------------------- */

.huelle {
  display: grid;
  grid-template-columns: var(--breite-nav) minmax(0, 1fr) var(--breite-nav);
  gap: 2rem;
  max-width: 84rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  align-items: start;
}

.seitenleiste {
  position: sticky;
  top: calc(var(--kopf-hoehe) + 1.5rem);
  max-height: calc(100vh - var(--kopf-hoehe) - 3rem);
  overflow-y: auto;
}

.nav-liste,
.nav-liste ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-teil {
  margin-bottom: 1.1rem;
}

.nav-teil-titel {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.nav-liste a {
  display: block;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-liste a:hover {
  background: var(--surface-2);
}

.nav-liste a.aktiv {
  background: var(--accent-flaeche);
  border-left-color: var(--accent);
  font-weight: 600;
}

.inhalt {
  min-width: 0;
  max-width: var(--breite-inhalt);
}

/* Textkoerper ----------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5 {
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-size: 1.9rem;
  margin-bottom: 1.2rem;
}

h2 {
  font-size: 1.35rem;
  margin: 2.2rem 0 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.5rem;
}

h4 {
  font-size: 1rem;
  margin: 1.2rem 0 0.4rem;
}

p {
  margin: 0 0 0.9rem;
}

ul,
ol {
  margin: 0 0 0.9rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.3rem;
}

li > ul,
li > ol {
  margin-top: 0.3rem;
}

ol {
  counter-reset: none;
}

a {
  color: var(--accent);
}

/* Prueflisten: das Kaestchen bleibt auch auf Papier zum Ankreuzen. */
li.pruefpunkt {
  list-style: none;
  margin-left: -1.4rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

li.pruefpunkt .kaestchen {
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  text-align: center;
  line-height: 1;
  font-size: 0.9em;
}

code {
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background: var(--surface-2);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

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

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

.anker {
  margin-left: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}

h2:hover .anker,
h3:hover .anker,
h4:hover .anker {
  opacity: 1;
}

/* Bilder ---------------------------------------------------------------- */

figure.bild {
  margin: 1.4rem 0;
}

figure.bild img {
  display: block;
  /* Nie hochskalieren: Die Installer-Aufnahmen sind kleiner als die Spalte
     und wuerden sonst unscharf aufgeblasen. Grosse Aufnahmen schrumpfen
     ueber max-width auf die Spaltenbreite. */
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

/* Sicherheitsnetz: Auch ein Bild mitten im Text bleibt in der Spalte. */
.inhalt img {
  max-width: 100%;
  height: auto;
}

figure.bild figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Kaesten --------------------------------------------------------------- */

.kasten {
  margin: 1.2rem 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-flaeche);
}

.kasten p:last-child,
.kasten ul:last-child,
.kasten ol:last-child {
  margin-bottom: 0;
}

.kasten-titel {
  font-weight: 600;
}

.kasten-warnung {
  border-left-color: var(--warnung);
  background: var(--warnung-flaeche);
}

.kasten-tipp {
  border-left-color: var(--tipp);
  background: var(--tipp-flaeche);
}

/* Platzhalter fuer einen Screenshot, der noch aufgenommen wird. */
.kasten-bild {
  border: 1px dashed var(--border);
  border-left: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
}

.kasten-bild .kasten-titel {
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
}

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

.tabelle-rahmen {
  overflow-x: auto;
  margin: 1.2rem 0;
}

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

th,
td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
}

/* Seiten-Inhaltsverzeichnis --------------------------------------------- */

.seiten-toc {
  position: sticky;
  top: calc(var(--kopf-hoehe) + 1.5rem);
  font-size: 0.9rem;
}

.seiten-toc-titel {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.seiten-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.seiten-toc a {
  display: block;
  padding: 0.2rem 0.7rem;
  color: var(--muted);
  text-decoration: none;
}

.seiten-toc a:hover,
.seiten-toc a.aktiv {
  color: var(--accent);
}

/* Uebersichtsseite ------------------------------------------------------ */

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

.karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.karte h2 {
  margin: 0 0 0.6rem;
  padding: 0;
  border: none;
  font-size: 1.05rem;
}

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

.karte li {
  margin-bottom: 0.5rem;
}

.karte li span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.komplett-link {
  margin-top: 1.5rem;
}

/* Blaettern ------------------------------------------------------------- */

.blaettern {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.blaettern a {
  flex: 1 1 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.blaettern a span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.blaettern-weiter {
  text-align: right;
}

.stand {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Schmale Bildschirme --------------------------------------------------- */

@media (max-width: 1200px) {
  .huelle {
    grid-template-columns: var(--breite-nav) minmax(0, 1fr);
  }

  .seiten-toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .huelle {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-schalter {
    display: block;
  }

  .seitenleiste {
    display: none;
    position: static;
    max-height: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
  }

  body.nav-offen .seitenleiste {
    display: block;
  }

  .kopf-version {
    display: none;
  }
}

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

@media print {
  /* Ohne eigenen Rand druckt der Browser bis dicht an die Blattkante; die
     Bilder standen dann sichtbar ueber dem Satzspiegel. */
  @page {
    size: A4;
    margin: 16mm 15mm;
  }

  .kopf,
  .seitenleiste,
  .seiten-toc,
  .blaettern,
  .anker,
  .sprungmarke {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .huelle {
    display: block;
    max-width: none;
    padding: 0;
  }

  .inhalt {
    max-width: none;
  }

  /* Auf Papier zaehlt die Blattbreite, nicht die Bildschirmbreite: Eine
     Aufnahme darf nie breiter als der Satzspiegel und nie hoeher als etwa
     eine halbe Seite werden, sonst schiebt sie den Text auf die naechste. */
  figure.bild img {
    max-width: 100%;
    max-height: 110mm;
  }

  .kapitel {
    break-before: page;
  }

  .kapitel:first-child {
    break-before: auto;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  figure.bild,
  .kasten,
  table {
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* Website-Ergaenzung zum Handbuch ---------------------------------------

   Wird von tools/handbuch_sync.py an die aus der Anwendung uebernommene
   handbuch.css angehaengt. Auf der Fotobox gibt es weder Sprachauswahl noch
   den Weg zurueck auf die Website. */

.kopf-sprache {
  margin-left: auto;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.kopf-sprache:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Steht die Versionsangabe daneben, schiebt bereits sie beides nach rechts. */
.kopf-version + .kopf-sprache {
  margin-left: 0.75rem;
}

@media (max-width: 620px) {
  /* Auf schmalen Geraeten bleibt die Suche wichtiger als der Rueckweg. */
  .kopf-zurueck {
    display: none;
  }
}

@media print {
  .kopf-sprache {
    display: none !important;
  }
}
