/* =================================================================
   Pervez Ali · academic website styles
   -----------------------------------------------------------------
   You rarely need to edit this file. Colours, fonts and spacing are
   set once in the ":root" block below; change a value there and it
   updates everywhere on the page.
   ================================================================= */

/* ---------- Fonts (self-hosted; licences in assets/fonts/) ---------- */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2-variations"),
       url("assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-latin-ext-opsz-normal.woff2") format("woff2-variations"),
       url("assets/fonts/newsreader-latin-ext-opsz-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-latin-opsz-italic.woff2") format("woff2-variations"),
       url("assets/fonts/newsreader-latin-opsz-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/newsreader-latin-ext-opsz-italic.woff2") format("woff2-variations"),
       url("assets/fonts/newsreader-latin-ext-opsz-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design tokens: edit colours and fonts here ---------- */
/* Layout: a warm off-white page, one reading column per section, with
   research themes linked by a line and publications in a year column. */
:root {
  color-scheme: light;

  --paper: #F7F4EE;          /* warm off-white page background */
  --paper-raised: #FCFBF8;   /* panels and link chips */
  --paper-tint: #EFEAE1;     /* alternate section background */
  --navy: #15243D;           /* headings and main text */
  --navy-soft: #3B4A62;      /* secondary text */
  --muted: #586375;          /* labels and small print */
  --teal: #0F6B68;           /* links and accents (passes contrast for text) */
  --teal-line: #2B8A85;      /* decorative lines */
  --teal-wash: #DDEDEA;      /* soft teal background */
  --rule: #DCD4C7;           /* hairlines */
  --placeholder-bg: #FBEAC4; /* highlight for text still to be filled in */
  --placeholder-ink: #6B4A00;

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --page-max: 72rem;
  --measure: 40rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-space: clamp(3.5rem, 8vw, 6.5rem);
  --radius: 6px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--navy);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (min-width: 40rem) {
  body { font-size: 1.125rem; }
}

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

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.15;
  color: var(--navy);
  text-wrap: balance;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--navy); text-decoration-thickness: 2px; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Text still to be replaced */
.placeholder {
  background: var(--placeholder-bg);
  color: var(--placeholder-ink);
  border-bottom: 1px dashed currentColor;
  border-radius: 2px;
  padding: 0 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -6rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; color: var(--paper); }

/* ---------- Header and navigation ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
/* Without JavaScript the phone header shows all links on two rows, so it scrolls away */
@media (max-width: 47.99rem) {
  html:not(.js-nav) .site-header { position: relative; }
}
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-header {
    background: rgba(247, 244, 238, 0.95);
    -webkit-backdrop-filter: saturate(1.2) blur(8px);
    backdrop-filter: saturate(1.2) blur(8px);
  }
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  min-height: 4rem;
  padding-block: 0.5rem;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy);
  text-decoration: none;
}
.brand:hover { color: var(--teal); }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.35rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.45rem 0;
  color: var(--navy-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--teal); border-bottom-color: currentColor; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--teal-line); }
.nav-toggle-icon,
.nav-toggle-icon::before {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease;
}
.nav-toggle-icon { position: relative; transform: translateY(-3px); }
.nav-toggle-icon::before { content: ""; position: absolute; top: 6px; left: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { transform: translateY(0) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { top: 0; transform: rotate(-90deg); }

/* Small screens: when script.js has loaded, the links fold behind a Menu button.
   Without JavaScript the links simply stay visible. */
@media (max-width: 47.99rem) {
  .js-nav .nav-toggle { display: inline-flex; }
  .js-nav .site-nav { display: none; flex-basis: 100%; }
  .js-nav .site-nav.is-open { display: block; }
  .js-nav .site-nav ul { flex-direction: column; padding-bottom: 0.5rem; }
  .js-nav .site-nav li + li { border-top: 1px solid var(--rule); }
  .js-nav .site-nav a { display: block; padding: 0.8rem 0; font-size: 1.05rem; border-bottom: 0; }
}

/* ---------- Buttons and link chips ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.55rem 1.15rem;
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.button:hover { background: var(--navy); color: var(--paper); }
.button--primary { background: var(--navy); color: var(--paper); }
.button--primary:hover { background: var(--teal); border-color: var(--teal); color: #FFFFFF; }

.link-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.link-list a,
.bibtex > summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.125rem;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--teal);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.link-list a:hover,
.bibtex > summary:hover { border-color: var(--teal); color: var(--navy); }

/* Links left without an address (href="") are hidden automatically */
.link-list li:has(> a[href=""]),
.link-list li:has(> a:not([href])) { display: none; }
.link-list a[href=""] { display: none; }

/* ---------- Introduction ---------- */
.hero { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5.5rem); }

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 44rem) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
    gap: clamp(1.5rem, 5vw, 4.5rem);
  }
}

.hero h1 {
  font-size: clamp(2.8rem, 7.5vw, 4.75rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}
.hero-role {
  margin-top: 0.75rem;
  font-size: clamp(1.3rem, 2.6vw, 1.65rem);
  font-style: italic;
  line-height: 1.3;
  color: var(--navy-soft);
}
.hero-affiliation {
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.hero-affiliation a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.hero-affiliation a:hover { color: var(--navy); text-decoration-thickness: 2px; }
.hero-intro {
  max-width: 36rem;
  margin-top: 1.6rem;
  font-size: clamp(1.1rem, 1.8vw, 1.22rem);
  line-height: 1.6;
}

.availability {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  width: fit-content;
  max-width: 100%;
  margin-top: 1.6rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid rgba(43, 138, 133, 0.35);
  border-radius: 14px;
  background: var(--teal-wash);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
}
.availability::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 107, 104, 0.18);
  transform: translateY(-0.05em);
}

.hero-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}
@media (max-width: 29.99rem) {
  .hero-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-links .button { width: 100%; }
}

/* Portrait: photo (or initials) inside decorative orbit artwork */
.portrait {
  position: relative;
  width: min(100%, 25rem);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}
.portrait-orbits {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.portrait-frame {
  position: absolute;
  inset: 22%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--paper-tint);
  box-shadow: 0 0 0 1px rgba(43, 138, 133, 0.45), 0 0 0 0.6rem var(--paper);
}
.portrait-initials,
.portrait-photo { grid-area: 1 / 1; }
.portrait-initials {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5.5vw, 3.9rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--navy);
}
/* The photo covers the initials when assets/images/profile.jpg exists */
.portrait-photo {
  width: 100%;
  height: 100%;
  background-image: url("assets/images/profile.jpg");
  background-position: center 30%;
  background-size: cover;
}
@media (max-width: 43.99rem) {
  .portrait { order: -1; width: 11.5rem; margin-inline: -0.9rem 0; margin-bottom: -0.5rem; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section-space); }
.section--tint { background: var(--paper-tint); }

.section-head {
  display: grid;
  gap: 0.9rem;
  max-width: var(--measure);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head h2 {
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  letter-spacing: -0.015em;
}
.section-head h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-bottom: 1rem;
  background: var(--teal-line);
}
.section-lede {
  font-size: clamp(1.08rem, 1.6vw, 1.2rem);
  color: var(--navy-soft);
}

/* ---------- Research themes ---------- */
.themes {
  --theme-gap: 2.5rem;
  list-style: none;
  display: grid;
  gap: var(--theme-gap);
}
.theme {
  position: relative;
  min-width: 0;
  max-width: 44rem;
  padding-left: 2.25rem;
}
.theme > p + p { margin-top: 0.75rem; }
.theme::before {            /* node on the line */
  content: "";
  position: absolute;
  left: 0;
  top: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--teal-line);
  box-shadow: 0 0 0 4px var(--paper);
}
.theme::after {             /* line to the next theme */
  content: "";
  position: absolute;
  left: calc(0.5rem - 1px);
  top: 1.65rem;
  bottom: calc(-1 * var(--theme-gap) + 0.25rem);
  width: 2px;
  background: var(--teal-line);
}
.theme:last-child::after { display: none; }
.theme--future::before { background: var(--paper); border: 2px solid var(--teal-line); }
.theme:has(+ .theme--future)::after {
  background: repeating-linear-gradient(to bottom, var(--teal-line) 0 6px, transparent 6px 12px);
}

@media (min-width: 62rem) {
  .themes { --theme-gap: 3rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theme { padding-left: 0; padding-top: 2.4rem; }
  .theme::before { top: 0; }
  .theme::after {
    top: calc(0.5rem - 1px);
    bottom: auto;
    left: 1.6rem;
    right: calc(-1 * var(--theme-gap) + 0.4rem);
    width: auto;
    height: 2px;
  }
  .theme:has(+ .theme--future)::after {
    background: repeating-linear-gradient(to right, var(--teal-line) 0 6px, transparent 6px 12px);
  }
}

.theme-status {
  margin-bottom: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.theme--future .theme-status { color: var(--muted); }
.theme h3 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.3rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.2;
}
.theme-question {
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--navy);
}
.theme p:not(.theme-status):not(.theme-question) { color: var(--navy-soft); }

.equation {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.equation img {
  display: block;
  width: 100%;
  max-width: 21rem;
  height: auto;
}
.equation figcaption {
  margin-top: 0.65rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Interactive sampler demo (drawn by demo.js) ---------- */
.demo {
  margin-top: clamp(3.5rem, 7vw, 5rem);
  padding-top: clamp(2rem, 4vw, 2.75rem);
  border-top: 1px solid var(--rule);
}
.demo-head { max-width: var(--measure); }
.demo-eyebrow {
  margin-bottom: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.demo h3 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  font-weight: 600;
  line-height: 1.2;
}
.demo-intro { color: var(--navy-soft); }
.demo-figure { margin: clamp(1.5rem, 3vw, 2rem) 0 0; }
.demo-live[hidden] { display: none; }

.demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem 1rem;
}
.demo-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
@media (min-width: 34rem) {
  .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-cell--chart { grid-column: 1 / -1; }
  .demo-canvas--chart { aspect-ratio: 3 / 1; }
}
@media (min-width: 62rem) {
  .demo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .demo-cell--chart { grid-column: auto; }
  .demo-canvas--chart { aspect-ratio: 3 / 2; }
}
.demo-cell { min-width: 0; }
.demo-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy-soft);
}
.demo-label span {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.demo-label--nonrev { color: var(--teal); }

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.1rem;
}
.demo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.75rem;
  min-height: 2.75rem;
  padding: 0.4rem 1.1rem;
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.demo-button:hover { background: var(--teal); border-color: var(--teal); color: #FFFFFF; }
.demo-button--quiet { background: transparent; color: var(--navy); }
.demo-button--quiet:hover { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.demo-slider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--navy-soft);
}
.demo-slider i,
.demo-time i { font-family: var(--font-serif); font-size: 1.1em; }
.demo-slider input {
  width: clamp(7rem, 24vw, 10rem);
  min-height: 2.75rem;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}
.demo-slider output {
  min-width: 2.25em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.demo-time {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.demo-readout {
  margin-top: 1rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--teal-line);
  color: var(--navy);
}
.demo-readout:empty { display: none; }
.demo-figure figcaption {
  max-width: 56rem;
  margin-top: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}
.demo-fallback {
  display: block;
  width: 100%;
  max-width: 47.25rem;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
/* A small 2 × 2 matrix written inline in the caption */
.matrix {
  display: inline-grid;
  grid-template-columns: auto auto;
  column-gap: 0.55em;
  margin-left: 0.15em;
  padding: 0 0.35em;
  vertical-align: middle;
  font-size: 0.78em;
  line-height: 1.05;
  text-align: center;
  border-inline: 1px solid currentColor;
  border-radius: 0.45em / 1.1em;
}

/* ---------- Projects ---------- */
.subsection-title {
  margin: clamp(3.5rem, 7vw, 5rem) 0 1.25rem;
  font-size: clamp(1.5rem, 2.6vw, 1.8rem);
}
.projects { border-top: 1px solid var(--rule); }
.project {
  display: grid;
  gap: 1.25rem;
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 52rem) {
  .project:has(> .project-figure) {
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 2.5rem;
    align-items: start;
  }
}
.project-body { min-width: 0; max-width: 46rem; }
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin-bottom: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
}
.project-tag {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--teal);
  align-self: center;
}
.project h4 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.2rem, 2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.25;
}
.project-body > p:not(.project-meta) { color: var(--navy-soft); }
.project .link-list { margin-top: 0.9rem; }

.project-figure { margin: 0; min-width: 0; max-width: 22rem; }
.project-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #FFFFFF;
}
.project-figure figcaption {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}
.figure-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  padding: 1rem;
  border: 1.5px dashed rgba(107, 74, 0, 0.55);
  border-radius: 4px;
  background: var(--placeholder-bg);
  color: var(--placeholder-ink);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
}

/* ---------- Publications ---------- */
.group-title {
  margin-bottom: 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-title--spaced { margin-top: 3rem; }

.pub-list { list-style: none; border-top: 1px solid var(--rule); }
.pub {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  padding-block: 1.6rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 5.5rem;
}
@media (min-width: 40rem) {
  .pub { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.5rem; }
}
.pub-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
}
@media (min-width: 40rem) {
  .pub-side { flex-direction: column; align-items: flex-start; }
}
.pub-year {
  font-size: 1.35rem;
  line-height: 1.2;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--navy);
}
.pub-status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--teal);
  white-space: nowrap;
}
.talk-month {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pub-main { min-width: 0; max-width: 46rem; }
.pub-title {
  font-size: clamp(1.15rem, 1.9vw, 1.28rem);
  font-weight: 600;
  line-height: 1.3;
}
.pub-authors { margin-top: 0.35rem; color: var(--navy-soft); }
.pub-me { font-weight: 600; color: var(--navy); }
.pub-venue { margin-top: 0.15rem; font-style: italic; color: var(--navy-soft); }
.pub-summary {
  margin-top: 0.6rem;
  max-width: 44rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--navy-soft);
}
.pub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.bibtex > summary {
  gap: 0.4rem;
  list-style: none;
  cursor: pointer;
}
.bibtex > summary::-webkit-details-marker { display: none; }
.bibtex > summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  transition: transform 0.15s ease;
}
.bibtex { min-width: 0; max-width: 100%; }
.bibtex[open] { flex: 1 1 100%; }
.bibtex[open] > summary::after { transform: translateY(0.1rem) rotate(-135deg); }
.bibtex-panel {
  max-width: 100%;
  margin-top: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.bibtex-panel pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre-wrap;       /* long lines wrap on screen; copied text is unchanged */
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--navy);
  tab-size: 2;
}
.bibtex-panel .copy-button { margin: 0 1.1rem 1rem; }

.copy-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.125rem;
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: transparent;
  color: var(--teal);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.copy-button:hover { background: var(--teal); color: #FFFFFF; }
.copy-button[hidden] { display: none; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 3rem;
}
@media (min-width: 56rem) {
  .about-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 4.5rem; }
}
.about-bio { min-width: 0; }
.about-bio > p { max-width: var(--measure); }
.about-bio > p + p { margin-top: 1rem; }
.about-facts { min-width: 0; }
@media (min-width: 56rem) {
  .about-facts { padding-top: 3.9rem; }
}

.facts-title {
  margin-bottom: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts-title--spaced { margin-top: 2.5rem; }
.facts-title--social { margin-top: 1.75rem; }

.edu-list { list-style: none; display: grid; gap: 1.35rem; }
.edu-item {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  gap: 1rem;
}
@media (max-width: 29.99rem) {
  .edu-item { grid-template-columns: 5rem minmax(0, 1fr); gap: 0.75rem; }
}
.edu-years {
  padding-top: 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.edu-degree { font-weight: 600; }
.edu-place { color: var(--navy-soft); }
.edu-detail { font-size: 0.98rem; color: var(--muted); }
.edu-place a,
.edu-detail a { color: inherit; }
.edu-place a:hover,
.edu-detail a:hover { color: var(--navy); }

.honor-list { list-style: none; border-top: 1px solid var(--rule); }
.honor-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.65rem;
  border-bottom: 1px solid var(--rule);
}
.honor-year {
  flex: none;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ---------- Teaching ---------- */
.teaching-grid { display: grid; gap: 3rem; }
@media (min-width: 62rem) {
  .teaching-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4rem; }
}
.teaching-block { min-width: 0; }
.teaching-block h3 { font-size: 1.4rem; font-weight: 600; }
.teaching-meta {
  margin-top: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--muted);
}
.course-table {
  width: 100%;
  margin-top: 1.1rem;
  border-collapse: collapse;
  font-size: 1rem;
}
.course-table th,
.course-table td {
  padding: 0.7rem 1rem 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.course-table thead th {
  padding-block: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--navy);
}
.course-table tbody th { font-weight: 600; }
.course-table td { color: var(--navy-soft); }
.teaching-also { margin-top: 1.1rem; color: var(--navy-soft); }
.teaching-also-label {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* On phones each course becomes a small block with labelled lines */
@media (max-width: 33.99rem) {
  .course-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .course-table tr {
    display: block;
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--rule);
  }
  .course-table tbody tr:first-child { border-top: 1px solid var(--navy); }
  .course-table th,
  .course-table td { display: block; padding: 0.1rem 0; border: 0; }
  .course-table td::before {
    content: attr(data-label) ": ";
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--muted);
  }
}

/* ---------- CV and contact ---------- */
.split { display: grid; gap: var(--section-space); }
@media (min-width: 56rem) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4.5rem; }
}
.split > section { min-width: 0; scroll-margin-top: 5.5rem; }
.split > section > p { max-width: var(--measure); }
.cv-download,
.cv-fallback { margin-top: 1.25rem; }
.cv-fallback { color: var(--navy-soft); }

.contact-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
}
.email-address {
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  overflow-wrap: anywhere;
  color: var(--navy);
}
.contact-address {
  margin-top: 1.25rem;
  font-style: normal;
  line-height: 1.55;
  color: var(--navy-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

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

/* ---------- Print ---------- */
@media print {
  .site-header, .skip-link, .hero-links, .portrait, .nav-toggle,
  .copy-button, .bibtex, .figure-placeholder, .demo-controls { display: none !important; }
  body { background: #FFFFFF; font-size: 11pt; }
  .section, .hero { padding-block: 1rem; }
  .section--tint { background: none; }
  a { color: inherit; }
  .link-list a { border: 0; padding: 0; min-height: 0; }
}
