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

/* ── Themes ──────────────────────────────────── */

:root {
  --body-bg: #ffffff;
  --page-bg: #eff1f5;
  --page-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.08);
  --accent: #3a5fd9;
  --text: #111827;
  --muted: #6b7280;
  --border: #e2e0db;
  --tag-bg: #eef1fd;
  --tag-fg: #2d46b0;
  --switcher-bg: #eff1f5;
  --switcher-border: #d8d4cd;
  --switcher-text: #555;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 5px;
  --max-width: 900px;
}

[data-theme="dark"] {
  --body-bg: #111111;
  --page-bg: #1c1b19;
  --page-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 8px 32px rgba(0, 0, 0, 0.5);
  --accent: #7a9cf7;
  --text: #e4e2dd;
  --muted: #7a7a80;
  --border: #2c2b28;
  --tag-bg: #1e2340;
  --tag-fg: #8ba3f7;
  --switcher-bg: #2a2927;
  --switcher-border: #3a3936;
  --switcher-text: #999;
}

/* ── Base ────────────────────────────────────── */

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 2.5rem 1.5rem;
  transition: background 0.2s, color 0.2s;
}

/* ── Theme switcher ──────────────────────────── */

#theme-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  font-family: var(--font);
  font-size: 0.75rem;
  background: var(--switcher-bg);
  color: var(--switcher-text);
  border: 1px solid var(--switcher-border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  outline: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

/* ── Page ────────────────────────────────────── */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--page-bg);
  border-radius: 8px;
  box-shadow: var(--page-shadow);
  overflow: hidden;
  transition: background 0.2s, box-shadow 0.2s;
}

/* ── Header ─────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 2rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

#name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.header-title {
  font-size: 0.9rem;
  color: var(--muted);
}

.header-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.header-location {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.header-contact a {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
}

.header-contact a:hover {
  text-decoration: underline;
}

/* ── Main ────────────────────────────────────── */

main {
  padding: 0 2.5rem;
}

section {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--border);
}

section:last-child {
  border-bottom: none;
}

h2 {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ── Projects ────────────────────────────────── */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.project-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--body-bg);
  transition: background 0.2s, border-color 0.2s;
}

.project-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.project-description {
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1;
}

.project-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.project-links a {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.project-links a:hover {
  text-decoration: underline;
}

/* ── Summary ─────────────────────────────────── */

#summary p {
  margin-bottom: 0.7rem;
}

#summary p:last-child {
  margin-bottom: 0;
}

/* ── Skills ──────────────────────────────────── */

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-tag {
  background: var(--tag-bg);
  color: var(--tag-fg);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

/* ── Experience ──────────────────────────────── */

.company-block {
  margin-bottom: 1.4rem;
}

.company-block:last-child {
  margin-bottom: 0;
}

.company-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.company-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.company-duration {
  font-size: 0.78rem;
  color: var(--muted);
}

.roles {
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.role-title {
  font-weight: 500;
  font-size: 0.88rem;
}

.role-period {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.role-location {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.05rem;
}

.role-description {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ── Education ───────────────────────────────── */

.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.edu-institution {
  font-weight: 600;
  font-size: 0.92rem;
}

.edu-period {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.edu-degree {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.12rem;
}

/* ── Responsive ──────────────────────────────── */

@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .page {
    border-radius: 0;
    box-shadow: none;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 1.25rem;
  }

  .header-contact {
    align-items: flex-start;
  }

  main {
    padding: 0 1.25rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .company-header,
  .role-header,
  .edu-header {
    flex-direction: column;
    gap: 0.05rem;
  }
}
