/* Site styles. Colors are defined once as variables, with a dark variant. */
:root {
  color-scheme: light dark;

  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2937;
  --text-muted: #4b5563;
  --heading: #111827;
  --border: #e5e7eb;
  --link: #1d4ed8;
  --link-hover: #1e3a8a;
  --accent: #1d4ed8;
  --on-accent: #ffffff;
  --focus: #1d4ed8;

  --radius: 12px;
  --wrap: 52rem;
  --space: 1.5rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --heading: #f9fafb;
    --border: #334155;
    --link: #93c5fd;
    --link-hover: #bfdbfe;
    --accent: #93c5fd;
    --on-accent: #0f172a;
    --focus: #93c5fd;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

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

.container {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.25;
  margin: 2.5rem 0 0.75rem;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.5vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.75rem); }
h3 { font-size: 1.2rem; }

p,
ul,
ol {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.4rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

main:focus {
  outline: none;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

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

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 2rem;
  row-gap: 0.25rem;
  padding-block: 0.75rem;
}

.site-title {
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  margin: 0;
}

.nav-list a {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}

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

.nav-list a[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

/* Main content */
main {
  display: flow-root;
  min-height: 60vh;
  padding-bottom: 3rem;
}

main > :first-child {
  margin-top: 2.5rem;
}

.page-title + h2 {
  margin-top: 1.5rem;
}

/* Home hero */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  padding-block: 1rem 0.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
}

.hero-role {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.hero-photo,
.profile-image {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  color: var(--on-accent);
  text-decoration: none;
  opacity: 0.9;
}

.button-secondary {
  background: transparent;
  color: var(--link);
}

.button-secondary:hover {
  color: var(--link-hover);
  background: var(--surface);
  opacity: 1;
}

/* About page photo */
.profile-image {
  float: left;
  width: 160px;
  height: 160px;
  margin: 0.5rem 1.5rem 1rem 0;
}

/* Cards (projects and research) */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h3 {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

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

.publication-list > li {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.publication-list > li:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

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

.social-links li {
  margin: 0;
}

.social-links a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}

.social-links a:hover {
  color: var(--link);
  border-color: var(--link);
}

.social-links.with-labels a {
  width: auto;
  gap: 0.6rem;
  padding: 0 1.1rem 0 0.9rem;
  border-radius: 999px;
}

.icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.footer-inner p,
.footer-inner .social-links {
  margin: 0;
}

/* Small screens */
@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-photo {
    order: -1;
    width: 128px;
    height: 128px;
  }

  .profile-image {
    float: none;
    display: block;
    margin: 1.5rem auto;
  }

  .card {
    padding: 1rem 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
