/* ---------- Tokens ---------- */

:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #17171a;
  --muted: #6a6a70;
  --line: #e2dfd6;
  --accent: #16a34a;
  --accent-deep: #15803d;
  --accent-soft: rgba(22, 163, 74, 0.1);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.1);

  --cube-top: #ffffff;
  --cube-left: #e7e4db;
  --cube-right: #d8d4c8;
  --cube-line: #cbc6b8;

  --font-sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --radius: 10px;
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --surface: #161619;
    --surface-2: #1c1c20;
    --text: #ececec;
    --muted: #8e8e96;
    --line: #26262b;
    --accent: #3ee07f;
    --accent-deep: #22a55a;
    --accent-soft: rgba(62, 224, 127, 0.12);
    --warn: #e0a84a;
    --warn-soft: rgba(224, 168, 74, 0.1);
    --cube-top: #1f1f23;
    --cube-left: #17171a;
    --cube-right: #121215;
    --cube-line: #2c2c31;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #161619;
  --surface-2: #1c1c20;
  --text: #ececec;
  --muted: #8e8e96;
  --line: #26262b;
  --accent: #3ee07f;
  --accent-deep: #22a55a;
  --accent-soft: rgba(62, 224, 127, 0.12);
  --warn: #e0a84a;
  --warn-soft: rgba(224, 168, 74, 0.1);
  --cube-top: #1f1f23;
  --cube-left: #17171a;
  --cube-right: #121215;
  --cube-line: #2c2c31;
  color-scheme: dark;
}

/* ---------- Basis ---------- */

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

html { scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-dim { color: var(--muted); font-weight: 400; }
.brand-mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  -webkit-mask: url("../img/logo.svg") center / contain no-repeat;
  mask: url("../img/logo.svg") center / contain no-repeat;
  transition: transform 0.5s var(--ease);
}
.brand:hover .brand-mark { transform: translateY(-2px) scale(1.08); }

.nav { display: flex; align-items: center; gap: 28px; font-size: 15px; }
.nav a { color: var(--muted); transition: color 0.2s; }
.nav a:hover { color: var(--text); }

.theme-toggle {
  width: 36px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
}
.theme-toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.35s var(--ease);
}
:root[data-theme="dark"] .theme-toggle-dot { transform: translateX(16px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-dot { transform: translateX(16px); }
}

.menu-toggle { display: none; }

.lang-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang-switch button {
  padding: 2px 9px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 500 12px var(--font-mono);
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.is-active { background: var(--text); color: var(--bg); }

/* ---------- Buttons & Suche ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 15px;
  transition: transform 0.2s var(--ease), background-color 0.2s;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* ---------- Plugins ---------- */

.wiki.wiki-home { grid-template-columns: 240px minmax(0, 1fr); }
.wiki-home .wiki-main { max-width: 1100px; }

/* Banner */
.home-banner {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 44px 40px 36px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.home-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(100deg, transparent 25%, #000 75%);
  -webkit-mask-image: linear-gradient(100deg, transparent 25%, #000 75%);
}
.home-banner-glow {
  position: absolute;
  z-index: -1;
  top: -140px;
  right: -80px;
  width: 520px;
  height: 360px;
  pointer-events: none;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
    radial-gradient(closest-side at 30% 70%, color-mix(in srgb, #0ea5e9 26%, transparent), transparent 70%);
  will-change: transform;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-60px, 15px, 0) scale(1.05); }
  100% { transform: translate3d(-20px, 30px, 0) scale(0.97); }
}
.home-banner-kicker {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}
.home-banner h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.home-banner-stats { margin-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }
.home-banner-stats > span {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  font-size: 13.5px;
  color: var(--muted);
}
.home-banner-stats strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.home-search { width: 100%; margin-bottom: 20px; height: 48px; border-radius: 12px; }

/* Plugin-Karten */
.plugin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.plugin-card {
  --plugin: var(--accent);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.plugin-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--plugin) 16%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.plugin-card:hover {
  border-color: color-mix(in srgb, var(--plugin) 50%, var(--line));
  transform: translateY(-3px);
  box-shadow: 0 16px 40px -24px color-mix(in srgb, var(--plugin) 70%, transparent);
}
.plugin-card:hover::before { opacity: 1; }
.plugin-card[hidden] { display: none; }
.plugin-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.plugin-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.plugin-card-text { margin: 4px 0 18px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.plugin-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.plugin-card .tag { background: color-mix(in srgb, var(--plugin) 12%, transparent); color: var(--plugin); }
.plugin-card .tag-plain { background: var(--surface-2); color: var(--muted); }
.plugin-card-pages {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.2s;
}
.plugin-card-pages span { display: inline-block; transition: transform 0.3s var(--ease); }
.plugin-card:hover .plugin-card-pages { color: var(--plugin); }
.plugin-card:hover .plugin-card-pages span { transform: translateX(4px); }

/* Seitenleiste mit Plugin-Farbe */
.sidebar-plugin { display: flex !important; align-items: center; gap: 10px; }
.sidebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--plugin, var(--accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--plugin, var(--accent)) 60%, transparent);
}

.plugin-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 18px;
  overflow: hidden;
}
.plugin-icon.has-color {
  --plugin: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--plugin) 28%, var(--surface)), color-mix(in srgb, var(--plugin) 10%, var(--surface)));
  border-color: color-mix(in srgb, var(--plugin) 35%, var(--line));
  color: var(--plugin);
}
.plugin-icon img { width: 100%; height: 100%; object-fit: cover; }
.plugin-icon.has-image { padding: 0; background: var(--surface-2); }

.plugin-version { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.tag {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag-plain { background: var(--surface-2); color: var(--muted); }

.plugin-arrow {
  position: absolute;
  right: 20px;
  top: 50%;
  margin-top: -12px;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
.plugin-card:hover .plugin-arrow { opacity: 1; transform: none; color: var(--accent); }

.empty { color: var(--muted); }

/* Doku-Suchergebnisse */
.doc-results { margin-top: 28px; }
.doc-results[hidden] { display: none; }
.doc-results-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.doc-results ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-results-status { color: var(--muted); font-size: 14px; }
.doc-result {
  --plugin: var(--accent);
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.doc-result:hover,
.doc-result:focus-visible { border-color: color-mix(in srgb, var(--plugin) 55%, var(--line)); transform: translateX(3px); }
.doc-result-path { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.doc-result-path .sidebar-dot { width: 6px; height: 6px; flex: none; }
.doc-result-title { display: block; margin: 6px 0 4px; font-size: 15.5px; font-weight: 600; }
.doc-result-text { display: block; font-size: 14px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.doc-result mark { background: color-mix(in srgb, var(--plugin) 22%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding: 28px 24px; }

/* ---------- Reveal-Animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }
.plugin-card.reveal.is-visible { transition: opacity 0.7s var(--ease) var(--delay, 0ms), transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s var(--ease); }

/* ---------- Wiki-Layout ---------- */

.wiki {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: 48px;
  align-items: start;
}

.wiki-sidebar, .wiki-toc {
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 36px 0;
}

.wiki-plugin {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.wiki-plugin .plugin-icon { width: 38px; height: 38px; font-size: 16px; }
.wiki-plugin strong { display: block; font-weight: 600; line-height: 1.3; }
.wiki-version { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.wiki-nav-group {
  margin: 20px 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.wiki-nav-group:first-child { margin-top: 0; }
.wiki-nav ul { list-style: none; margin: 0; padding: 0; }
.wiki-nav a {
  position: relative;
  display: block;
  padding: 6px 12px;
  margin-left: -12px;
  border-radius: 6px;
  font-size: 15px;
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}
.wiki-nav a:hover { color: var(--text); background: var(--surface-2); }
.wiki-nav a.is-active { color: var(--text); background: var(--surface-2); font-weight: 500; }
.wiki-nav a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--plugin, var(--accent));
}

.wiki-main { padding: 36px 0 96px; min-width: 0; }

.toc-title { margin: 0 0 10px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.wiki-toc nav { border-left: 1px solid var(--line); }
.wiki-toc a {
  display: block;
  padding: 4px 0 4px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.wiki-toc a.toc-sub { padding-left: 26px; }
.wiki-toc a:hover { color: var(--text); }
.wiki-toc a.is-active { color: var(--plugin, var(--accent)); border-left-color: var(--plugin, var(--accent)); }

.wiki-links {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.wiki-links a { color: var(--muted); transition: color 0.2s; }
.wiki-links a:hover { color: var(--text); }

/* ---------- Inhalt (Markdown) ---------- */

/* Tabellen und Code nutzen die volle Breite, Fließtext bleibt gut lesbar */
.prose { max-width: 900px; transition: opacity 0.18s, transform 0.25s var(--ease); }
.prose.is-leaving { opacity: 0; transform: translateY(6px); }

.prose h1 { font-size: 40px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin: 0 0 16px; }
.prose h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 48px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.prose h3 { font-size: 18px; font-weight: 600; margin: 32px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote { max-width: 75ch; }
.prose > p:first-of-type { font-size: 18px; color: var(--muted); }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--muted); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin: 24px 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.prose pre {
  position: relative;
  margin: 0 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  line-height: 1.55;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: 13.5px; }

.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font: 12px var(--font-sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.prose pre:hover .copy, .copy:focus-visible { opacity: 1; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

.prose blockquote {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.callout { border-radius: 0 8px 8px 0; color: var(--text) !important; }
.callout-note { border-left-color: var(--accent) !important; background: var(--accent-soft); }
.callout-note strong:first-child { color: var(--accent); }
.callout-warn { border-left-color: var(--warn) !important; background: var(--warn-soft); }
.callout-warn strong:first-child { color: var(--warn); }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 900px;
  margin-top: 64px;
}
.pager a {
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.3s var(--ease);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; font-size: 13px; color: var(--muted); }
.pager span { font-weight: 500; }
.pager-next { text-align: right; }
.pager-prev:hover { transform: translateX(-2px); }
.pager-next:hover { transform: translateX(2px); }

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .wiki { grid-template-columns: 220px minmax(0, 1fr); }
  .wiki-toc { display: none; }
  .wiki.wiki-home { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .wiki { display: block; }
  .wiki-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(300px, 85vw);
    max-height: none;
    padding: 24px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease);
  }
  .nav-open .wiki-sidebar { transform: none; }
  .wiki-main { padding-top: 24px; }
  .prose h1 { font-size: 32px; }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .menu-toggle span { height: 1.5px; background: var(--text); transition: transform 0.3s var(--ease); }
  .nav-open .menu-toggle span:first-child { transform: translateY(3.25px) rotate(45deg); }
  .nav-open .menu-toggle span:last-child { transform: translateY(-3.25px) rotate(-45deg); }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .nav { gap: 18px; }
  .search { min-width: 0; }
  .nav-link { display: none; }
  .home-banner { padding: 32px 22px 26px; }
  .footer-inner { flex-direction: column; padding: 24px 16px; }
  .pager { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .home-banner-glow { animation: none; }
  .reveal { opacity: 1; transform: none; }
}
