:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --text: #101010;
  --text-fade: rgba(0, 0, 0, 0.18);
  --text-muted: rgba(0, 0, 0, 0.55);
  --text-subtle: rgba(0, 0, 0, 0.35);
  --border: rgba(0, 0, 0, 0.1);
  --pill-bg: rgba(0, 0, 0, 0.06);
  --header-bg: rgba(255, 255, 255, 0.9);
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --page-x: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1120px;
}

[data-theme="dark"] {
  --bg: #0e0e0e;
  --bg-soft: #1a1a1a;
  --text: #f2f2f2;
  --text-fade: rgba(255, 255, 255, 0.15);
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-subtle: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.12);
  --pill-bg: rgba(255, 255, 255, 0.08);
  --header-bg: rgba(14, 14, 14, 0.92);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.75rem var(--page-x);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

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

.nav-links a {
  position: relative;
  padding-top: 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
}

.nav-links a.is-active::before {
  transform: scaleX(1);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-icon--dark {
  display: none;
}

[data-theme="dark"] .theme-icon--light {
  display: none;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
}

/* Hero */
.hero {
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(2.5rem, 7vw, 5rem) var(--page-x) clamp(2rem, 5vw, 3.5rem);
}

.intro-greeting {
  margin: 0 0 2rem;
  max-width: 34rem;
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
}

.intro-greeting strong {
  font-weight: 600;
  color: var(--text);
}

.intro-bio {
  max-width: 38rem;
  margin-bottom: 1.5rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
}

.intro-bio p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
}

.intro-bio a {
  font-style: italic;
  color: var(--text);
}

.intro-contact {
  max-width: 38rem;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.45;
  color: var(--text);
}

.intro-contact a {
  font-family: var(--font-sans);
  font-style: normal;
  color: var(--text);
}

.intro-location {
  display: block;
  margin-top: 0.35rem;
}

/* Status grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: var(--max);
  margin-inline: auto;
  padding: 0 var(--page-x) clamp(3rem, 6vw, 5rem);
}

.status-grid h2 {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-roles {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-roles li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.status-role {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.status-org {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.status-org:hover {
  color: var(--text);
}

.status-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
}

.status-grid a {
  text-decoration: underline;
}

/* Sections */
.section {
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(3rem, 6vw, 5rem) var(--page-x);
  border-top: 1px solid var(--border);
}

.section-display {
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-fade);
}

/* Projects */
.project + .project {
  margin-top: clamp(3rem, 6vw, 4.5rem);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.pill {
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--pill-bg);
  border-radius: 4px;
}

.project-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.project-title a {
  text-decoration: none;
}

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

.project-desc {
  max-width: 52rem;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Experience */
.role + .role {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.role-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.role-top h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.role-top time {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.role-org {
  margin: 0 0 0.85rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-muted);
}

.role-details {
  margin: 0;
  padding-left: 1.1rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.role-details li + li {
  margin-top: 0.35rem;
}

/* Education */
.edu-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem 2rem;
  margin: 0;
}

.edu-list div {
  margin: 0;
}

.edu-list dt {
  margin-bottom: 0.2rem;
  font-weight: 700;
  font-size: 1rem;
}

.edu-list dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-muted);
}

/* Contact */
.contact {
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(3rem, 6vw, 5rem) var(--page-x) clamp(4rem, 8vw, 6rem);
  border-top: 1px solid var(--border);
}

.contact-title {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.contact-text {
  max-width: 32rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-muted);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
}

.contact-link {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  padding: 1.5rem var(--page-x) 2.5rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

/* Responsive */
@media (max-width: 860px) {
  .status-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .role-top {
    flex-direction: column;
    gap: 0.15rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .brand {
    flex-shrink: 0;
  }

  .theme-toggle {
    order: 1;
    margin-right: auto;
  }

  .site-nav {
    order: 2;
    width: auto;
    margin-left: 0;
    flex-shrink: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 1rem var(--page-x) 1.5rem;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s, opacity 0.25s;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links li {
    padding-block: 0.45rem;
  }

  .nav-links a {
    padding-top: 0;
  }

  .nav-links a::before {
    display: none;
  }
}

@media print {
  :root,
  [data-theme="dark"] {
    --bg: #ffffff;
    --bg-soft: #f4f4f4;
    --text: #101010;
    --text-fade: rgba(0, 0, 0, 0.18);
    --text-muted: rgba(0, 0, 0, 0.55);
    --text-subtle: rgba(0, 0, 0, 0.35);
    --border: rgba(0, 0, 0, 0.1);
    --pill-bg: rgba(0, 0, 0, 0.06);
    --header-bg: #ffffff;
  }

  body {
    background: #fff;
    color: #101010;
  }

  .site-header,
  .theme-toggle,
  .nav-toggle,
  .site-footer {
    display: none;
  }

  .hero,
  .section,
  .works,
  .contact {
    break-inside: avoid-page;
  }

  .role,
  .project {
    break-inside: avoid-page;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
