/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  /* Dark (default) */
  --bg: #0F1419;
  --bg-alt: #131920;
  --surface: #161C24;
  --surface-2: #1C242E;
  --border: #262F3B;
  --text: #E6EDF3;
  --text-muted: #8B98A5;
  --text-dim: #5B6572;
  --accent: #5CC8C2;
  --accent-soft: rgba(92, 200, 194, 0.12);
  --accent2: #E8B04B;
  --accent2-soft: rgba(232, 176, 75, 0.12);
  --danger: #E5636B;
  --shadow: 0 20px 60px rgba(0,0,0,0.35);

  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 1080px;
}

[data-theme="light"] {
  --bg: #F6F7F5;
  --bg-alt: #EFF1EE;
  --surface: #FFFFFF;
  --surface-2: #F1F3F1;
  --border: #DDE2DE;
  --text: #14201E;
  --text-muted: #566260;
  --text-dim: #8A938F;
  --accent: #1E8A83;
  --accent-soft: rgba(30, 138, 131, 0.09);
  --accent2: #B67A1E;
  --accent2-soft: rgba(182, 122, 30, 0.09);
  --shadow: 0 20px 60px rgba(20,32,30,0.08);
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

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

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.accent { color: var(--accent); }
.accent-text { color: var(--accent); }

/* subtle grain overlay for texture */
.noise-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   NAV
   ========================================================================== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  letter-spacing: -0.02em;
}
.cursor-blink { animation: blink 1.1s step-end infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; gap: 28px; }
.nav-link {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: color 0.2s ease;
}
.nav-link:hover { color: var(--text); }
.nav-num { color: var(--text-dim); font-size: 11px; }

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

.theme-toggle {
  background: var(--surface); border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); position: relative;
}
.theme-toggle svg { position: absolute; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; transition: opacity 0.2s ease, transform 0.3s ease; }
.icon-moon { opacity: 0; transform: rotate(-40deg) scale(0.6); }
[data-theme="light"] .icon-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
[data-theme="light"] .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
:root:not([data-theme="light"]) .icon-sun { opacity: 1; transform: rotate(0) scale(1); }

.nav-menu-btn {
  display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px;
}
.nav-menu-btn span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

.mobile-menu {
  position: fixed; top: 0; right: 0; height: 100vh; width: 240px;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 99; transform: translateX(100%); transition: transform 0.3s ease;
  display: flex; flex-direction: column; gap: 4px; padding: 90px 24px 24px;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-link { font-family: var(--font-mono); font-size: 15px; padding: 12px 0; display: flex; gap: 10px; color: var(--text); border-bottom: 1px solid var(--border); }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 120px 24px 60px; position: relative;
}
.hero-inner {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: center;
}

.terminal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  order: 2;
}
.terminal-titlebar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.term-dots { display: flex; gap: 6px; }
.term-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.term-dots span:nth-child(1) { background: #E5636B; }
.term-dots span:nth-child(2) { background: var(--accent2); }
.term-dots span:nth-child(3) { background: var(--accent); }
.term-title { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); margin-left: 4px; }

.terminal-body { padding: 20px 20px 24px; font-family: var(--font-mono); font-size: 13.5px; }
.term-prompt { color: var(--accent); }
.term-request { color: var(--text); margin-bottom: 14px; min-height: 1.4em; }
.term-response { opacity: 0; transform: translateY(6px); transition: opacity 0.5s ease, transform 0.5s ease; }
.term-response.show { opacity: 1; transform: translateY(0); }
.term-status { display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 12.5px; }
.status-ok { color: var(--accent); font-weight: 600; }
.json-block { color: var(--text-muted); font-size: 13px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.jp { color: var(--text-dim); }
.jk { color: var(--accent2); }
.jv { color: var(--text); }
.jarr { color: var(--accent); }

.hero-text { order: 1; }
.hero-eyebrow {
  font-family: var(--font-mono); color: var(--accent); font-size: 13px;
  margin-bottom: 18px; letter-spacing: 0.02em;
}
.hero-heading {
  font-family: var(--font-mono); font-size: clamp(32px, 4.2vw, 52px);
  font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 22px;
}
.hero-sub {
  color: var(--text-muted); font-size: 16.5px; max-width: 46ch; margin-bottom: 34px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 500;
  padding: 13px 24px; border-radius: var(--radius-sm); border: 1px solid transparent;
  display: inline-flex; align-items: center; transition: all 0.2s ease;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--accent-soft); }
.btn-secondary { border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.scroll-hint {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim);
}
.scroll-line { width: 1px; height: 28px; background: linear-gradient(var(--text-dim), transparent); animation: scrollpulse 1.8s ease-in-out infinite; }
@keyframes scrollpulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ==========================================================================
   SECTIONS (shared)
   ========================================================================== */
.section { padding: 110px 24px; }
.section-alt { background: var(--bg-alt); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-eyebrow {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.section-heading {
  font-family: var(--font-mono); font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700; letter-spacing: -0.01em; margin-bottom: 52px;
}

.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   ABOUT
   ========================================================================== */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 60px; }
.about-text p { color: var(--text-muted); font-size: 16px; margin-bottom: 18px; max-width: 54ch; }
.about-text strong { color: var(--text); font-weight: 600; }

.about-meta { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.meta-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.meta-row:last-child { border-bottom: none; }
.meta-key { font-family: var(--font-mono); color: var(--text-dim); }
.meta-val { color: var(--text); text-align: right; font-weight: 500; }

/* ==========================================================================
   SKILLS
   ========================================================================== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; transition: border-color 0.2s ease, transform 0.2s ease; }
.skill-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.skill-cat { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-bottom: 14px; font-weight: 600; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono); font-size: 12px; padding: 5px 10px;
  border-radius: 5px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.tag-sm { font-size: 11px; padding: 4px 9px; }

/* ==========================================================================
   PROJECTS
   ========================================================================== */
.endpoint-list { display: flex; flex-direction: column; gap: 20px; }
.endpoint-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px; transition: border-color 0.2s ease, transform 0.2s ease;
}
.endpoint-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.endpoint-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.method {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 4px 9px;
  border-radius: 4px; letter-spacing: 0.03em;
}
.method-get { background: var(--accent-soft); color: var(--accent); }
.method-post { background: var(--accent2-soft); color: var(--accent2); }
.endpoint-path { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.endpoint-title { font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.endpoint-desc { color: var(--text-muted); font-size: 14.5px; margin-bottom: 18px; max-width: 70ch; }
.endpoint-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.endpoint-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ==========================================================================
   EXPERIENCE
   ========================================================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 44px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -28px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.timeline-role { font-size: 17px; font-weight: 700; }
.timeline-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.timeline-org { color: var(--accent); font-size: 13.5px; font-weight: 500; margin-bottom: 12px; }
.timeline-list li { color: var(--text-muted); font-size: 14.5px; padding-left: 16px; position: relative; margin-bottom: 6px; }
.timeline-list li::before { content: '—'; position: absolute; left: 0; color: var(--text-dim); }

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact-section { text-align: left; }
.contact-sub { color: var(--text-muted); font-size: 15.5px; margin-top: -36px; margin-bottom: 44px; max-width: 50ch; }
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.contact-label { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.contact-value { font-size: 15px; font-weight: 500; word-break: break-word; }

.footer { text-align: center; padding: 34px 24px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: flex; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .terminal-card { order: 1; }
  .hero-text { order: 2; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .contact-grid { grid-template-columns: 1fr; }
  .section { padding: 80px 20px; }
}

@media (max-width: 480px) {
  .hero { padding-top: 100px; }
  .hero-heading { font-size: 30px; }
  .terminal-body { font-size: 12px; padding: 16px; }
  .json-block { font-size: 11.5px; }
}
