/* ============ Theme tokens ============ */
:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #111a2e;
  --surface-2: #1a2540;
  --border: #233047;
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, .12);
  --accent-ink: #042f2e;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text); font-weight: 600; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 780px; }
[hidden] { display: none !important; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 16px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700;
}
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.menu-btn { display: none; }

/* ============ Hero ============ */
.hero { padding: 96px 0 72px; border-bottom: 1px solid var(--border); }
.status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
h1 { font-size: clamp(40px, 6vw, 60px); line-height: 1.1; margin: 0 0 10px; letter-spacing: -.025em; font-weight: 800; }
.hero-title { font-size: clamp(18px, 2.4vw, 22px); font-weight: 600; color: var(--accent); margin: 0 0 16px; }
.hero-tagline { font-size: 18px; color: var(--text-2); margin: 0 0 12px; max-width: 620px; }
.hero-loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; color: var(--muted); font-size: 15px; margin: 0 0 28px; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
a.meta-item:hover { color: var(--accent); text-decoration: none; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 13px 28px; font-size: 16px; }

.socials { display: flex; gap: 10px; }
.socials.center { justify-content: center; margin-top: 28px; }
.socials a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: color .2s, border-color .2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }

/* Key numbers */
.stats-title {
  margin: 56px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.stat { padding: 24px 22px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat b { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); line-height: 1.15; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.4; }

/* ============ Sections ============ */
.section { padding: 88px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title {
  font-size: clamp(26px, 3.2vw, 32px); margin: 0 0 36px; letter-spacing: -.015em; font-weight: 700;
}
.section-title::after {
  content: ""; display: block; width: 44px; height: 3px; border-radius: 2px; margin-top: 12px; background: var(--accent);
}
.contact .section-title::after { margin-left: auto; margin-right: auto; }

/* About */
.about-text p { color: var(--text-2); font-size: 17px; margin: 0 0 18px; }
.about-text p:last-child { margin-bottom: 0; }
.sub-title { margin: 40px 0 16px; font-size: 18px; font-weight: 700; }
.hobbies { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hobby {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.hobby-icon {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
}
.hobby h4 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; }
.hobby p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.6; }
@media (max-width: 760px) { .hobbies { grid-template-columns: 1fr; } }

/* Experience */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.job { position: relative; padding-left: 36px; margin-bottom: 28px; }
.job:last-child { margin-bottom: 0; }
.job::before {
  content: ""; position: absolute; left: 0; top: 28px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-alt); border: 3px solid var(--accent);
}
.job-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
.job-head h3 { margin: 0; font-size: 19px; font-weight: 700; }
.job-company { margin: 2px 0 0; color: var(--accent); font-weight: 600; }
.job-meta { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.job-period { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.job-loc { font-size: 13.5px; color: var(--muted); }
.job-points { margin: 0 0 18px; padding-left: 20px; color: var(--text-2); }
.job-points li { margin-bottom: 8px; }
.job-points li::marker { color: var(--accent); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chip {
  font-size: 13px; font-weight: 500; padding: 4px 11px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2);
}

/* Skills */
.skills-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.skill-row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; padding: 18px 24px; border-top: 1px solid var(--border); }
.skill-row:first-child { border-top: 0; }
.skill-row h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transition: border-color .2s;
}
.project:hover { border-color: var(--accent); }
.project-type {
  align-self: flex-start; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 5px; margin-bottom: 14px;
}
.project h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.project p { margin: 0 0 18px; color: var(--text-2); font-size: 15px; flex: 1; }
.project-link { margin-top: 16px; font-size: 14px; font-weight: 600; }

/* Featured (flagship) project */
.project-featured { grid-column: 1 / -1; padding: 30px; border-top: 3px solid var(--accent); }
.project-featured h3 { font-size: 22px; }
.project-featured > p { flex: none; font-size: 16px; max-width: 820px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 4px 0 22px; }
.feature { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.feature-tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.feature h4 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.feature p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.6; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .project-featured { padding: 22px; } }

/* Education */
.edu-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.edu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.edu-card .label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.edu-card h3 { margin: 10px 0 6px; font-size: 18px; font-weight: 700; line-height: 1.4; }
.edu-card p { margin: 0; color: var(--text-2); font-size: 15px; }
.edu-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--muted); }

/* Contact */
.contact-inner { text-align: center; }
.contact-text { color: var(--text-2); font-size: 18px; margin: 0 auto 32px; max-width: 560px; }
.contact-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.contact-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); transition: border-color .2s;
}
.contact-card:hover { border-color: var(--accent); text-decoration: none; }
.contact-icon {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
}
.contact-body { display: flex; flex-direction: column; min-width: 0; }
.contact-label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.contact-value { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 600px) { .contact-cards { grid-template-columns: 1fr; } }

/* Footer */
.footer { padding: 28px 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }
.footer p { margin: 0; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .edu-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 18px; }
}
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .menu-btn { display: grid; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 20px; border-top: 1px solid var(--border); }
  .hero { padding: 64px 0 56px; }
  .section { padding: 64px 0; }
  .stat { padding: 18px 16px; }
  .stat b { font-size: 28px; }
  .skill-row { grid-template-columns: 1fr; gap: 10px; padding: 16px 18px; }
  .job-card { padding: 20px; }
  .job-meta { align-items: flex-start; text-align: left; }
  .projects-grid { grid-template-columns: 1fr; }
}
