:root {
  --background: #ffffff;
  --text: #1a1a1a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --muted: #6b7280;
  --border: #e5e7eb;
  --featured-bg: #fafaf7;
  --wp-bg: #f9fafb;
  --carousel-bg: #fafafa;
  --max-width: 720px;
  --nav-width: 1040px;
  --section-gap: 5rem;
  --item-gap: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f1115;
    --text: #e8eaed;
    --accent: #7aa2ff;
    --accent-hover: #a4bcff;
    --muted: #9aa0a6;
    --border: #2a2e36;
    --featured-bg: #171923;
    --wp-bg: #161a22;
    --carousel-bg: #12141a;
  }

  .tag--published {
    color: #c9b99a;
    background: #2a2619;
    border-color: #3b3424;
  }

  .tag--policy {
    color: #a2c5ac;
    background: #1a241c;
    border-color: #2a3a2d;
  }

  .tag--submitted {
    color: #a2b2c5;
    background: #1a1e26;
    border-color: #2a3040;
  }

  .tag--wip {
    color: #c5a2b8;
    background: #241a22;
    border-color: #3a2a36;
  }

  .project-logo,
  .carousel-track img {
    filter: brightness(0.92);
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

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

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

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

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

h1,
h2,
h3,
p,
ul,
ol {
  margin-top: 0;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--text);
  letter-spacing: -0.005em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

small,
.meta,
.muted,
.site-nav a,
.site-footer,
.eyebrow {
  font-size: 0.875rem;
}

.chrome {
  width: min(var(--nav-width), calc(100% - 4rem));
  margin: 0 auto;
}

.content {
  width: min(var(--max-width), calc(100% - 4rem));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.25rem 0;
}

.site-name {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.site-name:hover {
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem 1.25rem;
}

.site-nav a {
  color: var(--muted);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.page {
  padding: 4.5rem 0 5rem;
}

.hero {
  padding-top: 0.25rem;
}

.hero-block {
  margin-top: 1.75rem;
}

.hero-block h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.hero-block p {
  margin-bottom: 0;
}

.hero-inner {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-photo {
  flex: 0 0 110px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .hero-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-text {
    text-align: left;
  }

  .hero-photo {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
  }
}

.eyebrow {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.role {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.lede {
  font-size: 1.125rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.intro {
  color: var(--muted);
  margin-bottom: 0;
}

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

.link-list li {
  display: flex;
  align-items: center;
}

.link-list li:not(:last-child)::after {
  content: "|";
  color: var(--muted);
  margin-left: 0.75rem;
}

.section {
  margin-top: var(--section-gap);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--text);
}

.section-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.section-link {
  flex-shrink: 0;
}

.stack {
  display: grid;
  gap: var(--item-gap);
}

.stack:has(.cv-item) {
  gap: 0.75rem;
}

.entry {
  padding-top: 2.5rem;
  position: relative;
}

.entry::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--text);
  opacity: 0.8;
}

.entry:first-child {
  padding-top: 0;
}

.entry:first-child::before {
  display: none;
}

.entry-title {
  margin-bottom: 0.35rem;
}

.entry-title a {
  color: var(--text);
}

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

.meta {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Peer-reviewed: warm beige */
.tag--published {
  color: #7c6f5b;
  background: #f5f0e8;
  border-color: #e8e0d0;
}

/* Policy brief: muted sage */
.tag--policy {
  color: #5b7c65;
  background: #edf5ef;
  border-color: #d4e8d9;
}

/* Under review: muted slate */
.tag--submitted {
  color: #5b6a7c;
  background: #edf1f5;
  border-color: #d4dce8;
}

/* Work in progress: muted mauve */
.tag--wip {
  color: #7c5b72;
  background: #f5edf3;
  border-color: #e8d4e2;
}

.card-grid {
  display: grid;
  gap: var(--item-gap);
}

.card {
  padding-top: 2.5rem;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--text);
  opacity: 0.8;
}

.card:first-child {
  padding-top: 0;
}

.card:first-child::before {
  display: none;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.85rem;
}

.link-row a {
  font-size: 0.95rem;
}

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

.plain-list li + li {
  margin-top: 0.85rem;
}

.bullet-list {
  padding-left: 1.1rem;
  margin-bottom: 0;
}

.bullet-list li + li {
  margin-top: 0.55rem;
}

.definition-list {
  display: grid;
  gap: 1rem;
}

.definition-list strong {
  display: inline-block;
  min-width: 8rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 1.5rem 0 2.5rem;
}

.site-footer p {
  margin-bottom: 0;
}

/* CV page */

.cv-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.cv-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
}

.cv-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.cv-btn--secondary {
  background: transparent;
  color: var(--accent);
}

.cv-btn--secondary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.cv-item {
  padding-top: 1.5rem;
  padding-bottom: 0;
  position: relative;
}

.cv-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--text);
  opacity: 0.8;
}

.cv-item:first-child {
  padding-top: 0;
}

.cv-item:first-child::before {
  display: none;
}

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

.cv-item p {
  margin-bottom: 0.35rem;
}

.cv-item h3 {
  margin-bottom: 0.25rem;
}

.cv-dates {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.cv-more {
  margin-top: 1.25rem;
}

/* Featured card */

.featured {
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--featured-bg);
}

.featured .entry-title {
  margin-top: 0;
  font-size: 1.2rem;
}

/* Project separation — stronger break between top-level projects on projects page */

.entry.project-entry {
  padding-top: 3.5rem;
  margin-top: 3.5rem;
  border-top: 2px solid var(--border);
}

.entry.project-entry::before {
  display: none;
}

.entry.project-entry:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

/* Project logos */

.project-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.project-header h2 {
  margin-bottom: 0;
}

.project-logo {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
}

/* Subprojects */

.subproject {
  margin-top: 1.25rem;
  padding: 1rem 0 0 1.25rem;
  border-left: 2px solid var(--border);
}

.subproject h3 {
  font-size: 1rem;
}

.subproject p {
  font-size: 0.95rem;
}

.subproject + .subproject {
  margin-top: 1rem;
}

/* Carousel */

.carousel {
  margin-top: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.carousel-track {
  display: flex;
}

.carousel-track img {
  flex: 0 0 100%;
  scroll-snap-align: start;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--carousel-bg);
}

/* Research controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-btn {
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.control-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.control-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* Working paper notes */

.wp-note {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--wp-bg);
  border-left: 3px solid var(--border);
  border-radius: 2px;
}

.wp-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.wp-delta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .page {
    padding: 3rem 0 4rem;
  }

  .section {
    margin-top: 3rem;
  }

  h1 {
    font-size: 1.85rem;
  }

  .chrome,
  .content {
    width: calc(100% - 2.5rem);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1.25rem;
  }
}
