:root {
  --bg: #ffffff;
  --bg-alt: #f4f6f9;
  --text: #14141a;
  --text-muted: #565f6e;
  --border: #e1e4ea;
  --accent: #0369a1;
  --accent-contrast: #ffffff;
  --radius: 12px;
  --max-width: 800px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.07);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --text: #e6e8eb;
  --text-muted: #8b93a1;
  --border: #262c36;
  --accent: #38bdf8;
  --accent-contrast: #0b1220;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-alt: #161b22;
    --text: #e6e8eb;
    --text-muted: #8b93a1;
    --border: #262c36;
    --accent: #38bdf8;
    --accent-contrast: #0b1220;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.5rem;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  font-size: 1.05rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .95rem;
}
.nav-links a:hover { color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  cursor: pointer;
  color: var(--text);
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hero */
.hero {
  position: relative;
  text-align: center;
  padding: 4.5rem 1.5rem 3.5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -140px;
  left: 50%;
  width: 480px;
  height: 480px;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-photo img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 3px solid var(--bg);
  outline: 1px solid var(--border);
}

.hero h1 {
  margin: 1.25rem 0 .25rem;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 1.75rem;
}

.hero-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: .65rem 1.3rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

/* Sections */
.section {
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border);
}

.section h2 {
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
}

/* Timeline (Experience) */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.75rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.timeline-item {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: border-color .15s ease;
}
.timeline-item:hover { border-color: var(--accent); }

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 6px);
  top: 1.4rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem;
}

.timeline-header h3 { margin: 0; font-size: 1.1rem; }

.timeline-date {
  color: var(--text-muted);
  font-size: .85rem;
  white-space: nowrap;
}

.timeline-org {
  color: var(--text-muted);
  margin: .25rem 0 .75rem;
  font-size: .9rem;
}

.timeline-item ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}

.skill-group h3 {
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin: 0 0 .75rem;
}

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag-list li {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .8rem;
  font-size: .85rem;
}

/* Social links */
.social-links {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.social-links a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  transition: border-color .12s ease, color .12s ease;
}
.social-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* Mobile */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
  }
  .nav-links.open { max-height: 260px; }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: .9rem 1.5rem; }
  .hero h1 { font-size: 1.85rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}
