/* ---------- Design tokens ---------- */
:root {
  --bg: #090c13;
  --bg-alt: #0d1220;
  --surface: #121729;
  --surface-hover: #171e35;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ecf6;
  --text-dim: #9aa4bd;
  --text-faint: #5c6580;
  --accent: #6ee7ff;
  --accent-2: #8b7bff;
  --accent-gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --wrap: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.2; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(9, 12, 19, 0.75);
  border-bottom: 1px solid var(--border);
}

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

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #0a0e16;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav-link {
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 120px 0 96px;
  overflow: hidden;
}

.hero-fx {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(110, 231, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 231, 255, 0.1) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 65% 55% at 50% 0%, black, transparent);
}

.hero-orb {
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  will-change: transform, opacity;
  animation: heroOrbFloat 14s ease-in-out infinite alternate;
}

.hero-orb-a {
  top: -140px;
  right: -100px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
}

.hero-orb-b {
  bottom: -160px;
  left: -120px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  animation-delay: -6s;
}

@keyframes heroOrbFloat {
  0% { transform: translate(0, 0) scale(1); opacity: 0.32; }
  100% { transform: translate(-30px, 30px) scale(1.12); opacity: 0.5; }
}

.hero-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mask-image: radial-gradient(ellipse 65% 55% at 50% 0%, black, transparent);
}

.node-lines line {
  stroke: rgba(110, 231, 255, 0.18);
  stroke-width: 1;
}

.node {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 6px rgba(110, 231, 255, 0.85));
  animation: nodePulse 4.5s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes nodePulse {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-orb,
  .node {
    animation: none;
  }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 16px;
  text-transform: uppercase;
}

.hero h1 {
  display: flex;
  flex-direction: column;
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-role {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  margin-top: 6px;
}

.hero-tagline {
  max-width: 640px;
  color: var(--text-dim);
  font-size: 18px;
  margin: 24px 0 0;
}

.hero-meta {
  display: flex;
  gap: 24px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-faint);
}

.icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #0a0e16;
}

.btn-primary:hover { transform: translateY(-1px); }

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

.btn-ghost:hover { border-color: var(--accent); }

/* ---------- Sections ---------- */
.section {
  position: relative;
  overflow: hidden;
  padding: 88px 0;
}
.section-alt { background: var(--bg-alt); }

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(110, 231, 255, 0.12) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 40%, black, transparent 75%);
  opacity: 0.5;
}

.section::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.14;
}

.section:nth-of-type(odd)::after {
  background: var(--accent);
  top: -180px;
  right: -160px;
}

.section:nth-of-type(even)::after {
  background: var(--accent-2);
  bottom: -180px;
  left: -160px;
}

.section > .wrap {
  position: relative;
  z-index: 1;
}

.wrap.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.wrap.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .wrap.reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}

.section-heading {
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-subheading {
  color: var(--text-dim);
  margin: 10px 0 40px;
  max-width: 560px;
}

.text-link {
  font-size: 14px;
  color: var(--accent);
  white-space: nowrap;
}

.text-link:hover { text-decoration: underline; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 56px;
  margin-top: 32px;
}

.about-text p {
  color: var(--text-dim);
  margin: 0 0 18px;
  font-size: 16px;
}

.about-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
  height: fit-content;
}

.highlight { display: flex; flex-direction: column; gap: 4px; }

.highlight-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.highlight-value { font-size: 15px; font-weight: 600; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.skill-group:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.skill-group-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
}

/* ---------- Certificates ---------- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.cert-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 16px 36px -20px rgba(110, 231, 255, 0.45);
}

.cert-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.cert-head h3 { font-size: 16px; font-weight: 700; }

.cert-year {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
}

.cert-issuer {
  color: var(--text-dim);
  font-size: 14px;
  margin: 8px 0 14px;
}

.cert-link { font-size: 13px; }

.edu-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
}

/* ---------- Cards (open source) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

/* fixed 2-column layout for the paged open-source project grid */
.project-grid {
  grid-template-columns: repeat(2, 1fr);
}

.slider-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}

.slider-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.slider-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.slider-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slider-dots {
  display: flex;
  gap: 8px;
}

.slider-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
}

.slider-dot.active {
  background: var(--accent);
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.card-thumb {
  display: block;
  width: calc(100% + 44px);
  height: auto;
  margin: -22px -22px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 16px 36px -20px rgba(110, 231, 255, 0.45);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
}

.icon-ext { color: var(--text-faint); }

.card-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin: 12px 0 16px;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  background: rgba(110, 231, 255, 0.1);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- Work list ---------- */
.work-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.work-item {
  position: relative;
  padding: 26px 0 26px 20px;
  border-top: 1px solid var(--border);
  transition: padding-left 0.2s ease;
}

.work-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 26px;
  bottom: 26px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent-gradient);
  opacity: 0.25;
  transition: opacity 0.2s ease;
}

.work-item:hover { padding-left: 26px; }
.work-item:hover::before { opacity: 1; }

.work-item:last-child { border-bottom: 1px solid var(--border); }

.work-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.work-item-head h3 { font-size: 19px; font-weight: 700; }

.work-year {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
}

.work-role {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin: 6px 0 10px;
}

.work-desc { color: var(--text-dim); margin: 0; max-width: 640px; }

/* ---------- Contact ---------- */
.contact-wrap { text-align: center; }
.contact-wrap .section-subheading { margin-left: auto; margin-right: auto; }

.email-link {
  display: inline-block;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 8px 0 32px;
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.social-link {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.social-link:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.site-footer p {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .project-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-highlights {
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 20px;
    gap: 28px;
  }
}

@media (max-width: 720px) {
  .nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }
  .nav.nav-open { max-height: 320px; }
  .nav-link { padding: 14px 24px; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: flex; }
  .hero { padding: 96px 0 64px; }
  .section { padding: 64px 0; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .work-item-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}
