:root {
  --page: #fff;
  --text: #171717;
  --muted: #6f6f6f;
  --line: rgba(23, 23, 23, 0.14);
  --accent: #b71c1c;
  --accent-dark: #8d1616;
  --accent-soft: rgba(183, 28, 28, 0.045);
  --surface: #f6f6f6;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --header-height: 58px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  font-size: 17px;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: var(--sans);
  line-height: 1.58;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

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

a:hover,
a:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
}

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

img {
  height: auto;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

::selection {
  color: #fff;
  background: var(--accent);
}

.container {
  width: min(930px, calc(100% - 40px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: #fff;
  background: var(--accent);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.site-name {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 0.72rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  margin: 4px 0;
  background: var(--text);
}

main {
  padding-top: 4.25rem;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32%;
  grid-template-areas:
    "heading profile"
    "intro   profile"
    "facts   facts";
  column-gap: 2.3rem;
  align-items: start;
  padding-bottom: 0.4rem;
}

.page-heading {
  grid-area: heading;
}

.intro {
  grid-area: intro;
}

.facts {
  grid-area: facts;
}

.profile {
  grid-area: profile;
  width: 100%;
  margin: 0;
}

.profile img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 5px 18px rgba(23, 23, 23, 0.08);
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 0.9rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.45rem, 5vw, 3.45rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.page-heading h1 strong {
  font-weight: 700;
}

.tagline {
  margin: 0.45rem 0 1.85rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.intro {
  max-width: 64ch;
}

p {
  margin: 0 0 1rem;
}

.intro p {
  margin-bottom: 1.08rem;
}

.mentor-note {
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}

.mentor-note a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(183, 28, 28, 0.4);
  text-underline-offset: 0.16em;
}

.mentor-note a:hover,
.mentor-note a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.contact-invite {
  margin-top: 1.45rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 2.15rem 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts div {
  min-width: 0;
  padding: 1rem 1rem 1rem 0;
}

.facts div + div {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

dt,
.work-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.facts dt {
  margin-bottom: 0.32rem;
}

.facts dd {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.section {
  margin-top: 4.7rem;
}

.section h2 {
  margin: 0 0 1.15rem;
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.news-list {
  border-top: 1px solid var(--line);
}

.news-item {
  display: grid;
  grid-template-columns: 78px 6.9rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: baseline;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--line);
}

/* Highlight without shifting the columns: bleed the background outwards */
.news-item--featured {
  margin-left: -0.85rem;
  padding-left: 0.85rem;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.news-item time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.news-item p {
  margin: 0;
}

.news-label {
  justify-self: start;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  color: var(--tag);
  background: var(--tag-bg);
  white-space: nowrap;
  line-height: 1.5;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* One colour per news type */
.news-label,
.dot { --tag: #555; --tag-bg: rgba(0, 0, 0, 0.06); }
.news-label--review, .dot--review { --tag: #6a3fb5; --tag-bg: rgba(106, 63, 181, 0.1); }
.news-label--paper,  .dot--paper  { --tag: #1f5fbf; --tag-bg: rgba(31, 95, 191, 0.1); }
.news-label--award,  .dot--award  { --tag: #a86400; --tag-bg: rgba(214, 140, 0, 0.14); }
.news-label--grant,  .dot--grant  { --tag: #1e7a46; --tag-bg: rgba(30, 122, 70, 0.11); }

.news-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.news-filter button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 28px;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}

.news-filter button:hover {
  color: var(--text);
  border-color: rgba(23, 23, 23, 0.3);
}

.news-filter button.is-active {
  color: #fff;
  border-color: var(--text);
  background: var(--text);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--tag);
}

.news-item[hidden] {
  display: none;
}

/* Experience timeline */
.exp-list {
  --when: 6.2rem;
  --rail: 2.2rem;
  position: relative;
  margin: 0;
  padding: 0.4rem 0 0;
  list-style: none;
}

/* the vertical line */
.exp-list::before {
  position: absolute;
  top: 1.2rem;
  bottom: 1.2rem;
  left: calc(var(--when) + var(--rail) / 2 - 1px);
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, rgba(183, 28, 28, 0.35) 45%, var(--line) 100%);
  content: "";
}

.exp-item {
  position: relative;
  display: grid;
  grid-template-columns: var(--when) var(--rail) 92px minmax(0, 1fr);
  column-gap: 0;
  align-items: start;
  padding: 0.85rem 0 1.35rem;
}

.exp-when {
  align-self: baseline;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 0;
  padding-right: 0.9rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.5rem;
  white-space: nowrap;
}

.exp-when span:first-child {
  color: var(--text);
}

.exp-dot {
  justify-self: center;
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: calc((1.5rem - 13px) / 2);
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--page);
}

/* stop the line at the last node */
.exp-item:last-child::after {
  position: absolute;
  top: 1.65rem;
  bottom: -1.5rem;
  left: calc(var(--when) + var(--rail) / 2 - 2px);
  width: 4px;
  background: var(--page);
  content: "";
}

.exp-dot--current {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(183, 28, 28, 0.14);
}

.exp-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 64px;
  margin-left: 0.3rem;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.exp-item:hover .exp-logo {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}

.exp-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.exp-body {
  align-self: baseline;
  padding-left: 0.6rem;
}

.exp-body h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.5rem;
}

.exp-body h3 a {
  color: var(--text);
  text-decoration: none;
}

.exp-body h3 a:hover {
  color: var(--accent);
}

.exp-role {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4rem;
}

.exp-meta {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  column-gap: 0.6rem;
  row-gap: 0.15rem;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.exp-meta dt {
  padding-top: 0.12rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exp-meta dd {
  margin: 0;
  color: var(--text);
}

.work-list {
  border-top: 1px solid var(--line);
}

.work-item {
  display: grid;
  grid-template-columns: minmax(175px, 28%) minmax(0, 1fr);
  gap: 1.75rem;
  padding: 1.55rem 0 1.8rem;
  border-bottom: 1px solid var(--line);
}

.work-media {
  align-self: start;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 23, 23, 0.09);
  border-radius: 4px;
  background: var(--surface);
}

.work-media img,
.work-media video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
}

.work-media--video video {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.work-item--maniladder .work-media video {
  aspect-ratio: 16 / 9;
  background: #0d0d0d;
}

/* Project-page teasers are 16:9 on a dark background: show the full frame */
.work-item--teaser .work-media video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #090a0c;
}

.work-copy {
  min-width: 0;
}

.work-meta {
  margin: 0 0 0.35rem;
  color: var(--accent);
}

.work-copy h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 650;
  line-height: 1.3;
}

.work-copy p:not(.work-meta):not(.links) {
  margin-bottom: 0.7rem;
  font-size: 0.94rem;
  line-height: 1.55;
}

.links,
.misc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
}

.links a,
.misc-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.18rem 0.68rem;
  border: 1px solid rgba(183, 28, 28, 0.5);
  border-radius: 3px;
  font-size: 0.78rem;
}

.links a:hover,
.links a:focus-visible,
.misc-links a:hover,
.misc-links a:focus-visible {
  color: #fff;
  background: var(--accent);
  text-decoration: none;
}

.misc {
  padding-bottom: 4.8rem;
}

.misc > p:not(.misc-links) {
  max-width: 62ch;
  font-size: 0.98rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
}

.footer-inner a {
  color: var(--muted);
}

@media (max-width: 700px) {
  :root {
    --header-height: 54px;
  }

  html {
    font-size: 16px;
  }

  .container {
    width: min(100% - 32px, 620px);
  }

  main {
    padding-top: 2.6rem;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.45rem 1rem 0.7rem;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    min-height: 44px;
    padding-inline: 0.2rem;
  }

  .about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "profile"
      "heading"
      "intro"
      "facts";
  }

  .profile {
    width: min(260px, 78%);
    margin: 0 auto 2rem;
  }

  .page-heading {
    text-align: center;
  }

  .tagline {
    margin-bottom: 1.45rem;
  }

  .intro {
    max-width: none;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .facts div,
  .facts div + div {
    padding: 0.8rem 0;
    border-left: 0;
  }

  .facts div + div {
    border-top: 1px solid var(--line);
  }

  .section {
    margin-top: 3.7rem;
  }

  .section-heading-row {
    display: block;
  }

  .section-note {
    margin-top: -0.75rem;
    margin-bottom: 1.15rem;
  }

  .news-filter {
    margin: -0.4rem 0 1rem;
  }

  .work-item {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-block: 1.35rem 1.5rem;
  }

  .work-media {
    max-width: 430px;
  }

  .work-copy h3 {
    font-size: 1.08rem;
  }

  .misc {
    padding-bottom: 3.5rem;
  }

}

@media (max-width: 520px) {
  .exp-list {
    --rail: 1.6rem;
  }

  .exp-list::before {
    left: calc(var(--rail) / 2 - 1px);
  }

  .exp-item:last-child::after {
    left: calc(var(--rail) / 2 - 2px);
  }

  .exp-item {
    grid-template-columns: var(--rail) 56px minmax(0, 1fr);
    grid-template-areas:
      "dot  logo when"
      "dot  logo body";
    row-gap: 0.1rem;
  }

  .exp-dot { grid-area: dot; }
  .exp-logo { grid-area: logo; width: 56px; height: 48px; margin-left: 0; padding: 4px; }
  .exp-body { grid-area: body; }

  .exp-when {
    grid-area: when;
    flex-direction: row;
    gap: 0.4rem;
    align-items: baseline;
    padding: 0 0 0 0.6rem;
  }

  .exp-when span + span::before {
    content: "– ";
  }

  .news-item {
    grid-template-columns: 1fr;
    row-gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
