/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --border: #e4e6ef;
  --text: #14161f;
  --text-muted: #5c6072;
  --text-faint: #8b8fa3;
  --accent: #4a5df9;
  --accent-hover: #3746e0;
  --accent-soft: rgba(74, 93, 249, 0.1);
  --shadow: 0 1px 2px rgba(20, 22, 31, 0.04), 0 8px 24px rgba(20, 22, 31, 0.06);
  --shadow-lg: 0 4px 12px rgba(20, 22, 31, 0.08), 0 24px 48px rgba(20, 22, 31, 0.12);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0b0d14;
  --bg-alt: #10131c;
  --surface: #141824;
  --border: #232838;
  --text: #eef0f7;
  --text-muted: #a4a8bd;
  --text-faint: #6b708a;
  --accent: #7c8bff;
  --accent-hover: #96a2ff;
  --accent-soft: rgba(124, 139, 255, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 32px 64px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 760px; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-size: 0.92rem; font-weight: 500; color: var(--text-muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 10px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { border-color: var(--border); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { color: var(--text-muted); background: transparent; }
.btn-ghost:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 120px 0 100px; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 6px 14px; border-radius: 999px; margin: 0 0 20px;
}
.hero-photo { width: 108px; height: 108px; border-radius: 50%; object-fit: cover; margin: 0 0 20px; border: 3px solid var(--accent-soft); }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 8px; }
.hero-role { font-size: clamp(1.1rem, 2.5vw, 1.5rem); color: var(--accent); font-weight: 600; margin: 0 0 18px; }
.hero-tagline { font-size: 1.08rem; color: var(--text-muted); max-width: 620px; margin: 0 0 36px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-glow {
  position: absolute; top: -20%; right: -10%; width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  filter: blur(40px); pointer-events: none;
}

/* ---------- Sections ---------- */
.section { padding: 90px 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 40px;
  display: flex; align-items: baseline; gap: 10px;
}
.section-title span { color: var(--accent); font-family: var(--font-mono); font-size: 1rem; font-weight: 600; }
.section-title-spaced { margin-top: 64px; }
.about-text { font-size: 1.1rem; color: var(--text-muted); max-width: 720px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px;
}
.skill-card h3 { margin: 0 0 14px; font-size: 0.95rem; font-weight: 700; }
.skill-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
  background: var(--accent-soft); padding: 5px 12px; border-radius: 999px;
}

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.project-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.project-metric {
  display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 6px; margin-bottom: 14px;
}
.project-card h3 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 700; }
.project-stack { font-size: 0.8rem; color: var(--text-faint); font-family: var(--font-mono); margin: 0 0 12px; }
.project-summary { color: var(--text-muted); font-size: 0.94rem; margin: 0 0 18px; }
.project-link { font-size: 0.86rem; font-weight: 700; color: var(--accent); }

/* ---------- Project detail ---------- */
.back-link { display: inline-block; margin-bottom: 24px; color: var(--text-muted); font-weight: 600; font-size: 0.9rem; }
.back-link:hover { color: var(--accent); }
.project-detail-title { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 16px; }
.project-metric-large { font-size: 0.95rem; padding: 8px 16px; margin-bottom: 18px; }
.project-stack-large { font-size: 0.92rem; margin-bottom: 32px; }
.project-detail-body p { color: var(--text-muted); font-size: 1.04rem; margin: 0 0 18px; }
.project-detail-links { display: flex; gap: 14px; margin-top: 32px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 28px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: -34px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.timeline-content h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.timeline-period { font-size: 0.82rem; color: var(--text-faint); font-family: var(--font-mono); }
.timeline-org { color: var(--accent); font-weight: 600; font-size: 0.92rem; margin: 4px 0 12px; }
.timeline-content ul { margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 0.94rem; }
.timeline-content li { margin-bottom: 8px; }

.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px; margin-top: 56px; }
.edu-heading { font-size: 1rem; font-weight: 700; margin: 0 0 18px; }
.edu-item { display: flex; flex-direction: column; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.edu-item strong { font-size: 0.95rem; }
.edu-item span { font-size: 0.84rem; color: var(--text-faint); margin-top: 3px; }

/* ---------- Contact ---------- */
.contact-intro { color: var(--text-muted); max-width: 560px; margin: 0 0 40px; }
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; }
.contact-form { display: flex; flex-direction: column; gap: 18px; }
.contact-form label { display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; font-weight: 600; color: var(--text-muted); }
.contact-form input, .contact-form textarea {
  font-family: var(--font); font-size: 0.95rem; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form button { align-self: flex-start; margin-top: 6px; }
.contact-info p { margin: 0 0 24px; font-size: 0.94rem; }
.contact-info strong { display: block; font-size: 0.8rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.contact-info a { color: var(--accent); font-weight: 600; }

.flash { padding: 12px 18px; border-radius: 10px; margin: 16px 0; font-size: 0.9rem; font-weight: 600; }
.flash-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.flash-error { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: center; }
.footer-inner p { margin: 0; font-size: 0.85rem; color: var(--text-faint); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  .nav-links {
    position: fixed; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-150%); opacity: 0; transition: all 0.25s ease; padding: 8px 24px;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; }
  .nav-links a { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: inline-flex; }
  .contact-grid { grid-template-columns: 1fr; }
  .hero { padding: 90px 0 70px; }
  .section { padding: 64px 0; }
}
