/*
  Azura Roleplay · Regelwerk (regelwerk.html, gebaut von tools/regelwerk.py)
  Links: Suche (Chevron-Banner) und Kapitel als Hexagon + Plakette (wie die Navigation im Adminmenü), klebt beim Lesen.
  Rechts: Paragraphen mit flachem Hexagon, Regeln als ruhige Blöcke. Volles Teal-Glas nur für die angesprungene Regel.
*/

.rw-head .az-head { max-width: 980px; }
.rw-cluster { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.rw-cluster__hex { --s: 96px; }
.rw-cluster__hex b { font-size: 2rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(0, 248, 185, 0.6); }
.rw-cluster__col { display: grid; gap: 6px; justify-items: start; }
.rw-cluster .az-tag { --h: 30px; font-size: 0.8rem; min-width: 128px; }
.rw-cluster .az-tag b { font-weight: 600; color: var(--mint); font-variant-numeric: tabular-nums; }
.rw-cluster__ver { align-self: flex-end; margin-bottom: 2px; color: var(--sec); }

/* ---------- Aufbau ---------- */
.rw-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; padding-bottom: clamp(70px, 10vh, 120px); }
.rw-side { position: sticky; top: calc(var(--nav-h) + 14px); max-height: calc(100vh - var(--nav-h) - 28px); display: flex; }
.rw-side__in { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 12px; width: 100%; min-height: 0; }
.rw-side nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 6px 2px 0; scrollbar-width: thin; scrollbar-color: rgba(0, 248, 185, 0.35) transparent; }
.rw-side__foot { font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
.rw-side__foot code, .rw-rule code { font-family: inherit; font-weight: 600; color: var(--mint); }

/* Suche: Chevron-Banner als Feld */
.rw-search {
  --h: 46px;
  display: flex; align-items: center; gap: 10px; height: var(--h); padding: 0 calc(var(--h) * 0.55) 0 calc(var(--h) * 0.5);
  border-image: var(--chevron) 0 15 0 13 fill / 0 calc(var(--h) * 15 / 41) 0 calc(var(--h) * 13 / 41) stretch;
  cursor: text;
}
.rw-search svg { width: 16px; height: 16px; color: var(--mint); flex-shrink: 0; }
.rw-search input {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; color: #fff;
  font: inherit; font-size: 0.95rem;
}
.rw-search input::placeholder { color: rgba(203, 222, 235, 0.55); }
.rw-search input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); }
.rw-search:focus-within { filter: brightness(125%); }
.rw-hits { min-height: 1.3em; font-size: 0.84rem; color: var(--sec); padding-left: 6px; font-variant-numeric: tabular-nums; }
html:not(.js) .rw-search, html:not(.js) .rw-hits { display: none; }

/* Kapitel: kleines spitzes Hexagon mit Nummer + Plakette, mit Abstand (keine Überlappung) */
.rw-toc { display: grid; gap: 5px; }
.rw-nav { display: flex; align-items: center; gap: 5px; text-decoration: none; color: var(--body); }
.rw-nav__hx {
  width: 34px; aspect-ratio: 66 / 73; flex-shrink: 0; display: grid; place-items: center;
  background: var(--hex-pointy) center / 100% 100% no-repeat;
  font-size: 0.78rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; transition: filter 0.2s ease;
}
.rw-nav__pl {
  --h: 28px;
  flex: 1; min-width: 0; height: var(--h); display: flex; align-items: center; padding: 0 calc(var(--h) * 0.75) 0 calc(var(--h) * 0.68);
  font-size: 0.84rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-image: var(--plaque-bottom) 0 26 fill / 0 calc(var(--h) * 26 / 45) stretch;
  transition: color 0.2s ease;
}
.rw-nav:hover .rw-nav__pl { color: var(--mint); }
.rw-nav:hover .rw-nav__hx { filter: brightness(125%) contrast(140%); }
.rw-nav.is-active .rw-nav__pl { border-image-source: var(--plaque-solid); color: #00241b; font-weight: 600; }
.rw-nav.is-active .rw-nav__hx { color: var(--mint); filter: brightness(125%) contrast(140%) drop-shadow(0 0 2vh #13ffc4aa); }
.rw-nav.is-off { opacity: 0.32; }

/* ---------- Paragraphen ---------- */
.rw-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(40px, 6vh, 64px); }
.rw-sec { scroll-margin-top: calc(var(--nav-h) + 16px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.rw-sec[hidden] { display: none; }
.rw-sec__head { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid rgba(0, 248, 185, 0.16); }
.rw-sec__hex { --s: 86px; flex-direction: row; gap: 2px; align-items: baseline; display: flex; justify-content: center; }
.rw-sec__hex small { font-size: 0.95rem; color: var(--mint); font-weight: 500; }
.rw-sec__hex b { font-size: 1.7rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(0, 248, 185, 0.55); }
.rw-sec__tt { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rw-sec__tt h2 { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.2rem); font-weight: 600; color: #fff; line-height: 1.12; text-wrap: balance; }
.rw-sec__sum { color: var(--ice); font-size: 1rem; }
.rw-sec__cnt { --h: 28px; font-size: 0.76rem; color: var(--sec); }

/* Regel */
.rw-rule { position: relative; scroll-margin-top: calc(var(--nav-h) + 16px); padding: 18px 22px 20px; border-radius: 10px; background: linear-gradient(90deg, rgba(2, 225, 169, 0.06), rgba(0, 0, 0, 0.18) 60%); border: 1px solid rgba(0, 248, 186, 0.1); transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; }
.rw-rule[hidden] { display: none; }
.rw-rule:target, .rw-rule.is-focus {
  background: radial-gradient(124.3% 11233.57% at 0.03% 50%, rgba(2, 225, 169, 0.3) 0%, rgba(0, 0, 0, 0.35) 100%);
  border-color: rgba(0, 248, 186, 0.5); box-shadow: 0 0 3vh #07bd8f5e;
}
.rw-rule__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rw-rule__num {
  --h: 26px;
  height: var(--h); min-width: 3.6em; display: inline-flex; align-items: center; justify-content: center; padding: 0 calc(var(--h) * 0.62);
  font-size: 0.8rem; font-weight: 600; color: var(--mint); font-variant-numeric: tabular-nums; flex-shrink: 0;
  border-image: var(--plaque-top) 0 26 fill / 0 calc(var(--h) * 26 / 45) stretch;
}
.rw-rule__head h3 { flex: 1; min-width: 0; font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem); font-weight: 600; color: #fff; line-height: 1.25; }
.rw-rule__body { color: var(--body); font-size: clamp(1rem, 0.96rem + 0.18vw, 1.08rem); line-height: 1.68; max-width: 72ch; }
.rw-rule__body > * + * { margin-top: 0.7em; }
.rw-rule__body b { color: #fff; font-weight: 600; }
.rw-rule__body i { color: var(--ice); }
.rw-rule__body ul { display: grid; gap: 0.35em; }
.rw-rule__body li { position: relative; padding-left: 1.4em; }
.rw-rule__body li::before { content: ""; position: absolute; left: 0.1em; top: 0.68em; width: 7px; height: 7px; background: var(--mint); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.rw-xr { color: var(--mint); text-decoration: none; border-bottom: 1px solid rgba(0, 248, 185, 0.35); white-space: nowrap; }
.rw-xr:hover { border-bottom-color: var(--mint); }

/* Beispiel */
.rw-ex { display: grid; gap: 8px; justify-items: start; padding: 12px 16px 14px; border-left: 2px solid var(--mint); background: rgba(0, 248, 185, 0.05); }
.rw-ex .az-tag { --h: 24px; font-size: 0.72rem; color: var(--mint); }
.rw-ex p { color: var(--text); }

/* Tabellen */
.rw-tw { overflow-x: auto; max-width: 100%; border: 1px solid rgba(0, 248, 186, 0.16); border-radius: 8px; }
.rw-tw:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.rw-tw table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.5; }
.rw-tw th { text-align: left; font-weight: 600; color: var(--mint); font-size: 0.82rem; letter-spacing: 0.02em; padding: 10px 14px; background: rgba(0, 52, 39, 0.55); white-space: nowrap; }
.rw-tw td { padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; color: var(--body); }
.rw-tw tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
.rw-sanc td:first-child { white-space: nowrap; color: #fff; font-weight: 500; }
.rw-sev { display: inline-flex; gap: 3px; margin-right: 10px; vertical-align: -1px; }
.rw-sev i { width: 6px; height: 12px; background: var(--seg-off); }
.rw-sev i.on { background: var(--seg-on); }
/* Rot und Amber nur für Sanktionen und Warnungen (CLAUDE.md) */
.rw-sanc tr.sv4 .rw-sev i.on { background: radial-gradient(234.78% 142.5% at 50% -5%, #ffb347 0%, rgba(255, 179, 71, 0) 100%); }
.rw-sanc tr.sv5 .rw-sev i.on { background: radial-gradient(234.78% 142.5% at 50% -5%, #ff5a5a 0%, rgba(255, 90, 90, 0) 100%); }
.rw-chip { display: inline-block; padding: 0 0.5em; color: var(--mint); font-weight: 500; }
.rw-amb { color: #ffd36b; }
.rw-owner { display: grid; gap: 6px; padding: 12px 16px; border: 1px dashed rgba(255, 196, 0, 0.5); border-radius: 8px; }

/* Link kopieren: kleines spitzes Hexagon */
.rw-link {
  width: 30px; aspect-ratio: 66 / 73; flex-shrink: 0; display: grid; place-items: center; color: var(--mint);
  background: var(--hex-pointy) center / 100% 100% no-repeat; opacity: 0.55; transition: opacity 0.2s ease, filter 0.2s ease;
}
.rw-link svg { width: 42%; height: 42%; }
.rw-link--big { width: 38px; }
.rw-rule:hover .rw-link, .rw-sec__head:hover .rw-link, .rw-link:focus-visible { opacity: 1; }
.rw-link:hover { filter: brightness(125%) contrast(140%) drop-shadow(0 0 2vh #13ffc4cc); }
html:not(.js) .rw-link { display: none; }

/* Suchtreffer */
mark.rw-hl { background: rgba(0, 248, 185, 0.28); color: #fff; border-radius: 2px; padding: 0 1px; }
.rw-empty { color: var(--sec); font-size: 1.05rem; }
.rw-end { color: var(--muted); font-size: 0.88rem; line-height: 1.6; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.rw-toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; translate: -50% 0; opacity: 0; transform: translateY(10px); transition: opacity 0.25s ease, transform 0.25s var(--ease); pointer-events: none; }
.rw-toast .az-tag { --h: 34px; font-size: 0.88rem; color: var(--mint); min-width: 150px; }
.rw-toast.is-on { opacity: 1; transform: none; }

/* ---------- Schmale Fenster: Kapitel als Wabenraster über dem Text ---------- */
@media (max-width: 1023px) {
  .rw-layout { grid-template-columns: minmax(0, 1fr); }
  .rw-side { position: static; max-height: none; }
  .rw-side nav { overflow: visible; padding: 0; }
  .rw-toc { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px 14px; }
  .rw-side__foot { display: none; }
}
@media (max-width: 560px) {
  .rw-toc { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px 4px; }
  .rw-nav { justify-content: center; }
  .rw-nav__hx { width: 100%; max-width: 40px; font-size: 0.82rem; }
  .rw-nav__pl { display: none; }
  .rw-sec__head { gap: 12px; flex-wrap: wrap; }
  .rw-sec__hex { --s: 66px; }
  .rw-sec__hex b { font-size: 1.35rem; }
  .rw-sec__tt { flex-basis: calc(100% - 140px); }
  .rw-sec__cnt { order: 3; }
  .rw-link--big { order: 4; margin-left: auto; }
  .rw-rule { padding: 14px 14px 16px; }
  .rw-rule__head { gap: 10px; align-items: flex-start; }
  .rw-rule__num { margin-top: 1px; }
  .rw-cluster__hex { --s: 78px; }
}
