/* Regelwerk | PentaV - öffentliche Leseansicht.
   Tokens, Schriften und Formen wie die PentaV-Oberflächen im Spiel
   (pentav-tokens.css / pentav-ui.css): Orange = aktiv/Hauptaktion,
   Grün = positiv, Ecken oben links + unten rechts schräg, sonst eckig. */

:root {
  --ground: #0a0a0b;
  --panel: #121214;
  --sidebar: #0e0e10;
  --surface: #18181b;
  --surface-raised: #212125;
  --surface-high: #2a2a30;
  --line: #2c2c32;
  --line-strong: #74747f;
  --ink: #f5f2ed;
  --ink-muted: #aba59c;
  --ink-faint: #8e8981;
  --orange: #ff8a00;
  --orange-hi: #ffb21f;
  --orange-deep: #f25500;
  --orange-soft: #2b1806;
  --on-orange: #1c0e00;
  --green: #00d26a;
  --green-soft: #08261a;
  --focus: var(--orange-hi);
  --cut-sm: 7px;
  --cut-md: 12px;
  --cut-lg: 20px;
  --slant: 32deg;
  --top: 68px;
  --font-display: "Chakra Petch", "Barlow Semi Condensed", system-ui, sans-serif;
  --font-sans: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-condensed: "Barlow Semi Condensed", Barlow, system-ui, sans-serif;
  --schnitt: polygon(var(--c, 7px) 0, 100% 0, 100% calc(100% - var(--c, 7px) * 1.6), calc(100% - var(--c, 7px)) 100%, 0 100%, 0 calc(var(--c, 7px) * 1.6));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(110% 70% at 90% 0%, #ff8a000f 0%, #ff8a0000 50%), var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: #ff8a0059; color: #fff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
* { scrollbar-color: #3a3a42 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--sidebar); }
::-webkit-scrollbar-thumb { background: #3a3a42; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

.skip { position: fixed; top: -80px; left: 16px; z-index: 50; padding: 10px 16px; background: var(--orange); color: var(--on-orange); font-family: var(--font-condensed); font-weight: 700; }
.skip:focus { top: 12px; }

/* V-Zeichen: oranger \ und grüner / */
.mark { position: relative; display: inline-block; flex: none; width: 20px; height: 10px; }
.mark::before, .mark::after { content: ""; position: absolute; top: 0; width: 3px; height: 10px; }
.mark::before { left: 3px; background: var(--orange); transform: skewX(var(--slant)); }
.mark::after { left: 13px; background: var(--green); transform: skewX(calc(var(--slant) * -1)); }

.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-condensed); font-size: 12px; line-height: 16px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint);
}
.eyebrow--orange { color: var(--orange); }

/* ---------- Kopfleiste ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: var(--top); padding: 0 24px;
  background: var(--sidebar); border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--orange) 0 64%, transparent 64% 65.2%, var(--green) 65.2%);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand small { font-family: var(--font-condensed); font-size: 11px; font-weight: 700; letter-spacing: .3em; color: var(--orange); margin-bottom: 4px; }
.brand strong { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; }
.brand:hover strong { color: #fff; }
.topbar-meta { margin-left: auto; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.meta-label { font-family: var(--font-condensed); font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--ink-faint); }
.topbar-meta strong { font-family: var(--font-condensed); font-size: 15px; font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.meta-sep { width: 1px; height: 14px; background: var(--line); margin: 0 8px; align-self: center; }

/* ---------- Raster ---------- */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  max-width: 1600px; margin: 0 auto;
  min-height: calc(100vh - var(--top));
}

/* Linke Leiste */
.rail {
  position: sticky; top: var(--top); align-self: start;
  height: calc(100vh - var(--top)); overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 32px 16px 24px 24px;
  border-right: 1px solid var(--line);
}
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  --c: var(--cut-sm);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px;
  clip-path: var(--schnitt);
  background: var(--sidebar);
  font-family: var(--font-condensed); font-size: 15px; font-weight: 600; letter-spacing: .04em; line-height: 20px;
  color: var(--ink-muted);
  transition: background 120ms, color 120ms;
}
.nav-item small { font-size: 12px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.nav-item:hover { background: var(--surface-raised); color: var(--ink); }
.nav-item.active {
  color: var(--ink); font-weight: 700;
  background: linear-gradient(90deg, #ff8a0029, #ff8a0000 80%), var(--surface-high);
  box-shadow: inset 2px 0 0 var(--orange);
}
.nav-item.active small { color: var(--orange); }
.rail-foot { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; color: var(--ink-faint); }
.rail-foot strong { display: block; margin-bottom: 4px; font-family: var(--font-condensed); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-muted); }

/* Hauptspalte */
main { min-width: 0; padding: 36px 40px 32px; }
.head { padding-bottom: 22px; border-bottom: 1px solid var(--line); position: relative; }
.head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 80px; height: 2px; background: var(--orange); }
h1 {
  margin-top: 10px;
  font-family: var(--font-display); font-style: italic; font-weight: 700;
  font-size: 44px; line-height: 1.05; letter-spacing: .01em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.intro { margin-top: 12px; max-width: 760px; color: var(--ink-muted); font-size: 16px; line-height: 24px; }

/* Suche */
.tools { margin-top: 22px; }
.search {
  --c: var(--cut-sm);
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 12px 0 14px;
  cursor: text;
}
.search::before { content: ""; position: absolute; inset: 0; z-index: -2; clip-path: var(--schnitt); background: var(--line); transition: background 120ms; }
.search::after { content: ""; position: absolute; inset: 1px; z-index: -1; clip-path: var(--schnitt); background: var(--ground); }
.search:focus-within::before { background: var(--orange-hi); }
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--ink-faint); stroke-width: 1.9; stroke-linecap: round; }
.search:focus-within svg { stroke: var(--orange); }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: transparent; border: 0; outline: 0;
  font-family: var(--font-sans); font-size: 16px; font-weight: 500;
}
.search input::placeholder { color: var(--ink-faint); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }
.key {
  --c: 4px;
  flex: none; min-width: 24px; padding: 2px 7px; text-align: center;
  clip-path: var(--schnitt); background: var(--surface-high); color: var(--ink-muted);
  font-family: var(--font-condensed); font-size: 12px; font-weight: 700; line-height: 18px;
}
.search:focus-within .key { display: none; }

/* Hinweis */
.notice {
  --c: var(--cut-md);
  position: relative; isolation: isolate;
  display: flex; gap: 16px; align-items: baseline;
  margin-top: 16px; padding: 14px 18px;
}
.notice::before { content: ""; position: absolute; inset: 0; z-index: -2; clip-path: var(--schnitt); background: #ff8a0059; }
.notice::after { content: ""; position: absolute; inset: 1px; z-index: -1; clip-path: var(--schnitt); background: linear-gradient(90deg, var(--orange) 0 3px, transparent 3px), var(--orange-soft); }
.notice-label { flex: none; font-family: var(--font-condensed); font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--orange); }
.notice p { font-size: 15px; line-height: 22px; color: var(--ink); }

/* Inhaltsverzeichnis fürs Handy */
.toc-mobile { display: none; }

.search-status {
  margin-top: 18px;
  font-family: var(--font-condensed); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--orange);
}
.search-status:empty { display: none; }
#rules { margin-top: 28px; }
.page-hit {
  display: flex; align-items: center; gap: 8px;
  margin: 36px 0 18px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 20px; text-transform: uppercase;
}
.page-hit:first-child { margin-top: 0; }

/* Abschnitte */
.rule-section { margin-bottom: 40px; scroll-margin-top: calc(var(--top) + 16px); }
.section-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
h2 { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 28px; letter-spacing: .02em; overflow-wrap: anywhere; }
.section-count { flex: none; font-family: var(--font-condensed); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* Absatz-Karte: Kante und Füllung als Ebenen, damit auch der Schnitt eine Kante hat */
.rule {
  --c: var(--cut-md);
  --edge: var(--line);
  --fill: linear-gradient(180deg, #ffffff06, #ffffff00 70%), var(--surface);
  position: relative; isolation: isolate;
  margin: 8px 0; padding: 14px 18px 16px;
  scroll-margin-top: calc(var(--top) + 16px);
}
.rule::before { content: ""; position: absolute; inset: 0; z-index: -2; clip-path: var(--schnitt); background: var(--edge); }
.rule::after { content: ""; position: absolute; inset: 1px; z-index: -1; clip-path: var(--schnitt); background: var(--fill); }
.rule:hover { --edge: #3a3a42; }
.rule.focused, .rule:target {
  --edge: #ff8a0099;
  --fill: linear-gradient(90deg, var(--orange) 0 3px, transparent 3px), linear-gradient(90deg, #ff8a0014, #ff8a0000 70%), var(--surface);
}
.rule-top { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.rule-label {
  font-family: var(--font-condensed); font-size: 16px; font-weight: 700; letter-spacing: .06em; line-height: 22px;
  color: var(--orange);
}
.rule-label:hover { color: var(--orange-hi); text-decoration: underline; text-underline-offset: 3px; }
.rule-actions { margin-left: auto; display: flex; gap: 4px; }
.rule-actions button {
  --c: 5px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 0; cursor: pointer;
  clip-path: var(--schnitt);
  background: var(--surface-raised); color: var(--ink-muted);
  font-family: var(--font-condensed); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  transition: background 120ms, color 120ms;
}
.rule-actions button:hover { background: var(--surface-high); color: var(--ink); }
.rule-actions button:active { transform: translateY(1px); }
.rule-actions svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rule-text {
  white-space: pre-line; overflow-wrap: anywhere;
  color: #dcd7cf; font-size: 16px; line-height: 26px;
}
.rule-text strong { color: var(--ink); font-weight: 600; }
.rule-text a { color: var(--orange-hi); text-decoration: underline; text-underline-offset: 3px; }
mark { background: #ff8a0040; color: #fff; box-shadow: inset 0 -2px 0 var(--orange); }

.empty { padding: 48px 16px; text-align: center; color: var(--ink-muted); }

.foot {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line);
  font-family: var(--font-condensed); font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--ink-faint);
}
.foot a { color: var(--ink-muted); }
.foot a:hover { color: var(--orange); }

/* Rechte Leiste */
.toc {
  position: sticky; top: var(--top); align-self: start;
  max-height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 32px 24px 24px 16px;
  border-left: 1px solid var(--line);
}
#toc { display: flex; flex-direction: column; margin-top: 14px; }
#toc a, #toc-mobile a {
  display: block; padding: 6px 0 6px 12px;
  border-left: 1px solid var(--line);
  font-family: var(--font-condensed); font-size: 14px; font-weight: 600; letter-spacing: .02em; line-height: 18px;
  color: var(--ink-muted);
}
#toc a:hover, #toc-mobile a:hover { color: var(--ink); border-left-color: var(--orange); box-shadow: inset 1px 0 0 var(--orange); }
.toc-hint { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.toc-hint strong { font-family: var(--font-display); font-style: italic; font-size: 15px; text-transform: uppercase; }
.toc-hint p { margin-top: 6px; font-size: 13px; line-height: 19px; color: var(--ink-faint); }

/* Meldung */
.toast {
  --c: var(--cut-sm);
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  clip-path: var(--schnitt);
  background: linear-gradient(90deg, var(--green) 0 3px, transparent 3px), var(--surface-raised);
  font-family: var(--font-condensed); font-size: 14px; font-weight: 700; letter-spacing: .06em;
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity 160ms, transform 160ms;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mittlere Breite: rechte Leiste weg ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; }
  main { padding: 32px 28px; }
}

/* Inhaltsverzeichnis als aufklappbarer Kasten */
.toc-mobile { margin-top: 12px; border: 1px solid var(--line); background: var(--sidebar); }
.toc-mobile summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; list-style: none;
  font-family: var(--font-condensed); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-muted);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--orange); border-bottom: 2px solid var(--orange); transform: rotate(45deg) translateY(-3px); }
.toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc-mobile[open] summary { border-bottom: 1px solid var(--line); }
#toc-mobile { display: flex; flex-direction: column; padding: 8px 14px 12px; max-height: 60vh; overflow-y: auto; }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  :root { --top: 60px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .brand img { width: 36px; height: 36px; }
  .brand strong { font-size: 19px; }
  .topbar-meta { flex-direction: column; align-items: flex-end; gap: 0; line-height: 1.15; }
  .topbar-meta .meta-sep, .topbar-meta .meta-label { display: none; }
  .topbar-meta strong { font-size: 13px; }
  .topbar-meta strong#version::before { content: "Fassung "; color: var(--ink-faint); }
  .layout { display: block; }
  .rail {
    position: static; height: auto; overflow: visible;
    padding: 16px 16px 0; border-right: 0; gap: 10px;
  }
  .rail > .eyebrow, .rail-foot { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav { gap: 4px; }
  .nav-item { flex: 1 1 auto; justify-content: center; text-align: center; padding: 10px 8px; font-size: 13px; letter-spacing: .01em; line-height: 17px; white-space: nowrap; box-shadow: none; }
  .nav-item.active { background: linear-gradient(0deg, var(--orange) 0 2px, transparent 2px), var(--surface-high); box-shadow: none; }
  .nav-item small { display: none; }
  main { padding: 22px 16px 24px; }
  h1 { font-size: 30px; }
  .intro { font-size: 15px; line-height: 22px; }
  .notice { flex-direction: column; gap: 4px; padding: 12px 14px; }
  .key { display: none; }
  h2 { font-size: 19px; line-height: 24px; }
  .section-heading { flex-wrap: wrap; gap: 4px 12px; }
  .rule { padding: 12px 14px 14px; }
  .rule-top { gap: 8px; }
  .rule-actions button { padding: 0 9px; }
  .rule-actions button span { display: none; }
  .rule-actions svg { width: 16px; height: 16px; }
  .rule-text { font-size: 15px; line-height: 24px; }
  .foot { flex-direction: column; gap: 8px; }
}

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