:root {
  --ink: #171512;
  --paper: #f3efe7;
  --cream: #fbf8f1;
  --sand: #d7b98f;
  --rust: #b64c2d;
  --olive: #56624f;
  --blue: #35556d;
  --line: rgba(23, 21, 18, 0.19);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); margin: 0; }
a { color: inherit; }
.skip { background: var(--ink); color: white; left: -9999px; padding: 0.7rem; position: fixed; top: 0; z-index: 100; }
.skip:focus { left: 0; }

.topbar {
  align-items: center;
  background: rgba(243, 239, 231, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 4.5rem);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.topbar nav { display: flex; gap: clamp(0.8rem, 2vw, 2rem); }
.topbar nav a { font-size: 0.78rem; font-weight: 700; text-decoration: none; text-transform: uppercase; }
.topbar nav a.active, .topbar nav a:hover { color: var(--rust); }

.portfolio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  min-height: 82vh;
}

.hero-main { display: flex; flex-direction: column; justify-content: center; padding: clamp(4rem, 10vw, 9rem) clamp(1.5rem, 7vw, 7.5rem); }
.eyebrow { color: var(--rust); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.16em; text-transform: uppercase; }
.hero-main h1 { font-family: var(--serif); font-size: clamp(3.3rem, 7.6vw, 7.8rem); font-weight: 500; letter-spacing: -0.055em; line-height: 0.95; margin: 1rem 0 2rem; max-width: 1050px; }
.hero-deck { font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.5; max-width: 780px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }
.button { border: 1px solid var(--ink); font-size: 0.78rem; font-weight: 800; padding: 0.8rem 1rem; text-decoration: none; text-transform: uppercase; }
.button.dark { background: var(--ink); color: white; }
.button.light { background: transparent; }
.hero-portrait { background: #ddc39f; display: flex; flex-direction: column; margin: 0; min-height: 620px; }
.hero-portrait img { flex: 0 0 auto; height: auto; object-fit: contain; width: 100%; }
.hero-portrait figcaption { background: var(--ink); color: white; font-size: 0.72rem; line-height: 1.6; padding: 1.2rem 1.4rem; text-transform: uppercase; }

.featured { background: var(--ink); color: var(--cream); display: grid; gap: clamp(2rem, 8vw, 9rem); grid-template-columns: 0.35fr 1.65fr; padding: clamp(4rem, 9vw, 9rem) clamp(1.5rem, 7vw, 7.5rem); }
.feature-number { color: #bdad98; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.featured > div:last-child { max-width: 980px; }
.featured h2 { font-family: var(--serif); font-size: clamp(3rem, 6vw, 6.5rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1; margin: 1rem 0 2rem; }
.featured p:not(.eyebrow):not(.status) { color: #ded6ca; font-family: var(--serif); font-size: clamp(1.1rem, 1.8vw, 1.45rem); line-height: 1.55; }
.eyebrow.inverse { color: #e38767; }
.featured .status { border-top: 1px solid #544f48; font-size: 0.8rem; margin-top: 2rem; padding-top: 1rem; }
.featured a { color: #f1a78b; display: inline-block; font-size: 0.82rem; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.feature-actions { display: flex; flex-wrap: wrap; gap: 0.8rem 1.4rem; margin-top: 1.5rem; }
.feature-actions .pdf-link { border: 1px solid #7c6e63; color: var(--cream); padding: 0.65rem 0.8rem; }

.programmes, .selected-research, .profile, .research-page { padding: clamp(4rem, 9vw, 8rem) clamp(1.5rem, 7vw, 7.5rem); }
.section-header { display: grid; gap: 1.5rem; grid-template-columns: 0.5fr 1.1fr 0.7fr; margin-bottom: 4rem; }
.section-header h2, .research-intro h1, .profile h2 { font-family: var(--serif); font-size: clamp(2.6rem, 5vw, 5.5rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1; margin: 0; }
.section-header > p:last-child { color: #5c554c; line-height: 1.65; }
.programme-grid { display: grid; gap: 1px; grid-template-columns: repeat(2, 1fr); }
.programme-card { display: flex; flex-direction: column; min-height: 390px; padding: clamp(2rem, 5vw, 4rem); }
.programme-card:nth-child(1) { background: #dcb99a; }
.programme-card:nth-child(2) { background: #a6b7bd; }
.programme-card:nth-child(3) { background: #c7c2a2; }
.programme-card:nth-child(4) { background: #d6a18f; }
.programme-meta { display: flex; font-size: 0.7rem; font-weight: 800; justify-content: space-between; letter-spacing: 0.1em; text-transform: uppercase; }
.programme-card h3 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.8rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; margin: auto 0 1rem; }
.programme-card p { line-height: 1.6; max-width: 570px; }
.programme-card a { font-size: 0.76rem; font-weight: 800; margin-top: 1rem; text-decoration: none; text-transform: uppercase; }

.selected-research { background: var(--cream); }
.section-header.compact { grid-template-columns: 0.5fr 1.8fr; }
.selected-list { background: var(--line); border: 1px solid var(--line); display: grid; gap: 1px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.selected-list, .selected-paper, .selected-paper > *, .section-header.compact > * { min-width: 0; }
.selected-paper { background: var(--cream); display: flex; flex-direction: column; min-height: 470px; overflow: hidden; padding: clamp(2rem, 4vw, 3.4rem); transition: background 180ms ease; }
.selected-paper:hover { background: #fffdf8; }
.selected-meta { color: #685f55; display: flex; flex-direction: column; font-size: 0.7rem; gap: 0.35rem; letter-spacing: 0.06em; text-transform: uppercase; }
.selected-paper .selected-meta { align-items: start; display: grid; gap: 1rem; grid-template-columns: auto minmax(0, 1fr); margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.selected-paper .selected-meta span:first-child { background: var(--ink); color: white; padding: 0.35rem 0.5rem; white-space: nowrap; }
.selected-paper .selected-meta span:last-child { line-height: 1.45; text-align: right; }
.selected-paper h3, .portfolio-paper h3 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.8rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 1rem; }
.selected-paper h3 { font-size: clamp(2rem, 3.6vw, 3.25rem); }
.selected-paper h3, .selected-paper p, .selected-paper .selected-meta span, .section-header.compact h2 { overflow-wrap: anywhere; }
.selected-paper p { color: #413c36; font-size: 1rem; line-height: 1.72; margin-bottom: 2rem; }
.text-link { align-self: start; color: var(--rust); font-size: 0.76rem; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.selected-paper > .paper-actions { border-top: 1px solid var(--line); margin-top: auto; padding-top: 1rem; width: 100%; }
.text-link { display: inline-block; margin-top: 2.5rem; }

.profile { background: #d9c5a9; display: grid; gap: 4rem; grid-template-columns: 0.65fr 1.35fr; }
.profile-copy > p { font-family: var(--serif); font-size: clamp(1.35rem, 2.7vw, 2.25rem); line-height: 1.4; margin-top: 0; }
.profile-links { border-top: 1px solid rgba(23, 21, 18, 0.25); display: flex; flex-wrap: wrap; gap: 1.5rem; padding-top: 1rem; }
.profile-links a, .profile-links span { font-size: 0.75rem; font-weight: 700; text-decoration: none; text-transform: uppercase; }

.research-page { min-height: 80vh; }
.research-intro { display: grid; gap: 2rem; grid-template-columns: 0.45fr 1fr 0.7fr; margin-bottom: 4rem; }
.research-intro p:last-child { color: #5c554c; line-height: 1.6; }
.research-controls { border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); display: grid; gap: 1.5rem; grid-template-columns: minmax(240px, 0.7fr) 1.3fr auto; padding: 1.5rem 0; }
.research-controls label span { display: block; font-size: 0.67rem; font-weight: 800; margin-bottom: 0.3rem; text-transform: uppercase; }
.research-controls input { background: transparent; border: 1px solid #aaa095; font: inherit; padding: 0.65rem 0.75rem; width: 100%; }
.portfolio-filters { align-items: end; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.portfolio-filters button { background: transparent; border: 1px solid var(--line); cursor: pointer; font-size: 0.68rem; padding: 0.55rem 0.65rem; text-transform: uppercase; }
.portfolio-filters button.is-active { background: var(--ink); color: white; }
#portfolio-count { align-self: end; color: #6d655b; font-size: 0.72rem; white-space: nowrap; }
.portfolio-group { display: grid; gap: clamp(2rem, 5vw, 6rem); grid-template-columns: 0.55fr 1.45fr; padding: 5rem 0; }
.portfolio-group + .portfolio-group { border-top: 1px solid var(--line); }
.portfolio-group > header { align-self: start; position: sticky; top: 6rem; }
.portfolio-group > header h2 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 4rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; margin: 0.5rem 0 1rem; }
.portfolio-group > header p:last-child { color: #655d54; line-height: 1.6; }
.portfolio-paper { display: grid; gap: 1.2rem; grid-column: 2; grid-template-columns: 54px 1fr; padding: 2rem 0; }
.portfolio-paper + .portfolio-paper { border-top: 1px solid var(--line); }
.paper-index { color: var(--rust); font-size: 0.7rem; font-weight: 800; padding-top: 0.4rem; }
.paper-body > p:not(.authors) { color: #4e4841; line-height: 1.65; }
.authors { font-size: 0.8rem; font-style: italic; }
.paper-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; }
.paper-actions a { color: var(--rust); font-size: 0.75rem; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.paper-actions .pdf-link { background: var(--ink); color: white; padding: 0.6rem 0.75rem; }

footer { background: var(--ink); color: #d8d0c5; display: flex; font-size: 0.7rem; justify-content: space-between; letter-spacing: 0.08em; padding: 1.5rem clamp(1.5rem, 7vw, 7.5rem); text-transform: uppercase; }

@media (max-width: 850px) {
  .topbar nav a { display: none; }
  .topbar nav a[href*="research"], .topbar nav a[href*="scholar.google"] { display: inline; }
  .portfolio-hero { grid-template-columns: 1fr; }
  .hero-main { min-height: 75vh; }
  .hero-portrait { min-height: 0; }
  .hero-portrait img { aspect-ratio: auto; height: auto; object-fit: contain; }
  .featured, .section-header, .section-header.compact, .profile, .research-intro, .research-controls, .portfolio-group { grid-template-columns: 1fr; }
  .programme-grid { grid-template-columns: 1fr; }
  .programme-card { min-height: 330px; }
  .selected-list { grid-template-columns: 1fr; }
  .selected-paper { min-height: 0; }
  .selected-paper .selected-meta { margin-bottom: 2.5rem; }
  .portfolio-group > header { position: static; }
  .portfolio-paper { grid-column: auto; }
  #portfolio-count { justify-self: start; }
  footer { flex-direction: column; gap: 0.5rem; }
}

@media (max-width: 520px) {
  .hero-main h1 { font-size: 3.4rem; }
  .selected-paper .selected-meta { grid-template-columns: 1fr; }
  .selected-paper .selected-meta span:last-child { text-align: left; }
  .portfolio-paper { grid-template-columns: 36px 1fr; }
  .programmes, .selected-research, .profile, .research-page { padding-left: 1rem; padding-right: 1rem; }
}
