/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --border: #e4e7ef;
  --text: #16181d;
  --text-dim: #5a6072;
  --text-faint: #8a8f9c;
  --accent: #4f46e5;
  --accent-2: #0ea5e9;
  --accent-contrast: #ffffff;
  --shadow: 0 4px 24px rgba(23, 24, 32, 0.06);
  --shadow-lg: 0 12px 40px rgba(23, 24, 32, 0.10);
  --radius: 14px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --maxw: 1080px;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-alt: #11141c;
  --surface: #151925;
  --border: #242938;
  --text: #eef0f5;
  --text-dim: #aab0c0;
  --text-faint: #767c8c;
  --accent: #818cf8;
  --accent-2: #38bdf8;
  --accent-contrast: #0b0d12;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --bg-alt: #11141c;
    --surface: #151925;
    --border: #242938;
    --text: #eef0f5;
    --text-dim: #aab0c0;
    --text-faint: #767c8c;
    --accent: #818cf8;
    --accent-2: #38bdf8;
    --accent-contrast: #0b0d12;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }
.logo { font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }

.nav-menu { display: flex; gap: 28px; flex: 1; justify-content: center; }
.nav-menu a {
  font-size: 0.92rem; font-weight: 500; color: var(--text-dim);
  position: relative; padding: 4px 0; transition: color .15s ease;
}
.nav-menu a:hover { color: var(--text); }
.nav-menu a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
  background: var(--accent); transition: width .2s ease;
}
.nav-menu a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); display: block; border-radius: 2px; }

.icon-sun, .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: block; }
: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; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .icon-moon { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 48px; align-items: center;
  padding: 88px 24px 64px;
}
.eyebrow {
  font-family: var(--font-mono); color: var(--accent); font-size: 0.9rem; font-weight: 500;
  margin-bottom: 14px; letter-spacing: 0.3px;
}
.hero-text h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -1px; margin-bottom: 20px; }
.accent { color: var(--accent); }
.lede { color: var(--text-dim); font-size: 1.08rem; max-width: 56ch; }
.hero-cta { display: flex; gap: 14px; margin: 28px 0 40px; flex-wrap: wrap; }

.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.hero-stats span { font-size: 0.82rem; color: var(--text-faint); }

.hero-visual { position: relative; display: flex; justify-content: center; }
.photo-frame {
  width: 280px; height: 280px; border-radius: 28px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  padding: 4px;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 24px; }
.hero-badge {
  position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 8px 16px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }

/* ---------- Sections ---------- */
.section { padding: 88px 24px; }
.section.alt { background: var(--bg-alt); }
.section-title {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 800; margin-bottom: 40px;
  display: flex; align-items: baseline; gap: 10px;
}
.section-title .num { color: var(--accent); font-family: var(--font-mono); font-size: 1rem; font-weight: 600; }
.subsection-title { font-size: 1.05rem; font-weight: 700; color: var(--text-dim); margin: 36px 0 18px; }
.subsection-title:first-of-type { margin-top: 0; }

/* About */
.about-copy p { color: var(--text-dim); max-width: 72ch; }
.about-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 32px;
}
.about-facts > div {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.fact-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); font-weight: 600; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: transform .15s ease, box-shadow .15s ease;
}
.skill-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.skill-card h3 { font-size: 1rem; margin-bottom: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 500;
}
:root[data-theme="dark"] .tags li { background: var(--bg); }
.tags-sm li { font-size: 0.76rem; padding: 4px 10px; }

/* Timeline */
.timeline { position: relative; padding-left: 28px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 48px; }
.timeline-item { position: relative; }
.timeline-marker {
  position: absolute; left: -35px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--accent);
}
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.timeline-head h3 { font-size: 1.15rem; }
.timeline-date { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); white-space: nowrap; }
.timeline-company { font-weight: 600; color: var(--accent); margin: 4px 0 2px; }
.timeline-company .dim { color: var(--text-faint); font-weight: 400; }
.timeline-project { color: var(--text-dim); font-style: italic; margin-bottom: 12px; }
.timeline-project a { color: var(--accent-2); text-decoration: underline; }
.timeline-content ul:not(.tags) { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.timeline-content ul:not(.tags) li { color: var(--text-dim); font-size: 0.95rem; padding-left: 18px; position: relative; }
.timeline-content ul:not(.tags) li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 12px; transition: transform .15s ease, box-shadow .15s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.project-card-featured { border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); }
.project-head { display: flex; align-items: center; gap: 10px; color: var(--accent); flex-wrap: wrap; }
.project-head h3 { font-size: 1.05rem; color: var(--text); flex: 1; }
.badge {
  background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.4px;
}
.project-card p { color: var(--text-dim); font-size: 0.93rem; flex: 1; margin-bottom: 0; }
.project-link { font-weight: 600; color: var(--accent); font-size: 0.88rem; margin-top: 4px; }
.project-link:hover { text-decoration: underline; }
.projects-more { text-align: center; margin-top: 40px; }

/* Coding Activity */
.activity-lede { color: var(--text-dim); max-width: 60ch; margin-bottom: 20px; }
.activity-lede a { color: var(--accent); font-weight: 600; }
.activity-lede a:hover { text-decoration: underline; }

.activity-tabs { display: inline-flex; gap: 6px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
:root[data-theme="dark"] .activity-tabs { background: var(--bg); }
.activity-tab {
  border: none; background: transparent; color: var(--text-dim); font-family: inherit; font-weight: 600;
  font-size: 0.85rem; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.activity-tab:hover { color: var(--text); }
.activity-tab.is-active { background: var(--accent); color: #fff; }

.activity-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; max-width: 640px;
}
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.activity-range { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); font-weight: 600; margin-bottom: 4px; }
.activity-total { font-size: 1.8rem; font-weight: 800; font-family: var(--font-mono); }
.activity-updated { font-size: 0.78rem; color: var(--text-faint); font-family: var(--font-mono); white-space: nowrap; }

.activity-substats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.activity-substats:empty { display: none; margin-bottom: 0; }
.activity-substat {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; flex: 1; min-width: 140px;
}
:root[data-theme="dark"] .activity-substat { background: var(--bg); }
.activity-substat-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); font-weight: 600; margin-bottom: 3px; }
.activity-substat-value { font-family: var(--font-mono); font-weight: 700; font-size: 0.92rem; }
.lang-bars { display: flex; flex-direction: column; gap: 14px; }
.lang-bar-row { display: flex; flex-direction: column; gap: 6px; }
.lang-bar-labels { display: flex; justify-content: space-between; font-size: 0.85rem; }
.lang-bar-name { font-weight: 600; }
.lang-bar-meta { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.78rem; }
.lang-bar-track { height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
:root[data-theme="dark"] .lang-bar-track { background: var(--bg); }
.lang-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.lang-bars:empty::after {
  content: "Language breakdown not available for this range yet.";
  color: var(--text-faint); font-size: 0.88rem;
}
.activity-card[data-state="loading"] .lang-bars:empty::after { content: "Loading coding activity…"; }
.activity-card[data-state="error"] .lang-bars:empty::after { content: "Coding stats will appear here once synced."; }

/* Education */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.cert-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.edu-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.edu-card h3 { font-size: 0.98rem; margin-bottom: 8px; }
.edu-school { color: var(--accent); font-size: 0.88rem; font-weight: 600; margin-bottom: 2px; }
.edu-date { color: var(--text-faint); font-size: 0.82rem; font-family: var(--font-mono); margin-bottom: 0; }

/* Contact */
.contact-lede { color: var(--text-dim); max-width: 60ch; margin-bottom: 36px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.contact-card {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; font-weight: 500; font-size: 0.92rem;
  transition: border-color .15s ease, transform .15s ease;
}
.contact-card:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.contact-card svg { flex-shrink: 0; }

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

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-visual { order: -1; }
  .photo-frame { width: 200px; height: 200px; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute; top: 68px; left: 0; right: 0; background: var(--bg);
    border-bottom: 1px solid var(--border); flex-direction: column; padding: 16px 24px; gap: 16px;
    display: none;
  }
  .nav-menu.open { display: flex; }
  .section { padding: 64px 20px; }
  .hero { padding: 48px 20px 48px; }
  .hero-stats { gap: 22px; }
}
