/* ===== Design tokens — set on :root, switched by [data-theme] and Tweaks ===== */
:root {
  /* Cool neutrals — light default */
  --bg: oklch(0.985 0.005 250);
  --bg-elev: oklch(0.97 0.006 250);
  --bg-card: oklch(1 0 0);
  --fg: oklch(0.16 0.01 250);
  --fg-mute: oklch(0.46 0.01 250);
  --fg-faint: oklch(0.65 0.01 250);
  --rule: oklch(0.88 0.008 250);
  --rule-strong: oklch(0.78 0.01 250);
  --grid: oklch(0.92 0.008 250);

  /* Accent — electric lime by default */
  --accent: oklch(0.78 0.18 145);
  --accent-fg: oklch(0.18 0.05 145);
  --accent-soft: oklch(0.92 0.08 145);

  /* Type */
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --font-serif: "Instrument Serif", "Times New Roman", serif;

  /* Density */
  --density: 1;
  --space-base: calc(8px * var(--density));
  --radius: 6px;

  /* Motion */
  --motion: 1;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: oklch(0.14 0.01 250);
  --bg-elev: oklch(0.18 0.012 250);
  --bg-card: oklch(0.20 0.013 250);
  --fg: oklch(0.96 0.005 250);
  --fg-mute: oklch(0.70 0.01 250);
  --fg-faint: oklch(0.50 0.01 250);
  --rule: oklch(0.28 0.012 250);
  --rule-strong: oklch(0.38 0.014 250);
  --grid: oklch(0.22 0.012 250);
  --accent-fg: oklch(0.14 0.04 145);
  --accent-soft: oklch(0.30 0.08 145);
}

/* Accent variants */
[data-accent="lime"] { --accent: oklch(0.82 0.18 145); --accent-fg: oklch(0.18 0.05 145); --accent-soft: oklch(0.92 0.08 145); }
[data-accent="cyan"] { --accent: oklch(0.78 0.14 220); --accent-fg: oklch(0.18 0.05 220); --accent-soft: oklch(0.92 0.06 220); }
[data-accent="amber"] { --accent: oklch(0.80 0.16 75); --accent-fg: oklch(0.20 0.05 75); --accent-soft: oklch(0.94 0.07 75); }
[data-accent="magenta"] { --accent: oklch(0.72 0.20 340); --accent-fg: oklch(0.18 0.05 340); --accent-soft: oklch(0.92 0.08 340); }
[data-accent="violet"] { --accent: oklch(0.72 0.16 290); --accent-fg: oklch(0.18 0.05 290); --accent-soft: oklch(0.92 0.07 290); }
[data-theme="dark"][data-accent="lime"] { --accent-soft: oklch(0.30 0.08 145); }
[data-theme="dark"][data-accent="cyan"] { --accent-soft: oklch(0.30 0.06 220); }
[data-theme="dark"][data-accent="amber"] { --accent-soft: oklch(0.32 0.07 75); }
[data-theme="dark"][data-accent="magenta"] { --accent-soft: oklch(0.30 0.08 340); }
[data-theme="dark"][data-accent="violet"] { --accent-soft: oklch(0.30 0.07 290); }

/* Font pairings */
[data-fontpair="modern"] { --font-display: "Inter Tight", system-ui, sans-serif; --font-body: "Inter", system-ui, sans-serif; }
[data-fontpair="editorial"] { --font-display: "Instrument Serif", serif; --font-body: "Inter", system-ui, sans-serif; }
[data-fontpair="techno"] { --font-display: "JetBrains Mono", ui-monospace, monospace; --font-body: "Inter", system-ui, sans-serif; }
[data-fontpair="grotesk"] { --font-display: "Space Grotesk", system-ui, sans-serif; --font-body: "Space Grotesk", system-ui, sans-serif; }

/* ===== Reset ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
::selection { background: var(--accent); color: var(--accent-fg); }

/* ===== Layout ===== */
.app {
  position: relative;
  min-height: 100vh;
}

/* Background grid */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 90%);
}

/* Cursor */
.cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9000;
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease), height 0.2s var(--ease), background 0.2s;
  mix-blend-mode: difference;
}
.cursor-ring {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 8999;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), opacity 0.2s;
}
.cursor-active .cursor-dot { width: 14px; height: 14px; }
.cursor-active .cursor-ring { width: 56px; height: 56px; }
@media (max-width: 768px) { .cursor-dot, .cursor-ring { display: none; } }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.topbar-mark .dot {
  width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in oklch, var(--accent) 0%, transparent); }
}
.topbar-meta { color: var(--fg-mute); display: flex; gap: 14px; }
.topbar-meta span::before { content: "·"; margin-right: 14px; color: var(--fg-faint); }
.topbar-meta span:first-child::before { display: none; }
.topbar nav {
  display: flex;
  gap: 4px;
}
.topbar nav a {
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--fg-mute);
  transition: color 0.2s, background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}
.topbar nav a:hover { color: var(--fg); background: var(--bg-elev); }
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--fg-mute);
  transition: all 0.2s;
  font-size: 11px;
}
.topbar-btn:hover { color: var(--fg); border-color: var(--rule-strong); background: var(--bg-elev); }
.topbar-btn.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }

/* ===== Section scaffolding ===== */
section.sec {
  position: relative;
  z-index: 1;
  padding: calc(80px * var(--density)) 32px;
  border-bottom: 1px solid var(--rule);
  max-width: 1440px;
  margin: 0 auto;
}
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.sec-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
}
.sec-tag .num {
  color: var(--accent-fg);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 10px;
  display: inline-block;
}
.sec-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}
.sec-subtitle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  text-align: right;
  max-width: 320px;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  z-index: 1;
  padding: clamp(40px, 6vw, 80px) 32px clamp(60px, 8vw, 120px);
  max-width: 1440px;
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: stretch;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-left { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--fg-mute);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  width: fit-content;
}
.hero-eyebrow .live {
  width: 6px; height: 6px; background: var(--accent); border-radius: 50%;
  animation: pulse 2s infinite;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(56px, 11vw, 160px);
  line-height: 0.86;
  letter-spacing: -0.045em;
  font-weight: 600;
  margin: 0;
}
.hero-name .first { display: block; }
.hero-name .last { display: block; color: var(--fg-mute); }
.hero-role {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
}
.hero-role .role-pill {
  padding: 4px 10px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.hero-typing {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.hero-typing .prompt { color: var(--accent-fg); background: var(--accent); padding: 2px 6px; border-radius: 3px; font-weight: 600; font-size: 11px; }
.hero-typing .caret { display: inline-block; width: 8px; height: 16px; background: var(--fg); animation: blink 1s steps(1) infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.4;
  color: var(--fg);
  max-width: 540px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.hero-tagline em { font-family: var(--font-serif); font-style: italic; color: var(--fg-mute); font-weight: 400; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 500;
  transition: all 0.2s var(--ease);
  background: var(--bg-card);
}
.btn:hover { border-color: var(--fg); transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); color: var(--accent-fg); border-color: var(--fg); }
.btn-arrow { transition: transform 0.2s; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* Hero portrait (right column) */
.hero-right { display: flex; flex-direction: column; gap: 16px; }
.portrait-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}
.portrait-frame {
  position: relative;
  flex: 1;
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-card) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.portrait-frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.portrait-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, color-mix(in oklch, var(--fg-mute) 8%, transparent) 8px 9px);
  color: var(--fg-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.08em;
  gap: 8px;
}
.portrait-placeholder .monogram {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.04em;
  line-height: 1;
}
.portrait-placeholder .label { color: var(--fg-faint); }
.portrait-meta {
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-mute);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portrait-meta .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.portrait-meta .key { color: var(--fg-faint); letter-spacing: 0.12em; }
.portrait-meta .val { color: var(--fg); font-weight: 500; }
.portrait-meta .val.ok { color: var(--accent-fg); background: var(--accent); padding: 1px 6px; border-radius: 3px; }

/* Hero stat strip */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.hero-stat {
  padding: 14px 16px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hero-stat:last-child { border-right: none; }
.hero-stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.hero-stat .l { font-family: var(--font-mono); font-size: 10px; color: var(--fg-mute); letter-spacing: 0.1em; text-transform: uppercase; }

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }
.about-text {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--fg);
  font-weight: 400;
  text-wrap: pretty;
}
.about-text strong { font-weight: 600; background: var(--accent-soft); padding: 0 4px; border-radius: 3px; }
.about-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.about-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
}
.about-card h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--fg-mute);
  margin: 0 0 12px;
  text-transform: uppercase;
}
.about-card .body {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.about-card .body small {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 0;
}
.about-meta-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
}
.about-meta-row:last-child { border-bottom: none; }
.about-meta-row .key { color: var(--fg-mute); letter-spacing: 0.06em; }
.about-meta-row .val { color: var(--fg); font-weight: 500; }

/* ===== Experience ===== */
.exp-list { display: flex; flex-direction: column; gap: 24px; }
.exp-card {
  display: grid;
  grid-template-columns: 220px 1fr 200px;
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.exp-card:first-child { border-top: none; padding-top: 0; }
@media (max-width: 800px) {
  .exp-card { grid-template-columns: 1fr; gap: 16px; }
}
.exp-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exp-period .pill {
  display: inline-flex;
  width: fit-content;
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  letter-spacing: 0.1em;
  color: var(--fg);
}
.exp-body h3 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.exp-body .company {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-fg);
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 14px;
}
.exp-body .summary {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 16px;
  color: var(--fg);
}
.exp-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exp-body li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-mute);
}
.exp-body li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-fg);
}
.exp-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tech-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 4px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.tech-chip:hover { color: var(--fg); border-color: var(--fg); background: var(--bg-card); }
.tech-chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ===== Projects ===== */
.proj-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--rule);
}
.proj-filters .filter-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.1em;
  margin-right: 8px;
  align-self: center;
  text-transform: uppercase;
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.proj-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 240px;
  overflow: hidden;
}
.proj-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), color-mix(in oklch, var(--accent) 12%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.proj-card:hover { border-color: var(--rule-strong); transform: translateY(-2px); }
.proj-card:hover::before { opacity: 1; }
.proj-card.featured { grid-column: span 4; min-height: 360px; }
.proj-card:not(.featured) { grid-column: span 2; }
@media (max-width: 1100px) { .proj-card.featured { grid-column: span 6; } .proj-card:not(.featured) { grid-column: span 3; } }
@media (max-width: 700px) { .proj-card { grid-column: span 6 !important; } }

.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.proj-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.16em;
}
.proj-metric {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-mute);
  text-align: right;
  letter-spacing: 0.06em;
}
.proj-metric .v {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent);
  padding: 0 6px;
  border-radius: 3px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  width: fit-content;
  margin-left: auto;
}
.proj-name {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 0;
}
.proj-card.featured .proj-name { font-size: clamp(36px, 4vw, 56px); }
.proj-tagline {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--fg-mute);
  line-height: 1.4;
  margin: -4px 0 0;
}
.proj-card.featured .proj-tagline { font-size: 17px; }
.proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}
.proj-card .tech-chip { font-size: 10px; padding: 3px 7px; }
.proj-cta {
  position: absolute;
  bottom: 22px;
  right: 22px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-mute);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s, transform 0.2s;
}
.proj-card:hover .proj-cta { color: var(--accent-fg); transform: translateX(3px); }

/* Featured project: extra detail */
.proj-card.featured .proj-extra {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  border-top: 1px dashed var(--rule);
  padding-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.proj-card.featured .proj-extra div span:first-child { color: var(--fg-faint); margin-right: 8px; letter-spacing: 0.1em; }

/* ===== Modal (case study) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: color-mix(in oklch, var(--fg) 60%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  max-width: 880px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s var(--ease-out);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  position: sticky; top: 0;
  background: var(--bg);
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  z-index: 1;
}
.modal-close {
  width: 36px; height: 36px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.modal-close:hover { border-color: var(--fg); background: var(--bg-elev); transform: rotate(90deg); }
.modal-body { padding: 24px 32px 32px; }
.modal-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1;
}
.modal-tagline {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--fg-mute);
  margin: 0;
}
.modal-section { margin-bottom: 28px; }
.modal-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  text-transform: uppercase;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.modal-section p {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
  color: var(--fg);
}
.modal-section ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.modal-section li {
  font-size: 14px; line-height: 1.5;
  position: relative; padding-left: 24px;
  color: var(--fg);
}
.modal-section li::before {
  content: ""; position: absolute; left: 8px; top: 9px;
  width: 6px; height: 6px; background: var(--accent); border-radius: 1px;
}
.modal-stack { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
@media (max-width: 800px) { .skills-grid { grid-template-columns: 1fr; } }
.skills-cat {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
}
.skills-cat h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  margin: 0 0 18px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.skills-cat h4 .count { color: var(--fg-faint); font-weight: 400; }
.skill-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 13px;
}
.skill-row:last-child { border-bottom: none; }
.skill-row .name { font-family: var(--font-mono); font-size: 12px; color: var(--fg); letter-spacing: 0.02em; }
.skill-row .bar {
  height: 6px;
  background: var(--bg-elev);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.skill-row .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  width: 0;
  transition: width 1.4s var(--ease-out);
  position: relative;
}
.skill-row .bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 4px, color-mix(in oklch, var(--accent-fg) 12%, transparent) 4px 5px);
}
.skill-row .level {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-mute);
  text-align: right;
  letter-spacing: 0.04em;
}

/* Pattern + methodology chips */
.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 16px; margin-top: 16px;
  border-top: 1px solid var(--rule);
}
.chip-row .chip-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-mute);
  margin-right: 8px;
  align-self: center;
  text-transform: uppercase;
}

/* ===== Education ===== */
.edu-list { display: flex; flex-direction: column; }
.edu-row {
  display: grid;
  grid-template-columns: 140px 1fr 200px;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  align-items: center;
}
.edu-row:first-child { border-top: none; }
@media (max-width: 700px) { .edu-row { grid-template-columns: 1fr; gap: 8px; } }
.edu-period { font-family: var(--font-mono); font-size: 13px; color: var(--fg-mute); }
.edu-row.current .edu-period::after {
  content: "● NOW";
  display: inline-block;
  margin-left: 8px;
  font-size: 9px;
  color: var(--accent-fg);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.1em;
  vertical-align: middle;
}
.edu-degree {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}
.edu-school { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mute); text-align: right; }

/* ===== Certifications ===== */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}
.cert-card:hover { border-color: var(--rule-strong); transform: translateY(-2px); }
.cert-card .head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: 0.06em;
}
.cert-card .name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.cert-card .issuer { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute); }
.cert-card .status {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--accent-fg); background: var(--accent);
  padding: 2px 6px; border-radius: 3px;
  letter-spacing: 0.1em;
  width: fit-content;
}

/* ===== Languages ===== */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) { .lang-grid { grid-template-columns: 1fr; } }
.lang-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lang-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.lang-level { font-family: var(--font-mono); font-size: 12px; color: var(--fg-mute); }
.lang-bar {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 2px;
  height: 18px;
}
.lang-bar div {
  background: var(--bg-elev);
  border-radius: 1px;
  transition: background 0.6s var(--ease);
}
.lang-bar div.on { background: var(--accent); }

/* ===== Now (editorial board) ===== */
.now-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.now-banner-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.now-banner-pulse {
  width: 10px; height: 10px; background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
.now-banner-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  text-transform: uppercase;
}
.now-banner-date {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: capitalize;
  color: var(--fg);
}
.now-banner-right { display: flex; gap: 8px; flex-wrap: wrap; }
.now-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.now-meta-pill span { color: var(--fg-faint); letter-spacing: 0.14em; }
.now-meta-pill b { color: var(--fg); font-weight: 600; }
.now-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1000px) { .now-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .now-cards { grid-template-columns: 1fr; } }
.now-card-v2 {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s;
  opacity: 0;
  animation: nowin 0.6s var(--ease-out) forwards;
}
@keyframes nowin { to { opacity: 1; transform: none; } from { opacity: 0; transform: translateY(12px); } }
.now-card-v2:hover { transform: translateY(-3px); border-color: var(--rule-strong); }
.now-card-v2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
.now-card-v2:hover::before { transform: scaleX(1); }
.now-card-corner {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 14px; height: 14px;
  border-right: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  opacity: 0.5;
}
.now-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
}
.now-card-icon {
  font-size: 18px;
  color: var(--accent-fg);
  background: var(--accent);
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}
.now-card-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--fg-mute);
  text-transform: uppercase;
  flex: 1;
}
.now-card-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.1em;
}
.now-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.25;
  margin: 0;
  color: var(--fg);
  text-wrap: balance;
}
.now-card-detail {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-mute);
  margin: 0;
  text-wrap: pretty;
}
.now-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
}
.now-card-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-elev);
  border-radius: 100px;
  overflow: hidden;
}
.now-card-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  position: relative;
}
.now-card-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 4px, color-mix(in oklch, var(--accent-fg) 12%, transparent) 4px 5px);
}

/* ===== Testimonials ===== */
.testim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .testim-grid { grid-template-columns: 1fr; } }
.testim-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}
.testim-card .mark {
  font-family: var(--font-serif);
  font-size: 56px;
  line-height: 0.5;
  color: var(--accent);
  height: 24px;
}
.testim-card blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.5;
  color: var(--fg);
  font-weight: 400;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.testim-card footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  border-top: 1px dashed var(--rule);
  padding-top: 12px;
  margin-top: auto;
}
.testim-card footer strong { color: var(--fg); font-weight: 600; }

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-headline {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.35;
  margin: 0 0 24px;
}
.contact-headline em { font-family: var(--font-serif); font-style: italic; color: var(--fg-mute); font-weight: 400; }
.contact-headline .accent {
  color: var(--accent-fg);
  background: var(--accent);
  padding: 0 10px;
  border-radius: 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-side {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.contact-side .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
}
.contact-side .row:last-child { border-bottom: none; }
.contact-side .key { color: var(--fg-mute); letter-spacing: 0.06em; }
.contact-side .val { color: var(--fg); font-weight: 500; }
.contact-side .val.copyable { cursor: pointer; transition: color 0.2s; }
.contact-side .val.copyable:hover { color: var(--accent-fg); background: var(--accent); padding: 1px 6px; border-radius: 3px; }

/* ===== Contact form — refined ===== */
.contact-intro {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.contact-intro::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--accent);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.contact-form::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--accent);
}
.contact-form::after {
  content: "// CONTACT.FORM";
  position: absolute;
  top: 14px;
  right: 18px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--fg-faint);
}
.cf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .cf-grid { grid-template-columns: 1fr; } }
.cf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.cf-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cf-label::before {
  content: "›";
  color: var(--accent-fg);
  background: var(--accent);
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
}
.cf-label em {
  font-style: normal;
  color: oklch(0.62 0.18 25);
  text-transform: none;
  letter-spacing: 0.04em;
  margin-left: auto;
}
.cf-field input,
.cf-field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.cf-field textarea {
  min-height: 130px;
  line-height: 1.55;
  font-family: var(--font-body);
  font-size: 14px;
}
.cf-field input::placeholder,
.cf-field textarea::placeholder {
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}
.cf-field textarea::placeholder {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
}
.cf-field input:focus,
.cf-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 4%, var(--bg));
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.cf-field.err input,
.cf-field.err textarea {
  border-color: oklch(0.65 0.18 25);
}
.cf-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--rule);
  margin-top: 4px;
  padding-top: 18px;
}
.cf-status {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.cf-status.ok { color: var(--accent-fg); background: var(--accent); padding: 6px 12px; border-radius: 4px; font-weight: 600; }
.cf-status.err { color: oklch(0.65 0.18 25); }

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  padding: 40px 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  border-top: 1px solid var(--rule);
  letter-spacing: 0.04em;
  max-width: 1440px;
  margin: 0 auto;
}

/* ===== Terminal easter egg ===== */
.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: color-mix(in oklch, oklch(0 0 0) 60%, transparent);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeIn 0.2s var(--ease);
}
.terminal {
  width: 100%;
  max-width: 720px;
  background: oklch(0.16 0.01 250);
  color: oklch(0.95 0.005 250);
  border-radius: var(--radius);
  border: 1px solid oklch(0.30 0.01 250);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.25s var(--ease-out);
}
.terminal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: oklch(0.20 0.01 250);
  border-bottom: 1px solid oklch(0.30 0.01 250);
}
.terminal-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-head .r { background: oklch(0.65 0.18 25); }
.terminal-head .y { background: oklch(0.80 0.16 80); }
.terminal-head .g { background: oklch(0.78 0.18 145); }
.terminal-head .title { margin-left: 12px; color: oklch(0.65 0.01 250); font-size: 11px; letter-spacing: 0.06em; }
.terminal-body {
  padding: 16px;
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.terminal-line { white-space: pre-wrap; word-break: break-word; }
.terminal-line.cmd { color: oklch(0.95 0.005 250); }
.terminal-line.cmd::before { content: "λ "; color: oklch(0.78 0.18 145); }
.terminal-line.out { color: oklch(0.78 0.01 250); padding-left: 14px; }
.terminal-line.err { color: oklch(0.72 0.16 25); padding-left: 14px; }
.terminal-line.acc { color: oklch(0.78 0.18 145); }
.terminal-input-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
.terminal-input-row span { color: oklch(0.78 0.18 145); }
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: oklch(0.95 0.005 250);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  caret-color: oklch(0.78 0.18 145);
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(calc(20px * var(--motion)));
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }

/* Reduce motion override (animation intensity 0) */
[data-motion="0"] .reveal { transition: none; }
[data-motion="0"] .skill-row .bar-fill { transition: none; }
[data-motion="0"] .topbar-mark .dot { animation: none; }

/* Hide tweaks default by spec */
[data-tweaks="off"] .tweaks-floating { display: none; }

/* ===== Hero variant: stats-led ===== */
[data-hero="stats"] .hero-grid { grid-template-columns: 1fr; }
[data-hero="stats"] .hero-right { display: none; }
[data-hero="stats"] .hero-name { font-size: clamp(80px, 16vw, 240px); }

[data-hero="manifesto"] .hero-grid { grid-template-columns: 1fr; }
[data-hero="manifesto"] .hero-right { display: none; }
[data-hero="manifesto"] .hero-name { font-size: clamp(40px, 6vw, 96px); }
[data-hero="manifesto"] .hero-tagline {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 56px);
  font-style: italic;
  line-height: 1.15;
  max-width: 100%;
}

/* Density */
[data-density="compact"] { --density: 0.75; }
[data-density="cozy"] { --density: 1; }
[data-density="comfortable"] { --density: 1.25; }

/* utility */
.muted { color: var(--fg-mute); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }

/* ===========================================================
   RESPONSIVE — refined fluid system (PC / Tablet / Phone)
   =========================================================== */

/* ---- Fluid spacing tokens ---- */
:root {
  --pad-x: clamp(16px, 4vw, 32px);
  --section-pad-y: clamp(48px, 9vw, 80px);
  --topbar-h: 56px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 900px) {
  :root { --topbar-h: 100px; } /* nav wraps to its own row */
}

body { text-rendering: optimizeLegibility; }

/* Apply fluid horizontal padding to the main wrappers */
.topbar { padding-left: var(--pad-x); padding-right: var(--pad-x); }
.hero,
section.sec,
.footer {
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* Fluid vertical padding for sections (preserves --density) */
section.sec {
  padding-top: calc(var(--section-pad-y) * var(--density));
  padding-bottom: calc(var(--section-pad-y) * var(--density));
}

/* Safe-area-inset support for notched phones */
@supports (padding: env(safe-area-inset-left)) {
  .topbar,
  .hero,
  section.sec,
  .footer {
    padding-left: max(var(--pad-x), env(safe-area-inset-left));
    padding-right: max(var(--pad-x), env(safe-area-inset-right));
  }
}

/* Better headline wrapping */
.sec-title,
.hero-name,
.hero-tagline,
.contact-headline,
.proj-name,
.exp-body h3,
.modal-name,
.now-card-title { text-wrap: balance; }

/* Cleaner accessible focus rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.tech-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ===========================================================
   TOPBAR — graceful 3-tier responsive
   =========================================================== */

/* Small desktop / large tablet — drop the meta strip */
@media (max-width: 1100px) {
  .topbar-meta { display: none; }
  .topbar nav { gap: 2px; }
  .topbar nav a { padding: 6px 8px; font-size: 10.5px; }
}

/* Tablet & below — wrap nav onto its own scrollable row */
@media (max-width: 900px) {
  .topbar {
    padding-top: 10px;
    padding-bottom: 0;
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 0;
  }
  .topbar-left { flex: 1; min-width: 0; }
  .topbar-right { gap: 6px; flex-shrink: 0; }
  .topbar nav {
    order: 99;
    width: calc(100% + var(--pad-x) * 2);
    margin: 4px calc(var(--pad-x) * -1) 0;
    padding: 8px var(--pad-x) 10px;
    border-top: 1px dashed var(--rule);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    /* Subtle gradient mask edges hint at scrollability */
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex-shrink: 0; white-space: nowrap; }
}

/* Phone — compact topbar */
@media (max-width: 480px) {
  .topbar { font-size: 11px; padding-top: 8px; }
  .topbar-mark { gap: 8px; }
  .topbar-mark .dot {
    width: 6px; height: 6px;
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 25%, transparent);
  }
  .topbar-mark span:not(.dot) { font-size: 11px; letter-spacing: 0.08em; }
  .topbar-btn { padding: 6px 8px; font-size: 10px; gap: 4px; }
}

/* Very small phones — hide brand text, keep dot only */
@media (max-width: 340px) {
  .topbar-mark span:not(.dot) { display: none; }
}

/* ===========================================================
   SECTION HEADS — stack on phone
   =========================================================== */
@media (max-width: 700px) {
  .sec-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 12px;
  }
  .sec-subtitle {
    text-align: left;
    max-width: 100%;
    font-size: 11.5px;
  }
}

/* ===========================================================
   HERO — refined for every width
   =========================================================== */
@media (max-width: 900px) {
  .hero { padding-top: clamp(28px, 6vw, 60px); padding-bottom: clamp(48px, 8vw, 80px); }
  .hero-grid { gap: 32px; }
  .portrait-card { min-height: 320px; }
}

@media (max-width: 700px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { padding: 12px 14px; }
  .hero-stat:nth-child(2n) { border-right: none; }
  .hero-stat:nth-child(1),
  .hero-stat:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .hero-stat .v { font-size: 24px; }
  .hero-stat .l { font-size: 9.5px; }

  .hero-grid { gap: 28px; }
  .portrait-card { min-height: 260px; }
  .portrait-placeholder .monogram { font-size: 64px; }
  .portrait-meta { font-size: 10px; padding: 12px 14px; gap: 4px; }

  .hero-actions .btn { padding: 10px 14px; font-size: 11px; }
}

@media (max-width: 480px) {
  .hero-eyebrow { font-size: 10px; padding: 5px 10px; gap: 8px; }
  .hero-name {
    font-size: clamp(44px, 14vw, 80px);
    letter-spacing: -0.04em;
    line-height: 0.9;
  }
  .hero-role { font-size: 12px; gap: 10px; }
  .hero-tagline { font-size: clamp(15px, 4.4vw, 19px); }
  .hero-typing { font-size: 12px; }

  .hero-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .hero-actions .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 0;
  }
  .hero-actions .btn:first-child { flex-basis: 100%; }
}

/* ===========================================================
   ABOUT
   =========================================================== */
@media (max-width: 900px) {
  .about-grid { gap: 32px; }
}
@media (max-width: 700px) {
  .about-text { font-size: clamp(17px, 4.4vw, 22px); }
  .about-card { padding: 16px; }
  .about-card .body { font-size: 16px; }
  .about-meta-row { font-size: 10.5px; padding: 7px 0; }
}

/* ===========================================================
   EXPERIENCE
   =========================================================== */
@media (max-width: 800px) {
  .exp-card { padding: 24px 0; gap: 14px; }
  .exp-period {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
  }
  .exp-body h3 { font-size: clamp(20px, 5.2vw, 26px); }
  .exp-body .summary { font-size: 15px; line-height: 1.45; }
  .exp-body li { font-size: 13.5px; }
  .exp-stack { gap: 5px; }
}

/* ===========================================================
   PROJECTS
   =========================================================== */

/* Tablet — 2 across (featured spans full row) */
@media (max-width: 1100px) and (min-width: 701px) {
  .proj-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  .proj-card.featured { grid-column: span 4; min-height: 280px; }
  .proj-card:not(.featured) { grid-column: span 2; min-height: 220px; }
}

/* Phone — single column */
@media (max-width: 700px) {
  .proj-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .proj-card {
    grid-column: span 1 !important;
    min-height: 180px;
    padding: 20px;
  }
  .proj-card.featured {
    min-height: 220px;
  }
  .proj-card.featured .proj-name { font-size: clamp(28px, 8vw, 40px); }
  .proj-name { font-size: clamp(22px, 6vw, 30px); }
  .proj-card.featured .proj-extra { grid-template-columns: 1fr; gap: 6px; }
  .proj-cta { bottom: 18px; right: 18px; font-size: 9.5px; }

  /* Filters: horizontally scrollable strip with edge fade */
  .proj-filters {
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 14px;
    margin-left: calc(var(--pad-x) * -1);
    margin-right: calc(var(--pad-x) * -1);
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
  .proj-filters::-webkit-scrollbar { display: none; }
  .proj-filters .filter-label { margin-right: 4px; flex-shrink: 0; align-self: center; }
  .proj-filters .tech-chip { flex-shrink: 0; }
}

/* ===========================================================
   SKILLS
   =========================================================== */
@media (max-width: 800px) {
  .skills-grid { gap: 16px; }
}
@media (max-width: 700px) {
  .skills-cat { padding: 18px; }
  .skill-row {
    grid-template-columns: 110px 1fr 38px;
    gap: 10px;
    font-size: 12px;
  }
  .skill-row .name { font-size: 11.5px; }
  .skill-row .level { font-size: 9.5px; }
  .skills-cat h4 { font-size: 10px; margin-bottom: 14px; }
}
@media (max-width: 380px) {
  .skill-row {
    grid-template-columns: 88px 1fr 30px;
    gap: 8px;
  }
  .skill-row .name { font-size: 10.5px; }
}

/* ===========================================================
   EDUCATION
   =========================================================== */
@media (max-width: 700px) {
  .edu-row { padding: 18px 0; gap: 6px; }
  .edu-school { text-align: left; font-size: 11px; }
  .edu-period { font-size: 12px; }
}

/* ===========================================================
   CERTIFICATIONS
   =========================================================== */
@media (max-width: 1100px) and (min-width: 701px) {
  .certs-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
}
@media (max-width: 700px) {
  .certs-grid { grid-template-columns: 1fr; gap: 10px; }
  .cert-card { padding: 16px; gap: 6px; }
  .cert-card .name { font-size: 16px; }
}

/* ===========================================================
   LANGUAGES
   =========================================================== */
@media (max-width: 700px) {
  .lang-card { padding: 18px; gap: 12px; }
  .lang-name { font-size: 24px; }
  .lang-bar { height: 14px; }
}

/* ===========================================================
   NOW
   =========================================================== */
/* Wide tablet — 3 columns */
@media (max-width: 1200px) and (min-width: 1001px) {
  .now-cards { grid-template-columns: repeat(3, 1fr); }
}
/* Phone — banner stacks */
@media (max-width: 700px) {
  .now-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
  }
  .now-banner-date { font-size: 22px; }
  .now-banner-right { gap: 6px; }
  .now-meta-pill { padding: 5px 10px; font-size: 10px; }
  .now-card-v2 { padding: 18px 18px 20px; min-height: auto; }
  .now-card-title { font-size: 17px; }
  .now-card-detail { font-size: 13px; }
}

/* ===========================================================
   TESTIMONIALS
   =========================================================== */
@media (max-width: 1100px) and (min-width: 901px) {
  .testim-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .testim-card { padding: 22px; gap: 14px; }
  .testim-card blockquote { font-size: 15.5px; }
}

/* ===========================================================
   CONTACT
   =========================================================== */
@media (max-width: 800px) {
  .contact-grid { gap: 24px; }
  .contact-headline {
    font-size: clamp(36px, 9vw, 64px);
    line-height: 1.1;
    margin-bottom: 18px;
  }
  .contact-headline br { display: none; }
}

@media (max-width: 600px) {
  .contact-form { padding: 22px 18px; gap: 14px; }
  .contact-form::after { display: none; }
  .contact-form::before { width: 3px; }
  .cf-grid { gap: 12px; }
  .cf-actions { gap: 10px; }
  .cf-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .contact-side { padding: 18px; }
  .contact-side .row { font-size: 11px; }
  .contact-actions { gap: 8px; }
  .contact-actions .btn {
    font-size: 11px;
    padding: 9px 12px;
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 0;
  }
}

/* ===========================================================
   MODAL — mobile-friendly
   =========================================================== */
@media (max-width: 700px) {
  .modal-overlay { padding: 12px; }
  .modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 10px;
  }
  .modal-head {
    padding: 18px 20px 14px;
    gap: 12px;
  }
  .modal-body { padding: 16px 20px 28px; }
  .modal-name { font-size: clamp(22px, 6vw, 32px); }
  .modal-tagline { font-size: 14px; }
  .modal-section { margin-bottom: 22px; }
  .modal-section h4 { font-size: 9.5px; }
  .modal-section p { font-size: 15px; line-height: 1.5; }
  .modal-section li { font-size: 13.5px; }
  .modal-close { width: 32px; height: 32px; font-size: 14px; }
}

/* ===========================================================
   FOOTER
   =========================================================== */
@media (max-width: 600px) {
  .footer { font-size: 10.5px; padding: 32px var(--pad-x); line-height: 1.7; }
}

/* ===========================================================
   TERMINAL OVERLAY — phone safety
   =========================================================== */
@media (max-width: 600px) {
  .terminal-overlay { padding: 12px; }
  .terminal { font-size: 12px; }
  .terminal-body { height: 60vh; height: 60dvh; padding: 12px; }
}

/* ===========================================================
   TWEAKS PANEL — keep editor controls usable on small viewports
   =========================================================== */
@media (max-width: 480px) {
  .twk-panel {
    width: calc(100vw - 16px) !important;
    right: 8px !important;
    bottom: 8px !important;
    max-height: 60vh !important;
  }
}

/* ===========================================================
   TOUCH / POINTER POLISH
   =========================================================== */

/* Disable hover-only transforms on touch devices (sticky-tap fix) */
@media (hover: none) {
  .cursor-dot,
  .cursor-ring { display: none !important; }

  .proj-card:hover { transform: none; border-color: var(--rule); }
  .cert-card:hover { transform: none; border-color: var(--rule); }
  .now-card-v2:hover { transform: none; border-color: var(--rule); }
  .btn:hover { transform: none; }
  .modal-close:hover { transform: none; }
  .proj-card:hover::before { opacity: 0; }
  .now-card-v2:hover::before { transform: scaleX(0); }

  /* Active state instead of hover for the chip mouse-glow */
  .proj-card:active::before { opacity: 1; }
}

/* Larger tap targets on coarse pointers */
@media (pointer: coarse) {
  .topbar-btn { min-height: 34px; }
  .btn { min-height: 40px; }
  .tech-chip { padding-top: 6px; padding-bottom: 6px; }
  .topbar nav a { min-height: 32px; display: inline-flex; align-items: center; }
  .modal-close { width: 40px; height: 40px; }
  .contact-side .val.copyable { padding: 4px 6px; margin: -4px -6px; border-radius: 3px; }
}

/* ===========================================================
   REDUCED MOTION
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .hero-typing .caret { animation: none; }
  .topbar-mark .dot { animation: none; }
  .now-banner-pulse { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .now-card-v2 { opacity: 1; transform: none; animation: none; }
}

/* ===========================================================
   PRINT — clean résumé output
   =========================================================== */
@media print {
  .topbar, .footer, .bg-grid, .cursor-dot, .cursor-ring,
  .twk-panel, .terminal-overlay, .modal-overlay { display: none !important; }
  body { background: #fff; color: #000; }
  section.sec, .hero { padding: 24px 0; max-width: none; border-bottom: 1px solid #ccc; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { color: #000; text-decoration: underline; }
}
