/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

/* ---------- Theme tokens ---------- */
:root {
  --bg: #0b0e14;
  --bg-alt: #10141d;
  --surface: #151a24;
  --surface-hover: #1b2130;
  --border: #232a38;
  --text: #e7ebf3;
  --text-dim: #9aa4b8;
  --text-faint: #616d82;
  --accent: #9944ff;
  --accent-2: #8b8bf9;
  --accent-contrast: #ffffff;
  --shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f0f2f8;
  --border: #e3e6ef;
  --text: #171a21;
  --text-dim: #4d5566;
  --text-faint: #838ea3;
  --accent: #9944ff;
  --accent-2: #5b5bd6;
  --accent-contrast: #ffffff;
  --shadow: 0 20px 50px -25px rgba(20,25,40,0.25);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fb;
    --bg-alt: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f0f2f8;
    --border: #e3e6ef;
    --text: #171a21;
    --text-dim: #4d5566;
    --text-faint: #838ea3;
    --accent: #9944ff;
    --accent-2: #5b5bd6;
    --accent-contrast: #ffffff;
    --shadow: 0 20px 50px -25px rgba(20,25,40,0.25);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 999;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.logo-dot { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 28px;
  flex: 1;
  justify-content: center;
}
.main-nav a {
  font-size: 0.92rem;
  color: var(--text-dim);
  position: relative;
  padding: 6px 2px;
  transition: color 0.15s ease;
}
.main-nav a:hover { color: var(--text); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .icon-moon { display: block; }
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.lang-toggle:hover { background: var(--surface-hover); color: var(--text); border-color: var(--accent); }

.nav-burger { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 15% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(500px 400px at 85% 60%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 60%);
  pointer-events: none;
}

.hero-inner { position: relative; padding-top: 40px; padding-bottom: 40px; }

.hero-kicker {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.hero-name {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero-role {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 10px;
}

.hero-tagline {
  max-width: 620px;
  margin-top: 22px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); }

.hero-links {
  display: flex;
  gap: 18px;
  margin-top: 40px;
  color: var(--text-dim);
}
.hero-links a, .hero-links button { transition: color 0.15s ease, transform 0.15s ease; }
.hero-links a:hover, .hero-links button:hover { color: var(--accent); transform: translateY(-2px); }

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}
.tooltip-bubble {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}
.tooltip-bubble::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--border);
}
.tooltip-bubble strong {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
}
.tooltip-wrap:hover .tooltip-bubble,
.tooltip-bubble.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-faint);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 40px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p {
  color: var(--text-dim);
  margin-bottom: 18px;
}
.about-text p:last-child { margin-bottom: 0; }

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
}
.about-facts li { display: flex; flex-direction: column; gap: 4px; }
.about-facts .fact-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.about-facts .fact-value { font-weight: 600; }

/* ---------- Skills ---------- */
.skills-groups {
  display: grid;
  gap: 24px;
}

.skill-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
}
.skill-group h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-dim);
}
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg);
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: var(--shadow);
}

.project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.project-title { font-size: 1.1rem; font-weight: 700; }
.project-period { font-family: var(--mono); font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }

.project-desc { color: var(--text-dim); font-size: 0.95rem; flex: 1; }

.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tags .chip { font-size: 0.72rem; padding: 4px 10px; }

.project-links { display: flex; gap: 14px; margin-top: 4px; }
.project-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.project-links a:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.timeline-role { font-weight: 700; font-size: 1.05rem; }
.timeline-org { color: var(--accent); font-size: 0.95rem; }
.timeline-period { font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); margin-left: auto; }

.timeline-desc { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 10px; }

.timeline-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline-tags .chip { font-size: 0.72rem; padding: 3px 10px; }

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.edu-list, .cert-list { display: flex; flex-direction: column; gap: 18px; }

.edu-list li, .cert-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
}

.edu-school { font-weight: 700; }
.edu-program { color: var(--text-dim); font-size: 0.92rem; margin-top: 4px; }
.edu-period, .cert-date { font-family: var(--mono); font-size: 0.75rem; color: var(--text-faint); margin-top: 8px; }

.cert-title { font-weight: 600; }

/* ---------- Contact ---------- */
.section-contact { text-align: center; }
.contact-inner { display: flex; flex-direction: column; align-items: center; }
.contact-text { max-width: 560px; color: var(--text-dim); margin-top: 8px; }

.contact-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
}
.contact-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 20px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.contact-card:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .edu-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .main-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 14px;
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
  }
  .main-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-burger { display: inline-flex; }
  .hero { min-height: auto; padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
