/* =========================================================
   0xwi11iam — Personal Portfolio & Project Showcase
   Design system: dark, minimalist, technical elegance
   ========================================================= */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Gotham Medium';
  src: url('../Gotham Medium/Gotham Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces */
  --bg-primary: #0c0c0e;
  --bg-secondary: #1a1a1e;
  --bg-card: #26262b;
  --bg-card-hover: #2d2d33;
  --bg-elevated: #16161a;

  /* Text */
  --text-primary: #f0f0f3;
  --text-secondary: #a1a1aa;
  --text-body: #e4e4e7;
  --text-faint: #71717a;

  /* Accents */
  --accent-purple: #3b82f6;
  --accent-purple-hover: #2563eb;
  --accent-purple-light: #93c5fd;
  --accent-cyan: #06b6d4;
  --accent-cyan-hover: #0891b2;

  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Borders */
  --border: #2e2e33;
  --border-strong: #3f3f46;
  --border-accent: rgba(59, 130, 246, 0.35);

  /* Type */
  --font-heading: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body: 'Gotham Medium', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  --font-label: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Rhythm & radii */
  --space-1: 0.375rem;
  --space-2: 0.75rem;
  --space-3: 1.125rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;

  /* Effects */
  --glow-purple: 0 0 0 1px rgba(59, 130, 246, 0.45), 0 8px 40px -8px rgba(59, 130, 246, 0.5);
  --glow-cyan: 0 0 0 1px rgba(6, 182, 212, 0.4), 0 8px 40px -8px rgba(6, 182, 212, 0.4);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: 0.3s var(--ease);

  /* Syntax highlight tokens (dark) */
  --hl-comment: #7d8590;
  --hl-keyword: #ff7b72;
  --hl-string: #7ee787;
  --hl-number: #ffab70;
  --hl-title: #dcdcaa;
  --hl-attr: #79c0ff;
  --hl-built: #ffa657;
  --hl-meta: #79c0ff;
  --hl-name: #7ee787;
  --hl-var: #ff7b72;
  --hl-literal: #ffab70;

  --max-width: 1200px;
  --header-h: 4.25rem;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--accent-cyan);
}

::selection {
  background: var(--accent-purple);
  color: #fff;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid var(--bg-primary);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h3 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}

p {
  color: var(--text-secondary);
}

code,
pre,
kbd {
  font-family: var(--font-mono);
}

.section-label {
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-label::before {
  content: '';
  width: 2rem;
  height: 1px;
  background: var(--accent-cyan);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-8);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(12, 12, 14, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(62, 62, 68, 0.35);
  transition: border-color var(--transition), background var(--transition);
}

.site-header.is-scrolled {
  background: rgba(12, 12, 14, 0.92);
  border-bottom-color: var(--border);
}

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 600;
}

.brand .prompt {
  color: var(--accent-purple-light);
}

.brand .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  background: var(--accent-cyan);
  animation: blink 1.1s steps(1) infinite;
  transform: translateY(-3px);
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  padding-block: 0.35rem;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent-cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a[aria-current='page']::after {
  transform: scaleX(1);
}

.nav-cta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  border: 1px solid var(--accent-purple);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  transition: all var(--transition);
}

.nav-cta:hover {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: var(--glow-purple);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition), opacity var(--transition);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 28px -10px rgba(59, 130, 246, 0.75);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-purple-hover), #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -10px rgba(59, 130, 246, 0.85);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
  padding: 0.55rem 1.1rem;
  font-size: 0.8rem;
}

.btn-ghost:hover {
  border-color: var(--accent-purple-light);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-block: calc(var(--header-h) + var(--space-6)) var(--space-8);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 20% 20%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(50% 45% at 85% 30%, rgba(6, 182, 212, 0.14), transparent 60%),
    radial-gradient(55% 55% at 50% 100%, rgba(59, 130, 246, 0.1), transparent 65%);
  animation: heroDrift 18s ease-in-out infinite alternate;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%);
}

@keyframes heroDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-2%, 2%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: center;
  width: 100%;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  letter-spacing: 0.12em;
  margin-bottom: var(--space-3);
}

.hero h1 {
  margin-bottom: var(--space-2);
}

.hero h1 .name {
  background: linear-gradient(120deg, var(--text-primary) 30%, var(--accent-purple-light) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-role {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-secondary);
  min-height: 1.6em;
  margin-bottom: var(--space-4);
}

.hero-role .typed {
  color: var(--accent-purple-light);
  font-weight: 600;
}

.hero-role .caret {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  background: var(--accent-cyan);
  animation: blink 1.1s steps(1) infinite;
  transform: translateY(0.18em);
  margin-left: 2px;
}

.hero-motto {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.35;
  color: var(--text-body);
  max-width: 34rem;
  margin-bottom: var(--space-5);
  border-left: 2px solid var(--accent-purple);
  padding-left: var(--space-4);
}

.hero-motto em {
  color: var(--accent-purple-light);
  font-style: italic;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* Hamster above terminal */
.hero-terminal {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-hamster {
  width: min(400px, 78vw);
  height: auto;
  margin-bottom: 1.5rem;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.7);
}

.hero-terminal .terminal {
  width: 100%;
}

/* Terminal card */
.terminal {
  background: rgba(22, 22, 26, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.terminal-bar .traffic {
  display: flex;
  gap: 0.4rem;
}

.terminal-bar .traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-bar .traffic i:nth-child(1) { background: #ff5f57; }
.terminal-bar .traffic i:nth-child(2) { background: #febc2e; }
.terminal-bar .traffic i:nth-child(3) { background: #28c840; }

.terminal-bar .title {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.terminal-body {
  padding: 1.25rem;
  line-height: 1.8;
}

.terminal-body .line {
  display: block;
  min-height: 1.4em;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-body .prompt {
  color: var(--accent-purple-light);
}

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

.terminal-body .out {
  color: var(--text-secondary);
}

.terminal-body .out.ok {
  color: var(--success);
}

.terminal-body .out.accent {
  color: var(--accent-cyan);
}

.terminal-body .out.quote {
  color: var(--accent-purple-light);
  font-style: italic;
}

/* Terminal boot-in (JS-driven line reveal) */
.terminal.is-booting .line {
  opacity: 0;
}

.terminal.is-booting .line.typed-line {
  opacity: 1;
  transition: opacity 0.25s var(--ease);
}

/* ---------- Stats bar ---------- */
.stats-band {
  border-block: 1px solid var(--border);
  background: var(--bg-secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat {
  padding: var(--space-5) var(--space-4);
  border-right: 1px solid var(--border);
  text-align: center;
}

.stat:last-child {
  border-right: none;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  color: var(--text-primary);
  line-height: 1;
}

.stat-value .unit {
  font-family: var(--font-mono);
  font-size: 0.5em;
  color: var(--accent-cyan);
  vertical-align: super;
  margin-left: 2px;
}

.stat-label {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Section header ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.section-head h2 {
  max-width: 24ch;
}

.section-head .lede {
  max-width: 36ch;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ---------- Filter bar ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: var(--space-5);
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
}

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

.filter-btn.is-active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: 0 6px 20px -8px rgba(59, 130, 246, 0.8);
}

/* ---------- Project cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(59, 130, 246, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: var(--glow-purple);
}

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

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

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.1em;
}

.card-lang {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.card-title {
  font-size: 1.7rem;
  margin-bottom: 0.35rem;
}

.card-tagline {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-purple-light);
  margin-bottom: var(--space-3);
}

.card-desc {
  font-size: 0.94rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  flex: 1;
}

.card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-4);
}

.metric {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

.metric strong {
  color: var(--text-primary);
  font-weight: 600;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: var(--space-4);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.22);
  border-radius: 0.35rem;
  padding: 0.2rem 0.55rem;
}

.tag.purple {
  color: var(--accent-purple-light);
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.tag.green {
  color: var(--success);
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
}

.card-footer .btn {
  flex: 1;
  justify-content: center;
}

.card-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  transition: all var(--transition);
}

.card-link:hover {
  color: var(--accent-purple-light);
  border-color: var(--accent-purple-light);
}

/* ---------- Tech stack ---------- */
.tech-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  transition: all var(--transition);
}

.tech-item:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
  box-shadow: var(--glow-cyan);
}

.tech-item .glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: #f6f6f8;
  border: 1px solid #d9d9de;
  border-radius: 0.5rem;
  overflow: hidden;
}

.tech-item .glyph img.tech-logo {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

.tech-item .name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.tech-item .hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  color: var(--text-primary);
  transition: all var(--transition);
}

a.contact-item:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-3px);
  color: var(--text-primary);
}

.contact-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  background: #f6f6f8;
  border: 1px solid #d9d9de;
  border-radius: 0.6rem;
  overflow: hidden;
}

.contact-glyph img.contact-logo {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

.contact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-name {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.contact-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--text-faint);
  transition: color var(--transition), transform var(--transition);
}

a.contact-item:hover .contact-arrow {
  color: var(--accent-cyan);
  transform: translate(2px, -2px);
}

/* ---------- Philosophy ---------- */
.philosophy {
  position: relative;
  text-align: center;
  background:
    radial-gradient(50% 80% at 50% 0%, rgba(59, 130, 246, 0.16), transparent 65%),
    var(--bg-secondary);
  border-block: 1px solid var(--border);
  padding-block: var(--space-8);
}

.philosophy .motto {
  font-family: var(--font-heading);
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  line-height: 1.2;
  color: var(--text-primary);
  max-width: 24ch;
  margin: var(--space-5) auto;
}

.philosophy .motto em {
  font-style: italic;
  color: var(--accent-purple-light);
}

.philosophy p.lead {
  max-width: 58ch;
  margin: 0 auto var(--space-5);
  font-size: 1.05rem;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  max-width: 60rem;
  margin: var(--space-6) auto 0;
  text-align: left;
}

.pillar {
  background: rgba(22, 22, 26, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: all var(--transition);
}

.pillar:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
}

.pillar .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.pillar h3 {
  font-size: 1.25rem;
  margin: 0.4rem 0 0.5rem;
}

.pillar p {
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-6) var(--space-5);
  background: var(--bg-primary);
}

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

.footer-brand {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: right;
}

.footer-meta a {
  color: var(--text-secondary);
}

.footer-meta a:hover {
  color: var(--accent-cyan);
}

/* ---------- Page hero (subpages) ---------- */
.page-hero {
  position: relative;
  padding-top: calc(var(--header-h) + var(--space-7));
  padding-bottom: var(--space-7);
  overflow: hidden;
}

.page-hero .hero-bg {
  opacity: 0.7;
}

.page-hero h1 {
  max-width: 18ch;
  margin-bottom: var(--space-3);
}

.page-hero .lede {
  max-width: 56ch;
  font-size: 1.05rem;
}

/* ---------- Project detail sections ---------- */
.project-detail {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-6);
  align-items: start;
  padding-block: var(--space-7);
  border-top: 1px solid var(--border);
}

.project-detail:first-of-type {
  border-top: none;
}

.detail-aside {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
}

.detail-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  letter-spacing: 0.12em;
}

.detail-aside h2 {
  margin: 0.4rem 0 0.6rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.detail-aside .detail-tagline {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-purple-light);
  margin-bottom: var(--space-4);
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-body p {
  margin-bottom: var(--space-3);
}

.detail-body p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.detail-body h3 {
  font-size: 1.4rem;
  margin: var(--space-5) 0 var(--space-2);
}

.detail-list {
  list-style: none;
  display: grid;
  gap: 0.65rem;
  margin: var(--space-3) 0;
}

.detail-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.detail-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
}

.detail-list li strong {
  color: var(--text-primary);
}

.callout {
  background: var(--bg-card);
  border-left: 3px solid var(--accent-purple);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-4);
  margin: var(--space-4) 0;
}

.callout p {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-body);
}

.callout .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.about-copy h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
}

.about-copy p {
  margin-bottom: var(--space-3);
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-lg);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-row .key {
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.profile-row .val {
  color: var(--text-primary);
  text-align: right;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* Staggered delays */
.reveal[data-delay='1'] { transition-delay: 0.08s; }
.reveal[data-delay='2'] { transition-delay: 0.16s; }
.reveal[data-delay='3'] { transition-delay: 0.24s; }
.reveal[data-delay='4'] { transition-delay: 0.32s; }
.reveal[data-delay='5'] { transition-delay: 0.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .terminal {
    max-width: 560px;
  }

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

  .project-detail {
    grid-template-columns: 1fr;
  }

  .detail-aside {
    position: static;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(12, 12, 14, 0.98);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
    transform: translateY(-130%);
    transition: transform var(--transition);
  }

  .nav-links.is-open {
    transform: translateY(0);
  }

  .nav-links li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-toggle {
    display: flex;
  }

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

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

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

  .stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-3);
  }

  .stat:last-child {
    border-bottom: none;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

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

@media (max-width: 480px) {
  :root {
    --space-8: 4rem;
    --space-7: 3.25rem;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

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

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

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

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-purple);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme='light'] .theme-toggle .icon-sun {
  display: block;
}

[data-theme='light'] .theme-toggle .icon-moon {
  display: none;
}

/* ---------- Terminal (interactive) ---------- */
.terminal-body {
  max-height: 430px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.terminal-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-strong);
}

.terminal-form .prompt {
  color: var(--accent-purple-light);
  flex-shrink: 0;
}

.terminal-field {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  caret-color: var(--accent-cyan);
}

.terminal-field::placeholder {
  color: var(--text-faint);
}

.terminal-body .line.cmdline .cmd {
  color: var(--text-primary);
}

.terminal-body .line.out-error {
  color: var(--danger);
}

.terminal-body .line.out-ok {
  color: var(--success);
}

.terminal-body .line.out-dim {
  color: var(--text-faint);
}

/* ---------- Blog ---------- */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: block;
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  transition: all var(--transition);
}

.post-item:first-child {
  border-top: 1px solid var(--border);
}

.post-item:hover {
  color: inherit;
  transform: translateX(4px);
}

.post-item:hover .post-title {
  color: var(--accent-cyan);
}

.post-meta {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.post-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--text-primary);
  margin: 0 0 0.5rem;
  transition: color var(--transition);
}

.post-excerpt {
  margin: 0;
  color: var(--text-secondary);
  max-width: 60ch;
}

/* Markdown article body */
.article-body {
  max-width: 760px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-body);
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.article-body h2 {
  font-size: 1.575rem;
  margin: 2.5rem 0 0.75rem;
}

.article-body h3 {
  font-size: 1rem;
  margin: 2rem 0 0.5rem;
}

.article-body h4 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
}

.article-body p {
  margin: 0 0 1.25rem;
  color: var(--text-body);
}

.article-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

.article-body li {
  margin: 0.4rem 0;
  color: var(--text-body);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent-cyan);
}

.article-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-body);
}

.article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.5rem;
  font-size: 0.92rem;
}

.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: var(--text-body);
}

.article-body th {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

/* Syntax highlight token colors */
.article-body .hljs-comment,
.article-body .hljs-quote { color: var(--hl-comment); font-style: italic; }
.article-body .hljs-keyword,
.article-body .hljs-selector-tag { color: var(--hl-keyword); }
.article-body .hljs-string,
.article-body .hljs-regexp,
.article-body .hljs-addition { color: var(--hl-string); }
.article-body .hljs-number,
.article-body .hljs-literal,
.article-body .hljs-symbol,
.article-body .hljs-bullet { color: var(--hl-literal); }
.article-body .hljs-title,
.article-body .hljs-title.function_,
.article-body .hljs-section { color: var(--hl-title); }
.article-body .hljs-attr,
.article-body .hljs-attribute { color: var(--hl-attr); }
.article-body .hljs-built_in,
.article-body .hljs-type { color: var(--hl-built); }
.article-body .hljs-meta { color: var(--hl-meta); }
.article-body .hljs-name { color: var(--hl-name); }
.article-body .hljs-variable,
.article-body .hljs-template-variable,
.article-body .hljs-deletion { color: var(--hl-var); }
.article-body .hljs-params { color: var(--text-body); }
.article-body .hljs-emphasis { font-style: italic; }
.article-body .hljs-strong { font-weight: 700; }

/* Mermaid diagrams */
.article-body .mermaid {
  margin: 0 0 1.5rem;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.article-body .mermaid svg {
  max-width: 100%;
  height: auto;
}

.article-body blockquote {
  margin: 0 0 1.5rem;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--accent-cyan);
  color: var(--text-secondary);
}

.article-body img,
.article-body video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0.5rem 0 1.5rem;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---------- Light theme ---------- */
[data-theme='light'] {
  --bg-primary: #f7f7f8;
  --bg-secondary: #ececef;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f3f6;
  --bg-elevated: #f1f1f4;

  --text-primary: #151518;
  --text-secondary: #52525b;
  --text-body: #27272a;
  --text-faint: #7b7b85;

  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --border-accent: rgba(37, 99, 235, 0.4);

  --shadow-lg: 0 24px 48px -24px rgba(15, 23, 42, 0.25);
  --glow-purple: 0 0 0 1px rgba(59, 130, 246, 0.4), 0 10px 32px -12px rgba(59, 130, 246, 0.35);
  --glow-cyan: 0 0 0 1px rgba(6, 182, 212, 0.35), 0 10px 32px -12px rgba(6, 182, 212, 0.3);

  /* Syntax highlight tokens (light) */
  --hl-comment: #6a737d;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-number: #0550ae;
  --hl-title: #953800;
  --hl-attr: #0550ae;
  --hl-built: #8250df;
  --hl-meta: #0550ae;
  --hl-name: #0550ae;
  --hl-var: #cf222e;
  --hl-literal: #0550ae;
}

[data-theme='light'] .site-header {
  background: rgba(247, 247, 248, 0.82);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme='light'] .site-header.is-scrolled {
  background: rgba(247, 247, 248, 0.94);
}

[data-theme='light'] .nav-links {
  background: rgba(247, 247, 248, 0.98);
}

[data-theme='light'] .terminal {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--border-strong);
}

[data-theme='light'] .pillar {
  background: rgba(255, 255, 255, 0.65);
}

[data-theme='light'] .hero-bg {
  opacity: 0.6;
}

[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: #c8c8cf;
}
