/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080b10;
  --surface: #0d1117;
  --surface-2: #161b22;
  --border: #21262d;
  --green: #00ff88;
  --green-dim: rgba(0,255,136,0.12);
  --green-glow: rgba(0,255,136,0.18);
  --blue: #58a6ff;
  --purple: #a78bfa;
  --yellow: #e3b341;
  --text: #e6edf3;
  --text-2: #8b949e;
  --text-3: #3d444d;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --r: 8px;
  --ease: 0.3s ease;
}

html { scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
a { color: var(--green); text-decoration: none; }

/* ===== NAV ===== */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 60px; padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(8,11,16,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: all var(--ease);
}
.nav-logo { font-family: var(--mono); font-size: 0.95rem; color: var(--green); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { color: var(--text-2); font-size: 0.875rem; font-weight: 500; transition: color var(--ease); }
.nav-links a:hover, .nav-links a.active { color: var(--green); }
.nav-hire {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 0.35rem 0.875rem;
  border: 1px solid var(--green); border-radius: var(--r);
  color: var(--green); transition: background var(--ease), box-shadow var(--ease);
}
.nav-hire:hover { background: var(--green-dim); box-shadow: 0 0 14px var(--green-glow); }

/* ===== HERO ===== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 6rem 2rem 4rem; position: relative; overflow: hidden;
}
#bg-canvas { position: absolute; inset: 0; pointer-events: none; }
.hero-inner { position: relative; z-index: 2; width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; gap: 1.75rem; }

.hero-badge {
  font-family: var(--mono); font-size: 0.75rem; color: var(--green);
  letter-spacing: 0.15em; text-transform: uppercase; opacity: 0.85;
  display: flex; align-items: center; gap: 0.5rem;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{box-shadow:0 0 0 0 var(--green-glow)} 50%{box-shadow:0 0 0 6px transparent} }

/* Terminal */
.terminal {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,255,136,0.06), 0 24px 64px rgba(0,0,0,0.6);
}
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 0.7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.t-dot { width: 11px; height: 11px; border-radius: 50%; }
.t-dot:nth-child(1){background:#ff5f57} .t-dot:nth-child(2){background:#febc2e} .t-dot:nth-child(3){background:#28c840}
.t-bar-title { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin: 0 auto; padding-right: 55px; }
.terminal-body { padding: 1.25rem 1.5rem; font-family: var(--mono); font-size: 0.875rem; line-height: 2; min-height: 220px; }
.t-line { display: block; }
.t-prompt { color: var(--green); }
.t-cmd { color: var(--text); }
.t-out { color: var(--text-2); }
.t-key { color: var(--blue); }
.t-hi { color: var(--yellow); }
.t-cursor { display: inline-block; width: 9px; height: 1em; background: var(--green); vertical-align: middle; margin-left: 2px; animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: var(--mono); font-size: 0.82rem;
  padding: 0.6rem 1.35rem; border-radius: var(--r);
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.18s ease;
}
.btn-primary { background: var(--green); color: #080b10; font-weight: 700; }
.btn-primary:hover { box-shadow: 0 0 24px rgba(0,255,136,0.45); transform: translateY(-2px); }
.btn-ghost { border-color: var(--border); color: var(--text-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); transform: translateY(-1px); }

.scroll-hint { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); animation: bob 2s ease infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(5px)} }

/* ===== COMMON SECTION ===== */
.section { padding: 5rem 2rem; }
.section.alt { background: var(--surface); }
.container { max-width: 1020px; margin: 0 auto; }
.s-label { font-family: var(--mono); font-size: 0.7rem; color: var(--green); letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 0.35rem; opacity: 0.8; }
.s-title { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.1; margin-bottom: 0.75rem; }
.s-rule { width: 44px; height: 3px; background: var(--green); border-radius: 2px; margin-bottom: 3rem; }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.65s ease, transform 0.65s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
.d1{transition-delay:.1s} .d2{transition-delay:.2s} .d3{transition-delay:.3s} .d4{transition-delay:.4s}

/* ===== ABOUT ===== */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 4rem; align-items: start; }
.about-text p { color: var(--text-2); font-size: 1.05rem; line-height: 1.85; margin-bottom: 0.9rem; }
.about-text strong { color: var(--text); }
.jp-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem;
  background: rgba(0,255,136,0.07); border: 1px solid rgba(0,255,136,0.22);
  border-radius: var(--r); padding: 0.45rem 1rem;
  font-family: var(--mono); font-size: 0.78rem; color: var(--green);
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }
.stat-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.25rem; text-align: center;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.stat-card:hover { border-color: var(--green); box-shadow: 0 0 20px var(--green-dim); }
.stat-num { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; color: var(--green); }
.stat-lbl { font-size: 0.78rem; color: var(--text-3); margin-top: 0.2rem; }

/* ===== SKILLS ===== */
.skills-stack { display: flex; flex-direction: column; gap: 2.25rem; }
.skill-row h3 {
  font-family: var(--mono); font-size: 0.75rem; color: var(--green);
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.skill-row h3::before { content: '//'; opacity: 0.35; }
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 0.3rem 0.75rem; border-radius: 4px;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2);
  transition: all 0.18s ease; cursor: default;
}
.tag:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); transform: translateY(-1px); }
.tag.hi { border-color: rgba(0,255,136,0.3); color: var(--green); background: rgba(0,255,136,0.06); }

/* ===== EXPERIENCE ===== */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(180deg, var(--green) 0%, var(--border) 50%, transparent 100%);
}
.t-item { position: relative; margin-bottom: 3rem; }
.t-node {
  position: absolute; left: -2.45rem; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 14px rgba(0,255,136,0.6);
}
.t-node.dim { background: var(--border); box-shadow: none; }
.t-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.2rem; }
.t-co { font-weight: 700; font-size: 1.1rem; }
.t-period { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.18rem 0.55rem; white-space: nowrap; }
.t-role { font-family: var(--mono); font-size: 0.82rem; color: var(--green); margin-bottom: 0.2rem; }
.t-loc { font-size: 0.8rem; color: var(--text-3); margin-bottom: 1rem; }
.t-projects { display: flex; flex-direction: column; gap: 0.65rem; }
.t-proj {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1rem 1.1rem;
  transition: border-color var(--ease);
}
.t-proj:hover { border-color: rgba(0,255,136,0.25); }
.t-proj-name { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.4rem; color: var(--text); }
.t-proj ul { list-style: none; }
.t-proj ul li { font-size: 0.855rem; color: var(--text-2); padding: 0.12rem 0 0.12rem 1rem; position: relative; }
.t-proj ul li::before { content: '›'; position: absolute; left: 0; color: var(--green); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.65rem; }
.chip { font-family: var(--mono); font-size: 0.68rem; padding: 0.12rem 0.48rem; border-radius: 4px; background: rgba(88,166,255,0.1); color: var(--blue); border: 1px solid rgba(88,166,255,0.18); }

/* ===== PROJECTS ===== */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.proj-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.5rem; display: flex; flex-direction: column;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  cursor: pointer;
}
.proj-card:hover { border-color: var(--green); transform: translateY(-4px); box-shadow: 0 16px 48px rgba(0,255,136,0.08); }
.proj-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.proj-icon { font-size: 1.375rem; }
.proj-arr { color: var(--text-3); font-size: 0.85rem; transition: color var(--ease); }
.proj-card:hover .proj-arr { color: var(--green); }
.proj-name { font-family: var(--mono); font-weight: 700; font-size: 0.9375rem; color: var(--text); margin-bottom: 0.45rem; }
.proj-desc { font-size: 0.845rem; color: var(--text-2); line-height: 1.65; flex: 1; margin-bottom: 0.875rem; }
.proj-foot { display: flex; justify-content: space-between; align-items: center; }
.proj-lang { display: flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); }
.lang-dot { width: 9px; height: 9px; border-radius: 50%; }
.proj-badge { font-family: var(--mono); font-size: 0.68rem; color: var(--text-3); }

/* ===== OSS ===== */
.oss-lead { font-size: 1.05rem; color: var(--text-2); line-height: 1.8; max-width: 620px; margin-bottom: 2rem; }
.oss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.oss-row {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.65rem 1rem;
  font-family: var(--mono); font-size: 0.78rem; color: var(--text-2);
  display: flex; align-items: center; gap: 0.5rem;
  transition: all var(--ease);
}
.oss-row:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); transform: translateX(2px); }
.oss-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ===== EDUCATION ===== */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.edu-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 1.375rem; transition: border-color var(--ease); }
.edu-card:hover { border-color: rgba(0,255,136,0.3); }
.edu-badge { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--green); margin-bottom: 0.5rem; }
.edu-title { font-weight: 600; font-size: 0.9375rem; color: var(--text); margin-bottom: 0.25rem; }
.edu-sub { font-size: 0.845rem; color: var(--text-2); }
.edu-yr { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin-top: 0.5rem; }
.lang-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.lang-pill {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.45rem 0.875rem; font-size: 0.875rem;
}
.lang-pill-flag { font-size: 1.1rem; }
.lang-pill-name { font-weight: 600; }
.lang-pill-lv { font-size: 0.72rem; color: var(--text-3); margin-left: 0.2rem; }

/* ===== CONTACT ===== */
.contact-section { text-align: center; }
.contact-section .container { display: flex; flex-direction: column; align-items: center; }
.contact-desc { font-size: 1.05rem; color: var(--text-2); max-width: 520px; line-height: 1.8; margin-bottom: 2.5rem; }
.cta-links { display: flex; gap: 0.875rem; flex-wrap: wrap; justify-content: center; margin-bottom: 2.5rem; }
.cta-link {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.7rem 1.25rem;
  color: var(--text-2); font-family: var(--mono); font-size: 0.82rem;
  transition: all var(--ease);
}
.cta-link:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,255,136,0.1); }
.cta-link svg { flex-shrink: 0; }
.loc-chip { font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); display: flex; align-items: center; gap: 0.4rem; }

/* ===== FOOTER ===== */
footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2rem; text-align: center; font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); }
footer .g { color: var(--green); }

/* ===== BACK TO TOP ===== */
#back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 300;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--green);
  border-radius: 50%; color: var(--green);
  font-size: 1.1rem; font-family: var(--mono); cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-shadow: 0 0 0 var(--green-glow);
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: var(--green-dim); box-shadow: 0 0 18px var(--green-glow); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 0 1.25rem; }
  .nav-links { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .section { padding: 3.5rem 1.25rem; }
  .hero { padding: 5rem 1.25rem 3rem; }
  .terminal-body { font-size: 0.78rem; padding: 1rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
