/* === Docs-Aliase fuer PluriKey Theme-Variablen === */
[data-theme] {
  --pk-surface2: var(--pk-surface-2);
  --pk-surface3: var(--pk-surface-3);
  --pk-border2: var(--pk-border-hover);
  --pk-text2: var(--pk-text-dim);
  --pk-text3: var(--pk-text-muted);
  --pk-code-bg: var(--pk-accent-dim);
  --pk-pro: var(--pk-secondary);
  --pk-pro-dim: var(--pk-secondary-dim);
}
[data-theme="dark-copper"], [data-theme="dark-indigo"],
[data-theme="dark-emerald"], [data-theme="midnight-rose"] {
  color-scheme: dark;
  scrollbar-color: var(--pk-surface-3) transparent;
  --sq-frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect x='1' y='1' width='30' height='30' rx='4' fill='white' fill-opacity='.04' stroke='white' stroke-opacity='.06' stroke-width='.7'/%3E%3C/svg%3E");
  --sq-frame-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect x='1' y='1' width='30' height='30' rx='4' fill='white' fill-opacity='.07' stroke='white' stroke-opacity='.12' stroke-width='.7'/%3E%3C/svg%3E");
}
[data-theme="light-clean"], [data-theme="light-arctic"], [data-theme="light-sand"] {
  color-scheme: light;
  scrollbar-color: var(--pk-surface-3) transparent;
  --sq-frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect x='1' y='1' width='30' height='30' rx='4' fill='black' fill-opacity='.03' stroke='black' stroke-opacity='.08' stroke-width='.7'/%3E%3C/svg%3E");
  --sq-frame-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Crect x='1' y='1' width='30' height='30' rx='4' fill='black' fill-opacity='.05' stroke='black' stroke-opacity='.12' stroke-width='.7'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--pk-bg); color: var(--pk-text);
  height: 100vh; overflow: hidden;
}
code, pre { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pk-surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--pk-border2); }
a { color: var(--pk-accent); text-decoration: none; }
a:hover { color: var(--pk-accent-bright); }
* { transition: background-color .25s ease, border-color .25s ease, color .15s ease; }

:root { --pk-rail-w: 82px; }
.app {
  display: grid;
  grid-template-columns: var(--pk-rail-w) 240px 1fr;
  grid-template-rows: 1fr;
  height: 100vh;
}

/* === ICON RAIL === */
.icon-rail {
  width: var(--pk-rail-w);
  background: var(--pk-surface);
  border-right: 1px solid var(--pk-border);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; overflow: hidden;
}
.rail-logo {
  width: calc(var(--pk-rail-w) - 16px); height: calc(var(--pk-rail-w) - 16px);
  margin-bottom: 4px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.rail-logo svg {
  width: calc(var(--pk-rail-w) - 30px); height: calc(var(--pk-rail-w) - 30px);
  color: var(--pk-accent); overflow: visible;
}
.rail-logo:hover svg { filter: drop-shadow(0 0 6px var(--pk-accent-glow)); }
.rail-divider { width: calc(var(--pk-rail-w) - 28px); height: 1px; background: var(--pk-border); margin: 4px 0; }
.rail-icon {
  width: calc(var(--pk-rail-w) - 8px); height: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 0 4px;
  cursor: pointer; position: relative; margin: 1px 0;
  background-image: var(--sq-frame);
  background-size: calc(var(--pk-rail-w) - 12px) calc(var(--pk-rail-w) - 12px);
  background-position: center; background-repeat: no-repeat;
  transition: all .15s;
}
.rail-icon svg {
  width: calc(var(--pk-rail-w) * 0.3); height: calc(var(--pk-rail-w) * 0.3);
  color: var(--pk-text3); transition: color .15s; overflow: visible;
}
.rail-icon .rail-label {
  font-size: calc(var(--pk-rail-w) * 0.1 + 1px); font-weight: 600;
  color: var(--pk-text3); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: calc(var(--pk-rail-w) - 16px);
  text-align: center; line-height: 1; transition: color .15s;
}
.rail-icon:hover { background-image: var(--sq-frame-hover); }
.rail-icon:hover svg { color: var(--pk-text2); }
.rail-icon:hover .rail-label { color: var(--pk-text2); }
.rail-icon.active { background-image: var(--sq-frame-active); }
.rail-icon.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--pk-accent);
}
.rail-icon.active svg { color: var(--pk-accent); }
.rail-icon.active .rail-label { color: var(--pk-accent); }
.rail-spacer { flex: 1; }

/* === SIDEBAR === */
.sidebar {
  background: var(--pk-surface);
  border-right: 1px solid var(--pk-border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--pk-border); }
.sidebar-title {
  font-size: .875rem; font-weight: 700; color: var(--pk-accent);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-sub { font-size: .6875rem; color: var(--pk-text3); margin-top: 2px; }
.sidebar-search {
  display: flex; align-items: center; gap: 6px;
  margin: 12px 16px 8px; padding: 6px 10px; border-radius: 7px;
  background: var(--pk-bg); border: 1px solid var(--pk-border);
  font-size: .8125rem; color: var(--pk-text3); cursor: text;
}
.sidebar-search:focus-within { border-color: var(--pk-accent); }
.sidebar-search svg { width: 14px; height: 14px; opacity: .4; flex-shrink: 0; }
.sidebar-search input {
  border: none; background: transparent; color: var(--pk-text);
  font-size: .8125rem; font-family: inherit; outline: none; width: 100%;
}
.sidebar-search input::placeholder { color: var(--pk-text3); }
.sidebar-search kbd {
  font-size: .5625rem; font-family: inherit; font-weight: 600;
  background: var(--pk-surface2); padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--pk-border); color: var(--pk-text3); flex-shrink: 0;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.nav-section { margin-bottom: 16px; }
.nav-section h3 {
  font-size: .625rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--pk-text3); padding: 8px 10px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin: 1px 0; border-radius: 6px;
  font-size: .8125rem; color: var(--pk-text2); transition: all .12s;
  border-left: 2px solid transparent;
}
.nav-link:hover { color: var(--pk-text); background: var(--pk-accent-dim); }
.nav-link.active {
  color: var(--pk-accent); background: var(--pk-accent-dim);
  border-left-color: var(--pk-accent); font-weight: 600;
}
.badge { font-size: .5rem; font-weight: 700; padding: 1px 4px; border-radius: 3px; margin-left: auto; }
.badge-pro { background: var(--pk-pro-dim); color: var(--pk-pro); }
.badge-new { background: rgba(34,197,94,0.1); color: var(--pk-green); }

/* === CONTENT === */
.content-area { display: flex; flex-direction: column; overflow: hidden; }
.content-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 28px; border-bottom: 1px solid var(--pk-border);
  background: var(--pk-surface); min-height: 44px;
}
.breadcrumb { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--pk-text3); }
.breadcrumb a { color: var(--pk-text3); }
.breadcrumb a:hover { color: var(--pk-accent); }
.breadcrumb .sep { opacity: .3; }
.content-header-spacer { flex: 1; }

/* Theme shuttle trigger */
.theme-shuttle-wrap { position: relative; }
.theme-shuttle-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 7px; border: 1px solid var(--pk-border);
  background: transparent; font-family: inherit; font-size: .75rem; font-weight: 600;
  color: var(--pk-text2); cursor: pointer; transition: all .15s;
}
.theme-shuttle-trigger:hover { background: var(--pk-accent-dim); border-color: var(--pk-border2); color: var(--pk-text); }
.theme-shuttle-trigger .trigger-swatches { display: flex; gap: 2px; }
.theme-shuttle-trigger .trigger-swatches span {
  width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(128,128,128,0.2);
}
.theme-shuttle {
  position: absolute; right: 0; top: calc(100% + 6px);
  width: 260px; padding: 10px;
  background: var(--pk-surface); border: 1px solid var(--pk-border-hover, var(--pk-border2));
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none; z-index: 300;
}
.theme-shuttle.open { display: block; }
.theme-shuttle-title {
  font-size: .625rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--pk-text3); padding: 4px 6px 8px;
}
.theme-shuttle-group {
  font-size: .5625rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--pk-text3); padding: 10px 6px 4px;
}
.theme-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer; transition: background .12s;
}
.theme-opt:hover { background: var(--pk-accent-dim); }
.theme-opt.active { background: var(--pk-accent-dim); }
.theme-opt.active .theme-opt-name { color: var(--pk-accent); font-weight: 700; }
.theme-opt-swatches { display: flex; gap: 2px; flex-shrink: 0; }
.theme-opt-swatches span {
  width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(128,128,128,0.2);
}
.theme-opt-name { font-size: .8125rem; color: var(--pk-text); }
.theme-opt-desc { font-size: .6875rem; color: var(--pk-text3); margin-top: 1px; }

.lang-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 7px; border: 1px solid var(--pk-border);
  background: transparent; font-family: inherit; font-size: .75rem; font-weight: 600;
  color: var(--pk-text2); cursor: pointer; transition: all .15s;
}
.lang-toggle:hover { background: var(--pk-accent-dim); border-color: var(--pk-border2); color: var(--pk-text); }
.lang-toggle .lang-flag { font-size: .875rem; line-height: 1; }

/* Content body */
.content-body { flex: 1; overflow-y: auto; padding: 28px 48px 80px; }
.content-body h1 { font-size: 1.65rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; }
.content-body .lead { font-size: 1rem; color: var(--pk-text2); margin-bottom: 28px; line-height: 1.6; }
.content-body h2 {
  font-size: 1.2rem; font-weight: 700; color: var(--pk-accent);
  margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--pk-border);
}
.content-body h3 { font-size: 1rem; font-weight: 600; margin: 20px 0 8px; }
.content-body p { margin-bottom: 12px; line-height: 1.65; }
.content-body code {
  background: var(--pk-code-bg); padding: 2px 6px; border-radius: 4px;
  font-size: .875em; color: var(--pk-accent);
}
.content-body pre {
  background: var(--pk-surface); border: 1px solid var(--pk-border);
  border-radius: 8px; padding: 16px 20px; overflow-x: auto;
  margin: 10px 0 18px; font-size: .8125rem; line-height: 1.7;
}
.content-body pre code { background: none; padding: 0; color: var(--pk-text); }
.content-body ul, .content-body ol { margin: 8px 0 14px 20px; }
.content-body li { margin-bottom: 5px; }

.callout {
  padding: 14px 18px; border-radius: 8px; margin: 14px 0;
  border-left: 3px solid; font-size: .875rem;
}
.callout-info { background: var(--pk-accent-dim); border-color: var(--pk-accent); }
.callout-warn { background: rgba(234,179,8,0.06); border-color: var(--pk-yellow); }
.callout-title {
  font-weight: 700; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 4px;
}
.callout-info .callout-title { color: var(--pk-accent); }
.callout-warn .callout-title { color: var(--pk-yellow); }

.section-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px; margin: 8px 0 24px;
}
.section-card {
  display: block; padding: 18px 20px; background: var(--pk-surface);
  border: 1px solid var(--pk-border); border-radius: 10px; transition: all .2s;
}
.section-card:hover {
  border-color: var(--pk-accent); transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.section-card h3 {
  font-size: 1rem; font-weight: 700; color: var(--pk-accent);
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
}
.section-card p { font-size: .8125rem; color: var(--pk-text2); margin: 0 0 8px; line-height: 1.5; }
.card-meta { font-size: .6875rem; color: var(--pk-text3); font-style: italic; }

.shortcut-table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; }
.shortcut-table th, .shortcut-table td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--pk-border);
  font-size: .875rem;
}
.shortcut-table th { font-size: .75rem; font-weight: 700; color: var(--pk-text3); text-transform: uppercase; letter-spacing: .04em; }
.shortcut-table kbd {
  background: var(--pk-surface2); padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--pk-border); font-size: .8125rem; font-family: 'JetBrains Mono', monospace;
}

/* Logo animation */
.anim-p-trace {
  stroke-dasharray: 180; stroke-dashoffset: 0;
  animation: idle-logo 12s ease-in-out infinite;
}
.rail-logo:hover .anim-p-trace { animation: hover-logo 2.5s ease-in-out infinite; }
@keyframes idle-logo {
  0%,60% { stroke-dashoffset: 0; } 63% { stroke-dashoffset: 180; }
  80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; }
}
@keyframes hover-logo {
  0% { stroke-dashoffset: 180; opacity: 1; } 45% { stroke-dashoffset: 0; }
  75% { stroke-dashoffset: 0; opacity: .5; } 100% { stroke-dashoffset: -180; opacity: 0; }
}

/* Rail icon animations */
.anim-btn-trace { stroke-dasharray: 30; stroke-dashoffset: 0; animation: idle-btn-trace 9s ease-in-out infinite; }
.rail-icon:hover .anim-btn-trace { animation: hover-btn-trace 1.5s ease-in-out infinite; }
@keyframes idle-btn-trace {
  0%,60% { stroke-dashoffset: 0; } 63% { stroke-dashoffset: 30; }
  80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; }
}
@keyframes hover-btn-trace {
  0%,5% { stroke-dashoffset: 0; } 15% { stroke-dashoffset: 30; }
  55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; }
}
.anim-help-circle { stroke-dasharray: 63; stroke-dashoffset: 0; animation: idle-btn-trace 11s ease-in-out infinite; }
.anim-help-q { stroke-dasharray: 30; stroke-dashoffset: 0; animation: idle-btn-trace 11s ease-in-out 0.3s infinite; }
.anim-help-dot { opacity: 1; animation: idle-help-dot 11s ease-in-out infinite; }
.rail-icon:hover .anim-help-circle, .rail-icon:hover .anim-help-q { animation: hover-btn-trace 2.5s ease-in-out infinite; }
@keyframes idle-help-dot {
  0%,60% { opacity: 1; transform: scale(1); } 63% { opacity: 0; transform: scale(0); }
  80% { opacity: 0; transform: scale(0); } 84% { opacity: 1; transform: scale(1.4); }
  88%,100% { opacity: 1; transform: scale(1); }
}
.anim-gear { transform-origin: 12px 12px; transform-box: view-box; animation: idle-gear 10s ease-in-out infinite; }
.rail-icon:hover .anim-gear { animation: hover-gear 2s linear infinite; }
@keyframes idle-gear { 0%,10% { transform: rotate(0); } 18% { transform: rotate(45deg); } 25%,100% { transform: rotate(45deg); } }
@keyframes hover-gear { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

.content-footer {
  padding: 12px 48px; border-top: 1px solid var(--pk-border);
  font-size: .6875rem; color: var(--pk-text3);
  display: flex; align-items: center; gap: 12px;
}
.content-footer a { color: var(--pk-accent); font-weight: 500; }

/* === SCREENSHOT IMAGES === */
.doc-screenshot {
  display: block; max-width: 100%; margin: 20px 0;
  border-radius: 8px; border: 1px solid var(--pk-border);
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  transition: transform .2s, box-shadow .2s;
}
.doc-screenshot:hover { transform: scale(1.01); box-shadow: 0 4px 20px rgba(0,0,0,.25); }
.screenshot-caption {
  font-size: .75rem; color: var(--pk-text3); margin: -12px 0 20px;
  font-style: italic;
}
