/* --- Variables --- */
:root {
  --bg: #f7f6f3;
  --bg-card: #fff;
  --text: #2c2c2c;
  --text-muted: #5c5c5c;
  --accent: #a67c5b;
  --accent-hover: #8f6a4d;
  --border: #e5e3df;
  --radius: 8px;
  --font-heading: "Libre Baskerville", Georgia, serif;
  --font-body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --max-width: 720px;
  --max-width-wide: 960px;
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1917;
    --bg-card: #242220;
    --text: #e8e6e1;
    --text-muted: #9b9892;
    --accent: #c49a72;
    --accent-hover: #d4aa82;
    --border: #333130;
  }
}

[data-theme="dark"] {
  --bg: #1a1917;
  --bg-card: #242220;
  --text: #e8e6e1;
  --text-muted: #9b9892;
  --accent: #c49a72;
  --accent-hover: #d4aa82;
  --border: #333130;
}

/* --- Theme toggle button --- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--bg-card);
}

/* show correct icon depending on active theme */
.theme-toggle .icon-moon { display: inline; }
.theme-toggle .icon-sun  { display: none; }

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: inline; }
}

/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.nav {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Main layout --- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md) var(--space-2xl);
}

/* --- Landing --- */
.landing {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  margin: 0 auto var(--space-md);
  display: block;
  background: var(--bg-card);
}

.landing-name {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  margin: 0 0 var(--space-xs);
  color: var(--text);
}

.landing-role {
  font-size: 1.125rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 var(--space-md);
}

.landing-bio {
  max-width: 36ch;
  margin: 0 auto var(--space-lg);
  color: var(--text-muted);
  font-size: 1rem;
}

.quick-facts {
  text-align: left;
  max-width: 28rem;
  margin: 0 auto var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.quick-facts dt {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-top: var(--space-sm);
}

.quick-facts dt:first-child {
  margin-top: 0;
}

.quick-facts dd {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.landing-cta {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.nav-social {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.nav-social a {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  padding: var(--space-xs);
  border-radius: var(--radius);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-social a:hover {
  color: var(--accent);
  background: var(--bg-card);
}

.nav-social svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

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

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

.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Section common --- */
.section {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 var(--space-lg);
  color: var(--text);
}

.subsection-title {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--space-lg) 0 var(--space-md);
}

.subsection-title:first-of-type {
  margin-top: 0;
}

/* --- Publications --- */
.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pub-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 400;
  margin: 0 0 var(--space-xs);
  line-height: 1.4;
}

.pub-authors,
.pub-venue {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
}

.pub-links {
  margin-top: var(--space-sm);
}

.pub-links a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  margin-right: var(--space-md);
  font-weight: 600;
  transition: color 0.2s ease;
}

.pub-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* --- Projects (cards) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(166, 124, 91, 0.08);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 400;
  margin: 0 0 var(--space-sm);
  color: var(--text);
}

.card-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
  line-height: 1.55;
}

.card-links a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  margin-right: var(--space-md);
  transition: color 0.2s ease;
}

.card-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* --- Links --- */
.links-intro {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0 0 var(--space-lg);
  max-width: 42ch;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.link-list li:last-child {
  border-bottom: none;
}

.link-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.link-list a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* --- Footer --- */
.site-footer {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid var(--border);
  text-align: center;
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
  :root {
    --space-xl: 3rem;
    --space-2xl: 4rem;
  }

  .landing {
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .quick-facts {
    padding: var(--space-sm);
  }

  .landing-cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

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