/* ===========================================================
   wiki-blocks.css — GitBook-Ausbau
   Rich-Blocks · Slash-Menü · Command-Palette · Icons ·
   Beschreibung · Anker · Theme-Umschalter
   =========================================================== */

/* ---------- Title-Zeile: Icon · Aktionen ---------- */
.wk-title-row { display: flex; align-items: flex-start; gap: 14px; }
.wk-title-icon {
  flex: none; font-size: clamp(30px, 4vw, 44px); line-height: 1; margin-top: 2px;
  background: none; border: none; padding: 0; cursor: default; border-radius: 12px; transition: background .2s, transform .15s;
}
.wk-title-icon.empty { display: none; }
body.wk-editing .wk-title-icon { cursor: pointer; padding: 4px; }
body.wk-editing .wk-title-icon.empty { display: grid; place-items: center; width: 52px; height: 52px; font-size: 22px; color: var(--faint); border: 1px dashed var(--line-strong); }
body.wk-editing .wk-title-icon:hover { background: rgba(255,255,255,.05); transform: scale(1.05); }

.wk-page-actions { margin-left: auto; display: flex; gap: 8px; padding-top: 8px; }
.wk-pa { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.03); color: var(--muted); font-size: 15px; cursor: pointer; display: grid; place-items: center; transition: color .2s, border-color .2s, background .2s; }
.wk-pa:hover { color: var(--fg); border-color: var(--accent); }

/* ---------- Beschreibung ---------- */
.wk-desc { margin-top: 12px; font-size: calc(18px * var(--font-scale)); line-height: 1.55; color: var(--muted); text-wrap: pretty; outline: none; }
.wk-desc:empty { display: none; }
body.wk-editing .wk-desc { display: block; border-radius: 9px; padding: 5px 10px; margin-left: -10px; border: 1px solid transparent; transition: border-color .2s; }
body.wk-editing .wk-desc:hover { border-color: var(--line); }
body.wk-editing .wk-desc:focus { border-color: var(--accent); }
body.wk-editing .wk-desc:empty { display: block; }
body.wk-editing .wk-desc:empty::before { content: attr(data-empty); color: var(--faint); }

/* ---------- Meta-Zeile: aktualisiert · Lesezeit · Wörter ---------- */
.wk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--faint); margin-top: 16px; }
.wk-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--dim); }

/* ---------- Sidebar-Icons ---------- */
.wk-pglink .wk-pgicon { flex: none; width: 18px; text-align: center; font-size: 13.5px; line-height: 1; }
body:not(.wk-editing) .wk-pglink:not(:has(.wk-pgicon)) { padding-left: 26px; }

/* ===========================================================
   Rich-Blocks
   =========================================================== */

/* Hinweis / Callout */
.wk-hint { display: flex; gap: 13px; margin: 20px 0; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.wk-hint .wk-hint-ic { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 1px; }
.wk-hint .wk-hint-body { flex: 1; min-width: 0; }
.wk-hint .wk-hint-body > *:first-child { margin-top: 0; }
.wk-hint .wk-hint-body > *:last-child { margin-bottom: 0; }
.wk-hint .wk-hint-body p { color: var(--fg); }
.wk-hint[data-variant="info"]    { border-color: color-mix(in oklab, #4a9eff 40%, var(--line)); background: color-mix(in oklab, #4a9eff 9%, transparent); }
.wk-hint[data-variant="info"]    .wk-hint-ic { background: color-mix(in oklab, #4a9eff 22%, transparent); color: #8cc2ff; }
.wk-hint[data-variant="success"] { border-color: color-mix(in oklab, #41d77f 40%, var(--line)); background: color-mix(in oklab, #41d77f 9%, transparent); }
.wk-hint[data-variant="success"] .wk-hint-ic { background: color-mix(in oklab, #41d77f 22%, transparent); color: #6fe6a0; }
.wk-hint[data-variant="warning"] { border-color: color-mix(in oklab, #f5b133 44%, var(--line)); background: color-mix(in oklab, #f5b133 10%, transparent); }
.wk-hint[data-variant="warning"] .wk-hint-ic { background: color-mix(in oklab, #f5b133 24%, transparent); color: #ffcd6b; }
.wk-hint[data-variant="danger"]  { border-color: color-mix(in oklab, #ff5f5f 42%, var(--line)); background: color-mix(in oklab, #ff5f5f 9%, transparent); }
.wk-hint[data-variant="danger"]  .wk-hint-ic { background: color-mix(in oklab, #ff5f5f 22%, transparent); color: #ff9292; }

/* Code-Block mit Sprache + Kopieren */
.wk-code { position: relative; margin: 20px 0; }
.wk-code pre { margin: 0; }
.wk-code .wk-code-bar { position: absolute; top: 0; left: 0; right: 0; height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); pointer-events: none; }
.wk-code .wk-code-lang { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.wk-code .wk-code-copy { pointer-events: auto; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; transition: color .2s, border-color .2s; }
.wk-code .wk-code-copy:hover { color: var(--fg); border-color: var(--accent); }
.wk-code pre { padding-top: 50px; }

/* Aufklappbar */
.wk-prose details.wk-exp { margin: 18px 0; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); overflow: hidden; }
.wk-prose details.wk-exp > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--fg); display: flex; align-items: center; gap: 10px; user-select: none; }
.wk-prose details.wk-exp > summary::-webkit-details-marker { display: none; }
.wk-prose details.wk-exp > summary::before { content: "▸"; color: var(--accent); font-size: 12px; transition: transform .2s; }
.wk-prose details.wk-exp[open] > summary::before { transform: rotate(90deg); }
.wk-prose details.wk-exp > summary:focus { outline: none; }
.wk-exp-body { padding: 0 18px 14px; }
.wk-exp-body > *:first-child { margin-top: 4px; }
body.wk-editing details.wk-exp { open: true; }

/* Tabs */
.wk-tabs { margin: 20px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.015); }
.wk-tablist { display: flex; flex-wrap: wrap; gap: 2px; padding: 7px 7px 0; border-bottom: 1px solid var(--line); }
.wk-tabbtn { padding: 9px 15px; border-radius: 9px 9px 0 0; font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: color .2s, background .2s; margin-bottom: -1px; }
.wk-tabbtn:hover { color: var(--fg); }
.wk-tabbtn.active { color: var(--accent); border-bottom-color: var(--accent); }
.wk-tab { padding: 16px 18px; }
.wk-tab > *:first-child { margin-top: 0; }
.wk-tab[hidden] { display: none; }
.wk-tab-title { display: none; }
body.wk-editing .wk-tabs .wk-tablist { display: none; }
body.wk-editing .wk-tab { border-top: 1px solid var(--line); }
body.wk-editing .wk-tab:first-child { border-top: none; }
body.wk-editing .wk-tab-title { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; outline: none; }

/* Karten */
.wk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 20px 0; }
.wk-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); text-decoration: none; transition: border-color .2s, transform .2s, background .2s; }
.wk-card:hover { border-color: var(--accent); transform: translateY(-2px); background: rgba(255,255,255,.04); }
.wk-card .wk-card-t { font-size: 15.5px; font-weight: 700; color: var(--fg); }
.wk-card .wk-card-d { font-size: 13px; color: var(--muted); line-height: 1.5; }
.wk-card .wk-card-arrow { margin-top: auto; font-family: var(--font-mono); font-size: 13px; color: var(--accent); }

/* Schritte */
.wk-steps { counter-reset: wkstep; display: grid; gap: 12px; margin: 20px 0; }
.wk-step { counter-increment: wkstep; position: relative; padding: 14px 18px 14px 58px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); }
.wk-step > *:first-child { margin-top: 0; }
.wk-step > *:last-child { margin-bottom: 0; }
.wk-step::before { content: counter(wkstep); position: absolute; left: 16px; top: 13px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #1c0f06; font-family: var(--font-display); font-weight: 700; font-size: 14px; display: grid; place-items: center; }

/* Überschrift-Anker */
.wk-prose h2, .wk-prose h3 { position: relative; }
.wk-anchor { position: absolute; left: -24px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; display: grid; place-items: center; color: var(--faint); font-size: 13px; opacity: 0; text-decoration: none; transition: opacity .15s, color .15s; cursor: pointer; }
.wk-prose h2:hover .wk-anchor, .wk-prose h3:hover .wk-anchor { opacity: 1; }
.wk-anchor:hover { color: var(--accent); }
@media (max-width: 720px) { .wk-anchor { display: none; } }

/* ===========================================================
   Slash-Menü
   =========================================================== */
.wk-slash {
  position: absolute; z-index: 150; width: 290px; max-height: 330px; overflow-y: auto;
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 30px 70px -28px rgba(0,0,0,.85); padding: 6px; display: none;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.wk-slash.show { display: block; }
.wk-slash-cat { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 9px 11px 5px; }
.wk-slash-item { display: flex; align-items: center; gap: 12px; padding: 8px 11px; border-radius: 10px; cursor: pointer; }
.wk-slash-item.sel, .wk-slash-item:hover { background: color-mix(in oklab, var(--accent) 13%, transparent); }
.wk-slash-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 15px; }
.wk-slash-meta { min-width: 0; }
.wk-slash-t { font-size: 14px; font-weight: 600; color: var(--fg); }
.wk-slash-d { font-size: 12px; color: var(--muted); }
.wk-slash-empty { padding: 14px; text-align: center; color: var(--faint); font-size: 13px; }

/* ===========================================================
   Command-Palette (Cmd/Strg + K)
   =========================================================== */
.wk-cmdk-scrim { position: fixed; inset: 0; z-index: 300; background: rgba(5,5,7,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.wk-cmdk-scrim.show { opacity: 1; pointer-events: auto; }
.wk-cmdk {
  position: fixed; z-index: 301; top: 13vh; left: 50%; transform: translateX(-50%) scale(.97);
  width: min(640px, 92vw);
  background: color-mix(in oklab, var(--bg) 95%, transparent);
  border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden;
  box-shadow: 0 50px 120px -30px rgba(0,0,0,.92);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease-out);
}
.wk-cmdk.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }
.wk-cmdk-in { display: flex; align-items: center; gap: 13px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.wk-cmdk-in .ic { color: var(--faint); font-size: 18px; }
.wk-cmdk-in input { flex: 1; background: none; border: none; outline: none; color: var(--fg); font-family: var(--font-body); font-size: 17px; }
.wk-cmdk-in input::placeholder { color: var(--faint); }
.wk-cmdk-in .esc { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--faint); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 7px; }
.wk-cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.wk-cmdk-cat { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 10px 12px 5px; }
.wk-cmdk-item { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border-radius: 12px; cursor: pointer; }
.wk-cmdk-item.sel { background: color-mix(in oklab, var(--accent) 13%, transparent); }
.wk-cmdk-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 14px; color: var(--accent); }
.wk-cmdk-meta { min-width: 0; flex: 1; }
.wk-cmdk-t { font-size: 14.5px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-cmdk-c { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-cmdk-c mark, .wk-search .results mark { background: color-mix(in oklab, var(--accent) 30%, transparent); color: var(--fg); border-radius: 3px; padding: 0 2px; }
.wk-cmdk-sec { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); flex: none; }
.wk-cmdk-empty { padding: 28px; text-align: center; color: var(--faint); font-size: 14px; }
.wk-cmdk-foot { display: flex; gap: 16px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--faint); }
.wk-cmdk-foot kbd { font-family: var(--font-mono); background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 5px; padding: 2px 6px; color: var(--muted); margin-right: 3px; }

/* Kbd-Hinweis in der Topbar-Suche */
.wk-kbd-hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: inline-flex; gap: 3px; pointer-events: none; }
.wk-kbd-hint kbd { font-family: var(--font-mono); font-size: 10px; background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 5px; padding: 2px 6px; color: var(--faint); }
@media (max-width: 860px) { .wk-kbd-hint { display: none; } }

/* ===========================================================
   Emoji-Picker
   =========================================================== */
.wk-emoji { position: absolute; z-index: 160; width: 268px; padding: 10px; background: color-mix(in oklab, var(--bg) 95%, transparent); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 30px 70px -28px rgba(0,0,0,.85); display: none; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.wk-emoji.show { display: block; }
.wk-emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.wk-emoji-grid button { font-size: 19px; padding: 6px 0; border-radius: 8px; border: none; background: none; cursor: pointer; transition: background .15s, transform .1s; }
.wk-emoji-grid button:hover { background: color-mix(in oklab, var(--accent) 14%, transparent); transform: scale(1.12); }
.wk-emoji-clear { width: 100%; margin-top: 8px; padding: 8px; border-radius: 9px; border: 1px solid var(--line-strong); background: none; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: color .2s, border-color .2s; }
.wk-emoji-clear:hover { color: var(--fg); border-color: var(--accent); }

/* ===========================================================
   Theme-Umschalter (Topbar)
   =========================================================== */
.wk-theme { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.03); color: var(--muted); font-size: 16px; cursor: pointer; display: grid; place-items: center; transition: color .2s, border-color .2s, background .2s; -webkit-appearance: none; appearance: none; }
.wk-theme:hover { color: var(--fg); border-color: var(--accent); }

/* ===========================================================
   HELL-THEME  ·  .wk-shell.theme-light
   überschreibt die Tokens nur im Wiki-Bereich (Marke bleibt orange)
   =========================================================== */
.wk-shell.theme-light {
  --bg: #f7f6f3;
  --fg: #1b1c20;
  --muted: #4b4d55;
  --faint: #8a8c95;
  --dim: #b3b5bd;
  --line: rgba(20,20,25,.10);
  --line-strong: rgba(20,20,25,.17);
  background: #f7f6f3;
  color: var(--fg);
  position: relative; z-index: 1;
}
/* Oberflächen, die mit weißem Tint auf Dunkel gebaut sind, im Hell-Theme abdunkeln */
.theme-light .wk-search input,
.theme-light .wk-edit-toggle,
.theme-light .wk-theme,
.theme-light .wk-back,
.theme-light .wk-burger,
.theme-light .wk-pa,
.theme-light .wk-tb,
.theme-light .wk-mini,
.theme-light .wk-hint,
.theme-light .wk-card,
.theme-light .wk-step,
.theme-light .wk-tabs,
.theme-light .wk-pn,
.theme-light .wk-exp,
.theme-light .wk-prose blockquote { background: rgba(20,20,25,.025); }
.theme-light .wk-pglink:hover, .theme-light .wk-sec-h:hover { background: rgba(20,20,25,.05); }
.theme-light .wk-pglink.active { background: color-mix(in oklab, var(--accent) 14%, transparent); }
.theme-light .wk-prose code { background: rgba(20,20,25,.06); color: #b25a28; }
.theme-light .wk-prose pre { background: #1c1d22; border-color: rgba(20,20,25,.2); }
.theme-light .wk-prose pre code { color: #e9e9ec; }
.theme-light .wk-prose th { background: rgba(20,20,25,.04); }
.theme-light .wk-top { background: color-mix(in oklab, #f7f6f3 82%, transparent); }
.theme-light .wk-toolbar { background: color-mix(in oklab, #f7f6f3 90%, transparent); }
.theme-light .wk-side { background: color-mix(in oklab, #f7f6f3 60%, transparent); }
.theme-light .wk-cmdk, .theme-light .wk-slash, .theme-light .wk-emoji, .theme-light .wk-search .results { background: #fbfaf8; }
.theme-light .wk-cmdk-ic, .theme-light .wk-slash-ic, .theme-light .wk-cmdk-foot kbd, .theme-light .wk-kbd-hint kbd { background: rgba(20,20,25,.05); }
/* Hintergrund-Effekte im Hell-Theme zurücknehmen */
.theme-light ~ .bg-aurora, body:has(.theme-light) .bg-aurora, body:has(.theme-light) #bgfx { opacity: 0; }

/* Textfarben im Hell-Theme NEU deklarieren — erzwingt Neuberechnung der
   var()-abgeleiteten Farbe bei Elementen mit `transition: color`
   (sonst bleiben sie auf dem alten Dunkel-Wert „kleben"). */
.theme-light .wk-pglink,
.theme-light .wk-sec-h,
.theme-light .stitle,
.theme-light .wk-toc a,
.theme-light .wk-back,
.theme-light .wk-edit-toggle,
.theme-light .wk-theme,
.theme-light .wk-pa,
.theme-light .wk-tb,
.theme-light .wk-mini,
.theme-light .wk-search input,
.theme-light .wk-tabbtn,
.theme-light .wk-fb,
.theme-light .wk-pn .k { color: var(--muted); }
.theme-light .wk-pglink.active,
.theme-light .wk-pglink:hover,
.theme-light .wk-sec-h:hover,
.theme-light .wk-toc a.active,
.theme-light .wk-back:hover,
.theme-light .wk-edit-toggle:hover,
.theme-light .wk-theme:hover,
.theme-light .wk-pa:hover,
.theme-light .wk-tabbtn.active,
.theme-light .wk-pn .v { color: var(--fg); }
.theme-light .wk-pgicon, .theme-light .wk-sec-icon, .theme-light .wk-meta, .theme-light .wk-bread { color: var(--faint); }
.theme-light .wk-bread .cur, .theme-light .wk-side-title, .theme-light .wk-toc .lab { color: var(--faint); }
.theme-light .wk-pglink.active { color: var(--fg); }
body.wk-editing.wk-shell.theme-light { color: var(--fg); }
