/* Kanon — Gesetz-Indexseite als aufgeschlagenes Buch.
   Ergänzt theme.css. Aktiv nur wenn buch.js das Markup gebaut hat. */

.kb { display: flex; align-items: flex-start; margin: 1.5rem 0 3rem; max-width: 100%; }

/* Das aufgeschlagene Buch */
.kb__book {
  flex: 1; min-width: 0; max-width: 100%; overflow-x: clip; display: flex; align-items: stretch;
  min-height: 620px; background: #FFFDF7; border: 1px solid #E3DCCB;
  border-radius: 8px 16px 16px 8px;
  box-shadow: 0 5px 0 -2px #F1EBDC, 0 10px 0 -4px #E7E0CF, 0 20px 28px rgba(34,31,26,0.06);
}
/* Linke Seite: Register */
.kb__left {
  flex: 0 0 40%; min-width: 0; padding: 24px 14px 18px 24px;
  display: flex; flex-direction: column; box-sizing: border-box;
}
.kb__search {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  border: 1px solid #E0D9C9; background: #FBF9F4; border-radius: 9px;
  padding: .55rem .7rem; margin-bottom: 1rem;
}
.kb__search svg { width: 15px; height: 15px; color: #8A8172; flex: 0 0 auto; }
.kb__search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: Spectral, Georgia, serif; font-size: .95rem; color: #221F1A;
}
.kb__scroll { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding-right: 6px; scrollbar-width: thin; }
.kb__gh {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: #A39A87; margin: 1.1rem 0 .35rem;
}
.kb__gh:first-child { margin-top: 0; }
.kb__item {
  display: flex; align-items: baseline; gap: .6rem; width: 100%;
  padding: .42rem .55rem; border: 0; background: none; border-radius: 7px;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  transition: background .12s ease;
}
.kb__item:hover { background: #F3EEE1; }
.kb__item.is-active { background: #F3EEE1; }
.kb__item .e {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .74rem; color: #8A8172; flex: 0 0 4.6rem;
}
.kb__item.is-active .e { color: var(--accent, #A33B2E); }
.kb__item .t {
  font-size: .93rem; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.kb__item .t.gone { color: #A39A87; font-style: italic; }
.kb__colo {
  padding-top: .85rem; font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #C9C0AC;
}

/* Bundsteg */
.kb__gutterL { flex: 0 0 13px; background: linear-gradient(90deg, transparent, rgba(34,31,26,0.07)); }
.kb__gutterR { flex: 0 0 13px; border-left: 1px solid #E7E0CF; background: linear-gradient(90deg, rgba(34,31,26,0.09), transparent 75%); }

/* Rechte Seite: Norm */
/* Rechte Seite: Norm — bleibt beim Scrollen im Viewport stehen (sticky),
   damit man bei langen Registern (StGB, ZPO) den Text immer sieht */
.kb__right {
  flex: 1; min-width: 0; padding: 24px 26px 18px 20px; box-sizing: border-box;
  display: flex; flex-direction: column;
  position: sticky; top: 12px; align-self: flex-start;
  max-height: calc(100vh - 24px);
}
.kb__gutterL, .kb__gutterR { align-self: stretch; }

/* ── Schreib-Schimmer ─────────────────────────────────────────────
   Text steht sofort vollstaendig im Layout; eine weiche Aufdeck-Welle
   laeuft diagonal durch, an deren Kante die Buchstaben warm-silbern
   aufglimmen (Champagner auf Papier) und sich in Tinte beruhigen.
   Nur mask + background-position -> GPU, kein Layout-Shift. */
.kb__ink {
  --inkDur: .55s;
  background-image: linear-gradient(115deg,
    #221F1A 42%, #8a8172 47%, #EFE8D8 50%, #D8D2C4 53%, #221F1A 58%);
  background-size: 320% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #221F1A;
  -webkit-mask-image: linear-gradient(115deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(115deg, #000 45%, transparent 55%);
  -webkit-mask-size: 320% 100%; mask-size: 320% 100%;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
  animation: kbInk var(--inkDur) cubic-bezier(.25,.1,.25,1) both;
}
@keyframes kbInk {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0;
         background-position: 100% 0; }
  to   { -webkit-mask-position: 0% 0; mask-position: 0% 0;
         background-position: 0% 0; }
}
/* Titel schreibt zuerst, Absaetze folgen minimal versetzt */
.kb__titel.kb__ink { --inkDur: .45s; }
.kb__text .abs:nth-child(1) .kb__ink { animation-delay: .06s; }
.kb__text .abs:nth-child(2) .kb__ink { animation-delay: .12s; }
.kb__text .abs:nth-child(3) .kb__ink { animation-delay: .18s; }
.kb__text .abs:nth-child(4) .kb__ink { animation-delay: .24s; }
.kb__text .abs:nth-child(n+5) .kb__ink { animation-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  .kb__ink { animation: none;
    -webkit-mask-image: none; mask-image: none;
    background-image: none;
    -webkit-text-fill-color: currentColor; color: #221F1A; }
}

.kb__kicker {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .64rem; text-transform: uppercase; letter-spacing: .11em;
  color: #A39A87; margin: 0 0 .9rem; min-height: .8rem;
}
.kb__enbezrow { display: flex; align-items: baseline; gap: .8rem; margin-bottom: .2rem; }
.kb__enbez {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .95rem; color: var(--accent, #A33B2E);
}
.kb__enbezrow::after { content: ""; flex: 1; height: 1px; background: #E7E0CF; }
.kb__titel {
  font-family: Fraunces, Spectral, Georgia, serif;
  font-size: 1.55rem; font-weight: 500; letter-spacing: -.015em;
  line-height: 1.15; margin: 0 0 1.2rem; text-wrap: balance;
}
.kb__text { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; }
.kb__text .abs { display: flex; gap: .8rem; margin-bottom: .9rem; }
.kb__text .abs__m {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .72rem; color: #C1B7A2; flex: 0 0 1.6rem;
  padding-top: .32rem; text-align: right;
}
.kb__text .abs p { font-size: 1.04rem; line-height: 1.62; margin: 0; max-width: 58ch; hyphens: auto; }
.kb__text > p { font-size: 1.04rem; line-height: 1.62; max-width: 58ch; }
.kb__open {
  display: inline-block; margin-top: .7rem; font-size: .88rem;
  color: #6E675C; border-bottom: 1px dotted #C9C0AC;
}
.kb__open:hover { color: var(--accent, #A33B2E); }
.kb__load { color: #A39A87; font-size: .95rem; padding: 2rem 0; }
.kb__stand {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .68rem; color: #A39A87; margin-top: 1.1rem;
  padding-top: .6rem; border-top: 1px dotted #E0D9C9;
}

/* Pager unten auf der Seite */
.kb__pager {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid #EDE7D8;
}
.kb__pbtn {
  border: 0; background: none; cursor: pointer; font: inherit;
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .8rem; color: #6E675C; padding: .2rem .3rem; min-width: 5.5rem;
}
.kb__pbtn:hover { color: var(--accent, #A33B2E); }
.kb__pbtn:disabled { color: #DED6C4; cursor: default; }
.kb__pbtn.next { text-align: right; }
.kb__phint {
  font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .62rem; letter-spacing: .1em; color: #C9C0AC;
}

/* Buchreiter rechts — haften ebenfalls beim Scrollen */
.kb__tabs { display: flex; flex-direction: column; gap: 6px; padding-top: 26px; flex: 0 0 138px; max-height: calc(100vh - 24px); overflow-y: auto; scrollbar-width: thin; position: sticky; top: 12px; align-self: flex-start; }
.kb__tab {
  cursor: pointer; border: 1.5px solid #E0D9C9; border-left: none;
  background: #F6F2E8; color: #6E675C; border-radius: 0 9px 9px 0;
  padding: 10px 10px 10px 14px; margin-left: 0; font: inherit; text-align: left;
  transition: margin-left .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.kb__tab .nr {
  display: block; font-family: 'Atkinson Mono', ui-monospace, monospace;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; opacity: .72;
}
.kb__tab .nm { display: block; font-size: .92rem; font-weight: 500; line-height: 1.2; }
.kb__tab:hover { margin-left: -6px; background: var(--tabPastel); border-color: var(--tabPastel); color: var(--tabColor); }
.kb__tab.is-active {
  margin-left: -10px; background: var(--tabColor); border-color: var(--tabColor);
  color: #FBF9F4; box-shadow: 2px 2px 0 rgba(34,31,26,0.06);
}
.kb__tab.is-active:hover { background: var(--tabColor); border-color: var(--tabColor); color: #FBF9F4; }

/* Original-TOC verstecken, wenn Buch aktiv */
.kb-active .section { display: none; }
/* Anti-FOUC: kb-boot wird inline im head gesetzt (nur mit JS), buch.js
   ersetzt es durch kb-active oder entfernt es (Fallback auf die Liste). */
.kb-boot .section { display: none; }

/* Mobil: Buch einspaltig, Reiter als scrollbare Zeile oben */
@media (max-width: 860px) {
  .kb { flex-direction: column-reverse; }
  .kb__tabs {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    padding: 0 0 10px; flex: 1 1 auto; width: 100%; max-height: none; position: static;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .kb__tabs::-webkit-scrollbar { display: none; }
  .kb__tab { flex: 0 0 auto; border: 1.5px solid #E0D9C9; border-radius: 9px; padding: 7px 10px; }
  .kb__tab.is-active, .kb__tab:hover { margin-left: 0; }
  .kb__book { flex-direction: column; min-height: 0; border-radius: 12px; }
  .kb__left { flex: 0 0 auto; max-height: 42vh; padding: 14px; }
  .kb__gutterL, .kb__gutterR { display: none; }
  .kb__right { border-top: 1px solid #E7E0CF; padding: 16px 14px; position: static; max-height: none; }
  .kb__text { max-height: none; overflow-y: visible; }
  .kb__titel { font-size: 1.3rem; }
  .kb__item .e { flex: 0 0 3.8rem; }
  /* Header: umbrechen statt Viewport sprengen */
  .site-head__in { flex-wrap: wrap; row-gap: .4rem; }
  .searchbtn { min-width: 0; }
  .searchbtn__txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Kein ⌘K-Kuerzel-Badge (Nutzerentscheid) */
.kbd { display: none; }
