/* ------------------------------------------------------------------
   Colours and sizes. Change the maroon here to re-theme the whole site.
   ------------------------------------------------------------------ */
:root {
  --maroon: #7b2d43;
  --maroon-dark: #5c1f31;
  --accent: #852243;
  --accent-tint: #f6e9ee;
  --ink: #1f1f1f;
  --text: #353535;
  --muted: #6a6a6a;
  --line: #e7e1e3;
  --soft: #f7f5f5;
  --white: #fff;
  --wrap: 1080px;
  --narrow: 860px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: Lato, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--white);
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--maroon-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: var(--narrow); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 20; background: var(--white); padding: 8px 12px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand:hover { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  color: var(--text); text-decoration: none;
  padding: 8px 14px; border-radius: 4px;
  font-size: .95rem; letter-spacing: .03em;
}
.site-nav a:hover { color: var(--accent); background: var(--soft); }
.site-nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-right: -10px;
    background: none; border: 0; border-radius: 6px; cursor: pointer; color: var(--ink);
  }
  .nav-toggle svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
  .js .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--white);
    border-bottom: 1px solid var(--line); padding: 8px 12px 14px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, .06);
  }
  .js .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
  .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  html:not(.js) .header-inner { flex-direction: column; align-items: flex-start; padding: 10px 0; }
}

/* ---------------- Home ---------------- */
.hero-title { text-align: center; padding: 52px 0 44px; }
.hero-title h1 { font-weight: 300; color: var(--accent); font-size: 2.75rem; line-height: 1.15; margin: 0; letter-spacing: .01em; }
.hero-title p { margin: .5rem 0 0; color: var(--muted); font-size: 1.05rem; letter-spacing: .02em; }

.band { background: var(--maroon); color: var(--white); }
.home-grid { display: grid; grid-template-columns: 280px 1fr; gap: 56px; padding-top: 56px; padding-bottom: 56px; align-items: start; }
.portrait { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.btn-cv {
  display: block; text-align: center; margin-top: 20px; padding: 10px 16px;
  background: var(--white); color: var(--accent); border-radius: 4px;
  text-decoration: none; font-weight: 700; font-size: .9rem; letter-spacing: .12em; text-transform: uppercase;
}
.btn-cv:hover { background: var(--accent-tint); color: var(--maroon-dark); }
.social { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.social a {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: var(--white); transition: background .15s, color .15s;
}
.social a:hover { background: var(--white); color: var(--maroon); }
.social svg { width: 19px; height: 19px; fill: currentColor; }
.social svg.i-stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.bio { font-size: 1.1rem; line-height: 1.75; max-width: 680px; }
.bio p { margin: 0 0 1.1em; }
.bio p:first-child { font-size: 1.3rem; font-weight: 300; }
.bio a { color: var(--white); }
.bio a:hover { color: var(--accent-tint); }

.contact { background: var(--soft); padding: 52px 0; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 48px; align-items: start; }
.contact h2 { font-weight: 400; color: var(--accent); font-size: 1.6rem; margin: 0 0 14px; }
.contact address { font-style: normal; margin-bottom: 1em; }
.contact p { margin: 0 0 .4em; }
.affil-logo { display: inline-block; margin-top: 24px; }
.affil-logo img { width: 200px; }
.map iframe { display: block; width: 100%; height: 300px; border: 0; border-radius: 4px; background: var(--line); }

@media (max-width: 800px) {
  .hero-title { padding: 36px 0 30px; }
  .hero-title h1 { font-size: 2.2rem; }
  .home-grid { grid-template-columns: 1fr; gap: 36px; padding-top: 40px; padding-bottom: 40px; }
  .home-side { max-width: 280px; width: 100%; margin: 0 auto; }
  .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .map iframe { height: 240px; }
}

/* ---------------- Inner pages ---------------- */
.page-banner { background: var(--maroon); color: var(--white); padding: 44px 0 40px; }
.page-banner h1 { font-weight: 300; font-size: 2.4rem; line-height: 1.2; margin: 0; letter-spacing: .01em; }
.banner-sub { margin: .5rem 0 0; opacity: .9; }
.banner-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.btn-inline { display: inline-block; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 16px 0 0; padding: 0; }
.tags li { border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; padding: 3px 14px; font-size: .9rem; letter-spacing: .02em; }

.content { padding-top: 16px; padding-bottom: 72px; }
.content h2 {
  color: var(--accent); font-weight: 400; font-size: 1.65rem; line-height: 1.3;
  margin: 2.4rem 0 1.1rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-block; font: inherit; font-size: .82rem; line-height: 1.6; letter-spacing: .03em;
  padding: 2px 12px; border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); background: var(--white); text-decoration: none; cursor: pointer;
}
.pill:hover, .pill[aria-expanded="true"] { background: var(--accent); color: var(--white); text-decoration: none; }
html:not(.js) .pill-toggle { display: none; }

/* Papers */
.papers { list-style: none; counter-reset: paper; margin: 0; padding: 0; }
.paper { counter-increment: paper; position: relative; padding: 0 0 1.35rem 2.1rem; margin: 0 0 1.35rem; border-bottom: 1px solid var(--line); }
.paper:last-child { border-bottom: 0; margin-bottom: 0; }
.paper::before { content: counter(paper) "."; position: absolute; left: 0; top: .1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.paper-title { font-size: 1.1rem; font-weight: 700; line-height: 1.45; color: var(--ink); margin: 0; }
.paper-title a { color: inherit; text-decoration-color: rgba(133, 34, 67, .4); }
.paper-title a:hover { color: var(--accent); }
.paper-authors { margin: .2rem 0 0; color: var(--muted); }
.paper-venue { margin: .35rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.paper-note { background: var(--accent-tint); color: var(--maroon-dark); border-radius: 4px; padding: 1px 9px; font-size: .92rem; }
.paper-links { display: flex; flex-wrap: wrap; gap: 6px; margin: .7rem 0 0; }
.abstract {
  margin: .9rem 0 0; padding: .9rem 1.1rem; font-size: .96rem; line-height: 1.65;
  background: var(--soft); border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0;
}
.abstract p { margin: 0; }
.js .abstract:not(.is-open) { display: none; }

/* Teaching */
.book-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; list-style: none; margin: 1.2rem 0 0; padding: 0; }
.book { border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 4px; padding: 16px 18px; }
.book h3 { font-size: 1.05rem; margin: 0 0 .35rem; line-height: 1.4; }
.book p { margin: 0; font-size: .95rem; color: var(--muted); }
.course-list { list-style: none; margin: 0; padding: 0; }
.course-list li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.course-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.course-extras { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: .35rem; }
.course-extras .pill { margin-left: auto; }
.course-programme { font-size: .8rem; color: #7d4b5c; background: var(--accent-tint); border-radius: 4px; padding: 1px 8px; white-space: nowrap; }
.course-name { font-weight: 700; color: var(--ink); }
.course-details { color: var(--muted); font-size: .95rem; }
.course-tools, .cv-tag { color: var(--muted); font-size: .82rem; border: 1px solid var(--line); background: var(--soft); border-radius: 4px; padding: 0 7px; }
.content .group-title {
  font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); margin: 2.2rem 0 .3rem; padding-bottom: .45rem;
  border-bottom: 2px solid var(--accent);
}
.content h2 + .group-title { margin-top: 1.2rem; }
.group-note { font-size: .95rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px;
  margin: 2.4rem 0 1.1rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line);
}
.content .section-head h2 { margin: 0; padding: 0; border: 0; }
.content .section-head + .group-title { margin-top: 1.2rem; }
.content .place-summary { margin: -.3rem 0 0; color: var(--muted); }
.content .place-summary + .group-title { margin-top: 1.2rem; }
.legend { display: flex; gap: 6px; margin: 0; }

/* CV */
.cv-entry { display: flex; justify-content: space-between; gap: 6px 28px; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.cv-entry:last-child { border-bottom: 0; }
.cv-title { font-weight: 700; color: var(--ink); }
.cv-title-plain { font-weight: 400; }
.cv-extra { font-weight: 400; }
.cv-lines { margin: 0; }
.cv-lines > div { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.cv-lines > div:last-child { border-bottom: 0; }
.cv-lines dt { font-weight: 700; color: var(--ink); }
.cv-lines dd { margin: 0; }
.cv-pointer { color: var(--muted); margin: .6rem 0 0; }
.cv-org { color: var(--muted); }
.cv-details { font-size: .96rem; margin-top: .25rem; }
.cv-details p { margin: 0; }
.cv-date { color: var(--muted); font-size: .95rem; white-space: nowrap; text-align: right; padding-top: .1rem; }
@media (max-width: 600px) {
  .cv-entry { flex-direction: column; }
  .cv-date { text-align: left; order: -1; padding: 0; font-size: .88rem; }
}

/* Talks */
.talk-year { display: grid; grid-template-columns: 84px 1fr; gap: 20px; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.talk-year:first-child { margin-top: 1.6rem; }
.talk-year:last-child { border-bottom: 0; }
.content .talk-year h2 { margin: 0; padding: 0; border: 0; font-size: 1.4rem; line-height: 1.5; }
.talk-list { list-style: none; margin: 0; padding: 0; }
.talk-list li { padding: .1rem 0 .7rem; }
.talk-list li:last-child { padding-bottom: 0; }
.talk-paper { display: block; font-style: italic; }
.talk-event { color: var(--ink); font-weight: 700; }
.talk-meta { display: block; color: var(--muted); font-size: .95rem; }
.badge { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; border: 1px solid var(--line); background: var(--soft); border-radius: 4px; padding: 0 7px; margin-left: 4px; vertical-align: 1px; }
@media (max-width: 600px) {
  .talk-year { grid-template-columns: 1fr; gap: 6px; }
}

/* Plain pages (e.g. 404) */
.prose { padding-top: 32px; }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------------- Cookie banner ---------------- */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50;
  max-width: 540px; margin: 0 auto; padding: 14px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); font-size: .95rem;
}
.consent[hidden] { display: none; }
.consent p { margin: 0; flex: 1 1 240px; }
.consent-buttons { display: flex; gap: 8px; }
.consent button { font: inherit; font-size: .9rem; padding: 6px 16px; border-radius: 4px; border: 1px solid var(--accent); cursor: pointer; }
.consent-accept { background: var(--accent); color: var(--white); }
.consent-accept:hover { background: var(--maroon-dark); }
.consent-decline { background: var(--white); color: var(--accent); }
.consent-decline:hover { background: var(--accent-tint); }
.site-footer a { color: inherit; }
