:root {
  --bg: #070a08;
  --bg-alt: #0b100d;
  --surface: #0e1511;
  --surface-hover: #132019;
  --surface-code: #050806;
  --border: #1d2b22;
  --border-strong: #2c4234;
  --text: #d8e6dc;
  --muted: #93a99a;
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --accent-ink: #04130a;
  --emerald: #4ade80;
  --cyan: #67e8f9;
  --amber: #fbbf24;
  --rose: #fb7185;
  --grid-dot: rgba(74, 222, 128, 0.07);
  --spotlight: rgba(74, 222, 128, 0.07);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --radius: 6px;
  --container: 1140px;
  --font-mono: ui-monospace, "Cascadia Code", "Cascadia Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --font-sans: var(--font-mono);
  --font-display: var(--font-mono);
}

[data-theme="light"] {
  --bg: #f4f7f2;
  --bg-alt: #eaf0e8;
  --surface: #ffffff;
  --surface-hover: #f7faf6;
  --surface-code: #0b120d;
  --border: #d5dfd3;
  --border-strong: #b5c5b2;
  --text: #0c1a10;
  --muted: #3f5446;
  --accent: #15803d;
  --accent-strong: #166534;
  --accent-ink: #ffffff;
  --emerald: #15803d;
  --cyan: #0e7490;
  --amber: #b45309;
  --rose: #be123c;
  --grid-dot: rgba(12, 26, 16, 0.08);
  --spotlight: rgba(21, 128, 61, 0.06);
  --shadow: 0 18px 40px rgba(12, 26, 16, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 1000;
}

.skip-link:focus {
  left: 12px;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  z-index: 120;
  transition: width 0.08s linear;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  color: var(--accent);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.brand-name {
  font-family: var(--font-display);
}

.brand-handle {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.84rem;
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 34px;
  padding: 0;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: none;
}

.menu-toggle,
.btn-ghost.menu-toggle {
  display: none;
  font-size: 1.05rem;
  padding: 6px 11px;
}

/* Buttons */
.btn,
.btn-ghost,
.filter-btn,
.pill-btn,
.term-chip,
.term-run,
.dpo-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn {
  padding: 11px 18px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.btn:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 11px;
  font-size: 0.82rem;
}

.btn-ghost:hover {
  border-color: var(--accent);
}

/* Spotlight Card Wrapper */
.spotlight-card {
  position: relative;
  overflow: hidden;
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--spotlight), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.spotlight-card:hover::before {
  opacity: 1;
}

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

/* Hero Section */
.hero {
  position: relative;
  padding: 58px 0 56px;
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1.25px, transparent 1.25px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 25%, #000 45%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 25%, #000 45%, transparent 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-split {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 38px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--emerald) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--emerald) 38%, var(--border));
  color: var(--emerald);
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulseRing 2.2s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(1.95rem, 3.6vw, 2.95rem);
  line-height: 1.12;
}

.hero-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: clamp(0.96rem, 1.4vw, 1.06rem);
  max-width: 640px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Interactive Terminal */
.terminal-window {
  background: var(--surface-code);
  color: #d8e6dc;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid #24242c;
  background: #14141a;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3f3f46;
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #f59e0b; }
.terminal-dots span:nth-child(3) { background: #22c55e; }

.terminal-title {
  font-size: 0.78rem;
  color: #a1a1aa;
}

.terminal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
}

.terminal-body {
  padding: 14px 16px;
  min-height: 220px;
  max-height: 260px;
  overflow-y: auto;
}

.terminal-output {
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d8e6dc;
}

.term-line-cmd {
  color: #4ade80;
  font-weight: 600;
}

.term-line-ok {
  color: #34d399;
}

.term-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: #4ade80;
  vertical-align: middle;
  margin-left: 3px;
  animation: blinkCursor 1s steps(2, start) infinite;
}

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

.terminal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.term-chip {
  font-size: 0.74rem;
  padding: 4px 9px;
  border-radius: 7px;
  background: #18181f;
  color: #d4d4d8;
  border: 1px solid #2e2e38;
}

.term-chip:hover,
.term-chip.is-active {
  border-color: #4ade80;
  color: #ffffff;
  background: rgba(74, 222, 128, 0.14);
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #24242c;
  background: #101015;
}

.terminal-prompt {
  color: #34d399;
  font-weight: 700;
  font-size: 0.86rem;
}

.terminal-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #fafafa;
  font-size: 0.82rem;
  outline: none;
}

.terminal-input::placeholder {
  color: #7d9384;
}

.term-run {
  font-size: 0.74rem;
  padding: 5px 10px;
  border-radius: 7px;
  background: #4ade80;
  color: #04130a;
  border: none;
}

.term-run:hover {
  background: #4ade80;
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.metric-value {
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Sections */
.section {
  padding: 68px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 780px;
}

/* Interactive Lab */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.lab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lab-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lab-card-head h3 {
  margin: 4px 0 0;
  font-size: 1.18rem;
}

.lab-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn {
  font-size: 0.78rem;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.pill-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.pill-btn.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
  border-color: var(--accent);
}

.pill-btn-accent {
  background: color-mix(in srgb, var(--emerald) 14%, var(--surface));
  color: var(--emerald);
  border-color: color-mix(in srgb, var(--emerald) 40%, var(--border));
}

.pill-btn-accent:hover {
  border-color: var(--emerald);
  color: var(--emerald);
}

.dlp-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dlp-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pane-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.dlp-textarea,
.dlp-output {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-code);
  color: #d8e6dc;
  padding: 12px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.dlp-textarea {
  resize: vertical;
  min-height: 108px;
}

.dlp-output {
  min-height: 108px;
  white-space: pre-wrap;
  word-break: break-word;
}

.mask-token {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.74rem;
  margin: 0 1px;
}

.mask-pii {
  background: rgba(251, 113, 133, 0.18);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.4);
}

.mask-secret {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.42);
}

.mask-ip {
  background: rgba(74, 222, 128, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(74, 222, 128, 0.45);
}

.lab-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lab-stats-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-k {
  font-size: 0.68rem;
  color: var(--muted);
}

.stat-v {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* Lab 3: daily reconciliation pass */
.lab-card-wide {
  grid-column: 1 / -1;
}

.recon-board {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.recon-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  background: var(--surface-code);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.recon-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #2a2a33;
  background: #16161c;
  color: #7d9384;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.recon-cell small {
  font-size: 0.56rem;
  opacity: 0.85;
}

.recon-cell.is-weekend {
  opacity: 0.75;
}

.recon-cell.is-scan {
  border-color: var(--accent);
  color: #fff;
  background: color-mix(in srgb, var(--accent) 30%, #16161c);
  transform: scale(1.08);
}

.recon-cell.is-ok {
  border-color: color-mix(in srgb, var(--emerald) 45%, #2a2a33);
  background: color-mix(in srgb, var(--emerald) 16%, #16161c);
  color: #d1fae5;
}

.recon-cell.is-gap {
  border-color: var(--rose);
  background: color-mix(in srgb, var(--rose) 28%, #16161c);
  color: #fff;
  transform: scale(1.08);
}

.recon-cell.is-fixed {
  border-color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 34%, #16161c);
  color: #fff;
}

.recon-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recon-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recon-log {
  min-height: 132px;
}

/* Topology SVG Stage */
.topo-stage {
  background: var(--surface-code);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.topo-svg {
  display: block;
  width: 100%;
  height: auto;
}

.topo-node rect {
  fill: #14141b;
  stroke: #2e2e3a;
  stroke-width: 1.5;
  transition: stroke 0.25s ease;
}

.node-title {
  fill: #fafafa;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
}

.node-sub {
  fill: #a1a1aa;
  font-family: var(--font-mono);
  font-size: 9.8px;
}

.topo-edge {
  fill: none;
  stroke: #34d399;
  stroke-width: 2.2;
  stroke-dasharray: 7 6;
  animation: packetFlow 1.1s linear infinite;
  transition: stroke 0.25s ease;
}

.topo-svg.mode-high-load .topo-edge {
  stroke: #f59e0b;
  animation-duration: 0.55s;
}

.topo-svg.mode-high-load .node-watchdog rect {
  stroke: #f59e0b;
}

.topo-svg.mode-stalled .topo-edge {
  stroke: #fb7185;
  animation-duration: 3.4s;
}

.topo-svg.mode-stalled .edge-4,
.topo-svg.mode-stalled .edge-vertical-2 {
  stroke: #fb7185;
  animation-duration: 0.7s;
}

.topo-svg.mode-stalled .node-watchdog rect {
  stroke: #fb7185;
}

@keyframes packetFlow {
  from { stroke-dashoffset: 26; }
  to { stroke-dashoffset: 0; }
}

.topo-log {
  background: var(--surface-code);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.74rem;
  color: #d4d4d8;
  min-height: 58px;
  line-height: 1.5;
  white-space: pre-line;
}

/* DPO Governance Section */
.dpo-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dpo-stepper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dpo-step-btn {
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

.dpo-step-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.dpo-step-btn.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.dpo-step-btn.is-active .step-num {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.dpo-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dpo-panel h3 {
  margin: 0;
  font-size: 1.24rem;
}

.dpo-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.dpo-deliverables {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.credentials-bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.cred-card {
  gap: 14px;
}

.edu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edu-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.edu-item strong {
  font-size: 0.88rem;
  color: var(--text);
}

.edu-item span {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

.cred-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.cred-block strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 3px;
}

.cred-meta {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--emerald);
  font-weight: 600;
}

.cred-copy {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.highlight-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.highlight-pills span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--emerald) 30%, var(--border));
  padding: 4px 10px;
  border-radius: 999px;
}

/* Filters, Cards & Grids */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.filter-btn.is-active {
  background: var(--accent-strong);
  color: var(--accent-ink);
  border-color: var(--accent-strong);
}

.projects-grid,
.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

/* Case em destaque: largura total, contado como Dor -> Solucao -> Resultado */
.impact-featured {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.case-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.case-step {
  padding: 14px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  border: 1px solid var(--border);
}

.case-step p {
  margin: 6px 0 0;
}

.case-step-k {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.case-step:first-child .case-step-k {
  color: var(--rose);
}

.case-step:last-child .case-step-k {
  color: var(--emerald);
}

/* Cards compactos: Dor / O que construi / Resultado empilhados */
.case-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.case-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.case-row {
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
}

.case-row dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.case-row dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.case-row.is-pain {
  border-left-color: color-mix(in srgb, var(--rose) 70%, transparent);
}

.case-row.is-pain dt {
  color: var(--rose);
}

.case-row.is-built {
  border-left-color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.case-row.is-built dt {
  color: var(--accent);
}

.case-row.is-result {
  border-left-color: color-mix(in srgb, var(--emerald) 70%, transparent);
}

.case-row.is-result dt {
  color: var(--emerald);
}

.case-row.is-result dd {
  color: var(--text);
}

.stack-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card,
.stack-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: var(--surface-hover);
}

.card.is-hidden {
  display: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.tag,
.impact-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
}

.badge-live {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--emerald) 35%, var(--border));
  padding: 2px 9px;
  border-radius: 999px;
}

.badge-live.is-warn {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--amber) 40%, var(--border));
}

.badge-live.is-danger {
  color: var(--rose);
  background: color-mix(in srgb, var(--rose) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--rose) 40%, var(--border));
}

.card h3,
.stack-group h3 {
  margin: 0;
  font-size: 1.12rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
  flex: 1;
}

.card-links {
  display: flex;
  gap: 14px;
  padding-top: 4px;
  font-size: 0.88rem;
  font-weight: 600;
}

/* Timeline */
.sub-heading {
  margin: 40px 0 18px;
  font-size: 1.24rem;
}

.timeline-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.timeline-card {
  border-left: 3px solid var(--accent);
}

.timeline-card h4 {
  margin: 0;
  font-size: 1.05rem;
}

.timeline-period {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--emerald);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list span {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 500;
}

/* Contact & Footer */
.contact-box {
  background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 9%, var(--surface)) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.contact-box h2 {
  margin: 0 0 8px;
}

.contact-box p {
  margin: 0;
  color: var(--muted);
  max-width: 600px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

/* Video Cinema Showcase */
.cinema-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 20px;
  align-items: start;
}

.demo-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.demo-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-stage-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-duration-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.demo-player-frame {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #050806;
}

.demo-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050806;
}

.demo-stage-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.demo-stage-copy {
  flex: 1;
  min-width: 220px;
}

.demo-stage-copy h3 {
  margin: 0 0 4px;
  font-size: 1.18rem;
}

.demo-stage-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.btn-sm {
  padding: 8px 13px;
  font-size: 0.82rem;
}

.demo-playlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}

.demo-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.16s ease;
}

.demo-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.demo-item.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
}

.demo-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #050806;
}

.demo-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.demo-item-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-item-sub {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-item-dur {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.dpo-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.demo-inline-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
  transform: translateY(-1px);
}

.card-links {
  align-items: center;
  flex-wrap: wrap;
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Command palette (Ctrl/Cmd + K) */
.cmdk-trigger {
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.cmdk[hidden] {
  display: none;
}

.cmdk {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh 16px 16px;
}

.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cmdk-panel {
  position: relative;
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: cmdk-in 0.16s ease-out;
}

@keyframes cmdk-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.cmdk-prompt {
  color: var(--accent);
  font-weight: 700;
}

.cmdk-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
}

.cmdk-kbd {
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
}

.cmdk-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(52vh, 380px);
  overflow-y: auto;
}

.cmdk-item,
.cmdk-empty {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text);
}

.cmdk-item {
  cursor: pointer;
}

.cmdk-item.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

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

.cmdk-foot {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 8px 14px;
  border-top: 1px solid var(--border);
}

body.cmdk-open {
  overflow: hidden;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 1020px) {
  .hero-split,
  .lab-grid,
  .recon-board,
  .cinema-grid,
  .dpo-layout,
  .credentials-bento {
    grid-template-columns: 1fr;
  }

  .demo-playlist {
    max-height: none;
    padding-right: 0;
  }

  .metrics-grid,
  .projects-grid,
  .impact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .menu-toggle,
  .btn-ghost.menu-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 66px;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .nav-links.is-open {
    display: flex;
  }
}

@media (max-width: 720px) {
  .brand-handle {
    display: none;
  }

  .metrics-grid,
  .projects-grid,
  .impact-grid,
  .case-steps,
  .timeline-rail,
  .stack-groups,
  .edu-list,
  .lab-stats,
  .lab-stats-4 {
    grid-template-columns: 1fr;
  }

  .recon-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  /* atalho de teclado nao faz sentido no celular */
  .btn-ghost.cmdk-trigger {
    display: none;
  }

  .recon-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    padding: 40px 0 42px;
  }

  .section {
    padding: 48px 0;
  }

  .contact-box {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* SQL Casebook */
.sqlbook {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
  gap: 20px;
  align-items: start;
}

.sqlbook-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sqlbook-item {
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.sqlbook-item:hover {
  border-color: var(--border-strong);
}

.sqlbook-item.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.sqlbook-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 2px;
}

.sqlbook-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sqlbook-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sqlbook-item-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.sqlbook-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sqlbook-panel h3 {
  margin: 0;
  font-size: 1.2rem;
}

.sqlbook-code {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-code);
}

.sqlbook-code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #22222a;
}

.sqlbook-link {
  font-size: 0.74rem;
  color: #86efac;
}

.sqlbook-pre {
  font-variant-ligatures: none; /* >= e <= sem virar simbolos */
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #d4d4d8;
  max-height: 380px;
}

.sqlbook-pre .k { color: #67e8f9; font-weight: 600; }
.sqlbook-pre .s { color: #86efac; }
.sqlbook-pre .c { color: #7d9384; font-style: italic; }
.sqlbook-pre .n { color: #fbbf24; }
.sqlbook-pre .f { color: #7dd3fc; }

@media (max-width: 1020px) {
  .sqlbook {
    grid-template-columns: 1fr;
  }

  .sqlbook-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sqlbook-item {
    min-width: 220px;
  }
}

/* Project cards: repo slug under the friendly name, and the "what you gain" line */
.card .project-slug {
  flex: none;
  margin: -6px 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.card .project-gain {
  flex: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--emerald);
  border-radius: 0 8px 8px 0;
  background: var(--surface-hover);
  font-size: 0.92rem;
}

.project-gain strong {
  color: var(--emerald);
  font-weight: 600;
}

/* ==========================================================================
   Terminal experience layer
   Sections are shell commands, a pixel-art avatar follows the scroll and
   every demo opens in a single video dialog.
   ========================================================================== */

.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;
}

html:not(.js) .reveal {
  opacity: 1;
  transform: none;
}

body {
  font-size: 15px;
  line-height: 1.65;
}

/* faint CRT scanlines, dark theme only */
[data-theme="dark"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.01em;
  font-weight: 700;
}

.section {
  padding: 72px 0;
  border-top: 1px dashed var(--border);
}

.section-head h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
}

.section-head h2::before {
  content: "## ";
  color: var(--accent);
  opacity: 0.75;
}

/* ---- header ---- */
.brand {
  gap: 10px;
}

.brand-prompt {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.brand-user,
.brand-path {
  color: var(--accent);
}

.nav-links a {
  text-transform: lowercase;
  font-size: 0.86rem;
}

.nav-links a::before {
  content: "./";
  color: var(--muted);
  opacity: 0.7;
}

.nav-links a.is-active::before,
.nav-links a:hover::before {
  color: var(--accent);
  opacity: 1;
}

/* ---- prompt lines: "gabriel@gavicoding:~$ ls -la ~/projects  # comment" ---- */
.prompt-line {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.prompt-line .ps1 {
  color: var(--accent);
  font-weight: 700;
}

.prompt-line .cmd {
  display: inline-block;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  vertical-align: bottom;
}

.prompt-line .cmt {
  color: var(--muted);
  text-transform: lowercase;
}

.prompt-line .cmt::before {
  content: "# ";
}

.js .prompt-line .cmd {
  clip-path: inset(0 100% 0 0);
}

.js .prompt-line .cmt {
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
}

.js .prompt-line.is-typing .cmd {
  animation: typeCmd calc(var(--n, 12) * 40ms) steps(var(--n, 12), end) forwards;
}

.js .prompt-line.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blinkCursor 0.9s steps(1) infinite;
}

.js .prompt-line.is-typed .cmd {
  clip-path: none;
}

.js .prompt-line.is-typed .cmt {
  opacity: 1;
}

@keyframes typeCmd {
  to {
    clip-path: inset(0 0 0 0);
  }
}

.prompt-sub {
  margin-top: 6px;
}

/* ---- hero: neofetch window ---- */
.hero {
  padding: 40px 0 56px;
}

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

.term-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.term-panel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}

.term-panel-body {
  padding: 20px 22px 24px;
}

.terminal-dots {
  display: inline-flex;
  gap: 6px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #f59e0b; }
.terminal-dots span:nth-child(3) { background: #22c55e; }

.neofetch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin: 6px 0 22px;
}

.ascii-portrait {
  position: relative;
  margin: 0;
  font-size: 7.4px;
  line-height: 1.12;
  color: var(--accent);
  text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent);
  user-select: none;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(11, 18, 13, 0.55);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  animation: asciiBreath 4.2s ease-in-out infinite;
}

.ascii-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(74, 222, 128, 0.14) 50%,
    transparent 100%
  );
  height: 28%;
  transform: translateY(-120%);
  animation: asciiScan 5.5s linear infinite;
}

.ascii-portrait.is-forming {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.18);
}

.ascii-portrait.is-glint {
  text-shadow: 0 0 12px rgba(103, 232, 249, 0.85), 0 0 6px rgba(74, 222, 128, 0.65);
}

@keyframes asciiBreath {
  0%, 100% {
    transform: translateY(0);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-1.5px);
    filter: brightness(1.09);
  }
}

@keyframes asciiScan {
  0% { transform: translateY(-120%); opacity: 0; }
  12% { opacity: 0.9; }
  88% { opacity: 0.7; }
  100% { transform: translateY(420%); opacity: 0; }
}

[data-theme="light"] .ascii-portrait {
  background: var(--surface-code);
  color: #4ade80;
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.45);
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.12);
}

.neofetch-info {
  font-size: 0.84rem;
  line-height: 1.55;
  min-width: 0;
}

.neofetch-info p {
  margin: 0;
}

.nf-head {
  font-weight: 700;
}

.nf-user,
.nf-host {
  color: var(--accent);
}

.nf-rule {
  color: var(--muted);
}

.neofetch-info dl {
  margin: 4px 0 8px;
}

.neofetch-info dl > div {
  display: flex;
  gap: 8px;
}

.neofetch-info dt {
  flex: 0 0 auto;
  min-width: 9.5ch;
  color: var(--cyan);
  font-weight: 700;
}

.neofetch-info dt::after {
  content: ":";
}

.neofetch-info dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.neofetch-info dd.nf-ok {
  color: var(--accent);
}

.nf-colors {
  display: flex;
  gap: 0;
}

.nf-colors span {
  width: 18px;
  height: 10px;
}

.nf-colors span:nth-child(1) { background: #ef4444; }
.nf-colors span:nth-child(2) { background: #f59e0b; }
.nf-colors span:nth-child(3) { background: #4ade80; }
.nf-colors span:nth-child(4) { background: #67e8f9; }
.nf-colors span:nth-child(5) { background: #a78bfa; }
.nf-colors span:nth-child(6) { background: #e5e7eb; }

.hero-title {
  font-size: clamp(1.35rem, 2.5vw, 1.95rem);
  line-height: 1.3;
}

.hero-title::before {
  content: "> ";
  color: var(--accent);
}

.terminal-window {
  position: sticky;
  top: 84px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

/* ---- pixel avatar sprite: 6 frames side by side ---- */
.sprite {
  display: block;
  background-image: url("images/avatar-sprite.png");
  background-repeat: no-repeat;
  background-size: 600% 100%;
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.sprite-mini {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background-color: #0a0e0b;
  flex: 0 0 auto;
}

.sprite-buddy {
  width: 112px;
  height: 112px;
  margin: 0 auto;
}

[data-buddy="smile"] .sprite { background-position: 40% 0; }
[data-buddy="glint"] .sprite { background-position: 100% 0; }
[data-buddy="typing"] .sprite { animation: buddyType 0.46s steps(1) infinite; }
.buddy-blink .sprite { background-position: 20% 0; }

@keyframes buddyType {
  0% { background-position: 60% 0; }
  50% { background-position: 80% 0; }
}

/* the companion lives in the right gutter on desktop and docks cleanly on mobile */
.buddy {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 70;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

.buddy-frame,
.buddy-bubble {
  pointer-events: auto;
  cursor: pointer;
}

.buddy-frame {
  background: #0a0e0b;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.buddy-frame:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

body.theater-open .buddy {
  display: none;
}

@media (max-width: 1399px) and (min-width: 721px) {
  .buddy {
    right: 10px;
    bottom: 14px;
    width: 104px;
    gap: 6px;
  }

  .sprite-buddy {
    width: 88px;
    height: 88px;
  }

  .buddy-bar em {
    font-size: 0.56rem;
  }

  .buddy-bubble {
    font-size: 0.64rem;
    padding: 6px 7px;
  }
}

.buddy-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-bottom: 1px solid #1d2b22;
}

.buddy-bar span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2c4234;
}

.buddy-bar em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.62rem;
  color: #8fa596;
}

.buddy-status {
  padding: 4px 7px 6px;
  font-size: 0.66rem;
  color: #4ade80;
  border-top: 1px solid #1d2b22;
  text-align: center;
}

.buddy-bubble {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.buddy-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  transform: rotate(45deg);
}

.buddy-ps1 {
  color: var(--accent);
  font-weight: 700;
}

.buddy-caret {
  display: inline-block;
  width: 0.55em;
  height: 0.95em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blinkCursor 1s steps(1) infinite;
}

.buddy.is-new .buddy-bubble {
  animation: bubblePop 0.35s ease-out;
}

@keyframes bubblePop {
  from { transform: translateY(6px); opacity: 0.2; }
  to { transform: none; opacity: 1; }
}

/* ---- project cards with their demo video ---- */
.projects-grid {
  align-items: stretch;
}

.project-card {
  display: flex;
  flex-direction: column;
}

.project-card .card-links {
  margin-top: auto;
}

.proj-media {
  position: relative;
  display: block;
  width: 100%;
  margin: 2px 0 14px;
  padding: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background: #050806;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.proj-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.25s ease;
  opacity: 0.9;
}

.proj-media.is-portrait img {
  object-position: 50% 6%;
}

.proj-media-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 7px;
  font-size: 0.74rem;
  color: #e5f5ea;
  background: linear-gradient(to top, rgba(5, 8, 6, 0.95), rgba(5, 8, 6, 0));
  text-align: left;
}

.play-glyph {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #4ade80;
  color: #04130a;
  font-size: 0.62rem;
}

.proj-media:hover img,
.proj-media:focus-visible img {
  transform: scale(1.03);
  opacity: 1;
}

.proj-media:hover,
.proj-media:focus-visible {
  border-color: var(--accent);
}

/* ---- video theater dialog ---- */
.theater {
  width: min(960px, 94vw);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.theater:has(.demo-video.is-vertical) {
  width: min(470px, 94vw);
}

.theater::backdrop {
  background: rgba(2, 4, 3, 0.82);
}

.theater-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.theater .demo-stage-meta {
  flex-wrap: wrap;
  min-width: 0;
}

.theater-close {
  font-size: 0.8rem;
}

.theater .demo-player-frame {
  border-radius: 6px;
}

.demo-video.is-vertical {
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.demo-stage-copy h2 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.demo-note {
  margin-top: 6px !important;
  font-size: 0.72rem !important;
  color: var(--amber) !important;
}

body.theater-open {
  overflow: hidden;
}

/* ---- keywords ---- */
.keywords {
  margin-top: 34px;
}

.kw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.kw-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kw-col h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--accent);
}

ul.pill-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pill-list li {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
  background: var(--bg-alt);
}

.footer-exit {
  color: var(--accent);
}

/* ---- responsive ---- */
@media (max-width: 1020px) {
  .terminal-window {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14.5px;
  }

  .term-panel-body {
    padding: 16px 14px 20px;
  }

  .neofetch {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ascii-portrait {
    font-size: 6.4px;
    justify-self: start;
  }

  .neofetch-info {
    font-size: 0.8rem;
  }

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

  .brand-prompt {
    font-size: 0.8rem;
  }

  .section {
    padding: 52px 0;
  }

  .theater-panel {
    padding: 10px;
  }
}

@media (max-width: 400px) {
  .brand-prompt .brand-path {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .prompt-line .cmd {
    clip-path: none !important;
    animation: none !important;
  }

  .js .prompt-line .cmt {
    opacity: 1 !important;
  }

  [data-buddy="typing"] .sprite {
    animation: none !important;
    background-position: 60% 0;
  }

  .buddy-caret,
  .js .prompt-line.is-typing::after,
  .ascii-portrait,
  .ascii-portrait::after {
    animation: none !important;
  }

  .proj-media img {
    transition: none;
  }
}

/* ---- tuning after first visual pass ---- */
main section[id] {
  scroll-margin-top: 72px;
}

.hero-title {
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  line-height: 1.4;
}

.hero-subtitle {
  font-size: 0.92rem;
}

.ascii-portrait {
  font-size: 8px;
}

.project-card .card-top {
  flex-wrap: nowrap;
  align-items: flex-start;
}

.project-card .card-top .badge-live {
  flex: 0 0 auto;
}

.term-run {
  font-weight: 700;
}

.sprite-hero {
  display: none;
}

.theater .demo-stage-bar {
  flex-wrap: nowrap;
}

.theater .demo-stage-meta {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.theater #demo-active-tag {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theater-close {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .ascii-portrait {
    display: block;
    font-size: 6.2px;
    justify-self: start;
    padding: 8px 10px;
    max-width: 100%;
  }

  .sprite-hero {
    display: none;
  }

  .buddy {
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }

  .buddy-frame {
    width: 74px;
    flex: 0 0 auto;
    border-radius: 10px;
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }

  .buddy-bar {
    padding: 3px 5px;
    gap: 3px;
  }

  .buddy-bar span {
    width: 4px;
    height: 4px;
  }

  .buddy-bar em {
    display: none;
  }

  .sprite-buddy {
    width: 52px;
    height: 52px;
  }

  .buddy-status {
    padding: 2px 3px 4px;
    font-size: 0.48rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .buddy-bubble {
    max-width: min(195px, calc(100vw - 104px));
    padding: 6px 9px;
    font-size: 0.66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 18px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  }

  .buddy-bubble::after {
    display: none;
  }

  .buddy.is-collapsed .buddy-bubble {
    display: none;
  }

  .footer {
    padding-bottom: 88px;
  }

  .neofetch-info dl > div {
    flex-direction: column;
    gap: 0;
    margin-bottom: 3px;
  }

  .theater .terminal-dots {
    display: none;
  }

  .demo-video.is-vertical {
    max-height: 62vh;
  }

  .hero-title {
    font-size: 1.12rem;
  }
}
