/* ==========================================================
   Theme tokens
   ========================================================== */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f7fa;
  --surface: #ffffff;
  --text: #1a2433;
  --text-muted: #5b6878;
  --heading: #12263f;
  --accent: #0e8c8c;
  --accent-strong: #0a6e6e;
  --accent-soft: #e3f4f4;
  --ai: #6d4fd8;
  --ai-soft: #efebfd;
  --border: #e2e8ef;
  --shadow: 0 4px 20px rgba(18, 38, 63, 0.07);
  --nav-bg: rgba(255, 255, 255, 0.85);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1520;
    --bg-alt: #111c2a;
    --surface: #152233;
    --text: #d6dee8;
    --text-muted: #93a1b3;
    --heading: #f1f5f9;
    --accent: #2cc4c4;
    --accent-strong: #5ad8d8;
    --accent-soft: #123536;
    --ai: #a08bff;
    --ai-soft: #231c44;
    --border: #22324a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --nav-bg: rgba(13, 21, 32, 0.85);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1520;
  --bg-alt: #111c2a;
  --surface: #152233;
  --text: #d6dee8;
  --text-muted: #93a1b3;
  --heading: #f1f5f9;
  --accent: #2cc4c4;
  --accent-strong: #5ad8d8;
  --accent-soft: #123536;
  --ai: #a08bff;
  --ai-soft: #231c44;
  --border: #22324a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(13, 21, 32, 0.85);
}

/* ==========================================================
   Base
   ========================================================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
strong { color: var(--heading); font-weight: 600; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

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

/* ==========================================================
   Nav
   ========================================================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--border); }

.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav__logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--heading); letter-spacing: -0.02em; }
.nav__logo img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; transition: transform 0.3s; }
.nav__logo:hover img { transform: rotate(-8deg) scale(1.08); }

.nav__links { display: flex; gap: 28px; }
.nav__links a { font-size: 0.95rem; font-weight: 500; color: var(--text-muted); transition: color 0.2s; }
.nav__links a:hover, .nav__links a.active { color: var(--accent); }

.nav__actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--bg-alt); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

.nav__burger { display: none; flex-direction: column; gap: 5px; }
.nav__burger span { display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.nav__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.open span:nth-child(2) { opacity: 0; }
.nav__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav__burger { display: flex; }
  .nav__links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav__links.open { max-height: 320px; }
  .nav__links a { padding: 14px 16px; border-top: 1px solid var(--border); }
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem;
  transition: transform 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); }
:root[data-theme="dark"] .btn--primary { color: #06201f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--primary { color: #06201f; } }
.btn--ghost { border: 1.5px solid var(--border); color: var(--heading); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================
   Hero
   ========================================================== */
.hero { min-height: 100vh; display: flex; align-items: center; padding: 100px 0 60px; }
.hero__inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }

.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: 0.04em; margin-bottom: 6px; }
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.1;
  color: var(--heading); font-weight: 800; letter-spacing: -0.03em;
}
.hero__role { font-size: clamp(1rem, 2.2vw, 1.2rem); font-weight: 600; color: var(--text-muted); margin: 14px 0 18px; }
.hero__lead { font-size: 1.05rem; max-width: 560px; color: var(--text-muted); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.hero__social { display: flex; gap: 16px; }
.hero__social a { color: var(--text-muted); transition: color 0.2s, transform 0.2s; }
.hero__social a:hover { color: var(--accent); transform: translateY(-2px); }

.hero__photo { display: flex; justify-content: center; }
.photo-frame {
  position: relative; width: min(320px, 70vw); aspect-ratio: 1;
  border-radius: 50%; padding: 6px;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  box-shadow: var(--shadow);
}
.photo-frame img, .photo-fallback {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 6px solid var(--bg);
}
.photo-fallback {
  display: none; align-items: center; justify-content: center;
  background: var(--bg-alt); color: var(--accent);
  font-size: 5rem; font-weight: 800;
}

@media (max-width: 820px) {
  .hero { padding-top: 96px; text-align: center; }
  .hero__inner { grid-template-columns: 1fr; gap: 36px; }
  .hero__photo { order: -1; }
  .photo-frame { width: min(220px, 60vw); }
  .hero__lead { margin: 0 auto; }
  .hero__cta, .hero__social { justify-content: center; }
}

/* ==========================================================
   Sections
   ========================================================== */
.section { padding: 88px 0; }
.section--alt { background: var(--bg-alt); }
.section__title {
  font-size: clamp(1.7rem, 4vw, 2.2rem); color: var(--heading);
  font-weight: 800; letter-spacing: -0.02em; margin-bottom: 40px;
}
.section__title::after {
  content: ""; display: block; width: 48px; height: 4px; border-radius: 4px;
  background: var(--accent); margin-top: 10px;
}

/* About */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: center; }
.about__text p { margin-bottom: 16px; font-size: 1.04rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; box-shadow: var(--shadow);
}
.stat__num { display: block; font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat__label { font-size: 0.85rem; color: var(--text-muted); }
@media (max-width: 820px) { .about { grid-template-columns: 1fr; } }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.skill-card--ai { border-top-color: var(--ai); }
.skill-card h3 { font-size: 1.05rem; color: var(--heading); margin-bottom: 14px; }

.chips, .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span, .tags span {
  font-size: 0.82rem; font-weight: 500; padding: 5px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
}
.skill-card--ai .chips span { background: var(--ai-soft); color: var(--ai); }
.tags--sm span { font-size: 0.75rem; padding: 3px 10px; background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }
@media (max-width: 400px) { .skills { grid-template-columns: 1fr; } }

/* Project */
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(22px, 4vw, 40px); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.project::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--ai));
}
.badge {
  display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 4px 12px; border-radius: 999px; background: var(--ai-soft); color: var(--ai);
  margin-bottom: 12px;
}
.project h3 { font-size: clamp(1.3rem, 3vw, 1.6rem); color: var(--heading); line-height: 1.3; }
.project__summary { color: var(--text-muted); margin: 10px 0 28px; max-width: 760px; }
.project__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 26px; }
.feature {
  padding: 18px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--border);
}
.feature h4 { font-size: 0.98rem; color: var(--heading); margin-bottom: 6px; }
.feature p { font-size: 0.9rem; color: var(--text-muted); }

/* Timeline */
.timeline { list-style: none; position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border);
}
.job { position: relative; margin-bottom: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.job::before {
  content: ""; position: absolute; left: -28px; top: 28px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-alt); border: 3px solid var(--accent);
}
.job:first-child::before { background: var(--accent); }
.job__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.job__loc { color: var(--text-muted); font-weight: 500; }
.job h3 { font-size: 1.12rem; color: var(--heading); margin-bottom: 10px; }
.job__co { color: var(--text-muted); font-weight: 500; }
.job ul { padding-left: 18px; margin-bottom: 14px; }
.job li { margin-bottom: 4px; font-size: 0.95rem; }
.job li::marker { color: var(--accent); }

/* Education */
.edu {
  display: flex; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); max-width: 680px;
}
.edu__icon {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.edu h3 { font-size: 1.05rem; color: var(--heading); }
.edu p { color: var(--text-muted); font-size: 0.92rem; }

/* Contact */
.contact { text-align: center; }
.contact .section__title::after { margin: 10px auto 0; }
.contact__lead { color: var(--text-muted); margin: -20px auto 36px; max-width: 560px; }
.contact__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.contact-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 16px; box-shadow: var(--shadow); color: var(--accent);
  transition: transform 0.2s, border-color 0.2s;
}
a.contact-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.contact-card__label { font-weight: 700; color: var(--heading); margin-top: 4px; }
.contact-card__value { font-size: 0.9rem; color: var(--text-muted); overflow-wrap: anywhere; }

/* Footer */
.footer { padding: 32px 0; text-align: center; font-size: 0.88rem; color: var(--text-muted); border-top: 1px solid var(--border); }
.footer__logo { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px; box-shadow: var(--shadow); }

/* ==========================================================
   Scroll reveal
   ========================================================== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
