/*
 * Wissensraum · Gestaltung
 * ------------------------
 * Alle Regeln hängen an .wr und greifen damit nur im Wissensraum.
 * Die Werte im ersten Block sind die Stellschrauben. Sie folgen designsystem/tokens.json:
 * New Edge 666 Light für große Schrift, Söhne für Text, Schwarz, Weiß und die Grautöne,
 * dazu das Grün des Fokusrings. Die Farben der Themenwelten kommen aus den Daten.
 */

.wr {
  /* Farben */
  --wr-schwarz: #000000;          /* color-black */
  --wr-weiss: #ffffff;            /* color-white */
  --wr-grau-1: #c7c3c2;           /* color-muted */
  --wr-grau-2: #777574;           /* color-muted, 60 % auf Schwarz: Nebentext mit ausreichendem Kontrast */
  --wr-grau-3: #5e5c5c;           /* color-mutedDark */
  --wr-linie: rgba(255, 255, 255, 0.19);   /* color-borderOnDark (#ffffff30): Haarlinien auf Schwarz */
  --wr-blau: #0000ff;             /* color-blue */
  --wr-rot: #ff0000;              /* color-red */
  --wr-magenta: #ff00c3;          /* color-magenta */
  --wr-gruen: #33ff00;            /* color-green: Fokusring und Schreibmarke */

  /* Schrift. Auf sugarpool.de sind beide Hausschriften bereits geladen; die weiteren Namen sind Ersatz. */
  --wr-font-display: "New Edge 666", "Inter Tight", "Inter Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --wr-font-text: "Söhne", "Soehne", "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  --wr-text: 18px;                /* size-body */
  --wr-text-gross: 22px;          /* size-lead */
  --wr-text-klein: 16px;          /* size-small */

  /* Raster der Website: Rand 40 px, Hauptspalte ab gut einem Drittel */
  --wr-rand: 40px;                /* space-gutter */
  --wr-spalte: calc(33% + 20px);  /* .col-33 plus space-gap */

  /* Suche im Zentrum. Position und Breite setzt das Skript. */
  --wr-fx: 50vw;
  --wr-fy: 50vh;
  --wr-q-b: 440px;
  --wr-q-fs: 45px;                /* size-heading, unter 768 px 32 px */
  --wr-bereich: var(--wr-grau-2);

  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
  background: var(--wr-schwarz);
  color: var(--wr-weiss);
  font-family: var(--wr-font-text);
  font-size: var(--wr-text);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.25px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.wr *,
.wr *::before,
.wr *::after { box-sizing: border-box; }

.wr button {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.wr a { color: inherit; }

.wr :focus-visible {
  outline: 2px solid var(--wr-gruen);
  outline-offset: 5px;
}

.wr__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- Raum */

.wr__nebel,
.wr__raum {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.wr__nebel { z-index: 0; }
.wr__raum { z-index: 1; }

/* Ersatz, falls der Browser kein WebGL bereitstellt */
.wr--ohne-webgl .wr__nebel {
  background:
    radial-gradient(58% 54% at 20% 36%, rgba(0, 0, 255, 0.42), rgba(0, 0, 255, 0) 70%),
    radial-gradient(54% 58% at 54% 80%, rgba(255, 0, 195, 0.3), rgba(255, 0, 195, 0) 70%),
    radial-gradient(48% 50% at 85% 32%, rgba(255, 0, 0, 0.3), rgba(255, 0, 0, 0) 70%),
    var(--wr-schwarz);
}

.wr__buehne {
  position: absolute;
  inset: 0;
  z-index: 2;
  outline: none;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.wr[data-touch="seite"] .wr__buehne { touch-action: pan-y; }
.wr--zeigt .wr__buehne { cursor: pointer; }
.wr--zieht .wr__buehne { cursor: grabbing; }

/* ---------------------------------------------------------------- Kopf */

.wr__kopf {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: var(--wr-spalte) 1fr auto;
  align-items: baseline;
  padding: 22px var(--wr-rand) 0;
  pointer-events: none;
}

.wr__kopf > * { pointer-events: auto; }
.wr[data-kopf="aus"] .wr__ort,
.wr[data-kopf="aus"] .wr__kopf-rechts { visibility: hidden; }

.wr__ort {
  justify-self: start;
  text-decoration: none;
}

.wr__ansicht {
  display: flex;
  gap: 20px;
}

.wr__ansicht button,
.wr__bereiche button,
.wr__filter button,
.wr__werk button {
  color: var(--wr-grau-2);
  transition: color 0.25s ease;
}

.wr__ansicht button:hover,
.wr__ansicht button[aria-pressed="true"],
.wr__bereiche button:hover,
.wr__bereiche button[aria-pressed="true"],
.wr__bereiche button[aria-current="true"],
.wr__filter button:hover,
.wr__filter button[aria-pressed="true"],
.wr__werk button:hover { color: var(--wr-weiss); }

.wr__kopf-rechts {
  display: flex;
  gap: 40px;
}

.wr__kopf-rechts a { text-decoration: none; }

/* ---------------------------------------------------------------- Suche im Zentrum */

.wr__suche {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: var(--wr-q-b);
  max-width: calc(100% - 2 * var(--wr-rand));
  margin: 0;
  transform: translate3d(calc(var(--wr-fx) - 50%), calc(var(--wr-fy) - 0.75 * var(--wr-q-fs)), 0);
}

/* Ruhezone: dunkelt den Nebel hinter der Suche ab, damit sie auf jedem Grund lesbar bleibt */
.wr__suche::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -84px -120px -84px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.6) 58%, rgba(0, 0, 0, 0));
  pointer-events: none;
}

.wr--offen .wr__suche::before { inset: -22px -34px -30px; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0)); }

.wr--tippt .wr__suche::before { inset: -26px -70px -40px; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.78) 70%, rgba(0, 0, 0, 0)); }

.wr__feld {
  display: flex;
  align-items: baseline;
  gap: 0.06em;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--wr-linie);
  font-family: var(--wr-font-display);
  font-size: var(--wr-q-fs);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.5px;
  transition: border-color 0.3s ease;
}

.wr__feld:focus-within { border-bottom-color: var(--wr-weiss); }

.wr__slash {
  flex: none;
  color: var(--wr-bereich);
  transition: color 0.6s ease;
}

.wr__eingabe,
.wr__index-eingabe {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: none;
  color: var(--wr-weiss);
  caret-color: var(--wr-gruen);
  font: inherit;
  letter-spacing: inherit;
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
}

.wr .wr__eingabe:focus-visible,
.wr .wr__index-eingabe:focus-visible { outline: 0; }
.wr__eingabe::placeholder,
.wr__index-eingabe::placeholder { color: var(--wr-grau-2); opacity: 1; }
.wr__eingabe::-webkit-search-cancel-button,
.wr__index-eingabe::-webkit-search-cancel-button { display: none; }

.wr__unter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  min-height: 26px;
  padding-top: 7px;
  font-size: var(--wr-text-klein);
  color: var(--wr-grau-2);
}

.wr__leeren {
  border-bottom: 1px solid currentColor;
  line-height: 1.2;
  text-decoration: none;
}

.wr .wr__leeren { color: var(--wr-grau-1); }
.wr .wr__leeren:hover { color: var(--wr-weiss); }
.wr__leeren[hidden] { display: none; }

.wr__treffer {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.wr__treffer:empty { display: none; }

.wr__treffer li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0 9px;
  border-bottom: 1px solid var(--wr-linie);
  color: var(--wr-grau-2);
  font-size: var(--wr-text-gross);
  cursor: pointer;
}

.wr__treffer li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr__treffer mark { background: none; color: var(--wr-grau-1); }
.wr__treffer li:hover,
.wr__treffer li:hover mark,
.wr__treffer li[aria-selected="true"],
.wr__treffer li[aria-selected="true"] mark { color: var(--wr-weiss); }

.wr__m {
  flex: none;
  font-family: var(--wr-font-text);
  font-size: var(--wr-text-klein);
  letter-spacing: -0.25px;
  color: var(--wr-grau-2);
  white-space: nowrap;
}

.wr__leer {
  margin: 12px 0 0;
  color: var(--wr-grau-1);
}

.wr__leer button { border-bottom: 1px solid currentColor; line-height: 1.2; }

.wr__hinweis {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  margin: 0;
  transform: translate3d(calc(var(--wr-fx) - 50%), calc(var(--wr-fy) + 62px), 0);
  font-size: var(--wr-text-klein);
  color: var(--wr-grau-2);
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.9s ease;
}

.wr--erkundet .wr__hinweis,
.wr--tippt .wr__hinweis,
.wr--offen .wr__hinweis,
.wr--index .wr__hinweis { opacity: 0; }

/* ---------------------------------------------------------------- Lesespalte eines geöffneten Begriffs */

.wr__blatt {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(440px, 39vw, 600px);
  padding: 112px var(--wr-rand) 104px 132px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: 104px 0 132px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0.9) 118px, rgba(0, 0, 0, 0.95) 100%);
  /* Der Text läuft vor dem Fuß weich aus */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 118px), rgba(0, 0, 0, 0) calc(100% - 58px));
  mask-image: linear-gradient(to bottom, #000 calc(100% - 118px), rgba(0, 0, 0, 0) calc(100% - 58px));
  opacity: 0;
  visibility: hidden;
  transform: translate3d(32px, 0, 0);
  transition: opacity 0.45s ease, transform 0.75s cubic-bezier(0.16, 0.8, 0.2, 1), visibility 0s linear 0.75s;
}

.wr--offen .wr__blatt {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.wr .wr__blatt:focus { outline: 0; }

.wr__blatt-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin: 0 0 20px;
}

.wr__pfad {
  margin: 0;
  color: var(--wr-grau-2);
}

.wr__pfad i { font-style: normal; color: var(--wr-bereich); }
.wr__pfad b { font-weight: 400; color: var(--wr-weiss); }

.wr__zu {
  flex: none;
  border-bottom: 1px solid currentColor;
  line-height: 1.2;
  text-decoration: none;
}

.wr .wr__zu { color: var(--wr-grau-1); }
.wr .wr__zu:hover { color: var(--wr-weiss); }

.wr__lang {
  margin: -8px 0 20px;
  color: var(--wr-grau-2);
}

.wr__lang[hidden],
.wr__quellen[hidden],
.wr__label[hidden],
.wr__verwandt[hidden] { display: none; }

.wr__text p {
  max-width: 26em;
  margin: 0 0 0.9rem;
  text-wrap: pretty;
}

/* Kernaussage groß und weiß, Einordnung darunter ruhiger: Grau und Weiß wie auf der Website */
.wr__kern { font-size: var(--wr-text-gross); line-height: 1.2em; }
.wr__weiter { color: var(--wr-grau-1); }
.wr__offen { font-size: var(--wr-text-gross); line-height: 1.2em; color: var(--wr-grau-2); }

.wr__quellen {
  max-width: 34em;
  margin: 18px 0 0;
  font-size: var(--wr-text-klein);
  line-height: 1.3;
  color: var(--wr-grau-2);
}

.wr__quellen a { text-decoration: none; border-bottom: 1px solid currentColor; }
.wr__quellen a:hover { color: var(--wr-weiss); }

.wr__alias {
  margin-left: 12px;
  font-style: normal;
  font-size: var(--wr-text-klein);
  color: var(--wr-grau-2);
}

.wr__mehr {
  display: inline-block;
  margin-top: 14px;
  border-bottom: 1px solid currentColor;
  line-height: 1.2;
  text-decoration: none;
}

.wr__mehr[hidden] { display: none; }

.wr__label {
  margin: 44px 0 8px;
  font-size: var(--wr-text);
  font-weight: 400;
  color: var(--wr-grau-2);
}

.wr__verwandt {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--wr-linie);
}

.wr__verwandt button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  padding: 11px 0 12px;
  border-bottom: 1px solid var(--wr-linie);
  color: var(--wr-grau-1);
  font-size: 22px;
  text-align: left;
  transition: color 0.25s ease;
}

.wr__verwandt button:hover,
.wr__verwandt button:focus-visible { color: var(--wr-weiss); }

/* ---------------------------------------------------------------- Index: alle Begriffe als Liste */

.wr__index {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  grid-template-columns: var(--wr-spalte) 1fr;
  align-content: start;
  padding: 124px var(--wr-rand) 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.84);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

.wr--index .wr__index {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.wr__index-seite {
  position: sticky;
  top: 0;
  align-self: start;
  padding-right: 24px;
}

.wr__index-seite p { margin: 0; color: var(--wr-grau-2); }
.wr__index-seite p + p { color: var(--wr-weiss); }

.wr__filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-top: 28px;
}

.wr__gruppe {
  display: grid;
  grid-template-columns: 56px 1fr;
  margin-bottom: 36px;
}

.wr__gruppe[hidden] { display: none; }

.wr__gruppe h3 {
  margin: 0;
  padding-top: 14px;
  font-size: var(--wr-text);
  font-weight: 400;
  color: var(--wr-grau-2);
}

.wr__gruppe ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--wr-linie);
}

.wr__gruppe li[hidden] { display: none; }

.wr__zeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 7px 0 9px;
  border-bottom: 1px solid var(--wr-linie);
  color: var(--wr-grau-2);
  font-family: var(--wr-font-display);
  font-size: clamp(32px, 3.2vw, 45px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.5px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.wr a.wr__zeile { color: var(--wr-grau-2); }
.wr a.wr__zeile:hover,
.wr a.wr__zeile:focus-visible { color: var(--wr-weiss); }
.wr__zeile .wr__m { font-size: var(--wr-text); }

/* ---------------------------------------------------------------- Fuß */

.wr__fuss {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 0 var(--wr-rand) 22px;
  pointer-events: none;
}

.wr__fuss > * { pointer-events: auto; }

.wr__bereiche {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
}

.wr__werk {
  display: flex;
  align-items: baseline;
  gap: 28px;
  margin-left: auto;
}

.wr__zoom {
  display: flex;
  gap: 6px;
}

.wr__zoom button {
  width: 30px;
  font-family: var(--wr-font-display);
  font-size: 28px;
  font-weight: 300;
  line-height: 0.8;
}

.wr--index .wr__fuss { opacity: 0; visibility: hidden; }

/* ---------------------------------------------------------------- Schmale Fenster und Telefone */

@media (max-width: 1100px) {
  .wr__blatt { width: clamp(400px, 46vw, 520px); padding-left: 112px; }
}

@media (max-width: 767px) {
  .wr {
    --wr-rand: 20px;               /* space-gutterMobile */
    --wr-spalte: 0%;
  }

  .wr__kopf { grid-template-columns: 1fr auto; padding-top: 18px; }
  .wr__kopf-rechts { display: none; }
  .wr__ansicht { gap: 16px; }

  .wr__suche::before { inset: -64px -40px -64px; }
  .wr__treffer li { font-size: var(--wr-text); }

  .wr__blatt {
    top: auto;
    left: 0;
    width: auto;
    height: min(56%, 520px);
    padding: 52px var(--wr-rand) 76px;
    scroll-padding: 56px 0 88px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0.92) 46px, #000 100%);
    transform: translate3d(0, 28px, 0);
  }

  .wr__label { margin-top: 32px; }
  .wr__verwandt button { font-size: var(--wr-text); }

  .wr__index {
    display: block;
    padding-top: 92px;
  }

  .wr__index-seite { position: static; margin-bottom: 28px; padding-right: 0; }
  .wr__filter { margin-top: 14px; }
  .wr__gruppe { grid-template-columns: 32px 1fr; margin-bottom: 26px; }
  .wr__zeile { font-size: 32px; }
  .wr__zeile .wr__m { display: none; }

  .wr__bereiche button:not([aria-current="true"]) { display: none; }
  .wr__fuss { padding-bottom: 16px; }
  .wr__zoom { display: none; }
}

/* ---------------------------------------------------------------- Reduzierte Bewegung */

@media (prefers-reduced-motion: reduce) {
  .wr *,
  .wr *::before,
  .wr *::after { transition-duration: 0.01ms !important; }
}

.wr--ruhig .wr__blatt,
.wr--ruhig.wr--offen .wr__blatt { transform: none; transition: opacity 0.2s ease, visibility 0s; }

/* Erzwungene Farben (Kontrastmodus von Windows): Umrandungen sichtbar halten */
@media (forced-colors: active) {
  .wr__feld { border-bottom-color: CanvasText; }
  .wr__blatt, .wr__index { background: Canvas; }
}

/* Freigegebene Live-Bedienrevision, Issue 110. Fable-Referenz bleibt unverändert. */
.wr__ansicht button {
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}
.wr__ansicht button[aria-pressed="true"] { text-decoration-thickness: 2px; }
.wr .wr__zu {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--wr-grau-1);
  color: var(--wr-weiss);
  background: var(--wr-schwarz, #000);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.wr .wr__zu:hover { color: #000; background: var(--wr-weiss); }
.wr__pfad { min-width: 0; }
.wr__index-suche { margin-top: 20px; }
.wr__index-suche .wr__feld { font-size: clamp(26px, 3vw, 36px); min-height: 44px; }
.wr__index-eingabe { min-height: 44px; }
.wr__index-suche .wr__unter { min-height: 44px; align-items: center; }
.wr .wr__index-leeren { min-height: 44px; text-decoration: underline; text-underline-offset: 0.25em; }
.wr__index-leer { margin: 14px 0; color: var(--wr-weiss); }
.wr--index .wr__suche { visibility: hidden; }
