:root {
  color-scheme: light;
  --bg: #fdfdfc;
  --text: #1a1a19;
  --muted: #6a6a66;
  --border: #e3e3de;
  --accent: #0b5fbd;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --measure: 680px;
  --pad-x: 28px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 20px;
  --s5: 32px;
  --s6: 48px;
  --s7: 64px;
  --s8: 80px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131314;
  --text: #e6e6e3;
  --muted: #92928d;
  --border: #2b2b2c;
  --accent: #7fb0f5;
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p:not(.reach) a,
.empty-state a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

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

.band {
  height: clamp(150px, 26vw, 232px);
  border-bottom: 1px solid var(--border);
}

.band__plate {
  width: 100%;
  height: 100%;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--s7) var(--pad-x) var(--s8);
}

h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s1);
  line-height: 1.25;
}

.lede {
  color: var(--muted);
  font-size: 17px;
  margin: 0 0 var(--s4);
}

p {
  margin: 0 0 var(--s4);
}

.reach {
  margin: 0 0 var(--s5);
  font-size: 15px;
  color: var(--muted);
}

h2 {
  font-size: inherit;
  font-weight: 700;
  margin: var(--s6) 0 var(--s3);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  scroll-margin-top: var(--s3);
}

ul,
ol {
  margin: 0 0 var(--s4);
  padding-left: 0;
  list-style: none;
}

.roles li,
.pubs li,
.repos li,
.interests li {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: var(--s1) var(--s3);
  padding: var(--s2) 0;
}

.gutter {
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

li.empty-state {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.loading-message {
  display: none;
}

html[data-theme] .loading-message {
  display: inline;
}

/* Approximate the initial lists while JSON loads; loaded and failed lists size naturally. */
html[data-theme] .pubs[data-loading] {
  min-height: 24em;
}

html[data-theme] .repos[data-loading] {
  min-height: 20em;
}

html[data-theme] .interests[data-loading] {
  min-height: 14em;
}

.roles em {
  font-style: normal;
  color: var(--muted);
}

.pub-more {
  font-size: 15px;
}

.filter {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}

.filter:hover {
  text-decoration: underline;
}

.pubs li {
  padding: var(--s3) 0;
  line-height: 1.5;
}

.pub__title {
  display: block;
  font-weight: 600;
}

.pub__authors,
.pub__meta {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.repos .gutter {
  font-weight: 600;
}

.foot {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s3);
  font-size: 15px;
  color: var(--muted);
}

.theme-toggle {
  margin-left: auto;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  background: none;
  border: 0;
  padding: 8px;
  font: inherit;
  font-size: 15px;
  color: var(--accent);
  cursor: pointer;
}

html[data-theme] .theme-toggle {
  display: inline-flex;
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle__icon--sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 160ms;
}

/* The filter morphs entries between views, which needs longer than the theme
   swap; the page beneath them fades at the same pace. */
html[data-vt="pub"]::view-transition-group(*),
html[data-vt="pub"]::view-transition-old(root),
html[data-vt="pub"]::view-transition-new(root) {
  animation-duration: 280ms;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

@media (max-width: 560px) {
  :root {
    --pad-x: 20px;
  }

  body {
    font-size: 16px;
  }

  .page {
    padding: var(--s6) var(--pad-x) var(--s7);
  }

  .roles li,
  .pubs li,
  .repos li,
  .interests li {
    grid-template-columns: 1fr;
  }

  html[data-theme] .pubs[data-loading] {
    min-height: 33em;
  }

  html[data-theme] .repos[data-loading] {
    min-height: 32em;
  }

  html[data-theme] .interests[data-loading] {
    min-height: 29em;
  }
}
