:root {
  --site-background: #f5f7fb;
  --site-surface: rgba(255, 255, 255, 0.92);
  --site-border: rgba(54, 68, 84, 0.12);
  --site-shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
  --site-text: #1f2933;
  --site-muted: #5f6c7b;
  --site-link: #0f6ab4;
  --site-highlight: #e8f1fb;
  /* One container width for every page, matching the original site (1120 px).
     --width-read / --width-wide are kept as aliases so the shell classes stay valid. */
  --width-read: 1120px;
  --width-wide: 1120px;
}

html {
  background: var(--site-background);
}

body {
  min-height: 100vh;
  color: var(--site-text);
  background:
    radial-gradient(circle at top, rgba(15, 106, 180, 0.08), transparent 32rem),
    linear-gradient(180deg, #fbfcfe 0%, var(--site-background) 100%);
}

a {
  color: var(--site-link);
}

.site-navbar {
  background: var(--site-surface);
  border-bottom: 1px solid var(--site-border);
  box-shadow: 0 10px 30px rgba(31, 41, 51, 0.04);
}

.site-navbar .navbar-brand .navbar-item {
  color: var(--site-text);
  font-weight: 700;
}

.site-navbar .navbar-item,
.site-navbar .navbar-link {
  font-weight: 600;
}

.site-navbar .navbar-burger {
  margin-left: auto;
  color: var(--site-text);
}

.site-shell {
  width: min(var(--width-read), calc(100% - 2rem));
  margin: 0 auto;
}

.site-shell--narrow {
  width: min(var(--width-read), calc(100% - 2.5rem));
  margin: 0 auto;
}

.site-shell--wide {
  width: min(var(--width-wide), calc(100% - 2.5rem));
  margin: 0 auto;
}

.page-section {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.page-copy {
  max-width: var(--width-read);
}

.profile-box {
  border: 1px solid var(--site-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--site-shadow);
}

.profile-box .media {
  align-items: center;
  gap: 1.5rem;
}

.profile-box .media-left {
  margin-right: 0;
}

.home-profile-media-left {
  flex: 0 0 24%;
  width: 24%;
  min-width: 180px;
  max-width: 240px;
}

.profile-photo {
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(31, 41, 51, 0.15);
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-copy p,
.research-card .content {
  line-height: 1.7;
}

.section-note {
  border: 1px solid rgba(32, 156, 238, 0.14);
  border-radius: 16px;
}

.section-note.is-warning {
  border-color: rgba(255, 176, 0, 0.3);
}

.research-grid {
  column-count: 3;
  column-gap: 1.5rem;
}

.research-grid.is-waterfall-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  column-count: unset;
  gap: 1.5rem;
}

.waterfall-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.research-card {
  width: 100%;
  margin: 0 0 1.5rem;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--site-border);
  border-radius: 18px;
  box-shadow: var(--site-shadow);
}

.research-card .card-image .image {
  background: #fff;
}

.research-card .card-image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* per-image anchoring where a centred crop would cut something important */
.research-card .card-image img.crop-left {
  object-position: left center;
}

.research-card .card-image img.crop-top {
  object-position: center top;
}

.research-card .card-image img.crop-bottom {
  object-position: center bottom;
}

.research-card .card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.85rem;
}

.research-card .media,
.research-card .media-content,
.research-card .content {
  margin-bottom: 0;
}

.research-card .content {
  flex: 1;
}

.research-grid.is-waterfall-board .research-card {
  margin-bottom: 0;
}

.site-footer {
  margin-top: 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
  background: linear-gradient(180deg, rgba(233, 239, 247, 0.98) 0%, rgba(226, 234, 244, 0.98) 100%);
  border-top: 1px solid rgba(54, 68, 84, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.data-page {
  background:
    radial-gradient(circle at top right, rgba(32, 156, 238, 0.09), transparent 28rem),
    linear-gradient(180deg, #f9fbfd 0%, #eef3f8 100%);
}

.data-shell {
  width: min(var(--width-wide), calc(100% - 2rem));
  margin: 0 auto;
}

.data-hero,
.data-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--site-border);
  border-radius: 20px;
  box-shadow: var(--site-shadow);
}

.data-hero {
  padding: 2rem;
}

.data-card {
  padding: 1.5rem;
}

.data-kicker {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--site-highlight);
  color: var(--site-link);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.data-subtitle {
  color: var(--site-muted);
  line-height: 1.7;
}

.data-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.data-meta .tag {
  padding-inline: 0.85rem;
}

.data-stack {
  display: grid;
  gap: 1.5rem;
}

.data-copy {
  max-width: 80ch;
}

.data-code-block {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: 14px;
  background: #102a43;
  color: #f0f4f8;
}

.data-code-block code {
  color: inherit;
  white-space: pre;
}

.data-list {
  margin-left: 1.25rem;
}

.data-list li + li {
  margin-top: 0.45rem;
}

.data-table-card .table-container {
  margin-top: 1rem;
  border: 1px solid var(--site-border);
  border-radius: 16px;
  overflow: auto;
}

.data-table-card .table {
  margin-bottom: 0;
  min-width: 940px;
  background: white;
}

.data-table-card thead th {
  background: #f4f7fb;
  vertical-align: bottom;
}

.data-table-card tbody tr:nth-child(even) {
  background: rgba(15, 106, 180, 0.03);
}

.data-figure {
  margin-top: 1rem;
}

.data-figure img {
  display: block;
  width: min(100%, 1000px);
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid var(--site-border);
  box-shadow: var(--site-shadow);
}

.data-inline-link {
  font-weight: 600;
}

@media screen and (max-width: 768px) {
  .site-shell {
    width: min(100% - 1.25rem, 100%);
  }

  .site-shell--narrow,
  .site-shell--wide {
    width: min(100% - 1.25rem, 100%);
  }

  .data-shell {
    width: min(100% - 1.25rem, 100%);
  }

  .page-section {
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
  }

  .profile-box .media {
    align-items: flex-start;
    gap: 1rem;
  }

  .site-navbar .navbar-brand {
    width: 100%;
    align-items: center;
  }

  .site-navbar .navbar-brand .navbar-item {
    flex: 1;
    white-space: normal;
    line-height: 1.2;
  }

  .site-navbar .navbar-menu {
    padding: 0.5rem 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--site-border);
    box-shadow: 0 16px 32px rgba(31, 41, 51, 0.08);
  }

  .site-navbar .navbar-item,
  .site-navbar .navbar-link {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .site-navbar .navbar-item.has-dropdown {
    display: block;
  }

  .site-navbar .navbar-item.has-dropdown .navbar-link {
    padding-bottom: 0.45rem;
  }

  .site-navbar .navbar-item.has-dropdown .navbar-dropdown {
    display: block;
    position: static;
    margin-top: 0;
    padding-top: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .site-navbar .navbar-item.has-dropdown .navbar-dropdown .navbar-item {
    padding-left: 1.5rem;
    font-size: 0.97rem;
  }

  .home-profile-media-left {
    width: 170px;
    min-width: 170px;
    max-width: 200px;
  }

  .profile-photo {
    margin-inline: auto;
  }

  .data-hero,
  .data-card {
    padding: 1.15rem;
  }

  .research-grid {
    column-count: 2;
  }

  .research-grid.is-waterfall-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media screen and (max-width: 520px) {
  .profile-box .media {
    flex-direction: column;
  }

  .home-profile-media-left {
    width: 100%;
    min-width: 0;
    max-width: 170px;
  }

  .research-grid {
    column-count: 1;
  }

  .research-grid.is-waterfall-board {
    grid-template-columns: 1fr;
  }
}

/* ---------- Shared helpers ---------- */

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Justified prose for long text blocks. Hyphenation keeps the word spacing even;
   it needs a lang attribute on <html>, which every page has.
   Deliberately NOT applied to: navigation, lists, table cells, captions,
   and the narrow card descriptions on the research and projects pages. */
.profile-box .content > p,
.lead-copy p:not(.topic-line),
.page-copy > p,
.data-card.content > p,
.data-copy > p {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* ---------- Team: members note that needs no portrait card ---------- */

.members-incoming {
  margin-top: 1.4rem;
  font-size: 0.95rem;
}

/* ---------- CV dated entries: fixed first column so the text lines up ---------- */

.entry-date {
  display: inline-block;
  min-width: 7rem;
}

@media screen and (max-width: 560px) {
  .entry-date {
    min-width: 5rem;
  }
}

/* ---------- Concept grid (front page icons) ---------- */

.concept-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem 0.6rem;
  justify-items: center;
  max-width: 900px;
  margin: 1.35rem auto;
}

/* three classes so this outranks Bulma's
   `.content figure:not(:first-child) { margin-top/bottom: 2em }` */
.content .concept-grid .concept-cell {
  margin: 0;
  text-align: center;
}

.concept-grid .concept-cell img {
  display: block;
  width: 144px;
  height: 144px;
  margin: 0 auto 0.3rem;
}

.concept-grid .concept-cell figcaption {
  color: var(--site-muted);
  font-size: 0.82rem;
  font-style: normal; /* Bulma sets figcaption { font-style: italic } */
  line-height: 1.3;
}

@media screen and (max-width: 900px) {
  .concept-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .concept-grid .concept-cell img {
    width: 116px;
    height: 116px;
  }
}

@media screen and (max-width: 560px) {
  .concept-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .concept-grid .concept-cell img {
    width: 88px;
    height: 88px;
  }
}

/* ---------- Paper cards: tighten the title/author block, free the tag row ---------- */

.research-card .subtitle.is-5 {
  margin-bottom: 0.5rem;
}

/* needs three classes to outrank Bulma's .card-content .media:not(:last-child) */
.research-card .card-content .media {
  margin-bottom: 0.85rem;
}

.research-card .content .card-tags {
  margin-top: 1.05rem;
}

/* ---------- Project method tag ---------- */

.research-card .tag[data-tag="wfss"] {
  background: #dff2e2;
  color: #2c6b3f;
}

/* ---------- Project role tags: a solid hierarchy PI > co-PI > co-I ---------- */

.research-card .tag[data-tag="co-i"] {
  background: #eef1f5;
  color: #4a5568;
}

/* ---------- Research tag colours: one hue per topic ----------
   The three "kind" tags (Code, Data, Student-leading) stay solid Bulma colours;
   the topic tags are pastel tints with dark text so a card row reads as a whole. */

.research-card .tag[data-tag="jwst"] {
  background: #e3edfb;
  color: #1c4f9c;
}

.research-card .tag[data-tag="alma"] {
  background: #d9f2f0;
  color: #0d6b62;
}

.research-card .tag[data-tag="dust"] {
  background: #fdf0d5;
  color: #8a5a00;
}

.research-card .tag[data-tag="massive-galaxies"] {
  background: #dfe3fb;
  color: #35389e;
}

.research-card .tag[data-tag="protocluster"] {
  background: #fde3ec;
  color: #a1174a;
}

.research-card .tag[data-tag="gravitational-lensing"] {
  background: #f2e2f7;
  color: #742d9c;
}

.research-card .tag[data-tag="transients"] {
  background: #ffe7dc;
  color: #a8430a;
}

.research-card .tag[data-tag="agn-lrd"] {
  background: #fbe1e1;
  color: #a81f1f;
}

/* ---------- Tag filter (research page) ---------- */

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 1.5rem 0 1.25rem;
}

.tag-filter-label {
  margin-right: 0.15rem;
  color: var(--site-muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-filter-chip {
  padding: 0.32rem 0.85rem;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--site-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tag-filter-chip:hover {
  border-color: var(--site-link);
  color: var(--site-link);
}

.tag-filter-chip.is-active {
  background: var(--site-link);
  border-color: var(--site-link);
  color: #fff;
}

.research-card .tag[data-tag] {
  cursor: pointer;
}

.tag-filter-empty {
  margin: 0 0 1.5rem;
  color: var(--site-muted);
}

/* ---------- People cards (team page) ---------- */

.people-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.person-card {
  padding: 1.35rem;
  border: 1px solid var(--site-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--site-shadow);
  text-align: center;
}

.person-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1rem;
  background: var(--site-highlight);
}

.person-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
}

.person-card .person-role {
  margin: 0 0 0.55rem;
  color: var(--site-muted);
  font-size: 0.95rem;
}

.person-card .person-role a {
  font-weight: 600;
}

@media screen and (max-width: 900px) {
  .people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 520px) {
  .people-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Home page: news aside, quick links, topic line ---------- */

.home-aside {
  margin-top: 1.5rem;
  padding: 1.15rem 1.4rem;
  border: 1px solid var(--site-border);
  border-left: 4px solid var(--site-link);
  border-radius: 14px;
  background: var(--site-highlight);
}

.home-aside h3 {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--site-muted);
}

.home-aside ul {
  margin-left: 1rem;
  font-size: 0.92rem;
}

.home-aside li + li {
  margin-top: 0.4rem;
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.6rem;
  font-size: 0.95rem;
}

.home-links a {
  font-weight: 600;
}

.topic-line {
  color: var(--site-muted);
  line-height: 1.9;
}

/* ==========================================================================
   Motion — hover feedback and scroll reveals
   Everything here is cosmetic. The hover effects are pure CSS, so they work
   with JavaScript switched off; the scroll reveals rely on .motion-pending /
   .motion-in, which only scripts/motion.js ever adds. Visitors who ask for
   reduced motion get the still version of both.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---- cards lift, and their shadow deepens ---- */

.research-card,
.person-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.research-card:hover,
.person-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(31, 41, 51, 0.14);
}

.research-card:hover {
  border-color: rgba(15, 106, 180, 0.28);
}

/* ---- images: a slow zoom, clipped by the card that holds them ---- */

.research-card .card-image img {
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.research-card:hover .card-image img {
  transform: scale(1.045);
}

.person-card {
  overflow: hidden;
}

.person-card img {
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.person-card:hover img {
  transform: scale(1.035);
}

.data-figure img {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.data-figure img:hover {
  box-shadow: 0 22px 46px rgba(31, 41, 51, 0.16);
  border-color: rgba(15, 106, 180, 0.25);
}

/* ---- concept icons: the mark lifts, the caption warms up ---- */

.concept-grid .concept-cell img {
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1), filter 0.32s ease;
}

.concept-grid .concept-cell:hover img {
  transform: translateY(-5px) scale(1.07);
  filter: drop-shadow(0 12px 18px rgba(31, 41, 51, 0.2));
}

.concept-grid .concept-cell figcaption {
  transition: color 0.2s ease;
}

.concept-grid .concept-cell:hover figcaption {
  color: var(--site-link);
}

/* ---- icon links: the glyph nudges forward ---- */

.home-links a i,
.data-inline-link i,
.button i {
  transition: transform 0.18s ease;
}

.home-links a:hover i,
.data-inline-link:hover i,
.button:hover i {
  transform: translateX(3px);
}

.home-links a {
  transition: color 0.16s ease, transform 0.16s ease;
}

.home-links a:hover {
  transform: translateY(-1px);
}

/* ---- tags respond ---- */

.tag,
.tag-filter-chip {
  transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease,
    border-color 0.16s ease;
}

.card-tags .tag:hover,
.tag-filter-chip:hover {
  transform: translateY(-1px);
}

.tag-filter-chip:hover {
  border-color: var(--site-link);
}

/* ---- buttons ---- */

.button {
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.14);
}

/* ---- navbar settles in once you scroll ---- */

.site-navbar {
  transition: box-shadow 0.22s ease, background-color 0.22s ease;
}

.site-navbar.is-scrolled {
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.12);
}

.site-navbar .navbar-item,
.site-navbar .navbar-link {
  transition: color 0.16s ease, background-color 0.16s ease;
}

/* ---- scroll reveal ---- */

.motion-pending {
  opacity: 0;
  transform: translateY(16px);
}

.motion-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .motion-pending {
    opacity: 1;
    transform: none;
  }

  .research-card,
  .person-card,
  .person-card img,
  .research-card .card-image img,
  .data-figure img,
  .concept-grid .concept-cell img,
  .home-links a,
  .home-links a i,
  .data-inline-link i,
  .button,
  .button i,
  .tag,
  .tag-filter-chip,
  .site-navbar {
    transition: none;
  }

  .research-card:hover,
  .person-card:hover,
  .person-card:hover img,
  .research-card:hover .card-image img,
  .concept-grid .concept-cell:hover img,
  .card-tags .tag:hover,
  .tag-filter-chip:hover,
  .button:hover,
  .home-links a:hover,
  .home-links a:hover i,
  .data-inline-link:hover i,
  .button:hover i {
    transform: none;
  }
}

/* Reveals must never reach paper: anything still waiting prints as normal. */

@media print {
  .motion-pending {
    opacity: 1 !important;
    transform: none !important;
  }
}
