/* ---------- Tokens ---------- */
:root {
  --bg: #0A0A0A;
  --bg-2: #141414;
  --bg-3: #1A1A1A;
  --border: #1F1F1F;
  --border-2: #2A2A2A;
  --cyan: #FFFFFF;
  --cyan-dim: rgba(255, 255, 255, 0.5);
  --cyan-faint: rgba(255, 255, 255, 0.12);
  --green: #A3A3A3;
  --green-dim: rgba(180, 180, 180, 0.6);
  --warn: #FFFFFF;
  --text: #F5F5F5;
  --text-2: #9CA3AF;
  --muted: #525252;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.008) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.008) 1px, transparent 1px);
  background-size: 160px 160px, 160px 160px, 32px 32px, 32px 32px;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 80% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(180, 180, 180, 0.025), transparent 60%);
  z-index: 0;
}
#root { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--cyan); color: #000; }

/* Safety net: nothing may cause sideways scroll on phones */
html, body { overflow-x: clip; }

/* Custom scrollbar — matches the dark theme */
html { scrollbar-width: thin; scrollbar-color: #2e2e2e var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; }

/* Anchored sections land clear of the fixed nav */
section[id] { scroll-margin-top: 84px; }

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 768px) { .container { padding: 0 20px; } }

section { padding: 120px 0; position: relative; }
@media (max-width: 768px) { section { padding: 72px 0; } }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--cyan);
  display: inline-block;
}

h2.section-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 16px;
}
.section-sub { color: var(--text-2); font-size: 17px; max-width: 620px; line-height: 1.6; }

/* ---------- Circuit signal flow (Hero side visual) ---------- */
.circuit-wrap {
  position: absolute; right: 32px; top: 50%; transform: translateY(-50%);
  width: 400px; height: 400px;
  z-index: 1;
  pointer-events: none;
}
@media (max-width: 1180px) { .circuit-wrap { display: none; } }
.circuit-wrap svg { width: 100%; height: 100%; display: block; }

/* ---------- Programming language cards ---------- */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
@media (max-width: 600px) { .lang-grid { grid-template-columns: repeat(2, 1fr); } }
.lang-card {
  border: 1px solid var(--border-2); border-radius: 10px;
  padding: 10px 8px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; background: var(--bg-3); transition: all .2s ease;
}
.lang-card:hover { border-color: var(--cyan); background: rgba(255, 255, 255,0.06); transform: translateY(-2px); }
.lang-card svg { width: 32px; height: 32px; }
.lang-card .lang-name { font-family: var(--font-mono); font-size: 10px; color: var(--text); letter-spacing: 0.02em; }
.lang-card .lang-prof { width: 100%; height: 3px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.lang-card .lang-prof span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); }

/* The Programming Languages skill card spans 2 columns for the icon grid */
.skill-cat.lang-cat { grid-column: span 2; }
@media (max-width: 1100px) { .skill-cat.lang-cat { grid-column: span 2; } }
@media (max-width: 600px) { .skill-cat.lang-cat { grid-column: span 1; } }

/* ---------- Nav ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--text); color: #000;
  padding: 10px 16px; font-family: var(--font-mono); font-size: 13px;
  border-radius: 6px; z-index: 100001;
}
.skip-link:focus { left: 16px; top: 16px; }

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(10, 10, 10, 0.7);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-progress {
  position: absolute; left: 0; bottom: -1px; height: 1px;
  background: var(--text); width: 0;
  transition: width .15s linear;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--text); }
.nav-links { display: flex; gap: 4px; font-family: var(--font-mono); font-size: 12px; }
.nav-links a { padding: 8px 12px; border-radius: 6px; color: var(--text-2); transition: color .2s ease, background .2s ease; position: relative; }
.nav-links a:hover { color: var(--text); background: var(--bg-2); }
.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 1px; background: var(--text);
}
.nav-links .num { color: var(--cyan); margin-right: 6px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-cta {
  font-family: var(--font-mono); font-size: 12px; padding: 8px 14px; border: 1px solid var(--border-2); border-radius: 999px;
  background: transparent; color: var(--text); transition: all .2s ease;
}
.nav-cta:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 16px rgba(255, 255, 255,0.1); }

/* Language switcher in nav (desktop) */
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  padding: 7px 10px; border: 1px solid var(--border-2);
  border-radius: 999px; background: transparent;
  color: var(--text-2); transition: all .2s ease;
  letter-spacing: 0.04em;
}
.lang-switch:hover { border-color: var(--cyan); color: var(--cyan); }
.lang-switch svg { opacity: 0.85; }
.lang-switch-code { font-weight: 500; letter-spacing: 0.08em; }

/* Language switcher in mobile drawer */
.lang-switch-drawer {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 8px; border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-display); font-size: 22px; font-weight: 500;
  letter-spacing: -0.01em;
  transition: color .15s ease, padding-left .2s ease;
}
.lang-switch-drawer:hover { color: var(--text); padding-left: 16px; }
.lang-switch-drawer svg { color: var(--text-2); flex-shrink: 0; }
.lang-switch-drawer .lbl { flex: 1; }
.lang-switch-drawer .num { font-family: var(--font-mono); font-size: 10px; color: var(--cyan); letter-spacing: 0.1em; min-width: 24px; text-align: right; }

@media (max-width: 900px) {
  .lang-switch { display: none; }
}

.nav-burger {
  display: none; background: transparent; border: 1px solid var(--border-2);
  border-radius: 8px; width: 40px; height: 40px;
  flex-direction: column; gap: 4px; justify-content: center; align-items: center;
  cursor: pointer; transition: border-color .2s ease;
}
.nav-burger:hover { border-color: var(--text-2); }
.nav-burger span { display: block; width: 16px; height: 1.5px; background: var(--text); }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-burger { display: flex; }
}

/* Mobile drawer */
.nav-drawer {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.nav-drawer.open { opacity: 1; pointer-events: auto; }
.nav-drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(380px, 90vw);
  background: var(--bg); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.5,0,.2,1);
  padding: 20px;
}
.nav-drawer.open .nav-drawer-panel { transform: none; }
.nav-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.nav-drawer-close {
  background: transparent; border: 1px solid var(--border-2);
  border-radius: 8px; width: 36px; height: 36px;
  display: grid; place-items: center; color: var(--text); cursor: pointer;
  transition: border-color .2s ease;
}
.nav-drawer-close:hover { border-color: var(--text); }
.nav-drawer-links { display: flex; flex-direction: column; padding: 20px 0; flex: 1; }
.nav-drawer-links a {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 8px; border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-display); font-size: 22px; font-weight: 500;
  letter-spacing: -0.01em;
  transition: color .15s ease, padding-left .2s ease;
}
.nav-drawer-links a:hover { color: var(--text); padding-left: 16px; }
.nav-drawer-links a.is-active { color: var(--text); }
.nav-drawer-links a.is-active .num { color: var(--cyan); }
.nav-drawer-links .num { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.1em; min-width: 24px; }
.nav-drawer-links .lbl { flex: 1; }
.nav-drawer-links svg { color: var(--muted); }
.nav-drawer-foot { padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border-2);
  color: var(--text); display: grid; place-items: center;
  cursor: pointer; transition: all .2s ease;
  animation: btt-in .25s ease;
}
.back-to-top:hover { border-color: var(--text); transform: translateY(-2px); }
@keyframes btt-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .back-to-top { right: 16px; bottom: 16px; } }

/* ---------- Focus rings (accessibility) ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn:focus-visible, .nav-cta:focus-visible, .nav-burger:focus-visible {
  outline-offset: 4px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .stagger-char { transform: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 999px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; transition: all .25s ease; border: 1px solid transparent; position: relative; overflow: hidden; }
.btn-primary { background: var(--cyan); color: #000; box-shadow: 0 0 0 rgba(255, 255, 255,0); }
.btn-primary:hover { box-shadow: 0 0 32px rgba(255, 255, 255,0.18); transform: translateY(-1px); }
.btn-ghost { border-color: var(--border-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-icon svg { width: 14px; height: 14px; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero { padding: 0; min-height: 100vh; display: flex; align-items: center; position: relative; overflow: hidden; }
/* svh tracks the real visible height when mobile browser bars show/hide */
@supports (min-height: 100svh) { .hero { min-height: 100svh; } }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg svg { width: 100%; height: 100%; }
.hero-gradient { position: absolute; inset: 0; background: radial-gradient(ellipse 70% 45% at 30% 50%, rgba(255, 255, 255,0.06), transparent 70%); pointer-events: none; }
.hero-vignette { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, var(--bg) 100%); pointer-events: none; }
.hero-content { position: relative; z-index: 2; padding-top: 64px; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
}
.hero h1 .accent { color: var(--cyan); text-shadow: 0 0 28px rgba(255, 255, 255,0.18); }
/* ---------- Hero typography (editorial) ---------- */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.stagger-name {
  font-family: var(--font-display);
  font-size: clamp(56px, 10vw, 120px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 28px;
  display: flex; flex-wrap: wrap;
  column-gap: 0.24em;
}
/* Chars are grouped per word so lines only break between words */
.stagger-word { display: inline-flex; }
.stagger-char-mask {
  display: inline-block; overflow: hidden;
  vertical-align: bottom; line-height: 1;
}
.stagger-char {
  display: inline-block;
  transform: translateY(110%);
  animation: charReveal 0.9s both cubic-bezier(.66,0,.2,1);
}
@keyframes charReveal {
  from { transform: translateY(110%); }
  to   { transform: translateY(0); }
}

.hero-role {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  opacity: 0;
  animation: heroFadeUp 0.7s 0.85s both cubic-bezier(.4,0,.2,1);
}

.tagline {
  opacity: 0;
  animation: heroFadeUp 0.7s 1s both cubic-bezier(.4,0,.2,1);
}
.hero-cta {
  opacity: 0;
  animation: heroFadeUp 0.7s 1.15s both cubic-bezier(.4,0,.2,1);
}
.hero-socials {
  opacity: 0;
  animation: heroFadeUp 0.7s 1.25s both cubic-bezier(.4,0,.2,1);
}

@media (max-width: 700px) {
  /* Flow layout on phones: no vh-centering (mobile URL bars shift 100vh),
     and the stats strip follows the content instead of overlapping it. */
  .hero { min-height: 0; display: block; padding: 104px 0 56px; }
  .hero-content { padding-top: 0; }
  .stagger-name { font-size: clamp(38px, 13vw, 56px); }
  .tagline { font-size: 16px; }
}

/* Old typing role styles (kept for backward compat, unused) */
.role-line { display: none; }
.tagline { color: var(--text-2); font-size: 18px; max-width: 540px; line-height: 1.55; margin-bottom: 36px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }
.hero-socials { display: flex; gap: 10px; }
.hero-socials a {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-2); display: grid; place-items: center;
  color: var(--text-2); transition: all .2s ease;
}
.hero-socials a:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); box-shadow: 0 0 16px rgba(255, 255, 255,0.12); }
.hero-socials svg { width: 16px; height: 16px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr; }
.bio { max-width: 820px; }
.bio p { color: var(--text-2); font-size: 17px; line-height: 1.7; margin: 0 0 18px; }
.bio .lead { color: var(--text); font-size: 19px; }
.bio b { color: var(--text); font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 40px; }
.stat {
  border: 1px solid var(--border); border-radius: 12px; padding: 22px; background: var(--bg-2); position: relative; overflow: hidden;
  transition: border-color .25s ease;
}
.stat:hover { border-color: var(--cyan); }
.stat-num { font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1; color: var(--text); letter-spacing: -0.02em; }
.stat-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); margin-top: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat::after { content: ""; position: absolute; right: -20px; bottom: -20px; width: 80px; height: 80px; background: radial-gradient(circle, var(--cyan-faint), transparent 70%); opacity: 0; transition: opacity .25s ease; }
.stat:hover::after { opacity: 1; }

/* ---------- Skills ---------- */
.skills-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 24px; margin-bottom: 56px; }
.skills-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .skills-grid { grid-template-columns: 1fr; } }

.skill-cat {
  border: 1px solid var(--border); border-radius: 16px; padding: 24px; background: var(--bg-2);
  position: relative; overflow: hidden; transition: all .3s ease;
}
.skill-cat:hover { border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(255, 255, 255,0.4); transform: translateY(-2px); }
.skill-cat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.skill-cat-icon { width: 48px; height: 48px; }
.skill-cat-tag { font-family: var(--font-mono); font-size: 10px; color: var(--muted); border: 1px solid var(--border-2); padding: 3px 8px; border-radius: 4px; }
.skill-cat-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.skill-cat-desc { font-size: 13px; color: var(--text-2); margin: 0 0 16px; line-height: 1.5; }
.skill-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-family: var(--font-mono); font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text-2); transition: all .2s ease;
}
.skill-cat:hover .pill { color: var(--text); }
.pill.cyan { border-color: var(--cyan-dim); color: var(--cyan); background: rgba(255, 255, 255,0.06); }

/* ---------- Projects (case-study rows: visual | content, alternating) ---------- */
.projects-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
.project-card {
  border: 1px solid var(--border); border-radius: 18px; background: var(--bg-2);
  overflow: hidden; position: relative; cursor: pointer;
  transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease;
  display: grid; grid-template-columns: 1.15fr 1fr;
}
.project-card:nth-child(even) { grid-template-columns: 1fr 1.15fr; }
.project-card:nth-child(even) .project-thumb { order: 2; border-right: none; border-left: 1px solid var(--border); }

.project-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.35);
  transform: translateY(-3px);
}
.project-thumb {
  position: relative; overflow: hidden; min-height: 340px;
  border-right: 1px solid var(--border);
  background: linear-gradient(135deg, #0E1518, #0A0A0A);
}
.project-thumb svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transition: transform .7s cubic-bezier(.2, .6, .2, 1);
}
.project-card:hover .project-thumb svg { transform: scale(1.04); }
.project-thumb-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(10,10,10,0.65)); }
.project-badge {
  position: absolute; top: 14px; left: 14px; font-family: var(--font-mono); font-size: 10px;
  padding: 4px 10px; border-radius: 999px; background: rgba(10,10,10,0.7); border: 1px solid var(--border-2);
  display: inline-flex; align-items: center; gap: 6px; color: var(--text);
  backdrop-filter: blur(8px);
}
.project-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.project-badge.live .dot { background: var(--green); box-shadow: 0 0 4px rgba(212,212,212,0.5); }
.project-badge.wip .dot { background: #D4D4D4; box-shadow: 0 0 8px #D4D4D4; }
.project-badge.arch .dot { background: #60A5FA; }

.project-id {
  position: absolute; top: 14px; right: 14px; font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.1em;
}
.project-body { padding: 40px 44px; display: flex; flex-direction: column; justify-content: center; }
.project-index { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.14em; margin-bottom: 16px; }
.project-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.015em; line-height: 1.15; }
.project-desc { color: var(--text-2); font-size: 15px; line-height: 1.65; margin: 0 0 22px; }
.project-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.project-actions { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 12px; }
.proj-link { color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; transition: color .2s ease; }
.proj-link:hover { color: var(--cyan); }
.proj-link.primary { color: var(--cyan); }
.proj-link svg { width: 12px; height: 12px; transition: transform .25s ease; }
.project-card:hover .proj-link.primary svg { transform: translateX(4px); }

@media (max-width: 900px) {
  .project-card, .project-card:nth-child(even) { grid-template-columns: 1fr; }
  .project-thumb, .project-card:nth-child(even) .project-thumb {
    order: 0; min-height: 0; aspect-ratio: 16/9;
    border-right: none; border-left: none; border-bottom: 1px solid var(--border);
  }
  .project-body { padding: 24px; }
  .project-title { font-size: 22px; }
}

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 40px; max-width: 880px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(to bottom, var(--cyan), var(--border-2) 30%, var(--border-2)); }
.tl-item { position: relative; padding-bottom: 48px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-node {
  position: absolute; left: -39px; top: 6px; width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--cyan); background: var(--bg); box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}
.tl-node::after { content: ""; position: absolute; inset: 3px; background: var(--cyan); border-radius: 50%; }
.tl-meta { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.tl-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.tl-company { color: var(--text-2); font-size: 14px; margin-bottom: 14px; font-family: var(--font-mono); }
.tl-points { margin: 0 0 16px; padding-left: 18px; }
.tl-points li { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 6px; }
.tl-points li::marker { color: var(--cyan); }

/* ---------- Certs ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .cert-grid { grid-template-columns: 1fr; } }
.cert {
  border: 1px solid var(--border); border-radius: 12px; padding: 22px; background: var(--bg-2);
  display: flex; align-items: center; gap: 18px; transition: all .25s ease;
}
.cert:hover { border-color: var(--cyan); }
.cert-logo {
  width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bg-3); border: 1px solid var(--border-2);
  font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--cyan);
}
.cert-body { flex: 1; min-width: 0; }
.cert-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.cert-issuer { color: var(--text-2); font-size: 12px; font-family: var(--font-mono); }
.cert-date { color: var(--muted); font-size: 11px; font-family: var(--font-mono); margin-top: 4px; }
.cert-cred { color: var(--muted); font-size: 10px; font-family: var(--font-mono); margin-top: 4px; opacity: 0.7; word-break: break-all; }

/* Achievements row */
.achievements { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
@media (max-width: 900px) { .achievements { grid-template-columns: 1fr; } }
.ach {
  border: 1px solid var(--border); border-radius: 12px; padding: 22px; background: var(--bg-2);
  transition: all .25s ease;
}
.ach:hover { border-color: var(--green); }
.ach-icon { width: 28px; height: 28px; color: var(--green); margin-bottom: 14px; }
.ach-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.ach-desc { color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-card { border: 1px solid var(--border); border-radius: 16px; background: var(--bg-2); overflow: hidden; transition: all .25s ease; display: flex; flex-direction: column; }
.blog-card:hover { border-color: var(--cyan); transform: translateY(-2px); }
.blog-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #0E1518, #0A0A0A); position: relative; border-bottom: 1px solid var(--border); }
.blog-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.blog-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.blog-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); margin-bottom: 10px; display: flex; gap: 10px; }
.blog-meta .tag { color: var(--cyan); }
.blog-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 8px; line-height: 1.3; letter-spacing: -0.01em; }
.blog-excerpt { color: var(--text-2); font-size: 13px; line-height: 1.55; flex: 1; }
.blog-readmore { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Testimonials ---------- */
.testimonial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .testimonial-grid { grid-template-columns: 1fr; } }
.testimonial { border: 1px solid var(--border); border-radius: 16px; padding: 28px; background: var(--bg-2); position: relative; }
.testimonial .quote-mark { font-family: var(--font-display); font-size: 60px; line-height: 1; color: var(--cyan); opacity: 0.2; position: absolute; top: 12px; right: 20px; }
.testimonial p { color: var(--text); font-size: 15px; line-height: 1.65; margin: 0 0 22px; }
.testi-author { display: flex; align-items: center; gap: 12px; }
.testi-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--green)); display: grid; place-items: center; color: #000; font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.testi-name { font-size: 14px; font-weight: 500; }
.testi-role { color: var(--text-2); font-size: 12px; font-family: var(--font-mono); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr; max-width: 760px; }

.contact-left h2 { font-family: var(--font-display); font-size: clamp(40px, 5vw, 64px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.0; margin: 0 0 24px; }
.contact-left h2 .accent { color: var(--cyan); }
.contact-left p { color: var(--text-2); font-size: 17px; line-height: 1.6; margin-bottom: 32px; }
.contact-info { display: flex; flex-direction: column; gap: 18px; margin-bottom: 32px; }
.info-row { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 14px; color: var(--text); }
.info-row .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--cyan); }
.info-row .ico svg { width: 16px; height: 16px; }
.copy-btn { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-left: 8px; padding: 3px 8px; border: 1px solid var(--border-2); border-radius: 4px; background: transparent; transition: all .2s ease; }
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.avail-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.avail-chip { font-family: var(--font-mono); font-size: 11px; padding: 6px 12px; border: 1px solid var(--border-2); border-radius: 999px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.avail-chip .check { color: var(--green); }

.info-row a { color: var(--text); text-decoration: none; transition: color .2s ease; }
.info-row a:hover { color: var(--cyan); }

/* ---------- 404 ---------- */
.err-section { min-height: 72vh; display: flex; align-items: center; }
.err-code {
  font-family: var(--font-display); font-size: clamp(96px, 18vw, 180px);
  font-weight: 600; line-height: 1; margin: 16px 0 8px; letter-spacing: -0.04em;
}
.err-p { color: var(--text-2); font-size: 17px; max-width: 460px; margin: 0 0 32px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 56px 0 32px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 16px; }
.footer-col a { display: block; color: var(--text-2); font-size: 14px; padding: 6px 0; transition: color .2s ease; }
.footer-col a:hover { color: var(--cyan); }
.footer-brand-block p { color: var(--text-2); font-size: 14px; line-height: 1.6; margin: 14px 0 0; max-width: 320px; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.footer-bottom .heart { color: var(--warn); }
.footer-bottom .coffee { color: #D4D4D4; }

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 56px;
}
/* When the coursework card is hidden, the degree card takes the full row */
.edu-grid .edu-card:only-child { grid-column: 1 / -1; }
@media (max-width: 900px) { .edu-grid { grid-template-columns: 1fr; } }

.edu-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}
.edu-card.edu-degree {
  background:
    radial-gradient(circle 400px at 100% 0%, rgba(255,255,255,0.025), transparent 60%),
    var(--bg-2);
}
.edu-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.edu-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 6px 12px; border: 1px solid var(--text); border-radius: 4px;
  color: var(--text); letter-spacing: 0.18em;
}
.edu-year {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-2); letter-spacing: 0.1em;
}
.edu-degree-title {
  font-family: var(--font-display); font-size: 32px; font-weight: 600;
  letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.1;
}
.edu-field {
  font-size: 16px; color: var(--text-2);
  margin-bottom: 14px;
}
.edu-uni {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text); letter-spacing: 0.08em;
  padding-bottom: 24px; border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.edu-meta-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding-bottom: 24px; border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
@media (max-width: 700px) { .edu-meta-row { grid-template-columns: 1fr; } }
.edu-meta-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 6px;
}
.edu-meta-value {
  font-family: var(--font-display); font-size: 18px;
  font-weight: 500; color: var(--text);
}
.edu-meta-dim { color: var(--muted); font-weight: 400; }

.edu-thesis-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.16em;
  margin-bottom: 10px;
}
.edu-thesis-title {
  font-family: var(--font-display); font-size: 16px;
  font-weight: 500; line-height: 1.4;
  color: var(--text); margin-bottom: 8px;
  font-style: italic;
}
.edu-thesis-meta {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-2);
}

/* Coursework card */
.edu-courses { padding: 24px; }
.edu-courses-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.edu-courses-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  margin: 0; letter-spacing: -0.01em;
}
.edu-courses-count {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.1em;
}
.course-list {
  display: flex; flex-direction: column;
}
.course-row {
  display: grid; grid-template-columns: 1fr;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  transition: background .15s ease, padding-left .2s ease;
}
.course-row:last-child { border-bottom: none; }
.course-row:hover {
  background: var(--bg-3);
  padding-left: 8px;
}
.course-code {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.05em;
}
.course-name { color: var(--text); }

/* Organizational */
.org-block { margin-top: 24px; }
.org-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.org-title {
  font-family: var(--font-display); font-size: 24px; font-weight: 600;
  letter-spacing: -0.015em; margin: 0;
}
.org-tag {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.18em;
  padding: 4px 10px; border: 1px solid var(--border-2); border-radius: 4px;
}
.org-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
@media (max-width: 900px) { .org-grid { grid-template-columns: 1fr; } }
.org-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 22px; background: var(--bg-2);
  transition: all .25s ease;
}
.org-card:hover {
  border-color: var(--text-2);
  transform: translateY(-2px);
}
.org-period {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 10px;
}
.org-role {
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  margin: 0 0 4px; letter-spacing: -0.005em;
}
.org-name {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-2); margin-bottom: 12px;
}
.org-desc {
  color: var(--text-2); font-size: 13px; line-height: 1.55; margin: 0;
}
.section-head { margin-bottom: 56px; max-width: 720px; }
.section-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 56px; }
.section-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-align: right; }
.section-meta .v { color: var(--cyan); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 24px; overflow-y: auto;
  animation: modalFade .25s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) { .modal-overlay { padding: 0; } }

.modal {
  width: 100%; max-width: 840px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  position: relative;
  animation: modalIn .35s cubic-bezier(.5,0,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) { .modal { border-radius: 0; min-height: 100vh; } }

.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(10, 10, 10, 0.7); backdrop-filter: blur(8px);
  border: 1px solid var(--border-2);
  color: var(--text); display: grid; place-items: center;
  cursor: pointer; transition: all .2s ease;
}
.modal-close:hover { border-color: var(--text); transform: rotate(90deg); }

.modal-hero {
  position: relative; aspect-ratio: 21/9;
  background: linear-gradient(135deg, #0E1518, #0A0A0A);
  border-bottom: 1px solid var(--border);
}
.modal-hero svg { width: 100%; height: 100%; }
.modal-hero-meta {
  position: absolute; bottom: 16px; left: 16px;
  display: flex; gap: 10px; align-items: center;
}
.modal-hero-meta .project-id { position: static; }

.modal-body { padding: 36px; }
@media (max-width: 700px) { .modal-body { padding: 24px; } }
.modal-title {
  font-family: var(--font-display); font-size: 32px; font-weight: 600;
  letter-spacing: -0.02em; margin: 0 0 12px; line-height: 1.1;
}
.modal-desc {
  color: var(--text-2); font-size: 16px; line-height: 1.6;
  margin: 0 0 28px;
}

.modal-meta-row {
  display: grid; grid-template-columns: 1fr 1fr 1.4fr;
  gap: 20px; padding: 20px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 28px;
  background: var(--bg);
}
@media (max-width: 700px) { .modal-meta-row { grid-template-columns: 1fr; } }
.modal-meta-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 6px;
}
.modal-meta-val { font-size: 14px; color: var(--text); line-height: 1.5; }
.modal-stack-inline { display: flex; flex-wrap: wrap; gap: 6px; }

.modal-section { margin-bottom: 24px; }
.modal-section h3 {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text); letter-spacing: 0.18em; text-transform: uppercase;
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.modal-section p { color: var(--text-2); font-size: 15px; line-height: 1.65; margin: 0; }
.modal-section ul { padding-left: 18px; margin: 0; }
.modal-section ul li {
  color: var(--text-2); font-size: 14px; line-height: 1.6;
  margin-bottom: 8px;
}
.modal-section ul li::marker { color: var(--cyan); }

.modal-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--border);
}

/* === Modal photo gallery === */
.modal-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 600px) {
  .modal-gallery { grid-template-columns: 1fr; }
}
.modal-gallery-item {
  margin: 0; cursor: pointer; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2);
  transition: transform .25s ease, border-color .2s ease, box-shadow .25s ease;
  outline: none;
}
.modal-gallery-item:hover,
.modal-gallery-item:focus-visible {
  transform: translateY(-2px);
  border-color: var(--text-2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.modal-gallery-item img {
  display: block; width: 100%; height: 200px;
  object-fit: cover;
  transition: transform .35s ease, filter .25s ease;
}
.modal-gallery-item:hover img { transform: scale(1.03); filter: brightness(1.05); }
.modal-gallery-item figcaption {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-2); line-height: 1.5;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}

/* === Photo lightbox (full-screen overlay) === */
.photo-lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 5vh 4vw; cursor: zoom-out;
  animation: lb-fade .2s ease;
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.photo-lightbox-figure {
  margin: 0; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  cursor: default;
}
.photo-lightbox-figure img {
  max-width: 100%; max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}
.photo-lightbox-figure figcaption {
  font-family: var(--font-mono); font-size: 12px;
  color: rgba(255,255,255,0.75);
  max-width: 720px; text-align: center; line-height: 1.55;
}
.photo-lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .2s ease;
}
.photo-lightbox-close:hover {
  background: rgba(255,255,255,0.16); transform: scale(1.05);
}

/* Make project cards clickable */
.project-card { cursor: pointer; }
.project-card:focus-visible {
  outline: 2px solid var(--text); outline-offset: 4px;
}
