/* ===== Base ===== */
:root {
  --bg: #0a0e14;
  --bg-soft: #0f1520;
  --bg-card: #121a28;
  --border: #1f2a3c;
  --text: #d6e2f0;
  --text-dim: #8b9bb4;
  --accent: #58e6d9;
  --accent-2: #7c8cff;
  --accent-soft: rgba(88, 230, 217, 0.1);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.accent { color: var(--accent); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: var(--bg); }

/* ===== Background spine (descending index line) ===== */
.spine {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.spine-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

.spine-path-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-dasharray: 6 10;
  opacity: 0.55;
}

/* wide soft stroke under the fill acts as a glow trail */
.spine-path-under {
  fill: none;
  stroke: rgba(88, 230, 217, 0.11);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s linear;
}

.spine-path-fill {
  fill: none;
  stroke: url(#spineGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s linear;
}

.spine-glow {
  position: absolute;
  top: 0;
  left: 50%;
  width: 460px;
  height: 460px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(88, 230, 217, 0.12) 0%,
    rgba(124, 140, 255, 0.05) 35%,
    transparent 65%);
}

.spine-core {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #bffff7;
  box-shadow: 0 0 10px var(--accent), 0 0 30px var(--accent), 0 0 60px rgba(88, 230, 217, 0.6);
}

.spine-tick {
  position: absolute;
  left: calc(50% + 18px);
  transform: translateY(-50%);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  opacity: 0.45;
  transition: color 0.4s, opacity 0.4s, text-shadow 0.4s;
}
.spine-tick::before {
  content: "";
  position: absolute;
  left: -26px; top: 50%;
  width: 16px; height: 2px;
  transform: translateY(-50%);
  background: var(--border);
  transition: background 0.4s, box-shadow 0.4s;
}
.spine-tick.passed {
  color: var(--accent);
  opacity: 0.9;
  text-shadow: 0 0 12px rgba(88, 230, 217, 0.7);
}
.spine-tick.passed::before {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(88, 230, 217, 0.6);
}

/* Sections stay dimmed until the descending light reaches them */
main .section {
  filter: brightness(0.55) saturate(0.75);
  transition: filter 0.7s ease;
}
main .section.spine-lit { filter: none; }

@media (max-width: 1023px) {
  .spine-glow { width: 300px; height: 300px; }
}

/* ===== Scroll progress (mobile top bar) ===== */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
  display: none;
}
.scroll-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px rgba(88, 230, 217, 0.6);
}

/* ===== Scroll rail (guide line) ===== */
.scroll-rail {
  position: fixed;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  height: 60vh;
  z-index: 90;
}

.rail-track {
  position: relative;
  width: 2px;
  height: 100%;
  background: var(--border);
  border-radius: 2px;
}

.rail-fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(88, 230, 217, 0.4);
}

.rail-head {
  position: absolute;
  left: 1px; top: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 28px rgba(88, 230, 217, 0.5);
  pointer-events: none;
}

.rail-dot {
  position: absolute;
  left: 1px;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.rail-dot:hover { border-color: var(--accent); }
.rail-dot.passed { background: var(--accent); border-color: var(--accent); }
.rail-dot.active { box-shadow: 0 0 10px rgba(88, 230, 217, 0.8); }

.rail-label {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  pointer-events: none;
}
.rail-dot:hover .rail-label,
.rail-dot.active .rail-label { opacity: 1; }
.rail-dot.active .rail-label { color: var(--accent); border-color: rgba(88, 230, 217, 0.4); }

@media (max-width: 1023px) {
  .scroll-rail { display: none; }
  .scroll-progress { display: block; }
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }
.nav-logo .mono { color: var(--accent); }

.nav-links { display: flex; gap: 24px; }
.nav-links a {
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 12px; }

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--accent); color: var(--bg); }

.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 4px 10px;
  cursor: pointer;
}

/* ===== Hero ===== */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 48px) 24px 48px;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 56px;
}

.hero-hello { color: var(--accent); font-size: 0.95rem; margin-bottom: 14px; }

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

.hero-title {
  font-size: clamp(1.3rem, 4vw, 2.1rem);
  font-weight: 700;
  color: var(--text-dim);
  margin: 8px 0 20px;
  letter-spacing: -0.01em;
}

.hero-desc { max-width: 560px; color: var(--text-dim); margin-bottom: 22px; }

.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-avatar { text-align: center; flex-shrink: 0; }

.avatar-ring {
  width: 236px; height: 236px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 60px rgba(88, 230, 217, 0.25);
}
.avatar-ring img {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  border: 4px solid var(--bg);
}

.hero-loc { margin-top: 16px; color: var(--text-dim); font-size: 0.85rem; }

/* ===== Buttons & chips ===== */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(88, 230, 217, 0.35); }

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

.btn-lg { padding: 14px 36px; font-size: 1rem; }

.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(88, 230, 217, 0.25);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Sections ===== */
.section {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 24px;
}
.section-wide { max-width: 1100px; }

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 8px;
}

.sub-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  margin: 36px 0 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.about-text {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
}
.about-text p { margin-bottom: 16px; color: var(--text-dim); }
.about-text p:first-child { color: var(--text); }
.about-text p:last-child { margin-bottom: 0; }

.about-list { list-style: none; columns: 1; margin-top: 4px; }
.about-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.about-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.about-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gh-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.gh-panel h3 {
  font-size: 0.78rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.gh-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
  margin-bottom: 10px;
}
.gh-bar span { height: 100%; }

.gh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.gh-legend .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  vertical-align: -1px;
}

.gh-meta {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.stat-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label { font-size: 0.8rem; color: var(--text-dim); }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}

.t-item { position: relative; margin-bottom: 28px; }
.t-item:last-child { margin-bottom: 0; }

.t-fill {
  position: absolute;
  left: 7px; top: 8px;
  width: 2px;
  height: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(88, 230, 217, 0.35);
}

.t-dot {
  position: absolute;
  left: -28px; top: 24px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border);
  transition: background 0.3s, box-shadow 0.3s;
}
.t-item.lit .t-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(88, 230, 217, 0.55);
}
.t-item.lit .t-dot-edu {
  background: var(--accent-2);
  box-shadow: 0 0 0 2px var(--accent-2), 0 0 14px rgba(124, 140, 255, 0.55);
}

.t-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  transition: border-color 0.2s, transform 0.2s;
}
.t-card:hover { border-color: var(--accent); transform: translateX(4px); }

.t-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.t-head h3 { font-size: 1.08rem; font-weight: 700; }
.t-role { color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.t-date { color: var(--text-dim); font-size: 0.78rem; }
.t-sub { color: var(--accent-2); font-size: 0.8rem; margin: 4px 0 10px; }
.t-card > p:last-child { color: var(--text-dim); font-size: 0.93rem; }

/* ===== Projects ===== */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.f-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.f-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.f-art {
  background: rgba(10, 14, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 2px;
}
.f-art svg { display: block; width: 100%; height: 96px; }

.f-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.f-icon { font-size: 1.6rem; }
.f-links { display: flex; gap: 12px; align-items: center; }
.f-links a {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}
.f-links a:hover { color: var(--accent); text-decoration: none; }

.f-card h3 { font-size: 1.12rem; font-weight: 700; }
.f-card h3 a { color: var(--text); }
.f-card h3 a:hover { color: var(--accent); text-decoration: none; }

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

.f-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--text-dim);
}
.f-meta .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.p-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s, border-color 0.2s;
}
.p-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.p-card h4 { font-size: 0.98rem; font-weight: 600; }
.p-card h4 a { color: var(--text); }
.p-card h4 a:hover { color: var(--accent); text-decoration: none; }
.p-desc { color: var(--text-dim); font-size: 0.85rem; flex: 1; }

.proj-more { text-align: center; margin-top: 36px; }

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.skill-group h3 {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-group .chip {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text-dim);
}

/* ===== Contact ===== */
.contact { text-align: center; max-width: 640px; }
.contact .mono { font-size: 0.9rem; margin-bottom: 12px; }
.contact-title { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; margin-bottom: 16px; }
.contact-desc { color: var(--text-dim); margin-bottom: 32px; }
.contact-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.contact-links {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 32px 24px 40px;
  color: var(--text-dim);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

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

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

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero-inner { flex-direction: column-reverse; gap: 32px; text-align: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-tags, .hero-cta { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .avatar-ring { width: 180px; height: 180px; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 14px;
  }
  .nav-links.open { display: flex; }
  .nav-burger { display: block; }
}
