/* ---------- Design tokens ---------- */
:root {
  --bg: #05070f;
  --bg-alt: #0b0f1c;
  --surface: #0f1424;
  --surface-2: #131a2e;
  --border: #1e2740;
  --border-hover: rgba(249, 115, 22, 0.4);
  --text: #e6e9f2;
  --text-muted: #97a1b8;
  --text-faint: #5c6580;
  --accent: #f97316;
  --accent-2: #f43f5e;
  --accent-strong: #ea580c;
  --focus: #fb923c;
  --shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.5);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --container: 1140px;
  --nav-h: 76px;
}

[data-theme="light"] {
  --bg: #f7f8fc;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3fa;
  --border: #e4e7f1;
  --border-hover: rgba(234, 88, 12, 0.35);
  --text: #12162a;
  --text-muted: #565f7a;
  --text-faint: #8890a6;
  --shadow: 0 20px 50px -15px rgba(30, 30, 60, 0.15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--text); margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.icon { width: 20px; height: 20px; }
.icon.sm { width: 16px; height: 16px; }

.grad-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #05070f; padding: 10px 16px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { left: 16px; top: 16px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* ---------- Progress bar ---------- */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 300; transition: width .1s linear;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 150;
  border-bottom: 1px solid transparent;
  transition: background-color .3s ease, border-color .3s ease, padding .3s ease;
  padding: 20px 0;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  padding: 12px 0;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; color: var(--text); }
.brand span { color: var(--accent); }

.nav-links { display: none; gap: 32px; }
.nav-link {
  position: relative; font-size: .92rem; font-weight: 500; color: var(--text-muted);
  transition: color .2s ease; padding: 4px 0;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after, .nav-link:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: var(--text-muted);
  transition: background-color .2s ease, color .2s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--accent); }
.nav-toggle { display: inline-flex; }

.moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: inline-flex; }

.mobile-menu {
  display: flex; flex-direction: column;
  max-height: 0; overflow: hidden; opacity: 0;
  background: var(--bg-alt); border-bottom: 1px solid var(--border);
  transition: max-height .3s ease, opacity .25s ease;
}
.mobile-menu.open { max-height: 400px; opacity: 1; }
.mobile-menu a { padding: 16px 24px; color: var(--text-muted); font-weight: 500; border-top: 1px solid var(--border); }
.mobile-menu a:hover { color: var(--accent); background: var(--surface-2); }

@media (min-width: 860px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding-top: var(--nav-h); overflow: hidden;
}
.hero .wrap { width: 100%; }
.hero-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(249,115,22,.16), transparent 60%),
    radial-gradient(500px circle at 85% 75%, rgba(244,63,94,.14), transparent 60%);
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(-2%, 2%) scale(1.05); }
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; gap: 40px; } }
.hero-inner { max-width: 620px; }
.eyebrow {
  display: inline-block; margin: 0 0 20px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(249,115,22,.35); background: rgba(249,115,22,.08);
  color: var(--accent); font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.hero-name { font-size: clamp(2.6rem, 7vw, 4.5rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: 18px; }
.hero-role {
  font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 500; color: var(--text-muted);
  margin-bottom: 26px; min-height: 1.4em;
}
#roleText { color: var(--text); font-weight: 600; }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); margin-left: 4px; vertical-align: -0.15em; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-tagline { font-size: 1.1rem; color: var(--text-muted); max-width: 540px; padding-left: 20px; border-left: 2px solid var(--border); margin-bottom: 36px; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 40px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, border-color .25s ease;
}
.btn-primary {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent-2)); color: #fff;
  box-shadow: 0 10px 25px -8px rgba(234,88,12,.5);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -8px rgba(234,88,12,.6); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-hover); transform: translateY(-3px); background: var(--surface-2); }

.hero-socials { display: flex; gap: 22px; }
.hero-socials a { color: var(--text-faint); transition: color .25s ease, transform .25s ease; }
.hero-socials a:hover { color: var(--text); transform: translateY(-2px); }

.scroll-cue {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  color: var(--text-faint); animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,8px); } }

/* Hero terminal panel */
.hero-terminal {
  width: 100%; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.term-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #f87171; }
.dot-yellow { background: #fbbf24; }
.dot-green { background: #34d399; }
.term-title { margin-left: 8px; font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: var(--text-faint); }
.term-body { padding: 22px 24px; font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; line-height: 2; }
.term-line {
  margin: 0; color: var(--text-muted); overflow-wrap: break-word;
  opacity: 0; transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease;
  transition-delay: calc(var(--i, 0) * 110ms);
}
.hero-terminal.in .term-line { opacity: 1; transform: none; }
.term-cmd { color: var(--text); margin-bottom: 14px; }
.term-cmd::before { content: "$ "; color: var(--accent); }
.term-check { color: #34d399; }
.term-pass { color: #34d399; font-weight: 600; }
.term-summary { color: var(--accent); font-weight: 600; margin-top: 14px; display: flex; align-items: center; }
.term-caret { display: inline-block; width: 8px; height: 15px; background: var(--accent); margin-left: 8px; animation: blink 1s step-end infinite; }

@media (max-width: 640px) {
  .term-body { font-size: .74rem; }
}

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin-bottom: 56px; }
.kicker { color: var(--accent); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.section-title { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -.01em; margin-bottom: 14px; }
.section-sub { color: var(--text-muted); font-size: 1.05rem; }
.body-text { color: var(--text-muted); font-size: 1.05rem; line-height: 1.8; margin-bottom: 32px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 56px; }
@media (min-width: 960px) { .about-grid { grid-template-columns: 1fr 1fr; } }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stat-card { padding: 26px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); transition: border-color .25s ease, transform .25s ease; }
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-4px); }
.stat-num { display: block; font-size: 2.2rem; font-weight: 700; font-family: var(--font-head); margin-bottom: 6px; }
.stat-label { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

.about-side { display: flex; flex-direction: column; gap: 36px; }
.side-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.side-icon { display: inline-flex; padding: 10px; border-radius: 12px; background: rgba(249,115,22,.1); color: var(--accent); }
.side-icon.accent-2 { background: rgba(244,63,94,.1); color: var(--accent-2); }
.side-head h3 { font-size: 1.3rem; }

.card { padding: 26px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); transition: border-color .25s ease; }
.card:hover { border-color: var(--border-hover); }
.card h4 { font-size: 1.05rem; margin-bottom: 10px; }
.card-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--text-muted); margin-bottom: 6px; }
.pill { font-size: .72rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--accent); width: fit-content; }
.muted { color: var(--text-faint); font-size: .9rem; }

.cert-list { display: flex; flex-direction: column; gap: 12px; }
.cert-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); transition: border-color .25s ease; font-weight: 500; }
.cert-row:hover { border-color: var(--border-hover); }
.status { font-size: .72rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.status-done { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.25); }
.status-progress { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.25); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 700px) { .skills-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }
.skill-card { padding: 30px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease; }
.skill-card:hover { border-color: var(--border-hover); transform: translateY(-6px); box-shadow: var(--shadow); }
.skill-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.skill-icon { display: inline-flex; padding: 11px; border-radius: 12px; background: var(--surface-2); color: var(--text-muted); transition: background-color .25s ease, color .25s ease; }
.skill-card:hover .skill-icon { background: rgba(249,115,22,.15); color: var(--accent); }
.skill-head h3 { font-size: 1.15rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: .82rem; padding: 6px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }

/* ---------- Timeline ---------- */
.timeline { position: relative; margin-left: 8px; padding-left: 30px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 48px; }
.tl-item { position: relative; }
.tl-dot { position: absolute; left: -37px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); box-shadow: 0 0 0 4px rgba(249,115,22,.12); }
.tl-card { padding: 30px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); transition: border-color .3s ease; }
.tl-card:hover { border-color: var(--border-hover); }
.tl-top { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.tl-top h3 { font-size: 1.4rem; margin-bottom: 4px; }
.tl-company { color: var(--accent); font-weight: 600; }
.tl-meta { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--text-faint); }
.tl-meta span { display: flex; align-items: center; gap: 6px; }
.tl-list { display: flex; flex-direction: column; gap: 14px; color: var(--text-muted); }
.tl-list li { padding-left: 18px; position: relative; line-height: 1.7; }
.tl-list li::before { content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .6; }
.tl-list strong { color: var(--text); }

@media (min-width: 640px) {
  .tl-top { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .tl-meta { align-items: flex-end; }
}

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 800px) { .projects-grid { grid-template-columns: 1fr 1fr; } }
.project-card {
  padding: 32px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 18px;
  transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease;
}
.project-card:hover { border-color: var(--border-hover); transform: translateY(-6px); box-shadow: var(--shadow); }
.project-top { display: flex; align-items: center; gap: 14px; }
.project-icon { display: inline-flex; padding: 11px; border-radius: 12px; background: rgba(249,115,22,.1); color: var(--accent); }
.project-top h3 { font-size: 1.3rem; }
.project-goal { font-style: italic; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 16px; }
.project-outcome { display: flex; gap: 10px; align-items: flex-start; color: var(--text-muted); }
.project-outcome .accent-2 { color: #34d399; flex-shrink: 0; margin-top: 3px; }

/* ---------- Contact ---------- */
.contact-head { max-width: 620px; margin: 0 auto 56px; text-align: center; }
.contact-head .section-sub { margin-top: 14px; }
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 20px; max-width: 920px; margin: 0 auto; }
@media (min-width: 700px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }
.contact-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 34px 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  transition: border-color .3s ease, transform .3s ease, background-color .3s ease;
}
.contact-card:not(.static):hover { border-color: var(--border-hover); transform: translateY(-5px); background: var(--surface-2); }
.contact-icon { display: inline-flex; padding: 14px; border-radius: 50%; background: var(--surface-2); color: var(--accent); margin-bottom: 6px; }
.contact-icon.accent-2 { color: var(--accent-2); }
.contact-card h3 { font-size: 1.05rem; }
.contact-card p { color: var(--text-muted); font-size: .92rem; }
.copy-hint { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text-faint); margin-top: 4px; }

.social-row { display: flex; justify-content: center; gap: 32px; margin-top: 48px; }
.social-row a { display: flex; align-items: center; gap: 8px; color: var(--text-faint); font-weight: 500; transition: color .25s ease; }
.social-row a:hover { color: var(--text); }

/* ---------- Footer ---------- */
.footer { padding: 40px 0; text-align: center; color: var(--text-faint); font-size: .85rem; border-top: 1px solid var(--border); background: var(--bg); }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 120;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease, border-color .25s ease;
}
.to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--border-hover); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 250;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal:nth-child(1) { transition-delay: 0s; }
.reveal:nth-child(2) { transition-delay: .06s; }
.reveal:nth-child(3) { transition-delay: .12s; }
.reveal:nth-child(4) { transition-delay: .18s; }
.reveal:nth-child(5) { transition-delay: .24s; }
.reveal:nth-child(6) { transition-delay: .3s; }
