/* TTLAB — site styles.
 *
 * This file is the whole design system. It lives in git, which is the point:
 * the styling it replaces sat in a database field and was lost nine times in
 * three years.
 *
 * Colours come from the logo — #ed1c24 red, black, white — not from Hestia's
 * default purple gradient, which was never brand.
 *
 * No Bootstrap. No jQuery. No icon font.
 */

/* ---------- fonts: self-hosted, so font-src can stay 'self' ---------- */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.92895abae7c5.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  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: "Archivo";
  src: url("../fonts/archivo-var-latin-ext.288d2a1c9f04.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  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: "Source Serif 4";
  src: url("../fonts/source-serif-var-latin.6a682eb0234e.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  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: "Source Serif 4";
  src: url("../fonts/source-serif-var-latin-ext.8c3174bab6d6.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  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;
}

/* ---------- tokens ---------- */

:root {
  /* Light only, by choice. The palette below is the whole palette: there is no
     dark override, so nothing here is a default waiting to be replaced.
     color-scheme tells the browser to paint form controls, scrollbars and the
     canvas behind the page light whatever the reader's system is set to --
     without it, a dark-mode reader gets dark selects on a white form. */
  color-scheme: light;

  --ink: #14171a;
  --ink-2: #464e56;
  --ink-3: #6d767f;
  --ground: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f7;
  --surface-3: #e9ecee;
  --rule: #dde1e4;
  --rule-soft: #eceff1;

  /* Sampled from the logo. --brand is for graphics and large type; --brand-ink
     is darkened to clear 4.5:1 on white for body-sized links. */
  --brand: #ed1c24;
  --brand-ink: #c01118;
  --brand-soft: #fdecec;

  /* The banner and footer are dark bands with light text in BOTH themes, so
     they get their own tokens. Using --ink here would invert them in dark mode
     and put white text on a light ground. */
  --band: #14171a;
  --band-ink: #ffffff;
  --band-ink-2: rgba(255, 255, 255, 0.86);
  --band-ink-3: rgba(255, 255, 255, 0.62);
  --band-rule: rgba(255, 255, 255, 0.25);

  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.06);
  --shadow: 0 2px 4px rgba(20, 23, 26, 0.05), 0 10px 28px -14px rgba(20, 23, 26, 0.22);

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Set by the size classes on the feed frame, not inline: style-src is
     'self', so an inline style attribute is dropped by our own CSP. Declared
     here so every var() in this file resolves from :root. */
  --feed-height: 500px;

  --wrap: 1120px;
  --gap: clamp(1rem, 2.5vw, 2rem);

  /* One gap between blocks, named once. */
  --section-gap: clamp(2.5rem, 6vw, 4rem);

  /* THE TYPE SCALE.

     There wasn't one. Body text came in six sizes -- 13.6, 14.08, 15.2, 16, 17
     and 18px -- picked a rem at a time, and section headings came in two: 20px
     on the page and 12.48px inside a panel, for the same job. Sizes now come
     from here or they are a mistake. */
  --fs-meta: 0.82rem;      /* 13px  — venue, the note under a figure */
  --fs-small: 0.9rem;      /* 14px  — authors, arrow links, asides */
  --fs-body: 1.0625rem;    /* 17px  — running text, matches <body> */
  --fs-title: 1.05rem;     /* 17px  — the title on a card */
  --fs-card: 1.15rem;      /* 18px  — body text inside a panel card */
  --fs-section: 1.25rem;   /* 20px  — every section heading */
  --fs-display: 1.9rem;    /* 30px  — the closing call to action */

  /* The home banner: white type over a darkened photograph. Declared here so
     every token resolves from :root; only the banner uses them. */
  --hero-ground: #14171a;
  --hero-ink: #ffffff;
  --hero-ink-2: rgba(255, 255, 255, 0.86);
  --hero-ink-3: rgba(255, 255, 255, 0.60);
  --hero-rule: rgba(255, 255, 255, 0.26);
}

/* ---------- base ---------- */

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  /* The legacy CSS forced 15px !important everywhere. 17px is a readable
     default for long bios and abstracts. */
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .sans { font-family: var(--sans); text-wrap: balance; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }

/* Justified text on narrow columns opens rivers of whitespace and hurts
   readability, especially with long author names. Left-aligned by choice. */
p { margin: 0 0 1rem; text-align: left; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 2px; }

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

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.prose { max-width: 68ch; }
main > .wrap > .prose:first-child,
main > .wrap > .home-intro:first-child { margin-bottom: clamp(0.5rem, 2vw, 1rem); }

.skip-link {
  position: absolute; left: 0; top: -4rem; z-index: 100;
  background: var(--brand); color: #fff; padding: 0.75rem 1.25rem;
  font-family: var(--sans); font-weight: 600;
}
.skip-link:focus { top: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- header + navigation ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); }
.brand img { width: 42px; height: 42px; }
.brand__name { font-family: var(--sans); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--rule); border-radius: 4px;
  padding: 0.5rem 0.7rem; cursor: pointer; color: var(--ink);
  font-family: var(--sans); font-size: 0.9rem;
}

.nav > ul { list-style: none; display: flex; align-items: center; gap: 0.25rem; margin: 0; padding: 0; }
.nav__submenu { list-style: none; margin: 0; }
.nav a, .nav .nav__label {
  display: block; padding: 0.55rem 0.5rem; border-radius: 4px;
  font-family: var(--sans); font-size: 0.84rem; font-weight: 500;
  letter-spacing: 0; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand-ink); box-shadow: inset 0 -2px 0 var(--brand); }

.nav__item { position: relative; }
.nav__item--has-children > button {
  background: none; border: 0; cursor: pointer; font: inherit;
  display: flex; align-items: center; gap: 0.3rem;
}
.nav__item--has-children > button::after {
  content: ""; width: 0.4em; height: 0.4em; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px);
}
.nav__submenu {
  position: absolute; top: 100%; left: 0; min-width: 230px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: var(--shadow); padding: 0.35rem; flex-direction: column; gap: 0;
  display: none;
}
.nav__item--open .nav__submenu { display: flex; }
.nav__submenu a { text-transform: none; font-size: 0.9rem; letter-spacing: 0; }

/* ---------- page header ---------- */

.page-head {
  position: relative; display: grid; place-items: center;
  min-height: 260px; padding: 3.5rem 0; text-align: center;
  background: var(--band); color: var(--band-ink); overflow: hidden;
}
.page-head__bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 60%;
}

/* A flat opacity over a bright photo leaves white text sitting on pale sky.
   A gradient scrim instead: darkest at the top, where the sticky header sits,
   and through the middle where the heading is, easing off at the foot so the
   photograph is still visible as a photograph. */
.page-head--has-image::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 11, 13, 0.82) 0%,
    rgba(8, 11, 13, 0.62) 45%,
    rgba(8, 11, 13, 0.70) 100%
  );
}
.page-head__inner { position: relative; z-index: 1; }
.page-head--has-image h1 { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45); }
.page-head--has-image p { text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
.page-head h1 { color: var(--band-ink); margin-bottom: 0.35rem; }
.page-head p { color: var(--band-ink-2); font-size: 1.1rem; max-width: 56ch; margin-inline: auto; }
.page-head--tall { min-height: 420px; }

/* No top padding on main: the banner is a full-bleed band and has to sit flush
   against the header. Content wrappers carry their own top spacing instead, so
   pages with and without a banner both start correctly. */
main { padding-block: 0 clamp(2.5rem, 6vw, 4.5rem); }
main > .wrap { padding-top: clamp(2rem, 5vw, 3.5rem); }
/* Every top-level block in the home page's wrap gets the same gap, whatever
   element it happens to be.

   This was an enumerated list -- `section + section, .home-split + section,
   section + .home-split` -- and it had already failed once: `.home-split` is a
   DIV, so `section + section` never matched across it and the partners section
   got no top margin at all. Wrapping the panels would have broken it a second
   time. A child combinator cannot be outgrown by adding another wrapper. */
main > .wrap > * + * { margin-top: var(--section-gap); }
section + section { margin-top: var(--section-gap); }


/* ---- where red is allowed ----

   Red is the logo's colour and it had spread to everything: full-width rules
   under every section heading, a bar across the top of every card, every
   arrow link, every publication year. Twenty-four red marks on one screen, at
   which point red stops meaning anything.

   It is now reserved for three things: the primary button, the figures in the
   numbers band, and a short tick under each section heading as the brand cue.
   Everything else is ink and turns red on hover -- so red marks the thing you
   are about to act on, which is work it can actually do. */
.section-title {
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 1.4rem;
  color: var(--ink);
}
/* A 2.5rem tick rather than a rule the full width of the heading. "Surveys,
   Prototypes and Platforms" drew a 430px red line; this draws 40px, and it is
   the same mark the mission lead carries, so the page has one device instead
   of two. */
.section-title::after {
  content: ""; display: block;
  width: 2.5rem; height: 3px; background: var(--brand);
  margin-top: 0.6rem;
}


/* ---------- people ---------- */

.people-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  list-style: none; padding: 0; margin: 0;
}
.person-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.person-card:hover { box-shadow: var(--shadow); }
.person-card__photo {
  aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--surface-3);
  display: block;
}
.person-card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.person-card__name { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin: 0; }
.person-card__name a { color: var(--ink); text-decoration: none; }
.person-card__name a:hover { color: var(--brand-ink); }
.person-card__role { font-size: 0.9rem; color: var(--ink-3); margin: 0; }
.person-card__linkedin {
  display: inline-flex; align-items: center; gap: 0.4rem; align-self: flex-start;
  font-family: var(--sans); font-size: 0.9rem; color: var(--ink-3); text-decoration: none;
}
.person-card__linkedin:hover,
.person-card__linkedin:focus-visible { color: var(--brand-ink); }
.person-card__linkedin svg { flex: none; }

/* Profile page */
.person { display: grid; gap: clamp(1.5rem, 4vw, 3rem); grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
.person__photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.person__meta { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-direction: column; gap: 0.3rem; }
.person__meta li { font-family: var(--sans); font-size: 0.95rem; color: var(--ink-2); }
.person__meta .label { color: var(--ink-3); }

/* ---------- publications ---------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1rem 1.1rem; margin-bottom: 1.5rem;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label {
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.field input, .field select {
  font: inherit; font-size: 0.95rem; font-family: var(--sans);
  padding: 0.55rem 0.7rem; min-height: 44px;
  border: 1px solid var(--rule); border-radius: 5px;
  background: var(--surface); color: var(--ink);
}
.field--grow { flex: 1 1 15rem; }
.field--grow input { width: 100%; }

.btn {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  padding: 0.6rem 1.1rem; min-height: 44px; border-radius: 5px; cursor: pointer;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--brand-ink); }
.btn--quiet { background: transparent; color: var(--ink-2); border-color: var(--rule); }
.btn--quiet:hover { background: var(--surface-3); color: var(--ink); }

.result-count {
  font-family: var(--sans); font-size: 0.9rem; color: var(--ink-3);
  margin-bottom: 1rem; font-variant-numeric: tabular-nums;
}

.pub-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.pub {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1.25rem;
  padding: 1.25rem 0; border-top: 1px solid var(--rule-soft); align-items: start;
}
.pub:first-child { border-top: 0; }
.pub__year {
  font-family: var(--sans); font-weight: 700; font-size: 1.05rem;
  color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 0.1rem;
}
.pub__title { font-family: var(--sans); font-size: 1.05rem; font-weight: 600; margin: 0 0 0.25rem; line-height: 1.35; }
.pub__title a { color: var(--ink); text-decoration: none; }
.pub__title a:hover { color: var(--brand-ink); text-decoration: underline; }
.pub__authors { margin: 0 0 0.15rem; color: var(--ink-2); font-size: 0.97rem; }
.pub__venue { margin: 0; color: var(--ink-3); font-size: 0.93rem; font-style: italic; }
.pub__links { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tag {
  display: inline-block; font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; padding: 0.2rem 0.5rem;
  border-radius: 3px; background: var(--surface-3); color: var(--ink-2);
}
.tag--pdf { background: var(--brand-soft); color: var(--brand-ink); }

.pagination {
  display: flex; gap: 0.5rem; align-items: center; justify-content: center;
  margin-top: 2.5rem; font-family: var(--sans); font-size: 0.9rem;
}
.pagination__current { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; padding: 3rem 1rem; color: var(--ink-3);
  border: 1px dashed var(--rule); border-radius: 8px;
}

/* ---------- home ---------- */

/* The aims' layout, with one difference: a project keeps its title, because
   KAI and AI4SIDS are names rather than labels restating the sentence beneath
   them. Three across and anchored by an icon, same as the aims. */
.projects {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  gap: clamp(0.9rem, 1.6vw, 1.15rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  /* No `align-items: start`. Grid items stretch to their row by default, and
     that is what is wanted here: three cards of 376, 316 and 257px ended at
     three different points, which read as unfinished rather than as three
     objects. The blurbs are close enough in length (5, 4 and 2 lines) that
     equalising costs a little white space, not the dead third of a card that
     made the aims abandon it.

     Each ROW equalises on its own, so when these wrap to two rows below
     1040px the short row does not inherit the tall row's height. */
}
/* The mark at the head of a project card. The aims used to share this class;
   the ledge has its own, much smaller glyph now, so the disc belongs to the
   projects alone and is named for them. (Spelling the old class here would
   let a test that greps for it pass on this comment, which has happened three
   times in this file already.) */
.project__icon {
  /* The disc is a fixed size. In a column flex container it would otherwise
     be free to shrink along its height. */
  flex: none;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-ink);
  display: grid; place-items: center;
}
.project__icon svg { width: 1.4rem; height: 1.4rem; display: block; }
/* Flex, not grid. Equal-height cards are only half the job: with the content
   packed at the top, three cards of the same height ended their link rows at
   three different heights, which is the same raggedness one level down.
   `margin-top: auto` on the links needs a main axis to push along. */
.project {
  display: flex; flex-direction: column; gap: 0.7rem;
  background: var(--surface);
  border: 0; border-radius: 10px;
  padding: clamp(1.1rem, 2vw, 1.4rem);
}
.project__title {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.015em;
  text-transform: none; color: var(--ink);
}
.project__media { border-radius: 8px; overflow: hidden; }
.project__media img { width: 100%; height: auto; display: block; }
.project__blurb { color: var(--ink-2); font-size: var(--fs-card); }
.project__blurb p { margin: 0; }
/* auto, so the links fall to the floor of the card whatever the blurb does. */
.project__links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.15rem; }


/* ---------- grants, clients, theses ---------- */



/* ---------- footer ---------- */

.site-footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  background: var(--band); color: var(--band-ink-2);
  padding-block: 2.5rem;
}
.site-footer a { color: var(--band-ink); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }
.social { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.social a {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; text-decoration: none; padding: 0.55rem 0.8rem;
  border: 1px solid var(--band-rule); border-radius: 4px;
  display: inline-flex; min-height: 44px; align-items: center;
}
.social a:hover { background: var(--band-rule); }
.colophon { font-family: var(--sans); font-size: 0.82rem; color: var(--band-ink-3); }

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow); padding: 0.5rem;
  }
  .nav--open { display: block; }
  .nav > ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav a, .nav .nav__label { padding: 0.8rem; min-height: 44px; }
  .nav__submenu { position: static; display: flex; border: 0; box-shadow: none; padding-left: 1rem; }
  .nav__item--has-children > button { width: 100%; justify-content: space-between; }
  .site-header__inner { position: relative; }
}

@media (max-width: 700px) {
  .person { grid-template-columns: 1fr; }
  .person__photo { max-width: 240px; }
  .pub { grid-template-columns: 1fr; gap: 0.35rem; }
  .pub__year { padding-top: 0; }
  }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .site-header, .site-footer, .filters, .pagination, .skip-link { display: none; }
  body { font-size: 11pt; }
}

/* ---------- contact ---------- */

.contact {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px); align-items: start;
}
.contact-aside {
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 1.25rem 1.4rem;
}
.contact-aside h2 { font-size: 1rem; margin-bottom: 0.6rem; }

.contact-form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.5rem; }
.field--stacked { display: flex; flex-direction: column; gap: 0.35rem; }
.field--stacked input, .field--stacked textarea, .field--stacked select {
  font: inherit; font-family: var(--sans); font-size: 1rem;
  padding: 0.65rem 0.75rem; min-height: 44px; width: 100%;
  border: 1px solid var(--rule); border-radius: 5px;
  background: var(--surface); color: var(--ink);
}
.field--stacked textarea { min-height: 9rem; resize: vertical; }
.field--invalid input, .field--invalid textarea { border-color: var(--brand); border-width: 2px; }
.field__help { font-size: 0.85rem; color: var(--ink-3); margin: 0; }
.field__error { font-size: 0.88rem; color: var(--brand-ink); margin: 0; font-weight: 600; }
.form-errors {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  padding: 0.9rem 1.1rem; border-radius: 4px; margin-top: 1.25rem;
}
.form-errors p { margin: 0; }

/* The honeypot. Taken out of the layout and out of the accessibility tree, but
   still present and fillable in the DOM, which is the whole point. Not
   display:none -- some bots skip anything that is. */
.hp-field {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 780px) {
  .contact { grid-template-columns: 1fr; }
}

/* ---------- logo rows: clients and grants ---------- */

/* One pattern for both pages, so the two cannot drift apart: a centred logo in
   its own frame, with whatever that row has to say beside it. */
.record-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.record {
  display: grid; grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 2.75rem); align-items: start;
  padding: clamp(1.5rem, 3vw, 2.25rem) 0; border-top: 1px solid var(--rule);
}
.record:first-child { border-top: 0; padding-top: 0.5rem; }

/* The frame gives logos of wildly different shapes a common footprint, so the
   column reads as a column rather than a ragged edge. */
.record__logo {
  display: grid; place-items: center; padding: 1rem;
  /* Fixed, not min-height: these logos range from a tall roundel to a wide
     wordmark, and a box that grows to fit each one leaves the column ragged.
     A constant frame with the mark centred inside reads as a column. */
  height: 130px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
}
.record__logo img { max-height: 96px; max-width: 100%; width: auto; object-fit: contain; }

.record__name { font-size: 1.15rem; margin: 0 0 0.4rem; }
.record__meta { color: var(--ink-3); font-size: 0.95rem; margin: 0 0 0.6rem; }
.record__work { margin: 0; padding-left: 1.15rem; display: flex; flex-direction: column; gap: 0.4rem; }
.record__work li { line-height: 1.45; }
.record__work li::marker { color: var(--brand); }
.record__work a { color: var(--ink); text-decoration-color: var(--rule); }
.record__work a:hover { color: var(--brand-ink); text-decoration-color: currentColor; }

@media (max-width: 720px) {
  .record { grid-template-columns: 1fr; gap: 1rem; }
  .record__logo { max-width: 240px; }
}

/* ---------- home: hero ---------- */

/* The home banner is its own component rather than a modifier of .page-head.
   Inner pages want a compact centred strip; the home page wants a tall
   left-aligned hero with actions in it, and forcing both through one class had
   already collected three modifiers. */
/* The banner is always the photograph, with its colours in :root. */

/* The scrim is heavier than it looks like it needs to be, and the reason is
   worth writing down: MEAN contrast over the title area was a comfortable
   7.3:1, but the WORST SPOT was 1.15:1 -- a chandelier highlight directly
   behind the wordmark, where white type simply disappeared. An average tells
   you nothing about the pixel the letter happens to land on.

   So the left third is darkened hard, easing off to the right where the group
   is. That costs some of the person standing at the far left, which is a real
   loss and the better half of the trade: unreadable type costs more. */
.hero--photo::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(8, 11, 13, 0.52) 0%, rgba(8, 11, 13, 0.40) 45%, rgba(8, 11, 13, 0.92) 100%),
    linear-gradient(90deg, rgba(8, 11, 13, 0.88) 0%, rgba(8, 11, 13, 0.66) 30%, rgba(8, 11, 13, 0) 72%);
}

.hero--photo .hero__bg {
  display: block;
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Anchored RIGHT, not centred.

     The banner is wider than the photograph at desktop, so nothing is cropped
     horizontally there -- but zoom the page, or open it on a phone, and the
     box turns narrower than the image and `cover` starts trimming the sides.
     Centred, it trims both: at a 700px-wide box it shows 21%-79% of the frame,
     and on a phone only 33%-68%.

     The professor stands at 96% across. Anchoring the right edge keeps him in
     every case -- 43%-100% zoomed, 65%-100% on a phone. It costs the left of
     the group at narrow widths, which is the side the type and its scrim sit
     over anyway. */
  object-position: right 42%;
}

.hero {
  position: relative;
  display: grid; align-items: end;
  /* 620px left 276px of empty ground above 279px of content -- 45% of the
     banner doing nothing, which is most of why it read as plain. The content is
     bottom-aligned, so the top padding only ever set the minimum. */
  min-height: min(62vh, 500px);
  padding: clamp(2.5rem, 8vw, 4.5rem) 0 clamp(2.5rem, 7vw, 4rem);
  background: var(--hero-ground, var(--band)); color: var(--hero-ink, var(--band-ink));
  overflow: hidden;
}

/* Above the scrim, which is z-index 1. A ::after is generated as the last
   child, so at EQUAL z-index it paints over its siblings -- the scrim was
   landing on top of the wordmark and dimming the type it exists to protect.
   The measured contrast looked fine because the maths modelled the scrim
   under the text, which is where it was supposed to be. */
.hero__inner { position: relative; z-index: 2; width: 100%; }
.hero__eyebrow {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--hero-ink-3, var(--band-ink-3)); margin: 0 0 0.9rem;
  display: flex; align-items: center; gap: 0.7rem;
}
.hero__eyebrow::before {
  content: ""; width: 2rem; height: 2px; background: var(--brand); flex: none;
}
.hero__title {
  margin: 0 0 0.6rem;
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  font-weight: 800; letter-spacing: -0.035em; line-height: 0.95;
  color: var(--hero-ink, var(--band-ink));
}
.hero__tagline {
  margin: 0; max-width: 46ch;
  font-family: var(--sans); font-weight: 400;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1.35; color: var(--hero-ink-2, var(--band-ink-2));
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: clamp(1.5rem, 3vw, 2.25rem); }

/* ---------- buttons and arrow links ---------- */

/* `.btn` itself is defined once, up with the form controls, and is red by
   default -- several templates use it bare. These are modifiers only:
   redefining the base here left .btn--ghost inheriting the red background,
   because the duplicate block set no background of its own to override it. */
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-ink); color: #fff; }
.btn--ghost {
  background: transparent;
  border-color: var(--hero-rule, var(--band-rule));
  color: var(--hero-ink, var(--band-ink));
}
.hero--photo .btn--ghost:hover { background: rgba(255, 255, 255, 0.14); color: var(--hero-ink); }

/* Roomier only in the hero, where they carry the page. */
.hero__actions .btn { padding: 0.85rem 1.5rem; border-radius: 6px; gap: 0.5rem; }

.link-arrow {
  font-family: var(--sans); font-size: var(--fs-small); font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem;
  /* Ink, not brand. Five red arrow links in one viewport was five marks
     competing with the button that actually matters. The arrow is the
     affordance; red is the hover state. */
  color: var(--ink);
}
.link-arrow:hover {
  color: var(--brand-ink);
  text-decoration: underline; text-underline-offset: 3px;
}
.link-arrow::after {
  content: "\2192"; transition: transform 150ms ease;
}
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- home: the numbers ---------- */

.stats { background: var(--surface-2); border-block: 1px solid var(--rule); }
.stats__grid {
  display: grid; gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  padding-block: clamp(2rem, 4.5vw, 3rem);
}
.stat { text-align: center; }
.stat__value {
  margin: 0; font-family: var(--sans);
  font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800;
  letter-spacing: -0.04em; line-height: 1; color: var(--brand);
  /* The digits change width as the counter runs; tabular figures stop the
     label beneath from jittering left and right while it counts. */
  font-variant-numeric: tabular-nums;
}
.stat__label {
  margin: 0.5rem 0 0; font-family: var(--sans);
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
}
.stat__note { margin: 0.2rem 0 0; font-size: var(--fs-meta); color: var(--ink-3); }

/* ---------- home: mission ---------- */

/* The aims set as a statement rather than a table.

   The section's problem was never its wording -- it was that every element on
   it sat within a few pixels of every other: grey serif, hairline rules, no
   focal point, landing directly after a bold drawn banner. Scale is the fix.
   The aims run at 1.3rem against 17px body copy, and that contrast is the
   whole design.

   The labels are gone from the page (they remain in the admin). "Applied
   research" above a sentence beginning "Address local and regional industrial
   challenges" is a heading that tells a reader nothing the next six words do
   not. */

/* A tinted ground with each item on white, so a set reads as separate objects
   rather than as runs of text that happen to be in columns. It also gives a
   section an edge -- both of these sat flat on the page with nothing marking
   where they began or ended.

   Shared by the aims and the projects. Written once so the two cannot drift. */
.panel {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: clamp(1.4rem, 3vw, 2.25rem);
}

/* Inside a panel the heading is the same heading. It was a 12.48px eyebrow
   against 20px elsewhere -- the same job at two sizes, on one page. */
.panel > .section-title { margin-top: 0; }


/* ---------- home: the aims, on a ledge under the banner ---------- */

/* The aims were a tinted panel paired with the projects halfway down the page.
   The pairing could not be made to look right: the third aim is 55 characters
   against the second's 227, so the left box ran out of words 98px before the
   right one and the tint kept going. Grid equalises the BOXES; nothing
   equalises the sentences.

   Here they are three labels and one sentence, attached to the foot of the
   banner. White, so the contrast work the banner needs does not apply: the
   type sits on the page's own surface, not on the drawing. */
.aimledge { background: var(--surface); }
/* The ledge and the numbers band are both <section>s, so the page's 64px
   section gap landed between them -- a white stripe splitting two bands that
   are meant to butt together. The band brings its own rule on both edges. */
.stats + .aimledge { margin-top: 0; }
.aimledge__inner { padding-block: clamp(1rem, 2.2vw, 1.5rem); }

/* An h2, because it heads the section and screen readers navigate by heading.
   At the meta size because it is a lead-in to the labels beside it -- setting
   it at --fs-section would put a second 20px heading directly under a 88px
   wordmark. */
.aimledge__lead {
  margin: 0 0 0.7rem;
  font-family: var(--sans); font-size: var(--fs-meta); font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2);
  text-align: center;
}

.aimledge__heads {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
.aimhead {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  /* 48px: a pointer target, and comfortably past the 44px floor. */
  min-height: 48px; padding: 0.5rem 1rem;
  font-family: var(--sans); font-size: var(--fs-small); font-weight: 600;
  text-align: center; color: var(--ink-2);
  background: none; border: 0; border-top: 2px solid var(--rule);
  cursor: pointer;
  transition: color 150ms ease;
}
.aimhead:hover { color: var(--ink); }

/* A TICK, not the whole rule. Turning the selected label's own border red drew
   a 460px red line across a third of the page -- the exact mark this design
   took off every section heading. 2.5rem is the length of the tick under a
   section title, so the page has one red underline, used twice.

   Colour is not carrying this alone: the selected label also steps from
   --ink-2 to --ink, so the state survives a reader who cannot see the red. */
.aimhead::before {
  content: ""; position: absolute; top: -2px; left: 50%;
  transform: translateX(-50%);
  width: 2.5rem; height: 2px; background: var(--brand);
  opacity: 0; transition: opacity 150ms ease;
}
.aimhead[aria-selected="true"] { color: var(--ink); }
.aimhead[aria-selected="true"]::before { opacity: 1; }
.aimhead__icon { display: grid; place-items: center; flex: none; }
.aimhead__icon svg { width: 1.15rem; height: 1.15rem; display: block; }

/* Before the script runs this is a plain list of all three aims, and it has to
   look like one. Afterwards only one item is ever visible. */
.aims { list-style: none; margin: 0; padding: 0; }
.aim + .aim { margin-top: 0.8rem; }
.aim__text {
  /* The same size as a project blurb: both are body text carrying a section,
     and they were 18px and 16px for no reason anyone could have named. Above
     the 17px body copy, which is what this layout depends on. */
  font-size: var(--fs-card);
  line-height: 1.55;
  /* --ink-2, the same as a project blurb. --ink-3 would have been the obvious
     choice for a caption-like line and it measures 4.4:1 on white -- under the
     floor. This is 8.6:1. */
  color: var(--ink-2);
  /* Centred, as a band of three centred labels asks for. The 74ch cap still
     does the real work -- centring a full-width paragraph would leave both
     edges ragged, and it is the LEFT edge a reader returns to on every line.
     At 74ch the block is narrow enough that the ragged left costs little. */
  max-width: 74ch; margin-inline: auto; text-align: center;
}
/* text-align: inherit, not just the centred box above it. There is a global
   `p { text-align: left }`, and an inherited value loses to ANY rule that
   matches the element -- so the box centred and its only paragraph did not. */
.aim__text p { margin: 0; text-align: inherit; }

@media (min-width: 760px) {
  /* Room for the longest of the three whichever is showing, so switching
     between them never moves the page. Wide enough that the longest runs to
     three lines; on a phone it runs to nine and reserving that much blank
     ground would be worse than the shift. */
  /* In --fs-card, not em. `em` here resolves against the LIST's font size --
     17px body copy -- while the sentence inside it is set at 18px, so the
     reserved height came out a line short and the page still moved by 7px
     when the shortest aim was chosen. */
  .aims { margin-top: 0.8rem; min-height: calc(3 * 1.55 * var(--fs-card)); }
}
@media (max-width: 759px) {
  .aims { margin-top: 0.8rem; }
  .aimledge__heads { grid-template-columns: 1fr; }
}

/* On a phone the panel's padding and the card's padding come out of the same
   343px, which left 32 characters a line -- under the floor for a comfortable
   read. The panel runs to the edges instead, so only the card's padding is
   charged to the line. A band edge to edge also reads as deliberate on a
   phone, where a rounded panel with a margin looks like a boxed-in page. */
@media (max-width: 760px) {
  .panel {
    margin-inline: calc(-1 * clamp(1rem, 4vw, 2rem));
    padding-inline: clamp(1rem, 4vw, 2rem);
    border-radius: 0;
    border-inline: 0;
  }
}

/* The verb that completes the eyebrow: established to ADDRESS, PROVIDE,
   PROMOTE. Set by the lead_verb filter, because there is no ::first-word. */
.aim__text strong {
  font-weight: 700;
  /* The verb stays full ink. With the body lightened, the weight alone was
     carrying the emphasis; a step of colour as well makes Address / Provide /
     Promote read as the device they are. */
  color: var(--ink);
}

/* Under the partner logos now, where the funder it names has its own logo. */
.mission__note {
  margin: clamp(1.25rem, 2.5vw, 1.75rem) 0 0; padding-left: 1rem;
  border-left: 3px solid var(--brand-soft);
  color: var(--ink-3); font-size: var(--fs-small);
}

/* The single-paragraph fallback, shown when no aims are set. Full width rather
   than the 68ch measure: it is a lead-in, not something read at length. */
.home-intro {
  max-width: none;
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.6; color: var(--ink-2);
}

/* ---------- home: recent publications ---------- */

.paper-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.paper {
  display: grid; grid-template-columns: 3.75rem 1fr; gap: 1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--rule-soft);
}
.paper:first-child { padding-top: 0; }
.paper__year {
  margin: 0; font-family: var(--sans); font-size: 0.85rem; font-weight: 700;
  /* Muted. The year is a scanning anchor, not the point of the row -- in red
     it pulled the eye away from the titles. */
  color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 0.15rem;
}
.paper__body { min-width: 0; }
.paper__title { margin: 0 0 0.25rem; font-size: var(--fs-title); font-weight: 600; line-height: 1.35; }
.paper__title a { color: var(--ink); text-decoration: none; }
.paper__title a:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }
.paper__authors { margin: 0; font-size: var(--fs-small); color: var(--ink-2); }
.paper__venue { margin: 0.1rem 0 0; font-size: var(--fs-meta); color: var(--ink-3); font-style: italic; }
.section-more { margin: 1.25rem 0 0; }

/* ---------- home: partners ---------- */

.partner-strip {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(1rem, 2.5vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  align-items: center;
}
.partner { display: grid; place-items: center; padding: 1rem; min-height: 96px; }
.partner img { max-height: 70px; width: auto; object-fit: contain; }
/* Desaturated so eight different brand palettes read as one row rather than
   eight competing logos. Colour returns on hover, and for anyone who has asked
   not to see motion the filter is simply never applied. */
.partner img { filter: grayscale(1); opacity: 0.72; transition: filter 200ms ease, opacity 200ms ease; }
.partner:hover img { filter: grayscale(0); opacity: 1; }

/* ---------- home: closing call to action ---------- */

.cta {
  margin-top: clamp(3rem, 7vw, 5rem);
  background: var(--band); color: var(--band-ink);
}
.cta__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: clamp(1.25rem, 3vw, 2.5rem); padding-block: clamp(2.25rem, 5vw, 3.5rem);
}
.cta__title { margin: 0 0 0.35rem; color: var(--band-ink); font-size: clamp(1.4rem, 3vw, var(--fs-display)); }
.cta__text { margin: 0; color: var(--band-ink-2); max-width: 54ch; }

/* ---------- home: publications beside the feed ---------- */

.home-split {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem);
}
@media (min-width: 1000px) {
  /* The feed takes a fixed track because it is a fixed-width iframe from
     Facebook. It is the narrower of the two on purpose: the lab's own work
     should not end up in a thinner column than its social feed. */
  .home-split--two { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
}
/* Both columns are sections, and the sibling rule would otherwise push the
   second one down the page. */
.home-split section + section { margin-top: 0; }

/* ---------- motion ---------- */

/* Nothing is hidden until the script says so. `.js-reveal` is added by
   home.js, which returns early on prefers-reduced-motion and on browsers
   without IntersectionObserver -- so a blocked, failed or slow script leaves a
   complete page rather than an empty one. */
.js-reveal .reveal { opacity: 0; transform: translateY(18px); }
.js-reveal .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 520ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Children stagger in after their section. nth-child rather than a per-element
   inline custom property, because style-src is 'self' and an inline style
   attribute is dropped by our own CSP. */
.js-reveal .reveal.is-in .stat,
.js-reveal .reveal.is-in .aim,
.js-reveal .reveal.is-in .project { animation: rise 520ms cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.js-reveal .reveal.is-in :is(.stat, .aim, .project):nth-child(1) { animation-delay: 60ms; }
.js-reveal .reveal.is-in :is(.stat, .aim, .project):nth-child(2) { animation-delay: 130ms; }
.js-reveal .reveal.is-in :is(.stat, .aim, .project):nth-child(3) { animation-delay: 200ms; }
.js-reveal .reveal.is-in :is(.stat, .aim, .project):nth-child(4) { animation-delay: 270ms; }
.js-reveal .reveal.is-in :is(.stat, .aim, .project):nth-child(n + 5) { animation-delay: 340ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* The belt to the script's braces: if the query flips after load, or the class
   is on the page for any other reason, everything is visible and still. */
@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal,
  .js-reveal .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .js-reveal .reveal.is-in :is(.stat, .aim, .project) { animation: none; }
  .project, .partner img, .btn, .link-arrow::after { transition: none; }
  .project:hover { transform: none; }
}

@media (max-width: 700px) {
  /* The banner needs room of its own on a phone: at its natural height the
     photograph collapsed to 307px, which crops the group to a band. */
  .hero { min-height: 440px; text-align: left; }

  .cta__inner { flex-direction: column; align-items: flex-start; }
}
/* ---------- facebook feed ---------- */

/* The embed is a fixed-width iframe from Facebook, so it is capped and centred
   rather than stretched: scaling it up only blurs it. */
.social-feed__frame {
  max-width: 400px; height: var(--feed-height);
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
}
.social-feed__frame--short { --feed-height: 400px; }
.social-feed__frame--medium { --feed-height: 500px; }
.social-feed__frame--tall { --feed-height: 640px; }
.social-feed__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.social-feed__fallback { font-size: var(--fs-small); color: var(--ink-3); margin-top: 0.6rem; }

@media (max-width: 560px) {
  .social-feed__frame { max-width: 100%; }
}
