/* ---------- Design tokens ---------- */
:root {
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-alt: #161a23;
  --border: #232733;
  --text: #e9ebf1;
  --text-muted: #9aa1b4;
  --accent: #5b8cff;
  --accent-2: #2dd4bf;
  --accent-contrast: #061018;
  --radius: 14px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-alt: #eef0f6;
  --border: #e1e4ee;
  --text: #171a21;
  --text-muted: #5b6072;
  --accent: #3b66d6;
  --accent-2: #0f9a8a;
  --accent-contrast: #ffffff;
  --shadow: 0 20px 50px -24px rgba(23, 26, 33, 0.25);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-alt: #eef0f6;
    --border: #e1e4ee;
    --text: #171a21;
    --text-muted: #5b6072;
    --accent: #3b66d6;
    --accent-2: #0f9a8a;
    --accent-contrast: #ffffff;
    --shadow: 0 20px 50px -24px rgba(23, 26, 33, 0.25);
    color-scheme: light;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
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 0.3s ease, color 0.3s ease;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ---------- Layout helpers ---------- */
.section { padding: 6rem 1.5rem; }
.section-alt { background: var(--surface); }
.section-inner, .header-inner, .hero-inner, .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  margin-bottom: 2.5rem;
}
.dim { color: var(--text-muted); font-weight: 400; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, background-color 0.2s ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--accent); color: var(--accent-contrast); }
.button-primary:hover { filter: brightness(1.1); }
.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.button-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  gap: 1rem;
}
.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}
.logo-dot { color: var(--accent); }
.main-nav {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  margin-right: 2rem;
}
.main-nav a {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
  position: relative;
}
.main-nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
  min-height: 80vh;
}
.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, var(--text), var(--accent) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.role {
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.hero-lede {
  color: var(--text-muted);
  max-width: 54ch;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.social-row { display: flex; gap: 1.25rem; }
.social-row a {
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
}
.social-row a:hover { color: var(--accent); transform: translateY(-2px); }

.hero-visual { display: grid; place-items: center; }
.photo-frame {
  position: relative;
  width: min(320px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.profile-photo {
  width: 78%;
  height: 78%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
  background: var(--surface);
}
.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.ring-1 { animation: spin 18s linear infinite; }
.ring-2 { inset: -11%; animation: spin 26s linear infinite reverse; }
.ring .orbit-dot {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--accent-2);
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ring-1, .ring-2 { animation: none; }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
}
.about-text { color: var(--text-muted); margin-bottom: 1.25rem; }
.about-text:last-of-type { margin-bottom: 0; }
.about-facts {
  display: grid;
  gap: 1rem;
  align-content: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.about-facts li { display: flex; flex-direction: column; gap: 0.2rem; }
.fact-label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}
.skill-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.section-alt .skill-card { background: var(--surface-alt); }
.skill-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--accent); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-list li {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.section-alt .chip-list li { background: var(--bg); }

/* ---------- Timeline ---------- */
.timeline {
  display: grid;
  gap: 2.5rem;
  position: relative;
  padding-left: 1.75rem;
  border-left: 2px solid var(--border);
}
.timeline-item { position: relative; }
.timeline-marker {
  position: absolute;
  left: -2.35rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.timeline-head h3 { font-size: 1.2rem; }
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-2);
}
.timeline-org { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.95rem; }
.timeline-role { margin-top: 1.25rem; }
.timeline-role h4 { font-size: 1rem; margin-bottom: 0.5rem; }
.timeline-item ul, .timeline-role ul { display: grid; gap: 0.5rem; }
.timeline-item li, .timeline-role li {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding-left: 1.1rem;
  position: relative;
}
.timeline-item li::before, .timeline-role li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
}

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.edu-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
}
.section-alt .edu-card { background: var(--surface-alt); }
.edu-card.edu-current { border-color: var(--accent); }
.edu-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-contrast);
  background: var(--accent);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}
.edu-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.edu-org { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.4rem; }
.edu-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); }

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent-2);
}
.project-head a { color: var(--text-muted); transition: color 0.2s ease; }
.project-head a:hover { color: var(--accent); }
.project-private {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.project-body h3 { font-size: 1.1rem; margin-bottom: 0.6rem; }
.project-body p { color: var(--text-muted); font-size: 0.95rem; }
.tech-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tech-list li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}
.more-projects { margin-top: 2.5rem; color: var(--text-muted); }
.more-projects a { color: var(--accent); font-weight: 600; }

/* ---------- Contact ---------- */
.contact-lede { color: var(--text-muted); max-width: 60ch; margin-bottom: 2.5rem; }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--accent-2);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.section-alt .contact-card { background: var(--surface-alt); }
.contact-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.contact-card-static:hover { transform: none; border-color: var(--border); }
.contact-card div { display: flex; flex-direction: column; gap: 0.15rem; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.contact-card { min-width: 0; }
.contact-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 1.5rem; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal[data-reveal="fade-up"] { transform: translateY(24px); }
.reveal[data-reveal="fade-in"] { transform: scale(0.96); }
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: left; padding-top: 3rem; }
  .hero-visual { order: -1; max-width: 240px; margin: 0 auto; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .main-nav {
    position: fixed;
    inset: 64px 0 auto 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .main-nav.open { transform: translateY(0); opacity: 1; }
  .nav-toggle { display: inline-flex; }
  .header-actions .button-ghost { display: none; }
}
