/* ==========================================================================
   KALIOZ // THEME.CSS
   Design tokens + reset + shared chrome (HUD, nav, cursor, fx).
   Loaded by every page. Change the palette here and the whole site follows.
   ========================================================================== */

/* --- Fonts (Google, same delivery as the original site) ------------------ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800;900&family=Orbitron:wght@500;700;900&family=Share+Tech+Mono&display=swap');

/* --- Tokens ------------------------------------------------------------- */
:root {
  /* Brand — carried over from the original palette */
  --k-brand: #8167a9;        /* original purple accent   */
  --k-accent: #ffef08;       /* original yellow accent   */

  /* Cyberpunk palette */
  --k-neon: #00fff5;
  --k-neon-2: #ff2bd6;
  --k-neon-3: #7cf6ff;
  --k-ok: #39ff88;
  --k-warn: #ff9d2e;
  --k-err: #ff3b5c;

  /* Surfaces (dark is the default) */
  --k-bg: #05060a;
  --k-bg-2: #090c15;
  --k-surface: rgba(9, 13, 22, 0.66);
  --k-surface-solid: rgba(9, 13, 22, 0.94);
  --k-line: rgba(0, 255, 245, 0.22);
  --k-line-soft: rgba(124, 246, 255, 0.12);

  /* Type */
  --k-text: #cfe2ee;
  --k-text-dim: #7f93a6;
  --k-text-strong: #ffffff;

  --k-font: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --k-font-display: 'Orbitron', 'Montserrat', sans-serif;
  --k-font-mono: 'Share Tech Mono', 'Consolas', 'Courier New', monospace;

  /* Layout */
  --k-header-h: 74px;
  --k-radius: 14px;
  --k-radius-sm: 8px;
  --k-maxw: 1180px;

  /* Glow */
  --k-glow: 0 0 12px rgba(0, 255, 245, 0.45);
  --k-glow-2: 0 0 18px rgba(255, 43, 214, 0.35);
  --k-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);

  /* Motion */
  --k-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Live wallpaper (set per page via style="--k-wall:url(...)") */
  --k-wall: none;
  --k-wall-opacity: 0.22;

  color-scheme: dark;
}

/* --- Light theme -------------------------------------------------------- */
body.is-light {
  --k-bg: #eef2f7;
  --k-bg-2: #e2e8f2;
  --k-surface: rgba(255, 255, 255, 0.72);
  --k-surface-solid: rgba(255, 255, 255, 0.95);
  --k-line: rgba(129, 103, 169, 0.42);
  --k-line-soft: rgba(129, 103, 169, 0.18);

  --k-text: #1f2430;
  --k-text-dim: #5a6473;
  --k-text-strong: #0a0d14;

  --k-neon: #7a2fd6;
  --k-neon-2: #d6008f;
  --k-neon-3: #2f6fd6;
  --k-accent: #b08900;

  --k-glow: 0 0 10px rgba(122, 47, 214, 0.35);
  --k-glow-2: 0 0 14px rgba(214, 0, 143, 0.28);
  --k-shadow: 0 18px 44px rgba(40, 50, 70, 0.22);

  --k-wall-opacity: 0.14;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100%;
  font-family: var(--k-font);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: var(--k-text);
  background-color: var(--k-bg);
  background-image:
    radial-gradient(1200px 700px at 12% -10%, rgba(0, 255, 245, 0.09), transparent 60%),
    radial-gradient(1000px 640px at 100% 0%, rgba(255, 43, 214, 0.09), transparent 55%),
    linear-gradient(180deg, var(--k-bg) 0%, var(--k-bg-2) 100%);
  /* No `background-attachment: fixed`: it forces a full-viewport repaint on
     every scroll frame on mobile GPUs. The gradients are viewport-sized anyway. */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--k-ease), color 0.4s var(--k-ease);
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }

a { color: var(--k-neon); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: none; }

h1, h2, h3, h4 { font-family: var(--k-font-display); font-weight: 700; line-height: 1.1; margin: 0 0 0.5em; color: var(--k-text-strong); }
p { margin: 0 0 1em; }

::selection { background: var(--k-neon); color: #04121a; }

/* Keyboard focus only */
:focus-visible { outline: 2px solid var(--k-neon); outline-offset: 3px; border-radius: 4px; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--k-neon) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: linear-gradient(var(--k-neon), var(--k-neon-2)); border-radius: 10px; }

/* --- Accessibility helpers --------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: -60px; left: 12px;
  z-index: 400;
  padding: 10px 16px;
  background: var(--k-neon);
  color: #04121a;
  font-family: var(--k-font-mono);
  border-radius: 0 0 8px 8px;
  transition: top 0.2s var(--k-ease);
}
.skip-link:focus { top: 0; }

/* ==========================================================================
   BACKGROUND LAYERS  (canvas + grid + CRT effects)
   ========================================================================== */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -5;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.75;
  transition: opacity 0.5s var(--k-ease);
  /* The canvas already runs at 30 fps with a small node budget (bg-canvas.js) */
}
body.fx-off .bg-canvas { opacity: 0.32; }

.bg-wall {
  position: fixed;
  inset: 0;
  z-index: -6;
  background-image: var(--k-wall);
  background-size: cover;
  background-position: center;
  opacity: var(--k-wall-opacity);
  /* `filter` + `mix-blend-mode` on a full-screen layer forced the compositor to
     re-blend the whole viewport while scrolling. Keep it a plain, faded image. */
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: -20%;
  z-index: -4;
  pointer-events: none;
  background-image:
    linear-gradient(var(--k-line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--k-line-soft) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(520px) rotateX(58deg) translateY(-6%);
  transform-origin: center 70%;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  /* Static grid: the drifting `background-position` animation repainted the
     whole masked, perspective-transformed layer at 60 fps — the single most
     expensive thing on the page. The grid now simply stands still. */
}
/* features.background = false → modules/bg-canvas.js parks the drifting grid,
   so the only thing left moving behind the content is nothing at all. */
body.bg-off .bg-grid { animation: none; }

.fx-scanlines,
.fx-vignette,
.fx-noise {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}
.fx-scanlines {
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
  /* No `mix-blend-mode: multiply`: blending a full-screen layer costs a
     compositor pass per scroll frame; the plain overlay looks the same. */
}
body.is-light .fx-scanlines { opacity: 0.16; }
body.fx-off .fx-scanlines { opacity: 0; }

.fx-vignette {
  background: radial-gradient(circle at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}
body.is-light .fx-vignette { background: radial-gradient(circle at 50% 45%, transparent 50%, rgba(40, 50, 70, 0.18) 100%); }

.fx-noise {
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.6'/></svg>");
  /* Static grain. The old 0.7s steps() animation moved a filtered SVG over the
     whole viewport three times a second — that is what made scrolling stutter. */
}
body.fx-off .fx-noise { opacity: 0; }

/* ---------------------------------------------------------------------------
   EFFECTS OFF  (body.fx-off — the default, see core/config.js → features.crt)
   The "Effekte" switch starts off, so the perpetual animations of the chrome
   stop with it: glitch title, blinking carets, pulsing HUD dot, logo glow and
   the rolling scroll dot. `f` or the HUD button brings the layer back.
   --------------------------------------------------------------------------- */
body.fx-off .fx-vignette { opacity: 0; }
/* Without the animation the glitch clones would sit there as offset copies */
body.fx-off .glitch::before,
body.fx-off .glitch::after { opacity: 0; animation: none; }
body.fx-off .brand__logo,
body.fx-off .brand__caret,
body.fx-off .hud__dot,
body.fx-off .hero__type .caret,
body.fx-off .hero__scroll span { animation: none; }

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  z-index: 350;
  background: linear-gradient(90deg, var(--k-neon), var(--k-neon-2), var(--k-accent));
  box-shadow: 0 0 10px var(--k-neon);
}

/* ==========================================================================
   CURSOR  (desktop / fine pointer only)
   ========================================================================== */
.cursor {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: width 0.18s var(--k-ease), height 0.18s var(--k-ease),
              background-color 0.2s linear, border-color 0.2s linear, opacity 0.25s linear;
}
.cursor.is-visible { opacity: 1; }
.cursor--ring.is-down { width: 26px; height: 26px; background: rgba(0, 255, 245, 0.18); }
.cursor--dot {
  width: 6px; height: 6px;
  background: var(--k-neon);
  box-shadow: 0 0 12px var(--k-neon), 0 0 26px rgba(0, 255, 245, 0.5);
}
.cursor--ring {
  width: 34px; height: 34px;
  border: 1.5px solid var(--k-neon);
  box-shadow: 0 0 14px rgba(0, 255, 245, 0.35), inset 0 0 10px rgba(0, 255, 245, 0.18);
}
.cursor--ring.is-hover {
  width: 62px; height: 62px;
  border-color: var(--k-neon-2);
  background: rgba(255, 43, 214, 0.09);
  box-shadow: 0 0 20px rgba(255, 43, 214, 0.5);
}
body.is-light .cursor--dot { background: var(--k-neon); box-shadow: 0 0 10px var(--k-neon); }
body.is-light .cursor--ring { border-color: var(--k-brand); box-shadow: none; }

/* Hide the custom cursor on touch / small screens */
@media (hover: none), (pointer: coarse), (max-width: 1024px) {
  .cursor { display: none !important; }
}

/* ==========================================================================
   HUD (header)
   ========================================================================== */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--k-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 clamp(14px, 3vw, 40px);
  background: linear-gradient(180deg, var(--k-surface-solid), rgba(5, 6, 10, 0.28));
  border-bottom: 1px solid var(--k-line-soft);
}
body.is-light .hud {
  background: linear-gradient(180deg, var(--k-surface-solid), rgba(238, 242, 247, 0.35));
}

.hud__left, .hud__right { display: flex; align-items: center; gap: 12px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--k-text-strong); }
.brand__logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--k-neon), var(--k-neon-2));
  box-shadow: var(--k-glow);
  animation: logo-glow 9s linear infinite;
  display: grid; place-items: center;
}
.brand__logo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
@keyframes logo-glow {
  0%   { box-shadow: 0 0 12px rgba(0, 255, 245, 0.5); }
  50%  { box-shadow: 0 0 20px rgba(255, 43, 214, 0.55); }
  100% { box-shadow: 0 0 12px rgba(0, 255, 245, 0.5); }
}
.brand__text {
  font-family: var(--k-font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.brand__caret { color: var(--k-accent); animation: caret-blink 1.1s steps(1) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

.hud__readout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--k-font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--k-text-dim);
  padding: 6px 12px;
  border: 1px solid var(--k-line-soft);
  border-radius: 999px;
  white-space: nowrap;
}
.hud__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--k-ok);
  box-shadow: 0 0 8px var(--k-ok);
  animation: hud-pulse 1.8s ease-in-out infinite;
}
@keyframes hud-pulse { 50% { opacity: 0.35; } }
.hud__sep { opacity: 0.4; }

.hud-btn {
  --size: 40px;
  width: var(--size); height: var(--size);
  display: inline-grid; place-items: center;
  background: transparent;
  color: var(--k-text);
  border: 1px solid var(--k-line-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--k-ease);
}
.hud-btn:hover { color: var(--k-neon); border-color: var(--k-neon); box-shadow: var(--k-glow); transform: translateY(-2px); }
.hud-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hud-btn.is-on { color: var(--k-neon); border-color: var(--k-neon); box-shadow: var(--k-glow); }

/* Burger */
.menu-btn .menu-line {
  display: block;
  width: 22px; height: 2px;
  margin: 3px auto;
  background: currentColor;
  transition: transform 0.25s var(--k-ease), opacity 0.2s, width 0.25s var(--k-ease);
}
.menu-btn .menu-line:nth-child(2) { width: 15px; margin-left: 0; }
body.nav-open .menu-btn .menu-line:nth-child(1) { transform: translateY(5px) rotate(45deg); }
body.nav-open .menu-btn .menu-line:nth-child(2) { opacity: 0; }
body.nav-open .menu-btn .menu-line:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* --- Language switch (DE/EN) --------------------------------------------
   Markup sits in the HUD next to the menu button, the logic lives in
   modules/i18n.js (assets/data/i18n/<lang>.json). Only theme tokens are used,
   so light mode follows along. aria-pressed marks the active language. */
.lang {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--k-line-soft);
  border-radius: 999px;
  font-family: var(--k-font-mono);
  line-height: 1;
}
.lang__btn {
  min-width: 34px;
  padding: 6px 6px 5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--k-text-dim);
  font: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.lang__btn:hover { color: var(--k-neon); }
.lang__btn[aria-pressed="true"] {
  color: var(--k-bg);
  background: var(--k-neon);
  box-shadow: var(--k-glow);
}
.lang__btn:focus-visible { outline: 2px solid var(--k-neon); outline-offset: 2px; }

/* Compact the HUD on small screens */
@media (max-width: 900px) { .hud__readout { display: none; } }
@media (max-width: 520px) {
  :root { --k-header-h: 64px; }
  .brand__text { display: none; }
  .brand__logo { width: 38px; height: 38px; }
  .hud-btn { --size: 36px; }
  .hud__right { gap: 8px; }
  .lang { padding: 2px; }
  .lang__btn { min-width: 30px; padding: 5px 4px; font-size: 11px; }
}

/* ==========================================================================
   FULL-SCREEN NAV OVERLAY
   Layer ladder: page content (auto) < .deck-nav 160 (smart-home.css) <
   .nav 180 < .hud 200 < skip-link 400 < palette 500 < lightbox 520 <
   toast 550 < boot 600. Chrome has to stay inside this order, otherwise the
   opened burger menu ends up painted under a sticky bar.
   _qa/_layers.mjs guards the two weak spots.
   ========================================================================== */
.nav {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: calc(var(--k-header-h) + 24px) 24px 48px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s var(--k-ease), visibility 0s linear 0.4s;
}
.nav__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1000px 700px at 70% 20%, rgba(255, 43, 214, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(4, 5, 9, 0.94), rgba(4, 5, 9, 0.98));
  transform: scaleY(0.6);
  transform-origin: top;
  transition: transform 0.5s var(--k-ease);
}
body.is-light .nav__bg {
  background:
    radial-gradient(1000px 700px at 70% 20%, rgba(129, 103, 169, 0.22), transparent 60%),
    linear-gradient(180deg, rgba(238, 242, 247, 0.96), rgba(238, 242, 247, 0.99));
}
body.nav-open .nav { visibility: visible; opacity: 1; transition-delay: 0s; }
body.nav-open .nav__bg { transform: scaleY(1); }

.nav__list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
  display: grid;
  gap: clamp(6px, 1.4vh, 16px);
}
.nav__link {
  position: relative;
  display: inline-block;
  font-family: var(--k-font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 6vw, 3.1rem);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--k-text);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--k-ease), transform 0.5s var(--k-ease), color 0.25s, text-shadow 0.25s;
}
.nav__link .nav__idx {
  font-family: var(--k-font-mono);
  font-size: 0.85rem;
  color: var(--k-neon);
  vertical-align: super;
  margin-right: 10px;
  letter-spacing: 0;
}
.nav__link:hover,
.nav__link:focus-visible { color: var(--k-neon); text-shadow: 0 0 18px rgba(0, 255, 245, 0.55); }
.nav__link.is-current::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--k-neon), var(--k-neon-2));
  margin-top: 4px;
}
body.nav-open .nav__link { opacity: 1; transform: translateY(0); }
body.nav-open .nav__list li:nth-child(1) .nav__link { transition-delay: 0.14s; }
body.nav-open .nav__list li:nth-child(2) .nav__link { transition-delay: 0.20s; }
body.nav-open .nav__list li:nth-child(3) .nav__link { transition-delay: 0.26s; }
body.nav-open .nav__list li:nth-child(4) .nav__link { transition-delay: 0.32s; }
body.nav-open .nav__list li:nth-child(5) .nav__link { transition-delay: 0.38s; }
body.nav-open .nav__list li:nth-child(6) .nav__link { transition-delay: 0.44s; }

.nav__meta {
  position: relative;
  margin-top: 34px;
  font-family: var(--k-font-mono);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--k-text-dim);
  text-transform: uppercase;
}

/* ==========================================================================
   SHARED UI — buttons, chips, panels, section titles
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  font-family: var(--k-font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--k-text-strong);
  background: transparent;
  border: 1px solid var(--k-line);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--k-ease);
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--k-neon), var(--k-neon-2));
  transform: translateX(-101%);
  transition: transform 0.35s var(--k-ease);
  z-index: -1;
}
.btn:hover { color: #04121a; border-color: transparent; box-shadow: var(--k-glow); transform: translateY(-2px); }
.btn:hover::before { transform: translateX(0); }
.btn--primary { border-color: var(--k-neon); box-shadow: inset 0 0 22px rgba(0, 255, 245, 0.12); }
.btn--ghost { border-color: var(--k-line-soft); color: var(--k-text); }
.btn--sm { padding: 9px 18px; font-size: 12px; }
body.is-light .btn:hover { color: #fff; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--k-font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--k-text-dim);
  padding: 6px 12px;
  border: 1px solid var(--k-line-soft);
  border-radius: 999px;
  background: var(--k-surface);
}
.chip--neon { color: var(--k-neon); border-color: var(--k-line); }
.chip--ok { color: var(--k-ok); border-color: rgba(57, 255, 136, 0.4); }
.chip--warn { color: var(--k-warn); border-color: rgba(255, 157, 46, 0.4); }
.chip--off { color: var(--k-text-dim); }

.panel {
  background: var(--k-surface);
  border: 1px solid var(--k-line-soft);
  border-radius: var(--k-radius);
  padding: clamp(18px, 3vw, 30px);
  transition: border-color 0.3s, transform 0.3s var(--k-ease), box-shadow 0.3s;
}
.panel:hover { border-color: var(--k-line); box-shadow: var(--k-shadow); }

.section-title {
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.section-kicker {
  font-family: var(--k-font-mono);
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--k-neon);
  margin: 0 0 10px;
}

/* Scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--k-ease), transform 0.7s var(--k-ease);
  /* No `will-change`: one compositor layer per reveal block costs far more
     memory on phones than the transition gains. */
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   COMMAND PALETTE  (Ctrl/⌘ + K)
   ========================================================================== */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: start center;
  padding: 12vh 18px 18px;
  background: rgba(3, 4, 7, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--k-ease), visibility 0s linear 0.3s;
}
.cmdk.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.cmdk__box {
  width: min(620px, 100%);
  background: var(--k-surface-solid);
  border: 1px solid var(--k-line);
  border-radius: var(--k-radius);
  box-shadow: var(--k-shadow), var(--k-glow);
  overflow: hidden;
  transform: translateY(-14px) scale(0.98);
  transition: transform 0.3s var(--k-ease);
}
.cmdk.is-open .cmdk__box { transform: none; }
.cmdk__input {
  width: 100%;
  padding: 18px 20px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--k-line-soft);
  color: var(--k-text-strong);
  font-family: var(--k-font-mono);
  font-size: 16px;
  letter-spacing: 1px;
}
.cmdk__input:focus { outline: none; }
.cmdk__list { list-style: none; margin: 0; padding: 8px; max-height: 46vh; overflow-y: auto; }
.cmdk__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--k-radius-sm);
  cursor: pointer;
  color: var(--k-text);
  font-size: 14px;
}
.cmdk__item small { margin-left: auto; font-family: var(--k-font-mono); color: var(--k-text-dim); font-size: 11px; letter-spacing: 1px; }
.cmdk__item.is-active { background: linear-gradient(90deg, rgba(0, 255, 245, 0.14), rgba(255, 43, 214, 0.12)); color: var(--k-text-strong); }
.cmdk__hint {
  padding: 10px 16px;
  border-top: 1px solid var(--k-line-soft);
  font-family: var(--k-font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--k-text-dim);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   BOOT SEQUENCE + TOASTS
   ========================================================================== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  background: #04050a;
  font-family: var(--k-font-mono);
  color: var(--k-neon);
  transition: opacity 0.7s var(--k-ease), visibility 0s linear 0.8s;
}
.boot.is-done { opacity: 0; visibility: hidden; transition-delay: 0s; }
/* app.js puts .js-ready on <html> as its very first act. Without JS the
   overlay must never cover the page (features.intro is off by default). */
html:not(.js-ready) .boot { display: none; }
.boot__log {
  width: min(680px, 86vw);
  font-size: 13px;
  line-height: 2;
  letter-spacing: 1px;
}
.boot__log p { margin: 0; opacity: 0; animation: boot-line 0.02s forwards; }
.boot__log p span { color: var(--k-ok); }
@keyframes boot-line { to { opacity: 1; } }
.boot__bar {
  height: 3px;
  margin-top: 18px;
  background: rgba(0, 255, 245, 0.14);
  border-radius: 3px;
  overflow: hidden;
}
.boot__bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--k-neon), var(--k-neon-2)); animation: boot-fill 1.5s var(--k-ease) forwards; }
@keyframes boot-fill { to { width: 100%; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 30px);
  z-index: 550;
  padding: 12px 20px;
  background: var(--k-surface-solid);
  border: 1px solid var(--k-line);
  border-radius: 999px;
  color: var(--k-text-strong);
  font-family: var(--k-font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  box-shadow: var(--k-glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--k-ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .bg-grid { animation: none; }
  [data-reveal] { opacity: 1; transform: none; }
  .boot { display: none; }
}

/* ==========================================================================
   MOBILE PERFORMANCE
   Phones dropped frames on the perpetual chrome animations (pulsing HUD dot,
   glowing logo, blinking caret, LED pulses). They are pure decoration, so they
   stand still on small and touch screens; the CRT toggle keeps working as before.
   ========================================================================== */
@media (max-width: 900px), (hover: none) {
  .brand__logo,
  .brand__caret,
  .hud__dot,
  .glitch::before,
  .glitch::after { animation: none; }
}

@media print {
  .hud, .nav, .cmdk, .cursor, .bg-canvas, .bg-grid, .fx-scanlines,
  .fx-vignette, .fx-noise, .boot, .toast, .scroll-progress { display: none !important; }
  body { background: #fff; color: #000; }
}
