/* ---------- Design tokens ---------- */
:root {
  --bg: #F6F9F9;
  --surface: #FFFFFF;
  --surface-2: #EAF1F1;
  --text: #0F1E24;
  --muted: #4E6168;
  --primary: #0B6E6D;
  --primary-soft: rgba(11, 110, 109, 0.1);
  --secondary: #9A5414;
  --secondary-soft: rgba(154, 84, 20, 0.1);
  --border: rgba(15, 30, 36, 0.1);
  --on-primary: #FFFFFF;
  --header-bg: rgba(246, 249, 249, 0.82);
  --shadow-sm: 0 1px 2px rgba(15, 30, 36, 0.06), 0 2px 8px rgba(15, 30, 36, 0.04);
  --shadow-md: 0 8px 30px rgba(15, 30, 36, 0.1);
  --grid-line: rgba(11, 110, 109, 0.07);

  --font-sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  --fs-hero: clamp(2.5rem, 1.6rem + 4.2vw, 4.75rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 7rem;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --container: 1160px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0B1417;
  --surface: #13222A;
  --surface-2: #182B34;
  --text: #E6F0F0;
  --muted: #94A8AE;
  --primary: #2EC4B6;
  --primary-soft: rgba(46, 196, 182, 0.12);
  --secondary: #F4A259;
  --secondary-soft: rgba(244, 162, 89, 0.12);
  --border: rgba(230, 240, 240, 0.1);
  --on-primary: #0B1417;
  --header-bg: rgba(11, 20, 23, 0.8);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 34px rgba(0, 0, 0, 0.45);
  --grid-line: rgba(46, 196, 182, 0.06);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 1em; height: 1em; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--primary); color: var(--on-primary); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-4); }

.eyebrow {
  font-size: var(--fs-sm);
  color: var(--primary);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
}

.section { padding-block: var(--space-9); }
.section-title { font-size: var(--fs-xl); margin-bottom: var(--space-4); }


/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.logo { display: inline-flex; align-items: center; gap: var(--space-3); font-weight: 600; }
.logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: transform 0.4s var(--ease);
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.05); }
.logo-text { font-size: var(--fs-md); }
.logo-dot { color: var(--secondary); }

.nav-list { display: flex; gap: var(--space-2); }
.nav-link {
  position: relative;
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}
.nav-link .mono { color: var(--primary); opacity: 0.6; margin-right: 2px; transition: opacity 0.2s ease; }
.nav-link::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-link:hover, .nav-link.is-active { color: var(--text); }
.nav-link:hover .mono, .nav-link.is-active .mono { opacity: 1; }
.nav-link:hover::after, .nav-link.is-active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text);
  transition: background-color 0.2s ease;
}
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.menu-toggle { display: none; }
.burger { position: relative; width: 20px; height: 14px; }
.burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s ease, top 0.3s var(--ease);
}
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 6px; }
.burger span:nth-child(3) { top: 12px; }
.menu-toggle[aria-expanded="true"] .burger span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .burger span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .burger span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---------- Buttons & badges ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-5);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 20px var(--primary-soft); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--primary-soft); }
.btn-ghost { border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-link { padding-inline: var(--space-3); color: var(--muted); }
.btn-link:hover { color: var(--secondary); }

.badges { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.badge svg { width: 14px; height: 14px; fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-accent { color: var(--secondary); background: var(--secondary-soft); border-color: transparent; }
.badge-accent svg { stroke: var(--secondary); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  align-items: center;
  padding-block: var(--space-8);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 30%, transparent 75%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: var(--space-8);
}

.hero-title { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.035em; }
.hero-role {
  margin-top: var(--space-3);
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--primary);
}
.hero-lead {
  margin-top: var(--space-5);
  max-width: 34rem;
  font-size: var(--fs-md);
  font-weight: 300;
  color: var(--muted);
}
.hero-lead strong { font-weight: 500; color: var(--text); }
.hero .badges { margin-top: var(--space-5); }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }

.hero-visual { position: relative; justify-self: center; width: min(100%, 400px); }
.portrait {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  isolation: isolate;
}
.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  transform: translate(16px, 16px);
  transition: transform 0.5s var(--ease);
}
.portrait:hover::before { transform: translate(8px, 8px); }
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.portrait-tag {
  position: absolute;
  top: var(--space-4);
  left: calc(-1 * var(--space-5));
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-xs);
  color: var(--text);
  white-space: nowrap;
}
.portrait-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2s infinite;
}

.code-card {
  position: absolute;
  right: calc(-1 * var(--space-6));
  bottom: calc(-1 * var(--space-6));
  margin: 0;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 0.72rem;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre;
}
.portrait-tag:empty, .code-card:empty { display: none; }
.code-card .k { color: var(--primary); }
.code-card .s { color: var(--secondary); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.1em;
}
.scroll-cue span { display: inline-block; animation: bob 1.8s ease-in-out infinite; }
.scroll-cue:hover { color: var(--primary); }

@media (min-width: 961px) {
  .portrait { top: -2.5rem; }
  .portrait-tag { top: -1.1rem; }
  .code-card { bottom: -3.25rem; }
}

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .hero-visual { order: -1; width: min(78%, 320px); }
  .hero-copy { text-align: center; }
  .hero-lead { margin-inline: auto; }
  .hero .badges, .hero-cta { justify-content: center; }
  .code-card { display: none; }
  .portrait-tag { left: 50%; top: auto; bottom: calc(-1 * var(--space-4)); transform: translateX(-50%); }
  .scroll-cue { display: none; }
}

@media (max-width: 820px) {
  .menu-toggle { display: grid; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
    transition: clip-path 0.4s var(--ease), visibility 0s linear 0.4s;
  }
  .nav.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 0.4s var(--ease); }
  .nav-list { flex-direction: column; gap: 0; padding: var(--space-3) clamp(1rem, 4vw, 2rem) var(--space-5); }
  .nav-link { display: block; padding: var(--space-4) 0; font-size: var(--fs-md); border-bottom: 1px solid var(--border); }
  .nav-link::after { display: none; }
  .logo-text { display: none; }
}

@media (max-width: 420px) {
  .hero { padding-block: var(--space-7); }
  .hero-cta .btn { flex: 1 1 100%; }
  .hero-visual { width: min(62%, 240px); }
  .portrait::before { transform: translate(10px, 10px); }
  .portrait-tag {
    max-width: calc(100vw - 2rem);
    white-space: normal;
    text-align: center;
    justify-content: center;
    font-size: 0.68rem;
    line-height: 1.35;
    width: max-content;
  }
}

/* ---------- Section shared ---------- */
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 42rem; margin-bottom: var(--space-7); }
.section-intro { color: var(--muted); font-size: var(--fs-md); font-weight: 300; }
.accent { color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.chip.is-match { background: var(--primary); color: var(--on-primary); }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-8);
  align-items: end;
}
.about-text { display: grid; gap: var(--space-4); color: var(--muted); font-size: var(--fs-md); font-weight: 300; }
.about-text strong { color: var(--text); font-weight: 500; }
.about-offline {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--secondary);
  background: var(--secondary-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--fs-base);
  color: var(--text);
}
.about-offline svg { flex: none; width: 22px; height: 22px; margin-top: 2px; fill: none; stroke: var(--secondary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.stats { display: grid; gap: var(--space-4); }
.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.stat-value { font-size: clamp(2.25rem, 1.8rem + 1.6vw, 3rem); font-weight: 700; line-height: 1; color: var(--primary); letter-spacing: -0.04em; min-width: 3.2rem; }
.stat-label { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }

.expertise {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-8);
}
.skill-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
}
.skill-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.skill-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: transparent; }
.skill-card:hover::after { transform: scaleX(1); }
.skill-num { position: absolute; top: var(--space-5); right: var(--space-5); font-size: var(--fs-xs); color: var(--muted); opacity: 0.6; }
.skill-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: var(--space-2);
}
.skill-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skill-card h3 { font-size: var(--fs-md); }
.skill-card p { color: var(--muted); font-size: var(--fs-sm); flex: 1; }
.skill-card .chips { margin-top: var(--space-2); }

/* ---------- Experience ---------- */
.highlights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-7);
}
.highlight {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--secondary);
}
.highlight-title { font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--space-1); }
.highlight-text { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

.xp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filter-btn {
  min-height: 38px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  transition: all 0.2s ease;
}
.filter-btn:hover { color: var(--primary); border-color: var(--primary); }
.filter-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.filter-btn .count { margin-left: 6px; opacity: 0.65; }
.xp-count { font-size: var(--fs-xs); color: var(--muted); }

.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: calc(180px + var(--space-6));
  width: 2px;
  background: linear-gradient(var(--primary), var(--border) 85%);
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: calc(var(--space-6) * 2);
  padding-bottom: var(--space-6);
}
.tl-item[hidden] { display: none; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item.is-entering { animation: xp-in 0.45s var(--ease) both; }

.tl-meta { text-align: right; padding-top: var(--space-5); }
.tl-dates { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text); }
.tl-duration { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

.tl-dot {
  position: absolute;
  top: calc(var(--space-5) + 6px);
  left: calc(180px + var(--space-6) - 6px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
  z-index: 1;
}
.tl-item.is-current .tl-dot { background: var(--primary); animation: ring 2.2s infinite; }

.xp-card {
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: box-shadow 0.35s ease, transform 0.35s var(--ease), border-color 0.3s ease;
}
.xp-card:hover { box-shadow: var(--shadow-md); border-color: transparent; }

.xp-company { display: flex; align-items: center; gap: var(--space-4); }
.xp-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.xp-company-name { font-size: var(--fs-md); font-weight: 600; line-height: 1.3; }
.xp-company-sub { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-mono); }

.xp-role { position: relative; margin-top: var(--space-5); }
.xp-role[hidden] { display: none; }
.xp-card.is-group .xp-role { padding-left: var(--space-5); border-left: 2px dashed var(--border); }
.xp-card.is-group .xp-role + .xp-role { margin-top: var(--space-6); }

.xp-role-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.xp-role-title { font-size: var(--fs-base); font-weight: 600; }
.xp-role-title .at { color: var(--muted); font-weight: 400; }
.xp-role-dates { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.xp-domain {
  display: inline-block;
  margin-top: var(--space-2);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.xp-context { margin-top: var(--space-3); color: var(--text); font-size: var(--fs-sm); font-style: italic; opacity: 0.9; }

.xp-bullets { margin-top: var(--space-3); display: grid; gap: var(--space-2); }
.xp-bullets li {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.6;
}
.xp-bullets li::before {
  content: "▹";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
}

.xp-more {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease);
}
.xp-more > .xp-bullets { overflow: hidden; min-height: 0; margin-top: 0; }
.xp-more.is-open { grid-template-rows: 1fr; }
.xp-more.is-open > .xp-bullets { margin-top: var(--space-2); }

.xp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-3);
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--primary);
}
.xp-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--ease); }
.xp-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.xp-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }

.xp-role .chips { margin-top: var(--space-4); }

.xp-empty { padding: var(--space-6); text-align: center; color: var(--muted); }

@keyframes xp-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 var(--primary-soft), 0 0 0 0 rgba(46, 196, 182, 0.35); }
  70% { box-shadow: 0 0 0 0 var(--primary-soft), 0 0 0 10px rgba(46, 196, 182, 0); }
  100% { box-shadow: 0 0 0 0 var(--primary-soft), 0 0 0 0 rgba(46, 196, 182, 0); }
}

@media (max-width: 1024px) {
  .highlights { grid-template-columns: repeat(2, 1fr); }
  .expertise { grid-template-columns: 1fr 1fr; }
  .expertise > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat { grid-template-columns: 1fr; gap: var(--space-2); text-align: center; padding: var(--space-4); }
  .stat-value { min-width: 0; }

  .timeline::before { left: 6px; }
  .tl-item { grid-template-columns: 1fr; gap: var(--space-2); padding-left: var(--space-6); }
  .tl-dot { left: 0; top: 4px; }
  .tl-meta { text-align: left; padding-top: 0; display: flex; gap: var(--space-3); align-items: baseline; }
  .tl-duration { margin-top: 0; }
  .tl-duration::before { content: "· "; }
}

@media (max-width: 600px) {
  .section { padding-block: var(--space-7); }
  .expertise, .highlights { grid-template-columns: 1fr; }
  .expertise > :last-child { grid-column: auto; }
  .stats { grid-template-columns: 1fr; }
  .stat { grid-template-columns: auto 1fr; text-align: left; }
  .xp-card { padding: var(--space-5) var(--space-4); }
  .xp-card.is-group .xp-role { padding-left: var(--space-4); }
  .xp-toolbar { flex-direction: column; align-items: flex-start; }
  .filters { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex: none; }
}

/* ---------- Projects ---------- */
.section-head-row {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
}
.section-head-row > div:first-child { max-width: 42rem; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}
.project-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
}
.project-card[hidden] { display: none; }
.project-card.is-entering { animation: xp-in 0.45s var(--ease) both; }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: transparent; }

.project-art {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.project-art svg { width: 100%; height: 100%; display: block; transition: transform 0.6s var(--ease); }
.project-art img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform 0.6s var(--ease); }
.project-card:hover .project-art svg, .project-card:hover .project-art img { transform: scale(1.04); }

.project-body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) var(--space-6) var(--space-6); flex: 1; }
.project-cats { display: flex; flex-wrap: wrap; gap: var(--space-2); font-family: var(--font-mono); font-size: 0.7rem; color: var(--secondary); }
.project-cats span + span::before { content: "/ "; opacity: 0.6; }
.project-title { font-size: var(--fs-lg); }
.project-desc { color: var(--muted); font-size: var(--fs-sm); }
.project-highlights { display: grid; gap: 6px; }
.project-highlights li { position: relative; padding-left: var(--space-5); font-size: var(--fs-sm); color: var(--text); }
.project-highlights li::before { content: "▹"; position: absolute; left: 0; color: var(--primary); }
.project-card .chips { margin-top: auto; padding-top: var(--space-3); }
.project-links { display: flex; gap: var(--space-4); }
.project-links a { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--primary); }
.project-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Education ---------- */
.edu-list { list-style: none; margin: var(--space-5) 0 0; padding: 0; position: relative; }
.edu-list::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.edu-item { position: relative; padding: 0 0 var(--space-6) var(--space-7); }
.edu-item:last-child { padding-bottom: 0; }
.edu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
}
.edu-years { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.edu-degree { font-size: var(--fs-md); margin-top: 2px; }
.edu-school { color: var(--muted); font-size: var(--fs-sm); }


/* ---------- Contact ---------- */
.contact-card {
  position: relative;
  padding: clamp(2rem, 1rem + 5vw, 5rem);
  border-radius: 28px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--primary-soft), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, var(--secondary-soft), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
}
.contact-title { font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem); font-weight: 700; letter-spacing: -0.03em; max-width: 18ch; margin-inline: auto; }
.contact-lead { margin: var(--space-5) auto 0; max-width: 36rem; color: var(--muted); font-size: var(--fs-md); font-weight: 300; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }
.btn-lg { min-height: 54px; padding-inline: var(--space-6); font-size: var(--fs-base); }
#copy-email.is-copied { border-color: var(--primary); color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-6); }
.footer-inner { display: flex; justify-content: center; text-align: center; }
.footer-copy { font-size: var(--fs-sm); color: var(--muted); }

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

@media (max-width: 600px) {
  .project-body { padding: var(--space-5) var(--space-4); }
  .contact-actions .btn { flex: 1 1 100%; }
  .contact-actions .btn-lg { font-size: var(--fs-sm); padding-inline: var(--space-4); }
}

/* ---------- Project illustrations ---------- */
.a-bg { fill: var(--surface-2); }
.a-grid { stroke: var(--grid-line); stroke-width: 1.5; fill: none; }
.a-p { fill: var(--primary); }
.a-s { fill: var(--secondary); }
.a-card { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.a-line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.a-line-muted { fill: none; stroke: var(--muted); stroke-opacity: 0.45; stroke-width: 2; stroke-linecap: round; }
.a-text { fill: var(--text); font-family: var(--font-mono); font-size: 11px; }
.a-label { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
