/* ===== Tokens ===== */
:root {
  --bg: #0a0d0c;
  --bg-alt: #0d1211;
  --panel: #101614;
  --panel-border: #1f2b27;
  --text: #d3dcd7;
  --text-dim: #7c8d86;
  --text-faint: #4b5b55;
  --accent: #39ff9d;
  --accent-dim: #1d7a54;
  --accent-2: #ffb454;
  --danger: #ff5f5f;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --max-w: 960px;
  --radius: 3px;
}

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

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

::selection { background: var(--accent-dim); color: #eafff2; }

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

h1, h2, h3, h4 { font-family: var(--font-mono); margin: 0; }

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

/* ===== Ambient overlays ===== */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
}
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  background: radial-gradient(ellipse at top, rgba(57,255,157,0.04), transparent 60%);
}

/* ===== Header / Nav ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,13,12,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-border);
}
.nav {
  max-width: 1100px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: 0.5px;
}
.brand:hover { text-decoration: none; }
.brand-bracket { color: var(--accent); }
.brand-cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.nav-links {
  list-style: none; display: flex; gap: 22px; margin: 0; padding: 0;
  align-items: center;
}
.nav-links a {
  color: var(--text-dim); font-size: 0.85rem; display: flex; gap: 6px; align-items: baseline;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links .idx { color: var(--text-faint); font-size: 0.7rem; }
.nav-resume {
  border: 1px solid var(--panel-border); padding: 5px 10px; border-radius: var(--radius);
  color: var(--accent) !important;
}
.nav-resume:hover { border-color: var(--accent); }

.nav-toggle {
  display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); display: block; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 100px 24px 60px;
  overflow: hidden;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(57,255,157,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,255,157,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  opacity: 0.7;
}
.hero-inner { position: relative; z-index: 1; max-width: 760px; display: flex; flex-direction: column; align-items: center; gap: 18px; }

.hero-terminal { width: min(560px, 90vw); text-align: left; margin-bottom: 10px; }
#heroTyped { min-height: 118px; }
#heroTyped .ln { color: var(--text-dim); }
#heroTyped .out { color: var(--accent); display: block; }

.hero-name {
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero-tagline { color: var(--text-dim); font-size: clamp(0.95rem, 2vw, 1.1rem); }
.hero-sub { max-width: 560px; color: var(--text-dim); font-size: 0.92rem; }

.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.hero-socials { font-size: 0.85rem; color: var(--text-faint); margin-top: 4px; }
.hero-socials a { color: var(--text-dim); }
.hero-socials a:hover { color: var(--accent); }
.hero-socials .sep { margin: 0 8px; color: var(--text-faint); }

.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 34px; border: 1px solid var(--panel-border); border-radius: 12px;
  display: flex; justify-content: center; padding-top: 6px;
}
.scroll-cue span { width: 3px; height: 8px; background: var(--accent); border-radius: 2px; animation: scrollcue 1.6s ease infinite; }
@keyframes scrollcue { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-mono); font-size: 0.85rem; padding: 11px 18px;
  border-radius: var(--radius); border: 1px solid var(--panel-border);
  display: inline-block; transition: all .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #04140c; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #5affb3; }
.btn-ghost { color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Sections ===== */
.section { max-width: var(--max-w); margin: 0 auto; padding: 100px 24px; }
.section.alt { max-width: 100%; background: var(--bg-alt); border-top: 1px solid var(--panel-border); border-bottom: 1px solid var(--panel-border); }
.section.alt > * { max-width: var(--max-w); margin-left: auto; margin-right: auto; }

.section-heading {
  font-size: 1.4rem; margin-bottom: 40px; display: flex; align-items: center; gap: 12px;
  color: var(--text);
}
.section-heading .tag {
  font-size: 0.75rem; color: var(--bg); background: var(--accent);
  padding: 2px 8px; border-radius: var(--radius); font-weight: 700;
}

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ===== Terminal window component ===== */
.terminal-window {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 6px;
  overflow: hidden; box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
}
.terminal-titlebar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #0d1614; border-bottom: 1px solid var(--panel-border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.terminal-title { margin-left: 8px; font-size: 0.75rem; color: var(--text-faint); }
.terminal-body {
  padding: 18px 16px; font-size: 0.85rem; line-height: 1.7; min-height: 60px;
  white-space: pre-wrap;
}
.terminal-body .ln { color: var(--text-dim); }
.terminal-body .out { color: var(--accent); display: block; }
.static-body .ln { display: block; color: var(--text-dim); margin-bottom: 4px; }
.static-body .out { color: var(--text); }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.about-text p { color: var(--text-dim); margin: 0 0 16px; }
.about-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.fact { border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 10px 12px; }
.fact-label { display: block; font-size: 0.68rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.fact-value { display: block; font-size: 0.85rem; color: var(--text); margin-top: 4px; }

/* ===== Certs ===== */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cert-card {
  border: 1px solid var(--panel-border); background: var(--panel); border-radius: 6px; padding: 24px;
  transition: border-color .2s ease, transform .2s ease;
}
.cert-card:hover { border-color: var(--accent-dim); transform: translateY(-3px); }
.cert-icon {
  width: 42px; height: 42px; border-radius: 6px; background: rgba(57,255,157,0.1); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; margin-bottom: 16px;
  border: 1px solid var(--accent-dim);
}
.cert-card h3 { font-size: 0.98rem; margin-bottom: 8px; }
.cert-date { color: var(--accent-2); font-size: 0.75rem; margin: 0 0 10px; }
.cert-desc { color: var(--text-dim); font-size: 0.85rem; margin: 0; }

/* ===== Projects ===== */
.project-list { display: flex; flex-direction: column; gap: 20px; }
.project-card {
  border: 1px solid var(--panel-border); background: var(--panel); border-radius: 6px; padding: 26px 28px;
  transition: border-color .2s ease;
}
.project-card:hover { border-color: var(--accent-dim); }
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project-head h3 { font-size: 1.05rem; }
.project-status {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-2);
  border: 1px solid rgba(255,180,84,0.3); padding: 3px 9px; border-radius: 20px;
}
.project-stack { color: var(--text-faint); font-size: 0.78rem; margin: 8px 0 14px; }
.project-points { margin: 0; padding-left: 20px; color: var(--text-dim); font-size: 0.88rem; display: flex; flex-direction: column; gap: 8px; }
.project-points li::marker { color: var(--accent); }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 24px; }
.timeline-item { position: relative; padding-bottom: 8px; }
.timeline-dot { position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.timeline-head h3 { font-size: 1.05rem; }
.timeline-date { color: var(--text-faint); font-size: 0.78rem; }
.timeline-org { color: var(--accent-2); font-size: 0.82rem; margin: 4px 0 14px; }

/* ===== Skills ===== */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
.skill-group h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  font-size: 0.78rem; border: 1px solid var(--panel-border); color: var(--text-dim);
  padding: 5px 11px; border-radius: 20px; background: var(--panel);
}

/* ===== GitHub ===== */
.github-panel { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.github-panel .terminal-window { width: 100%; }
#githubStats .out { color: var(--text); display: block; }
#githubStats .accent { color: var(--accent); }
.github-link { align-self: center; }

/* ===== Interactive terminal ===== */
.interactive-terminal { max-width: 720px; margin: 0 auto; }
#termOutput { max-height: 320px; overflow-y: auto; }
#termOutput .out { color: var(--text); display: block; margin-bottom: 6px; }
#termOutput .cmd { color: var(--accent-2); display: block; }
#termOutput .accent { color: var(--accent); }
.terminal-input-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--panel-border);
}
.prompt { color: var(--accent); font-size: 0.8rem; white-space: nowrap; }
#termInput {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-family: var(--font-mono); font-size: 0.85rem;
}

/* ===== Contact ===== */
.contact-lede { color: var(--text-dim); margin-bottom: 28px; }
.contact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.contact-card {
  border: 1px solid var(--panel-border); background: var(--panel); border-radius: 6px; padding: 18px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .2s ease, transform .2s ease;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }
.contact-label { font-size: 0.68rem; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.6px; }
.contact-value { font-size: 0.85rem; color: var(--text); word-break: break-word; }

/* ===== Footer ===== */
.site-footer { text-align: center; padding: 36px 24px; color: var(--text-faint); font-size: 0.78rem; }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .cert-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: flex-start;
    background: var(--bg-alt); border-bottom: 1px solid var(--panel-border);
    padding: 16px 24px; gap: 16px; display: none;
  }
  .nav-links.open { display: flex; }
  .section { padding: 70px 20px; }
}
