/* SecondWind RO Wiki. Gleiche Farben und Schriften wie secondwindro.com,
   damit Seite und Wiki als ein Auftritt wirken. Drei Spalten: Navigation,
   Inhalt, Kapitel.

   Kein backdrop-filter irgendwo. Auf der Website war genau das die Ursache
   fuer hakendes Scrollen, und ein Wiki wird noch mehr gescrollt. */

:root {
  /* Palette der Website (httpdocs/css/new.css). Seite und Wiki sollen als
     ein Auftritt wirken, deshalb dieselben Werte, nicht nur aehnliche. */
  --bg-0: #F6F1E4;
  --bg-1: #FFFDF6;
  --bg-2: #EFE7D4;
  --line: rgba(176, 126, 34, 0.20);
  --line-soft: rgba(176, 126, 34, 0.11);

  --gold: #C89438;
  --gold-bright: #E7C063;
  --gold-pale: #F3D488;
  --gold-deep: #B07E22;
  /* Helles Gold kommt auf Creme nur auf 2.4:1 und taugt nicht als
     Schriftfarbe. Dafuer gibt es diese beiden. */
  --gold-ink: #8A6220;
  --gold-ink-strong: #6B4A14;
  --goldgrad: linear-gradient(180deg, #E7C063, #C89438 55%, #B07E22);
  --on-gold: var(--on-gold);

  --text: #2E2A24;
  --muted: #5C5545;
  --faint: #776E5D;
  --heading: #241F18;

  --green: #17754F;
  --red: #C0392B;
  --blue: #2E6FA8;

  --font-display: "Marcellus", "Palatino Linotype", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;

  --topbar-h: 56px;
  --nav-w: 280px;
  --toc-w: 230px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-ink); text-decoration: none; }
a:hover { color: var(--gold-ink-strong); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; border-radius: 4px; }

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

/* ================================================================ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 18px;
  background: rgba(255, 253, 246, 0.96);
  border-bottom: 1px solid var(--line);
}

/* Gleiches Raster wie .shell, damit die Suche exakt ueber der Inhaltsspalte
   steht und die Wortmarke ueber der Navigation. */
.topbar-inner {
  max-width: 1560px;
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w);
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 26px; width: auto; display: block; flex: none; }
.brand span { font-family: var(--font-display); font-size: 18px; color: var(--heading); }
.brand em { font-style: normal; color: var(--gold-ink); }
.brand:hover { text-decoration: none; }

.topbar-links { display: flex; align-items: center; gap: 6px; justify-self: end; white-space: nowrap; }
.topbar-links a { color: var(--text); font-size: 14px; padding: 7px 11px; border-radius: 8px; }
.topbar-links a:hover { background: rgba(176, 126, 34, 0.1); color: var(--gold-ink-strong); text-decoration: none; }
.topbar-links .cta {
  background: var(--goldgrad);
  color: var(--on-gold);
  font-weight: 600;
  padding: 7px 16px;
}
.topbar-links .cta:hover { background: var(--goldgrad); color: var(--on-gold); filter: brightness(1.07); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  flex: none;
}
.nav-toggle span {
  display: block; width: 18px; height: 2px; margin: 3.5px 0;
  background: var(--gold-bright); border-radius: 2px;
}

/* ================================================================ search */

.search { position: relative; justify-self: center; width: 100%; max-width: 460px; }
.search input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 34px 8px 13px;
}
.search input:focus {
  outline: none;
  border-color: var(--gold-ink);
  box-shadow: 0 0 0 3px rgba(176, 126, 34, 0.16);
}
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
  pointer-events: none;
}
.search input:focus + kbd { display: none; }

.results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  max-height: 70vh; overflow-y: auto;
  background: #0D1221;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(120, 95, 55, 0.22);
  padding: 6px;
  z-index: 60;
}
.results[hidden] { display: none; }
.results a {
  display: block; padding: 9px 12px; border-radius: 7px; color: var(--text);
}
.results a:hover, .results a.is-sel { background: rgba(176, 126, 34, 0.13); text-decoration: none; }
.results .r-title { display: block; font-weight: 600; font-size: 14.5px; }
.results .r-path { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--gold-ink); }
.results .r-snip { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.results .r-empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }

/* ================================================================= shell */

.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}
.shell.has-no-toc { grid-template-columns: var(--nav-w) minmax(0, 1fr); }

/* ============================================================ navigation */

.sidenav {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line-soft);
  background: var(--bg-1);

  /* Der Standard-Scrollbalken war zu praesent. Duenn, ohne Spur, und der
     Griff zeigt sich erst wenn die Maus in der Navigation ist. */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.2s;
}
.sidenav:hover, .sidenav:focus-within { scrollbar-color: rgba(176, 126, 34, 0.35) transparent; }
.sidenav::-webkit-scrollbar { width: 8px; }
.sidenav::-webkit-scrollbar-track { background: transparent; }
.sidenav::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.sidenav:hover::-webkit-scrollbar-thumb, .sidenav:focus-within::-webkit-scrollbar-thumb {
  background: rgba(176, 126, 34, 0.35);
  background-clip: content-box;
}
.sidenav:hover::-webkit-scrollbar-thumb:hover { background: rgba(176, 126, 34, 0.6); background-clip: content-box; }

/* Gleiche Behandlung fuer die Kapitelspalte. */
.toc { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.toc:hover { scrollbar-color: rgba(176, 126, 34, 0.3) transparent; }
.toc::-webkit-scrollbar { width: 8px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.toc:hover::-webkit-scrollbar-thumb { background: rgba(176, 126, 34, 0.3); background-clip: content-box; }
.sidenav-inner { padding: 22px 14px 60px; }

.nav-head {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-ink);
  margin: 22px 0 7px;
  padding: 0 10px;
}
.nav-head:first-child { margin-top: 0; }

.nav-list { list-style: none; margin: 0 0 4px; padding: 0; }
.nav-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.35;
}
.nav-list a:hover { background: rgba(176, 126, 34, 0.09); color: var(--gold-ink-strong); text-decoration: none; }
.nav-list a i { font-style: normal; font-size: 15px; width: 20px; text-align: center; flex: none; opacity: 0.9; }
.nav-list a.is-sub { padding-left: 40px; font-size: 13.5px; color: var(--muted); }
.nav-list a.is-active {
  background: rgba(176, 126, 34, 0.15);
  color: var(--gold-ink);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold);
}

/* ================================================================== doc */

.doc { min-width: 0; padding: 38px 40px 80px; }

.prose { max-width: 830px; margin: 0 auto; }

.doc-head { margin-bottom: 34px; }
.doc-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 10px;
}
.lead { font-size: 17px; color: var(--muted); margin: 0; line-height: 1.6; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  font-size: 11.5px;
  color: var(--gold-ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

/* -------- Abschnitte deutlich trennen. Das ist der Kernpunkt: eine h2
   beginnt einen neuen Abschnitt und das muss man ohne Lesen erkennen. ---- */

.prose h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  color: var(--heading);
  margin: 56px 0 16px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  position: relative;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.prose h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 64px;
  height: 2px;
  background: var(--goldgrad);
}
.prose > h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.prose > h2:first-child::before { display: none; }

.prose h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  color: var(--gold-ink);
  margin: 34px 0 10px;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}

.prose h4 {
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text);
  margin: 24px 0 8px;
}

.anchor {
  margin-left: 10px;
  color: var(--faint);
  font-size: 0.65em;
  opacity: 0;
  transition: opacity 0.15s;
}
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor:hover { text-decoration: none; color: var(--gold-ink-strong); }

.prose p { margin: 0 0 16px; }
.prose strong { color: var(--heading); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--gold-ink); }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.prose blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--gold);
  background: rgba(176, 126, 34, 0.07);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Code und /navi */

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(176, 126, 34, 0.1);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--gold-ink);
  white-space: nowrap;
}
.prose pre {
  background: #080B14;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 18px;
}
.prose pre code { background: none; border: 0; padding: 0; white-space: pre; color: var(--text); }

/* Der ganze /navi-Chip ist der Kopierknopf. Sieht aus wie Code, verhaelt
   sich wie eine Schaltflaeche. */
.prose .navi {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  vertical-align: baseline;
  font-family: var(--font-mono);
  font-size: 0.88em;
  line-height: 1.5;
  color: var(--gold-ink);
  background: rgba(176, 126, 34, 0.1);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 8px 1px 8px;
  margin: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.prose .navi:hover {
  background: rgba(176, 126, 34, 0.2);
  border-color: rgba(176, 126, 34, 0.45);
  color: var(--gold-ink);
}
.prose .navi:active { background: rgba(176, 126, 34, 0.28); }

.navi-ico {
  display: inline-flex;
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--gold-ink);
}
.navi-ico svg { width: 13px; height: 13px; display: block; }
.prose .navi:hover .navi-ico { color: var(--gold-ink-strong); }

.navi .ico-done { display: none; }
.navi.is-copied .ico-copy { display: none; }
.navi.is-copied .ico-done { display: block; }
.navi.is-copied {
  background: rgba(23, 117, 79, 0.14);
  border-color: rgba(23, 117, 79, 0.5);
  color: var(--green);
}
.navi.is-copied .navi-ico { color: var(--green); }
.navi.is-failed { border-color: rgba(192, 57, 43, 0.6); color: var(--red); }
.navi.is-failed .navi-ico { color: var(--red); }

/* Tabellen */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold-ink);
  background: rgba(176, 126, 34, 0.07);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.prose td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.prose tbody tr:last-child td { border-bottom: none; }
.prose tbody tr:hover td { background: rgba(176, 126, 34, 0.045); }
/* Sprites und Symbole.
   Die Vorlagen sind uneinheitlich: Item- und Skill-Icons stecken in einem
   festen 24x24-Rahmen, Mob-Sprites bringen je nach Monster 11 bis 221 Pixel
   Leinwand mit, und die Pet-Sprites lagen mit bis zu drei Vierteln leerem
   Rand in einem 64x64-Feld. Der Bau schneidet den durchsichtigen Rand der
   Mob- und Pet-Sprites weg, hier bekommen dann alle dieselbe sichtbare
   Hoehe. object-fit faengt die wenigen sehr breiten Sprites ab, damit die
   Spalte nicht ausreisst.
   image-rendering: pixelated, weil das Pixelgrafik aus dem Spiel ist und
   weiches Skalieren sie verwaschen wuerde. */
.prose img.sprite {
  width: auto;
  object-fit: contain;
  object-position: center;
  vertical-align: middle;
  image-rendering: pixelated;
}

/* Item-, Skill- und Boxsymbole stehen neben Text und sollen ihn nicht
   erschlagen. Sie kommen ohnehin nur in 24x24 aus dem Spiel. */
.prose img.sprite-item { height: 30px; max-width: 40px; }

/* Monster brauchen Flaeche, sonst erkennt man nicht, welches es ist. */
.prose img.sprite-mob { height: 56px; max-width: 130px; }
.prose td img.sprite { margin-right: 7px; }
.prose li img.sprite,
.prose p img.sprite { margin-right: 4px; }

/* In Ueberschriften richtet sich das Symbol nach der Schriftgroesse. */
.prose h1 img.sprite,
.prose h2 img.sprite,
.prose h3 img.sprite,
.prose h4 img.sprite { height: 1.15em; max-width: none; margin-right: 6px; }

.prose td img { vertical-align: middle; }
.prose p img { vertical-align: middle; }

/* Datenbankseiten. Die Klassen kommen aus den generierten Item-Seiten
   (Wiki	ools\gen_item_pages.py) und hatten im neuen Theme noch keine
   Gestaltung, die Kennwerte standen als nackte Woerter untereinander. */
.prose .db-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 13px;
}
.prose .db-meta > span {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px 13px;
  color: var(--muted);
  white-space: nowrap;
}
.prose .db-meta > .db-badge {
  background: rgba(176, 126, 34, 0.12);
  border-color: var(--line);
  color: var(--gold-ink);
  font-weight: 600;
}

/* Bilder, die als eigenstaendige Abbildung stehen. Sprites sind davon
   ausgenommen, sonst wuerde ein Symbol allein im Absatz zur Tafel. */
.prose p > img:only-child:not(.sprite) {
  display: block;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  image-rendering: auto;
}

.doc-foot {
  max-width: 830px;
  margin: 60px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.doc-foot p { margin: 0; }
.muted { color: var(--faint); }

/* ================================================================== toc */

.toc {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 38px 20px 60px 0;
}
.shell.has-no-toc .toc { display: none; }

.toc-head {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-ink);
  margin: 0 0 10px;
  padding-left: 14px;
}
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-soft); }
.toc-list a {
  display: block;
  padding: 5px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.toc-list a:hover { color: var(--gold-ink-strong); text-decoration: none; }
.toc-list .lvl3 a { padding-left: 26px; font-size: 13px; }
.toc-list a.is-active {
  color: var(--gold-ink);
  border-left-color: var(--gold-ink);
  background: rgba(176, 126, 34, 0.06);
}

/* ============================================================ responsive */

.nav-scrim {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(60, 48, 30, 0.45);
  z-index: 29;
}
.nav-scrim[hidden] { display: none; }

@media (max-width: 1400px) {
  :root { --nav-w: 260px; --toc-w: 210px; }
  .doc { padding: 34px 34px 70px; }
}

@media (max-width: 1150px) {
  .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .toc { display: none; }
  /* Ohne Kapitelspalte gibt es keine dritte Spalte zum Ausrichten. Die Suche
     fuellt dann die Inhaltsspalte, statt leicht versetzt darin zu schweben. */
  .topbar-inner { grid-template-columns: var(--nav-w) minmax(0, 1fr) max-content; }
  .search { justify-self: stretch; max-width: none; }
}

@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: block; }
  .sidenav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 290px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    height: auto;
    border-right: 1px solid var(--line);
  }
  .sidenav.is-open { transform: none; }
  .doc { padding: 26px 18px 60px; }
  .topbar { padding: 0 12px; }
  .topbar-inner { display: flex; gap: 12px; }
  .search { flex: 1; }
  .topbar-links a:not(.cta) { display: none; }
  .brand span { display: none; }
  .search { max-width: none; }
  .search kbd { display: none; }
}

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


/* ---------------------------------------------------------- Kontrast

   Vier Stellen kamen im gerenderten Dokument auf 4.38 bis 4.46 statt der
   geforderten 4.5. Ursache ueberall dieselbe: --gold-ink beziehungsweise
   --faint auf einer leicht getoenten Flaeche statt auf dem reinen Grund.
   Der kraeftigere Ton loest es, ohne das Bild zu veraendern. */

.navi-cmd,
.contents code,
.prose code, .navi-cmd, code { color: var(--gold-ink-strong); }

.anchor { color: var(--gold-ink-strong); }

/* --faint reicht auf --bg-0 (4.8:1), in der Fusszeile sitzt es aber auf
   einer Karte und faellt darunter. */
.muted { color: var(--muted); }
