/* ==========================================================================
   Processware — Cyber-Industrial Brutalism
   Hand-written CSS. No build step, no PostCSS, no node_modules.
   Everything is driven by custom properties so the four themes are a class
   swap on <html>.
   ========================================================================== */

/* --- fonts (self-hosted: no Google Fonts request, keeps the CSP strict) --- */

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-ext.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

/* --- theme tokens -------------------------------------------------------- */

:root {
  /* Cyber-Industrial Brutalism (default) */
  --background: #050505;
  --foreground: #e0e0e0;
  --card: #0a0a0a;
  --card-rgb: 10, 10, 10;
  --primary: #00f0ff;
  --primary-rgb: 0, 240, 255;
  --primary-fg: #000000;
  --secondary: #1a1a1a;
  --muted: #1a1a1a;
  --muted-fg: #888888;
  --accent: #ff5f00;
  --accent-rgb: 255, 95, 0;
  --accent-fg: #000000;
  --danger: #ff003c;
  --danger-rgb: 255, 0, 60;
  --ok: #00ff41;
  --ok-rgb: 0, 255, 65;
  --warn: #ffe600;
  --border: #333333;
  --input-bg: #1a1a1a;
  --radius: 0px;
  --grid-line: rgba(255, 255, 255, 0.05);
  --sidebar-bg: #050505;
  --shadow: none;

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --sidebar-w: 16rem;
  --container: 1400px;
}

.theme-corporate {
  --background: #0f172a;
  --foreground: #f8fafc;
  --card: #1e293b;
  --card-rgb: 30, 41, 59;
  --primary: #3b82f6;
  --primary-rgb: 59, 130, 246;
  --primary-fg: #ffffff;
  --secondary: #334155;
  --muted: #334155;
  --muted-fg: #94a3b8;
  --accent: #0ea5e9;
  --accent-rgb: 14, 165, 233;
  --accent-fg: #ffffff;
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;
  --ok: #22c55e;
  --ok-rgb: 34, 197, 94;
  --warn: #f59e0b;
  --border: #334155;
  --input-bg: #1e293b;
  --radius: 0.5rem;
  --grid-line: rgba(255, 255, 255, 0.04);
  --sidebar-bg: #0b1222;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.theme-matrix {
  --background: #000000;
  --foreground: #00ff41;
  --card: #001100;
  --card-rgb: 0, 17, 0;
  --primary: #00ff41;
  --primary-rgb: 0, 255, 65;
  --primary-fg: #000000;
  --secondary: #003300;
  --muted: #003300;
  --muted-fg: #008f11;
  --accent: #008f11;
  --accent-rgb: 0, 143, 17;
  --accent-fg: #000000;
  --danger: #ff0000;
  --danger-rgb: 255, 0, 0;
  --ok: #00ff41;
  --ok-rgb: 0, 255, 65;
  --warn: #a3ff00;
  --border: #003300;
  --input-bg: #001100;
  --radius: 0px;
  --grid-line: rgba(0, 255, 65, 0.06);
  --sidebar-bg: #000000;
}

.theme-light {
  --background: #ffffff;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-rgb: 255, 255, 255;
  --primary: #2563eb;
  --primary-rgb: 37, 99, 235;
  --primary-fg: #ffffff;
  --secondary: #f1f5f9;
  --muted: #f1f5f9;
  --muted-fg: #64748b;
  --accent: #ea580c;
  --accent-rgb: 234, 88, 12;
  --accent-fg: #ffffff;
  --danger: #dc2626;
  --danger-rgb: 220, 38, 38;
  --ok: #16a34a;
  --ok-rgb: 22, 163, 74;
  --warn: #ca8a04;
  --border: #e2e8f0;
  --input-bg: #ffffff;
  --radius: 0.5rem;
  --grid-line: rgba(15, 23, 42, 0.04);
  --sidebar-bg: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* --- reset --------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration: none;
}

p a:not(.btn) {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- utility ------------------------------------------------------------- */

.mono {
  font-family: var(--font-mono);
}

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

.upper {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-primary {
  color: var(--primary);
}

.text-accent {
  color: var(--accent);
}

.text-ok {
  color: var(--ok);
}

.text-danger {
  color: var(--danger);
}

.text-center {
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--primary);
  color: var(--primary-fg);
  font-family: var(--font-mono);
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

.glow {
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.55);
}

.stack {
  display: flex;
  flex-direction: column;
}

.gap-2 {
  gap: var(--space-2);
}
.gap-3 {
  gap: var(--space-3);
}
.gap-4 {
  gap: var(--space-4);
}
.gap-6 {
  gap: var(--space-6);
}
.gap-8 {
  gap: var(--space-8);
}
.gap-12 {
  gap: var(--space-12);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.icon {
  flex-shrink: 0;
}

/* --- layout shell -------------------------------------------------------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.035;
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 1) 50%,
    rgba(0, 0, 0, 1) 100%
  );
  background-size: 100% 4px;
}

.theme-light .scanlines {
  display: none;
}

.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: rgba(var(--card-rgb), 0.92);
  backdrop-filter: blur(8px);
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.06em;
  color: var(--primary);
  font-size: 1.25rem;
}

.wordmark .caret {
  animation: blink 1.2s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: transparent;
  border: 1px solid transparent;
  color: var(--foreground);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--border);
  color: var(--primary);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-4);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.sidebar[data-open="true"] {
  transform: translateX(0);
}

.sidebar-head {
  display: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--secondary);
  border-color: var(--border);
  color: var(--foreground);
}

.nav-item:hover .icon {
  color: var(--primary);
}

.nav-item[aria-current="page"] {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.nav-item .dot {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.meters {
  padding: var(--space-3);
  background: var(--secondary);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.meter-row {
  display: flex;
  justify-content: space-between;
}

.meter-track {
  height: 3px;
  background: var(--background);
}

.meter-fill {
  height: 100%;
  background: var(--primary);
}

.meter-fill.accent {
  background: var(--accent);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-foot {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--muted-fg);
  text-align: center;
  white-space: pre-line;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.main {
  position: relative;
  flex: 1;
  min-width: 0;
}

.main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 50px 50px;
}

.main > * {
  position: relative;
  z-index: 1;
}

@media (min-width: 900px) {
  .shell {
    flex-direction: row;
  }

  .mobile-bar,
  .backdrop {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none;
  }

  .sidebar-head {
    display: block;
  }

  .main {
    height: 100vh;
    overflow-y: auto;
  }
}

/* --- containers & sections ---------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-12);
  }
}

.narrow {
  max-width: 72rem;
}

.page {
  padding-block: var(--space-12) var(--space-20);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-20) var(--space-16);
  border-bottom: 1px solid var(--border);
}

.hero::after {
  content: "";
  position: absolute;
  inset-block: 0;
  right: 0;
  width: 33%;
  background: linear-gradient(to left, rgba(var(--primary-rgb), 0.06), transparent);
  pointer-events: none;
}

.hero.hero-accent::after {
  width: 50%;
  background: linear-gradient(to left, rgba(var(--accent-rgb), 0.1), transparent);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  align-items: flex-start;
}

.circuit {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6rem;
  color: rgba(var(--primary-rgb), 0.2);
  pointer-events: none;
}

.section-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.section-head h2,
.section-head h3 {
  font-size: 1.5rem;
  color: var(--primary);
  white-space: nowrap;
}

.section-head.accent h2,
.section-head.accent h3 {
  color: var(--accent);
}

.section-head::after,
.section-head .rule {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pill {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
}

.pill.accent {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
}

.ping {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.ping::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* --- typography scale ---------------------------------------------------- */

.h-xl {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
}

.h-lg {
  font-size: clamp(2rem, 5vw, 3rem);
}

.h-md {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.lead {
  font-size: 1.125rem;
  color: var(--muted-fg);
  max-width: 42rem;
  font-weight: 300;
}

.gradient-text {
  display: inline-block;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.terminal-block {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--foreground);
  border-left: 2px solid var(--primary);
  padding: var(--space-2) var(--space-4);
  background: rgba(var(--primary-rgb), 0.06);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.terminal-block span::before {
  content: "> ";
  color: var(--primary);
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-fg);
  transition: filter 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border-color: rgba(var(--primary-rgb), 0.5);
  color: var(--primary);
}

.btn-outline:hover {
  background: rgba(var(--primary-rgb), 0.12);
  filter: none;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-accent-outline {
  background: transparent;
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
}

.btn-accent-outline:hover {
  background: rgba(var(--accent-rgb), 0.12);
  filter: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  filter: none;
}

.btn-danger {
  background: transparent;
  border-color: rgba(var(--danger-rgb), 0.5);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.12);
  filter: none;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.6875rem;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --- cards --------------------------------------------------------------- */

.card {
  background: rgba(var(--card-rgb), 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.25s;
}

.card:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
}

.card-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
}

.card h3,
.card h4 {
  font-size: 1.0625rem;
}

.card:hover h3 {
  color: var(--primary);
}

.card.accent:hover {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.card.accent:hover h3 {
  color: var(--accent);
}

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.split {
  display: grid;
  gap: var(--space-12);
  align-items: center;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--primary);
  transition: background 0.25s, border-color 0.25s;
}

.card:hover .icon-tile {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.5);
}

.icon-tile.accent {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px var(--space-2);
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-fg);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-fg);
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.feature-list li::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.accent .feature-list li::before,
.feature-list.accent li::before {
  background: var(--accent);
}

/* --- spec rows ----------------------------------------------------------- */

.spec-list {
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.spec-row:last-child {
  border-bottom: 0;
}

.spec-row:hover {
  background: var(--secondary);
}

.spec-row dt {
  color: var(--muted-fg);
}

.spec-row dd {
  margin: 0;
  text-align: right;
}

.spec-inline {
  border-left: 1px solid var(--border);
  padding-left: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-fg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.spec-inline > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-1);
}

.spec-inline strong {
  color: var(--foreground);
  font-weight: 500;
}

/* --- spotlight ----------------------------------------------------------- */

.spotlight {
  position: relative;
  overflow: hidden;
  background: rgba(var(--card-rgb), 0.35);
  border: 1px solid var(--border);
  padding: var(--space-8);
}

.spotlight::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  opacity: 0.55;
}

.cta {
  position: relative;
  overflow: hidden;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: rgba(var(--primary-rgb), 0.08);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(var(--primary-rgb), 0.05) 0,
    rgba(var(--primary-rgb), 0.05) 1px,
    transparent 1px,
    transparent 12px
  );
  pointer-events: none;
}

.cta > * {
  position: relative;
}

/* --- carousel (home firmware showcase) ---------------------------------- */

.carousel {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  padding: var(--space-4);
}

.theme-light .carousel {
  background: var(--secondary);
}

.carousel-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  border: 2px solid var(--border);
}

.carousel-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.carousel-frame img[data-active="true"] {
  opacity: 1;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  padding: var(--space-2);
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
}

.carousel-nav:hover {
  background: rgba(0, 0, 0, 0.85);
}

.carousel-nav.prev {
  left: var(--space-2);
}

.carousel-nav.next {
  right: var(--space-2);
}

.carousel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.dots {
  display: flex;
  gap: var(--space-2);
}

.dot-btn {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--border);
  cursor: pointer;
}

.dot-btn[aria-current="true"] {
  background: var(--primary);
}

.firmware-note {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.theme-light .firmware-note {
  background: var(--secondary);
}

.led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}

/* --- 360 viewer ---------------------------------------------------------- */

.viewer {
  position: relative;
  border: 1px solid var(--border);
  background: rgba(var(--card-rgb), 0.55);
}

.viewer-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #c0c0c0;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}

.viewer-stage:active {
  cursor: grabbing;
}

.viewer-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: none;
}

.viewer-stage img[data-active="true"] {
  display: block;
}

.viewer-badge {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.viewer-badge.tl {
  top: var(--space-3);
  left: var(--space-3);
}

.viewer-badge.tr {
  top: var(--space-3);
  right: var(--space-3);
}

.viewer-hint {
  position: absolute;
  z-index: 2;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  color: var(--muted-fg);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.spin {
  animation: spin 3s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3);
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--border);
}

.theme-light .viewer-controls {
  background: var(--secondary);
}

.frame-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 60%;
}

.frame-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid rgba(136, 136, 136, 0.6);
  background: transparent;
  cursor: pointer;
}

.frame-dot:hover {
  border-color: var(--accent);
}

.frame-dot[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.viewer-glow {
  position: absolute;
  inset: -1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.25), transparent);
  filter: blur(48px);
  opacity: 0.35;
  pointer-events: none;
}

.viewer-wrap {
  position: relative;
}

/* --- video placeholder --------------------------------------------------- */

.video-placeholder {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgba(var(--card-rgb), 0.5);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.video-play {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.corner {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--accent);
}

.corner.tl {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}
.corner.tr {
  top: 0;
  right: 0;
  border-left: 0;
  border-bottom: 0;
}
.corner.bl {
  bottom: 0;
  left: 0;
  border-right: 0;
  border-top: 0;
}
.corner.br {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
}

/* --- tables -------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

table.data {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  min-width: 40rem;
}

table.data th,
table.data td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data thead th {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
}

table.data.plain thead th {
  background: var(--secondary);
  color: var(--primary);
}

table.data tbody tr:hover {
  background: rgba(var(--card-rgb), 0.6);
}

table.data tbody tr.highlight {
  background: rgba(var(--accent-rgb), 0.05);
}

table.data td.center,
table.data th.center {
  text-align: center;
}

/* --- portfolio ----------------------------------------------------------- */

.project {
  display: grid;
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.25s;
}

.project:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
}

@media (min-width: 800px) {
  .project {
    grid-template-columns: 2fr 3fr;
  }
}

.project-media {
  position: relative;
  min-height: 12rem;
  background: var(--secondary);
  overflow: hidden;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.project:hover .project-media img {
  transform: scale(1.06);
}

.project-media .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.project:hover .project-media .overlay {
  background: rgba(0, 0, 0, 0.35);
}

.project-body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.repo-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.repo-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--muted-fg);
}

.lang-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- forms --------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: var(--space-3);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
  font-family: var(--font-sans);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-fg);
  opacity: 0.7;
}

.field .error {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: var(--danger);
}

.field-row {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
}

.checkbox input {
  width: auto;
  accent-color: var(--primary);
}

.checkbox label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8125rem;
  color: var(--foreground);
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

form.stack {
  gap: var(--space-4);
}

/* --- flash messages ------------------------------------------------------ */

.flashes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.flash {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: rgba(var(--card-rgb), 0.7);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.flash-success {
  border-left-color: var(--ok);
  color: var(--ok);
}

.flash-error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.flash-warning {
  border-left-color: var(--warn);
  color: var(--warn);
}

.flash-info {
  border-left-color: var(--primary);
  color: var(--primary);
}

/* --- badges -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge-ok {
  color: var(--ok);
}
.badge-info {
  color: var(--primary);
}
.badge-accent {
  color: var(--accent);
}
.badge-warn {
  color: var(--warn);
}
.badge-danger {
  color: var(--danger);
}
.badge-muted {
  color: var(--muted-fg);
}

/* --- helpdesk ------------------------------------------------------------ */

.prompt {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted-fg);
}

.prompt .user {
  color: var(--primary);
}

.stat-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.stat {
  padding: var(--space-6);
  border: 1px solid var(--border);
  background: rgba(var(--card-rgb), 0.5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat .value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat .label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted-fg);
  border: 1px solid transparent;
  border-bottom: 0;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--foreground);
}

.tab[aria-current="page"] {
  color: var(--primary);
  border-color: var(--border);
  border-bottom: 1px solid var(--background);
  background: rgba(var(--card-rgb), 0.5);
}

.ticket-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border: 1px solid var(--border);
  background: rgba(var(--card-rgb), 0.45);
  transition: border-color 0.2s;
}

.ticket-row:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
}

.ticket-row .title {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--foreground);
}

.ticket-row:hover .title {
  color: var(--primary);
}

.ticket-row .excerpt {
  color: var(--muted-fg);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-fg);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.filters .field {
  min-width: 10rem;
}

.inline-form {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

.inline-form select {
  padding: var(--space-1) var(--space-2);
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.comment {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-left: 2px solid var(--border);
  background: rgba(var(--card-rgb), 0.4);
}

.comment.mine {
  border-left-color: var(--primary);
}

.comment .meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-fg);
}

.comment .body {
  white-space: pre-wrap;
  word-break: break-word;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-fg);
}

.empty {
  padding: var(--space-12);
  text-align: center;
  border: 1px dashed var(--border);
  color: var(--muted-fg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.panel {
  border: 1px solid var(--border);
  background: rgba(var(--card-rgb), 0.45);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.panel.accent {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.08);
}

.panel h3 {
  color: var(--primary);
  font-size: 1.125rem;
}

.panel.accent h3 {
  color: var(--accent);
}

.contact-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.hours-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.2);
  padding-bottom: var(--space-2);
}

.hours-row:last-child {
  border-bottom: 0;
}

/* --- dropdown ------------------------------------------------------------ */

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
}

.dropdown[data-open="true"] .dropdown-menu {
  display: flex;
}

.dropdown-menu button {
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 0;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-fg);
  cursor: pointer;
}

.dropdown-menu button:hover,
.dropdown-menu button[aria-current="true"] {
  background: var(--secondary);
  color: var(--primary);
}

/* --- error page ---------------------------------------------------------- */

.error-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.error-code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 18vw, 9rem);
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -0.06em;
}

/* --- print --------------------------------------------------------------- */

@media print {
  .sidebar,
  .mobile-bar,
  .scanlines,
  .main::before {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* --- utility classes ----------------------------------------------------
   These exist so no template needs a style="" attribute, which keeps the
   Content-Security-Policy free of 'unsafe-inline' for styles.
   ------------------------------------------------------------------------ */

.fs-xs {
  font-size: 0.625rem;
}
.fs-sm {
  font-size: 0.6875rem;
}
.fs-md {
  font-size: 0.75rem;
}
.fs-base {
  font-size: 0.875rem;
}
.fs-lg {
  font-size: 1.0625rem;
}
.fs-xl {
  font-size: 1.125rem;
}
.fs-2xl {
  font-size: 1.25rem;
}
.fs-3xl {
  font-size: 1.375rem;
}
.fs-4xl {
  font-size: 1.5rem;
}

.fw-normal {
  font-weight: 400;
}

.w-34 {
  max-width: 34rem;
}
.w-38 {
  max-width: 38rem;
}
.w-42 {
  max-width: 42rem;
}
.w-44 {
  max-width: 44rem;
}
.w-48 {
  max-width: 48rem;
}
.w-52 {
  max-width: 52rem;
}
.w-full {
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.grow-field {
  flex: 1;
  min-width: 14rem;
}

.items-start {
  align-items: start;
}

.mt-4 {
  margin-top: var(--space-4);
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dim {
  opacity: 0.55;
}

.dim-more {
  opacity: 0.7;
}

.text-warn {
  color: var(--warn);
}

.icon-tile.sm {
  width: 2.25rem;
  height: 2.25rem;
}

.icon-tile.md {
  width: 2.5rem;
  height: 2.5rem;
}

.bordered {
  border: 1px solid var(--border);
}

.boxed {
  border: 1px solid var(--border);
  padding: var(--space-4);
}

.flush {
  border: 0;
  padding: 0;
}

.card-media {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
  background: #000;
}

.card-body.tight {
  padding: var(--space-4);
}

/* meter widths -- the sidebar shows two fixed indicator bars */
.meter-fill.w-12 {
  width: 12%;
}
.meter-fill.w-42pct {
  width: 42%;
}

/* language dots on the portfolio repo cards */
.lang-python {
  background: #3572a5;
}
.lang-cpp {
  background: #f34b7d;
}
.lang-js {
  background: #f1e05a;
}
.lang-other {
  background: #8b949e;
}
