/* ============================================
   BRAD KING — SYSTEMS ARCHITECT
   Design System & Styles
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Background layers */
  --bg-void: #000000;
  --bg-deep: #020408;
  --bg-base: #040810;
  --bg-raised: #060C16;
  --bg-surface: #0A1020;

  /* Cyan accent system */
  --cyan: #00F0FF;
  --cyan-bright: #33F5FF;
  --cyan-dim: #00B8C5;
  --cyan-glow: rgba(0, 240, 255, 0.15);
  --cyan-border: rgba(0, 240, 255, 0.12);
  --cyan-hover: rgba(0, 240, 255, 0.25);
  --cyan-subtle: rgba(0, 240, 255, 0.06);

  /* Steel blue secondary */
  --steel: #5C8EBF;
  --steel-dim: #3D6A96;
  --steel-glow: rgba(92, 142, 191, 0.12);

  /* Text hierarchy */
  --text-primary: #E8EDF5;
  --text-secondary: rgba(232, 237, 245, 0.65);
  --text-tertiary: rgba(232, 237, 245, 0.40);
  --text-ghost: rgba(232, 237, 245, 0.20);

  /* Borders */
  --border: rgba(232, 237, 245, 0.08);
  --border-hover: rgba(0, 240, 255, 0.20);
  --border-active: rgba(0, 240, 255, 0.35);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-bg-hover: rgba(255, 255, 255, 0.04);

  /* Typography */
  --font-sans: "Inter", -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Spacing scale (8px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  /* Layout */
  --max-w: 1120px;
  --gutter: 24px;
  --radius: 4px;
  --radius-lg: 8px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(0, 240, 255, 0.06);
}


/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-void);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
input { font-family: inherit; }


/* --- Background Layers --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 15% 0%, rgba(0, 240, 255, 0.04), transparent 60%),
    radial-gradient(ellipse 600px 500px at 85% 20%, rgba(92, 142, 191, 0.03), transparent 55%),
    radial-gradient(ellipse 900px 600px at 50% 100%, rgba(0, 240, 255, 0.02), transparent 50%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-void) 40%, var(--bg-deep) 100%);
  pointer-events: none;
  z-index: 0;
}

#gridCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.3;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 2;
}


/* --- Site Container --- */
.site {
  position: relative;
  z-index: 3;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}


/* --- Navigation --- */
.nav {
  position: sticky;
  top: var(--s-3);
  z-index: 100;
  padding: var(--s-3) 0;
}

.nav-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(0, 240, 255, 0.08), transparent 38%),
    linear-gradient(330deg, rgba(92, 142, 191, 0.10), transparent 42%),
    rgba(0, 0, 0, 0.82);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav-brand:hover {
  border-color: var(--border-hover);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.08);
}
.nav-brand img {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.35));
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 4px;
  border: 1px solid rgba(232, 237, 245, 0.10);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.nav-links a span {
  color: var(--text-tertiary);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.nav-links a:hover {
  color: var(--text-primary);
  border-color: rgba(0, 240, 255, 0.2);
  background: rgba(0, 240, 255, 0.07);
}
.nav-links a.active {
  color: var(--text-primary);
  border-color: rgba(0, 240, 255, 0.26);
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.18), rgba(0, 240, 255, 0.06));
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.14);
}
.nav-links a.active span {
  color: var(--cyan-bright);
}

.nav-aux {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.nav-aux-label {
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.nav-aux-value {
  font-size: 11px;
  color: var(--cyan-dim);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-toggle-line {
  display: block;
  width: 10px;
  height: 1px;
  background: currentColor;
}
.nav-toggle-label {
  margin-left: 2px;
}


/* --- Sections --- */
.section {
  padding: var(--s-9) 0;
  border-top: 1px solid var(--border);
}
.section:first-of-type { border-top: none; }

.section-header { margin-bottom: var(--s-7); }
.section-header h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: var(--s-2);
}
.section-sub {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 520px;
}


/* --- Hero --- */
.hero {
  padding-top: var(--s-10);
  padding-bottom: var(--s-9);
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--s-6);
}
.kicker-sep { color: var(--cyan-dim); }

.hero-title {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  max-width: 800px;
  margin-bottom: var(--s-5);
}

.hero-sub {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 620px;
  margin-bottom: var(--s-7);
}

.hero-cta {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
}


/* --- Buttons --- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
}

.btn .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.btn .btn-border::before,
.btn .btn-border::after {
  content: "";
  position: absolute;
  background: var(--cyan);
}

/* Top and bottom border traces */
.btn .btn-border::before {
  top: 0; left: 0;
  height: 1px; width: 0;
  transition: width 0.35s ease;
}
.btn .btn-border::after {
  bottom: 0; right: 0;
  height: 1px; width: 0;
  transition: width 0.35s ease;
}
.btn:hover .btn-border { opacity: 1; }
.btn:hover .btn-border::before,
.btn:hover .btn-border::after { width: 100%; }

.btn-primary {
  border-color: var(--cyan-border);
  background: rgba(0, 240, 255, 0.06);
}
.btn-primary:hover {
  border-color: var(--cyan-hover);
  background: rgba(0, 240, 255, 0.10);
}

.btn-ghost {
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--border-hover);
  background: var(--glass-bg);
}

.btn:active { transform: scale(0.98); }


/* --- Status Bar --- */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0 var(--gutter);
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.status-bar.visible {
  opacity: 1;
  transform: translateY(0);
}
.status-bar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-3) 0;
}
.status-group {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  white-space: nowrap;
}
.status-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.status-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.status-track-wrap {
  flex: 1;
  min-width: 80px;
}
.status-track {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}
.status-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
  transition: width 0.15s linear;
}


/* --- Capability Cards --- */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}

.cap-card {
  position: relative;
  padding: var(--s-6) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  transition: border-color 0.3s ease, background 0.3s ease;
  overflow: hidden;
}
.cap-card:hover {
  border-color: var(--border-hover);
  background: var(--glass-bg-hover);
}

.cap-card > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.cap-card > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.cap-card > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.cap-card:hover > .btn-border { opacity: 1; }
.cap-card:hover > .btn-border::before,
.cap-card:hover > .btn-border::after { width: 60%; }

.cap-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin-bottom: var(--s-3);
}

.cap-card h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: var(--s-3);
}

.cap-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: var(--s-4);
}

.cap-card ul {
  padding-left: var(--s-4);
  list-style: none;
}
.cap-card li {
  position: relative;
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: var(--s-4);
  margin-bottom: var(--s-2);
}
.cap-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--cyan-dim);
}


/* --- Work Cards --- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}

.work-card {
  position: relative;
  padding: var(--s-6) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  transition: border-color 0.3s ease, background 0.3s ease;
  overflow: hidden;
}
.work-card:hover {
  border-color: var(--border-hover);
  background: var(--glass-bg-hover);
}
.work-card > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.work-card > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.work-card > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.work-card:hover > .btn-border { opacity: 1; }
.work-card:hover > .btn-border::before,
.work-card:hover > .btn-border::after { width: 60%; }

.work-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: var(--s-3);
}

.work-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--s-3);
}

.work-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: var(--s-4);
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.work-tags span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-tertiary);
  background: rgba(0, 0, 0, 0.3);
}


/* --- Shuriken Game --- */
.shuriken-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.shuriken-wrapper:hover { border-color: var(--border-hover); }
.shuriken-wrapper > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.shuriken-wrapper > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.shuriken-wrapper > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.shuriken-wrapper:hover > .btn-border { opacity: 1; }
.shuriken-wrapper:hover > .btn-border::before,
.shuriken-wrapper:hover > .btn-border::after { width: 40%; }

.shuriken-container {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: rgba(0, 0, 0, 0.5);
  cursor: crosshair;
}
.shuriken-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 640px) {
  .shuriken-container { aspect-ratio: 1.2 / 1; }
}


/* --- Playable Game --- */
.game-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.game-wrapper:hover { border-color: var(--border-hover); }
.game-wrapper > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.game-wrapper > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.game-wrapper > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.game-wrapper:hover > .btn-border { opacity: 1; }
.game-wrapper:hover > .btn-border::before,
.game-wrapper:hover > .btn-border::after { width: 40%; }

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.game-hud-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.game-hud-center {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.game-hud-right {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.game-return-btn {
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.game-score {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.game-score-sep {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-ghost);
}

.game-container {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: rgba(0, 0, 0, 0.5);
}
.game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5;
  transition: opacity 0.3s ease;
}
.game-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.game-overlay-text {
  text-align: center;
}
.game-overlay-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin-bottom: var(--s-2);
}
.game-overlay-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--s-5);
  max-width: 320px;
}
.game-overlay-hint {
  margin-top: var(--s-4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-ghost);
  letter-spacing: 0.04em;
}
.game-start-btn {
  border: none;
}

.game-telemetry {
  display: flex;
  gap: var(--s-6);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.game-tel-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 11px;
}
.game-tel-key {
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}
.game-tel-val {
  color: var(--text-secondary);
}

.terminal-game-section[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .game-container { aspect-ratio: 3 / 2; }
  .game-telemetry { gap: var(--s-4); }
  .game-hud { padding: var(--s-3) var(--s-4); }
  .game-telemetry { padding: var(--s-3) var(--s-4); }
  .game-hud-right {
    flex-direction: column;
    align-items: flex-end;
    gap: var(--s-2);
  }
}


/* --- Skill Tree --- */
.skill-tree-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.skill-tree-wrapper:hover { border-color: var(--border-hover); }
.skill-tree-wrapper > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.skill-tree-wrapper > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.skill-tree-wrapper > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.skill-tree-wrapper:hover > .btn-border { opacity: 1; }
.skill-tree-wrapper:hover > .btn-border::before,
.skill-tree-wrapper:hover > .btn-border::after { width: 40%; }

#skillTreeCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 2.2 / 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  #skillTreeCanvas { aspect-ratio: 1.4 / 1; }
}


/* --- Terminal --- */
.terminal-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.terminal-wrapper:hover { border-color: var(--border-hover); }
.terminal-wrapper > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.terminal-wrapper > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.terminal-wrapper > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.terminal-wrapper:hover > .btn-border { opacity: 1; }
.terminal-wrapper:hover > .btn-border::before,
.terminal-wrapper:hover > .btn-border::after { width: 40%; }

.terminal-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.terminal-dots {
  display: flex;
  gap: 6px;
}
.terminal-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-ghost);
}
.terminal-dots span:first-child { background: rgba(255, 95, 86, 0.7); }
.terminal-dots span:nth-child(2) { background: rgba(255, 189, 46, 0.7); }
.terminal-dots span:nth-child(3) { background: rgba(39, 201, 63, 0.7); }
.terminal-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

.terminal-body {
  padding: var(--s-4);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  height: 280px;
  overflow-y: auto;
}
.terminal-body::-webkit-scrollbar { width: 4px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.terminal-line { margin-bottom: 2px; }
.terminal-prompt { color: var(--cyan-dim); margin-right: var(--s-2); }
.terminal-cmd { color: var(--text-primary); }
.terminal-response { color: var(--text-secondary); }
.terminal-highlight { color: var(--cyan); }
.terminal-steel { color: var(--steel); }

.terminal-input-row {
  display: flex;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
}
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  caret-color: var(--cyan);
}
.terminal-input::placeholder {
  color: var(--text-ghost);
}

.terminal-secret {
  position: absolute;
  inset: 44px 0 0 0;
  z-index: 12;
  background: rgba(0, 0, 0, 0.95);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3);
}
.terminal-secret[hidden] {
  display: none !important;
}
.terminal-secret-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.terminal-secret-video {
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}


/* --- Particle Canvas --- */
#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}


/* --- Konami Flash --- */
.konami-flash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 240, 255, 0.12);
  pointer-events: none;
  animation: konamiFlash 0.6s ease-out forwards;
}
@keyframes konamiFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.konami-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--cyan-border);
  padding: var(--s-5) var(--s-7);
  border-radius: var(--radius);
  pointer-events: none;
  animation: konamiToast 2.5s ease-out forwards;
}
@keyframes konamiToast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}


/* --- Philosophy --- */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
.phil-item {
  position: relative;
  padding: var(--s-6) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.phil-item:hover { border-color: var(--border-hover); }

.phil-item > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.phil-item > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: var(--cyan);
  transition: width 0.4s ease;
}
.phil-item > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: var(--steel);
  transition: width 0.4s ease;
}
.phil-item:hover > .btn-border { opacity: 1; }
.phil-item:hover > .btn-border::before { width: 40%; }
.phil-item:hover > .btn-border::after { width: 40%; }

.phil-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-ghost);
  letter-spacing: -0.02em;
  margin-bottom: var(--s-4);
}
.phil-item h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--s-3);
}
.phil-item p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}


/* --- Contact --- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}
.contact-card {
  position: relative;
  padding: var(--s-6) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.contact-card:hover { border-color: var(--border-hover); }

.contact-card > .btn-border {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.contact-card > .btn-border::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 1px; width: 0;
  background: linear-gradient(90deg, var(--cyan), transparent);
  transition: width 0.5s ease;
}
.contact-card > .btn-border::after {
  content: "";
  position: absolute;
  bottom: 0; right: 0;
  height: 1px; width: 0;
  background: linear-gradient(270deg, var(--steel), transparent);
  transition: width 0.5s ease;
}
.contact-card:hover > .btn-border { opacity: 1; }
.contact-card:hover > .btn-border::before,
.contact-card:hover > .btn-border::after { width: 50%; }

.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: var(--s-3);
}
.contact-card h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--s-3);
}
.contact-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: var(--s-4);
}
.contact-card ul {
  padding-left: var(--s-4);
}
.contact-card li {
  position: relative;
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: var(--s-4);
  margin-bottom: var(--s-2);
}
.contact-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--steel-dim);
}

.contact-actions {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}


/* --- Footer --- */
.footer {
  padding: var(--s-6) 0 var(--s-8) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--s-9);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-tertiary);
}
.footer a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.footer a:hover { color: var(--cyan); }


/* --- Boot Overlay --- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-void);
}
#boot.hidden { display: none; }

.boot-panel {
  width: min(680px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(4, 8, 16, 0.95);
  overflow: hidden;
}
.boot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.boot-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.boot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}
.boot-skip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-ghost);
}
.boot-body { padding: var(--s-4); }

.boot-console {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-4);
  height: 200px;
  overflow: hidden;
  position: relative;
}
.boot-console .line {
  opacity: 0;
  transform: translateY(6px);
}
.boot-console .line.show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.boot-console .prompt { color: var(--cyan-dim); }

.boot-scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 240, 255, 0.04), transparent);
  transform: translateY(-100%);
  animation: scanmove 2.5s linear infinite;
  pointer-events: none;
}
@keyframes scanmove {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.boot-progress {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.boot-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.boot-fill {
  height: 100%;
  width: 0%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
  transition: width 0.2s ease;
}
.boot-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  width: 40px;
  text-align: right;
}


/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}


/* --- Responsive --- */
@media (max-width: 900px) {
  .nav {
    top: var(--s-2);
  }
  .nav-shell {
    grid-template-columns: 1fr auto;
    border-radius: 18px;
    row-gap: var(--s-3);
  }
  .nav-aux {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    border: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
  }
  .nav.open .nav-links {
    max-height: 280px;
    opacity: 1;
    padding: 6px;
    border: 1px solid rgba(232, 237, 245, 0.10);
  }
  .nav-links a {
    justify-content: space-between;
    width: 100%;
  }

  .cap-grid,
  .work-grid,
  .contact-grid { grid-template-columns: 1fr; }

  .tools-grid { grid-template-columns: 1fr; }

  .philosophy-grid { grid-template-columns: 1fr; }

  .hero-title { font-size: clamp(30px, 7vw, 48px); }

  .section { padding: var(--s-8) 0; }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .nav-shell {
    padding: var(--s-2);
    gap: var(--s-2);
  }
  .nav-brand {
    padding: 7px 10px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }
  .nav-links a {
    font-size: 10px;
    padding: 8px 10px;
  }
  .nav-links a span {
    font-size: 9px;
  }
  .nav-toggle {
    padding: 7px 9px;
    font-size: 9px;
  }

  .hero { padding-top: var(--s-8); }

  .hero-kicker {
    flex-wrap: wrap;
    gap: var(--s-2);
    font-size: 11px;
  }

  .hero-sub { font-size: 16px; }

  .tool-inputs { grid-template-columns: 1fr 1fr; }

  .section-header h2 { font-size: 22px; }
}

@media (max-width: 420px) {
  .nav-brand span {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-toggle-label {
    display: none;
  }
  .tool-inputs { grid-template-columns: 1fr; }
}


/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .boot-scanline { animation: none; }
  .boot-fill, .status-fill { transition: none; }
  .i-bar::after { transition: none; }
  .btn, .cap-card, .work-card, .phil-item, .contact-card,
  .nav-links a, .nav-links a::after { transition: none; }
  #gridCanvas { display: none; }
}
