:root {
  --bg: #ffffff;
  --bg-alt: #f4f4f5;
  --text: #18181b;
  --text-muted: #71717a;
  --accent: #18181b;
  --accent-text: #ffffff;
  --border: #e4e4e7;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] {
  --bg: #121212;
  --bg-alt: #1c1c1c;
  --text: #f2f2f2;
  --text-muted: #a1a1aa;
  --accent: #f2f2f2;
  --accent-text: #121212;
  --border: #2a2a2a;
  --card-bg: #181818;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --bg-alt: #1c1c1c;
    --text: #f2f2f2;
    --text-muted: #a1a1aa;
    --accent: #f2f2f2;
    --accent-text: #121212;
    --border: #2a2a2a;
    --card-bg: #181818;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }

  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

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

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

h1, h2, h3 {
  line-height: 1.25;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
  justify-content: center;
}

.site-header nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 15;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#nav-toggle {
  display: none;
}

.icon {
  display: block;
}

.icon-moon,
.icon-close {
  display: none;
}

:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

#nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
#nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Hero */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 3.5rem 1.5rem 2.5rem;
  flex-wrap: wrap;
}

.avatar {
  border-radius: 50%;
  width: 160px;
  height: 160px;
  object-fit: cover;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.hero-text h1 {
  margin: 0 0 0.35rem;
  font-size: 2rem;
}

.headline {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.location {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

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

.section h2 {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-extra {
  display: none;
}

.timeline.expanded .timeline-extra {
  display: block;
}

.section-toggle {
  display: block;
  margin: 0 auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}

.section-toggle:hover {
  background: var(--bg-alt);
}

.timeline-item {
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

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

.timeline-header .company {
  font-weight: 600;
  color: var(--accent);
}

.timeline-header .dates {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

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

.timeline-item li {
  margin-bottom: 0.4rem;
}

/* Projects */
.projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.projects-list li {
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.project-preview {
  display: block;
  margin-bottom: 0.9rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.project-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.projects-list h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.projects-list h3 a {
  text-decoration: none;
}

.projects-list h3 a:hover {
  text-decoration: underline;
}

.projects-list p {
  margin: 0;
  color: var(--text-muted);
}

.projects-list .dates {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

/* Education */
.education-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.education-list li {
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.education-list h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.education-list .degree {
  margin: 0 0 0.25rem;
}

.education-list .dates {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Skills */
.skills-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skills-list li {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
}

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

/* Responsive */
@media (max-width: 600px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: 2.5rem;
  }

  .hero-links {
    justify-content: center;
  }

  #contact {
    text-align: center;
  }

  #nav-toggle {
    display: flex;
  }

  .site-header nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 1.5rem 0.5rem;
  }

  .site-header nav.nav-open {
    display: flex;
  }

  .site-header nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }

  .site-header nav a:last-child {
    border-bottom: none;
  }

  .site-footer {
    text-align: center;
  }
}
