/* Layout: a single left-aligned column set like a well-kept CV; lists of papers
   hang their years in a left margin column, the way a publication record reads. */
:root {
  --paper: #f6f7f9;        /* page ground, cool white */
  --surface: #ffffff;      /* raised panels */
  --ink: #17202c;          /* text, navy-black */
  --muted: #586374;        /* secondary text */
  --rule: #d9dee6;         /* hairlines */
  --accent: #1d4f91;       /* links, Creighton-adjacent blue */
  --accent-strong: #133a6c;
  --accent-wash: #e5ecf6;  /* tints behind accent */

  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Public Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(2.125rem, 1.6rem + 2.2vw, 2.875rem);

  --measure: 42rem;
  --wrap: 62rem;
  --gutter-year: 6.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10151c;
    --surface: #171e28;
    --ink: #e7ebf1;
    --muted: #9ba6b6;
    --rule: #2a3442;
    --accent: #8fb6ec;
    --accent-strong: #b5cff3;
    --accent-wash: #1a2a40;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10151c;
  --surface: #171e28;
  --ink: #e7ebf1;
  --muted: #9ba6b6;
  --rule: #2a3442;
  --accent: #8fb6ec;
  --accent-strong: #b5cff3;
  --accent-wash: #1a2a40;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--accent);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Header ------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--accent); }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.375rem;
}
.site-nav a {
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Main ---------------------------------------------------------------- */
main { padding-block: 3rem 5rem; }

.page-header { max-width: var(--measure); margin-bottom: 2.75rem; display: grid; gap: 0.875rem; }
.lede { font-size: var(--step-1); color: var(--muted); line-height: 1.5; }

.section { margin-top: 3.5rem; }
.section:first-of-type { margin-top: 0; }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.section__head h2 { scroll-margin-top: 1.5rem; }
.section__count, .label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1rem; }

/* Jump links (Research page) */
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: -1.25rem 0 3rem;
  font-size: 0.9375rem;
}

.cite__meta, .versions, .timeline, .courses, .section__count, .year-group__year { font-variant-numeric: tabular-nums; }

/* Citations ----------------------------------------------------------- */
.cite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.375rem; }
.cite { display: grid; gap: 0.25rem; max-width: 46rem; }
.cite__title {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: pretty;
}
.cite__title a { color: var(--ink); text-decoration-color: var(--rule); }
.cite__title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.cite__meta { color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }
.cite__meta cite { font-style: italic; color: var(--ink); }
.cite__kind {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 0.375rem;
}
.cite__status { color: var(--accent); font-weight: 500; }
.cite__links {
  list-style: none;
  margin: 0.125rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.875rem;
}
.cite__links a { font-weight: 500; }
.cite__links a::before { content: "→ "; }

/* Selected publications: each paper in its own box */
.cite-list--featured {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
  gap: 1rem;
}
.cite-list--featured .cite {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.25rem 1.375rem;
  gap: 0.5rem;
  align-content: start;
  max-width: none;
  transition: border-color 0.15s ease;
}
.cite-list--featured .cite:hover { border-color: var(--accent); }
.cite-list--featured .cite__title { font-size: 1.25rem; }
.cite-list--featured .cite { display: flex; flex-direction: column; }
.cite-list--featured .cite__links { margin-top: auto; padding-top: 0.5rem; }

/* Year in the margin */
.year-list { display: grid; gap: 2rem; }
.year-group {
  display: grid;
  grid-template-columns: var(--gutter-year) minmax(0, 1fr);
  gap: 0 1.5rem;
}
.year-group__year {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding-top: 0.3rem;
  hyphens: manual;
}
@media (max-width: 40rem) {
  .year-group { grid-template-columns: minmax(0, 1fr); gap: 0.625rem; }
  .year-group__year { padding-top: 0; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
  .year-group__year br, .year-group__year wbr { display: none; }
}

/* Home ---------------------------------------------------------------- */
.intro {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 2.75rem;
  align-items: start;
}
.portrait {
  border-radius: 4px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  width: 100%;
  max-width: 100%;
  background: var(--rule);
}
.intro__text { display: grid; gap: 1.5rem; max-width: var(--measure); }
.roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.roles li { display: grid; gap: 0; }
.roles strong { font-weight: 600; }
.roles span { color: var(--muted); font-size: 0.9375rem; }
.bio { display: grid; gap: 1rem; }

.contact {
  list-style: none;
  margin: 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-size: 0.9375rem;
}
.contact .label { display: block; margin-bottom: 0.125rem; }

@media (max-width: 44rem) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .portrait { max-width: 11rem; }
}

/* Data cards (home + datasets) */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1.25rem;
}
.data-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.5rem;
  display: grid;
  gap: 0.75rem;
  align-content: start;
}
.data-card h3 a { color: var(--ink); text-decoration: none; }
.data-card h3 a:hover { color: var(--accent); }
.data-card p { color: var(--muted); font-size: 0.9375rem; }
.data-card .figure {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
}

/* Datasets page -------------------------------------------------------- */
.dataset { display: grid; gap: 1.5rem; max-width: 48rem; }
.dataset + .dataset { margin-top: 4.5rem; }
.dataset > .section__head { margin-bottom: 0; }

.table-scroll { overflow-x: auto; }
.versions {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.versions th, .versions td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.versions tr:last-child td { border-bottom: 0; }
.versions th {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.versions td.num, .versions th.num { white-space: nowrap; }
.versions .tag {
  display: inline-block;
  margin-left: 0.375rem;
  padding: 0 0.4rem;
  border-radius: 3px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 4px;
  background: var(--accent);
  color: var(--paper);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  width: fit-content;
}
.button:hover { background: var(--accent-strong); color: var(--paper); }
.button small { font-weight: 400; opacity: 0.85; }

.abstract {
  border-left: 2px solid var(--rule);
  padding-left: 1.25rem;
  display: grid;
  gap: 0.75rem;
  color: var(--ink);
}
.abstract .label { display: block; }
.keywords { font-size: 0.875rem; color: var(--muted); }
.keywords b { font-weight: 600; color: var(--ink); }

.cite-as {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  display: grid;
  gap: 0.375rem;
}

/* CV page -------------------------------------------------------------- */
.cv-download { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 3rem; }
.cv-download p { color: var(--muted); font-size: 0.9375rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.timeline li {
  display: grid;
  grid-template-columns: var(--gutter-year) minmax(0, 1fr);
  gap: 0 1.5rem;
}
.timeline .when {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  padding-top: 0.15rem;
  white-space: nowrap;
}
.timeline .what { display: grid; }
.timeline .what span { color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 40rem) {
  .timeline li { grid-template-columns: minmax(0, 1fr); }
}

/* Teaching page --------------------------------------------------------- */
.courses { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.courses li {
  display: grid;
  grid-template-columns: var(--gutter-year) minmax(0, 1fr);
  gap: 0 1.5rem;
  align-items: baseline;
}
.courses code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}
.institution { display: grid; gap: 1rem; }
.institution + .institution { margin-top: 3rem; }
.institution header { display: grid; gap: 0.25rem; }
.institution header p { color: var(--muted); font-size: 0.9375rem; }

/* Footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.875rem; }
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
}
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

.note { margin-top: 1.5rem; color: var(--muted); }

.not-found { display: grid; gap: 1rem; max-width: var(--measure); }

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

@media print {
  .site-header, .site-footer, .jump { display: none; }
  body { background: #fff; color: #000; }
  a { color: inherit; }
}

/* Version table stacks into blocks on phones so the download link stays visible */
@media (max-width: 40rem) {
  .versions thead { display: none; }
  .versions, .versions tbody, .versions tr, .versions td { display: block; }
  .versions tr { padding: 0.875rem 1rem; border-bottom: 1px solid var(--rule); display: grid; gap: 0.25rem; }
  .versions tr:last-child { border-bottom: 0; }
  .versions td { padding: 0; border: 0; }
  .versions td:first-child { font-weight: 600; }
  .versions td.num:nth-child(2) { color: var(--muted); font-family: var(--font-mono); font-size: 0.8125rem; }
}

/* State Capacity explorer callout (Datasets page) and link on the home data card */
.explorer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.5rem;
  border-radius: 6px;
  background: var(--accent-wash);
  border: 1px solid var(--rule);
}
.explorer__text { flex: 1 1 22rem; min-width: 0; display: grid; gap: 0.5rem; }
.explorer__text p { color: var(--ink); font-size: 0.9375rem; }
.data-card__link { font-size: 0.9375rem; }
.data-card p.data-card__link a { font-weight: 500; }
.data-card p.data-card__link a::after { content: " →"; }

.archive summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9375rem;
}
.archive[open] summary { margin-bottom: 1rem; }
