/* ---------------------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f7f9;
  --fg: #16181d;
  --muted: #5c6370;
  --border: #e3e6eb;
  --accent: #0b5fa5;
  --accent-hover: #084a80;
  --accent-soft: #e8f1fa;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 44rem;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --fg: #e6e7ea;
    --muted: #9aa0ab;
    --border: #272b34;
    --accent: #6cb4ff;
    --accent-hover: #93c8ff;
    --accent-soft: #15233a;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 650;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.5vw, 2.75rem);
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.125rem;
}

p {
  margin: 0 0 1rem;
}

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

a:hover {
  color: var(--accent-hover);
}

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

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

pre {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
}

::selection {
  background: var(--accent-soft);
}

.muted {
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Header and navigation
   --------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius);
  z-index: 100;
}

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

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

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  min-height: 3.25rem;
  padding-block: 0.5rem;
}

.wordmark {
  font-weight: 650;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
}

.wordmark:hover {
  color: var(--accent);
}

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

.nav-list a {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-list a:hover {
  color: var(--fg);
  background: var(--surface);
}

@media (max-width: 36rem) {
  .header-inner nav {
    order: 3;
    width: 100%;
  }
  .nav-list a {
    padding-inline: 0.45rem;
    font-size: 0.9rem;
  }
}

/* ---------------------------------------------------------------------------
   Sections
   --------------------------------------------------------------------------- */
.hero {
  padding-block: 4rem 2.5rem;
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.lede {
  font-size: 1.25rem;
  max-width: 36rem;
}

.section {
  padding-block: 2.5rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 4.5rem;
}

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

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

.pub {
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}

.pub:first-child {
  border-top: 0;
  padding-top: 0.5rem;
}

.pub .meta {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.pub h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.pub h3 a {
  color: var(--fg);
  text-decoration: none;
}

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

.pub .authors {
  margin: -0.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.pub details {
  margin: 0.5rem 0 0.75rem;
}

.pub summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.95rem;
  width: max-content;
}

.pub summary:hover {
  color: var(--accent-hover);
}

.pub details[open] summary {
  margin-bottom: 0.5rem;
}

.pub details p {
  color: var(--muted);
  font-size: 0.95rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
}

/* Projects */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.project {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.project h3 {
  margin: 0;
  font-size: 1.05rem;
}

.project h3 a {
  color: var(--fg);
  text-decoration: none;
}

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

.project .tags {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.project p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.project .actions {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner p {
  margin: 0;
}
