/* ==========================================================
   Gravity Group @ UIB â€” site stylesheet
   Palette
   --ink      deep space navy (hero, nav, footer)
   --paper    warm off-white (content pages)
   --accent   GW-strain orange
   --accent-2 detector blue
   ========================================================== */

:root {
  --ink: #0b1220;
  --ink-2: #111c30;
  --paper: #fbfaf7;
  --text: #1c2433;
  --muted: #5d6878;
  --accent: #f2762e;
  --accent-2: #3e7cb1;
  --line: #e4e1da;
  --maxw: 1100px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
}

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

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  font-size: 1.15rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .tilde { color: var(--accent); }
.nav-links { display: flex; gap: 1.6rem; list-style: none; }
.nav-links a {
  color: rgba(255,255,255,.78);
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: .03em;
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a[aria-current="page"] {
  color: #fff;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}
.nav-toggle { display: none; }

/* ---------- Hero (home) ---------- */
.hero {
  background:
    radial-gradient(1200px 600px at 70% -10%, #1a2a47 0%, transparent 60%),
    var(--ink);
  color: #fff;
  padding: 7rem 1.25rem 5rem;
  overflow: hidden;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.05;
  max-width: 18ch;
}
.hero p.lede {
  margin-top: 1.4rem;
  max-width: 56ch;
  font-size: 1.18rem;
  color: rgba(255,255,255,.82);
}
.hero .waveform { margin-top: 3rem; width: 100%; height: auto; }

/* Damped sinusoid draw-on animation */
.ringdown-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 3200;
  stroke-dashoffset: 3200;
  animation: draw 3.2s ease-out .3s forwards;
}
.ringdown-ghost {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 1.5;
  opacity: .45;
  stroke-dasharray: 3200;
  stroke-dashoffset: 3200;
  animation: draw 3.2s ease-out .55s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ----- Hero animation B: dimoni vs black hole ----- */
.hero-anim[hidden] { display: none; }

.dimoni-scene {
  margin-top: 2.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.25rem, 2.5vw, 1.25rem);
  min-height: 320px;
}
/* ----- The dimoni: five-layer boxing rig -----
   legs (root) > upper body (pivots at the waist) > head (neck),
   guard arm (rear shoulder), jab arm (front shoulder).
   All layers share the same 663x670 canvas; pivots are in canvas %.
   The whole cycle is 2.4s with the impact at 50%, in sync with the
   black hole wobble, the flash and the gravitational-wave ripples. */
.dimoni-rig {
  position: relative;
  width: clamp(210px, 31vw, 330px);
  aspect-ratio: 663 / 670;
  transform-origin: 45% 92%;            /* the feet */
  animation: d-rig 2.4s ease-in-out infinite;
}
.dimoni-rig img, .d-upper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.d-upper      { transform-origin: 44.5% 61.9%;  /* waist */
                animation: d-torso 2.4s ease-in-out infinite; }
.d-head       { transform-origin: 48.3% 42.5%;  /* neck */
                animation: d-head 2.4s ease-in-out infinite; }
.d-arm-front  { transform-origin: 60.5% 40.4%;  /* punching shoulder */
                animation: d-jab 2.4s ease-in-out infinite; }
.d-arm-rear   { transform-origin: 24.9% 39.1%;  /* guard shoulder */
                animation: d-guard 2.4s ease-in-out infinite; }

/* Root: boxer bounce, crouch into the back leg, lunge, damped settle */
@keyframes d-rig {
  0%   { transform: translate(0, 0); }
  7%   { transform: translate(0, -7px); }
  14%  { transform: translate(0, 0); }
  21%  { transform: translate(0, -7px); }
  28%  { transform: translate(0, 0); }
  40%  { transform: translate(-18px, 4px) scale(1, .965); }
  46%  { transform: translate(-20px, 4px) scale(1, .96);
         animation-timing-function: cubic-bezier(.7, 0, .85, 1); }
  51%  { transform: translate(40px, -3px) scale(1, 1.005); }
  56%  { transform: translate(42px, 0); }
  68%  { transform: translate(3px, 0); }
  76%  { transform: translate(-4px, -5px); }
  84%  { transform: translate(0, -7px); }
  92%  { transform: translate(0, 0); }
  96%  { transform: translate(0, -4px); }
  100% { transform: translate(0, 0); }
}

/* Upper body: sways with the bounce, coils back, drives through the punch */
@keyframes d-torso {
  0%   { transform: rotate(.6deg); }
  7%   { transform: rotate(-.6deg); }
  14%  { transform: rotate(.6deg); }
  21%  { transform: rotate(-.6deg); }
  28%  { transform: rotate(.3deg); }
  40%  { transform: rotate(6.2deg); }
  46%  { transform: rotate(7deg);
         animation-timing-function: cubic-bezier(.7, 0, .85, 1); }
  51%  { transform: rotate(-6.5deg); }
  56%  { transform: rotate(-5.5deg); }
  68%  { transform: rotate(-1deg); }
  78%  { transform: rotate(1deg); }
  88%  { transform: rotate(0deg); }
  100% { transform: rotate(.6deg); }
}

/* Head: bobs in counterphase, eyes locked on target while coiling,
   then a small whiplash lag after the hit */
@keyframes d-head {
  0%   { transform: rotate(-.5deg); }
  7%   { transform: rotate(.8deg); }
  14%  { transform: rotate(-.5deg); }
  21%  { transform: rotate(.8deg); }
  28%  { transform: rotate(0deg); }
  38%  { transform: rotate(-3deg); }
  46%  { transform: rotate(-4.5deg);
         animation-timing-function: cubic-bezier(.7, 0, .85, 1); }
  50%  { transform: rotate(-1deg); }
  54%  { transform: rotate(4deg); }
  62%  { transform: rotate(1.5deg); }
  74%  { transform: rotate(-1deg); }
  86%  { transform: rotate(0deg); }
  100% { transform: rotate(-.5deg); }
}

/* Jab arm: floats with the bounce, cocks to the hip, whips out with overshoot */
@keyframes d-jab {
  0%   { transform: rotate(2deg); }
  7%   { transform: rotate(-1.5deg); }
  14%  { transform: rotate(2deg); }
  21%  { transform: rotate(-1.5deg); }
  28%  { transform: rotate(1deg); }
  40%  { transform: rotate(26deg) translate(-1.5%, 1%); }
  46%  { transform: rotate(29deg) translate(-2%, 1%);
         animation-timing-function: cubic-bezier(.7, 0, .8, 1); }
  50%  { transform: rotate(-8deg); }
  54%  { transform: rotate(-2deg); }
  60%  { transform: rotate(1deg); }
  70%  { transform: rotate(4deg); }
  82%  { transform: rotate(1deg); }
  100% { transform: rotate(2deg); }
}

/* Guard arm: pumps with the rhythm, tucks tight on the coil,
   elbow drives back as the jab lands */
@keyframes d-guard {
  0%   { transform: rotate(0deg); }
  7%   { transform: rotate(2deg); }
  14%  { transform: rotate(0deg); }
  21%  { transform: rotate(2deg); }
  28%  { transform: rotate(1deg); }
  40%  { transform: rotate(-3.5deg); }
  46%  { transform: rotate(-4deg);
         animation-timing-function: cubic-bezier(.7, 0, .85, 1); }
  50%  { transform: rotate(7deg); }
  56%  { transform: rotate(5deg); }
  68%  { transform: rotate(2deg); }
  82%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.bh-wrap {
  position: relative;
  width: clamp(150px, 22vw, 230px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bh {
  width: 62%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #05070d 55%, #0b1525 78%, #16294a 100%);
  box-shadow:
    0 0 0 3px rgba(98, 150, 199, .35),
    0 0 28px 6px rgba(62, 124, 177, .35);
  animation: bh-wobble 2.4s cubic-bezier(.5, 0, .4, 1) infinite;
}
@keyframes bh-wobble {
  0%, 44%, 100% { transform: scale(1, 1); }
  52% { transform: scale(.92, 1.07); }   /* squish on impact */
  64% { transform: scale(1.05, .96); }
  78% { transform: scale(.99, 1.01); }
}

/* expanding gravitational-wave ripples, emitted at each impact */
.gw {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 62%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid rgba(122, 175, 222, .9);
  opacity: 0;
  animation: gw-ripple 2.4s linear infinite;
  pointer-events: none;
}
.gw2 { animation-delay: .22s; border-width: 1.5px; }
.gw3 { animation-delay: .44s; border-width: 1px; }
@keyframes gw-ripple {
  0%, 49% { transform: scale(.6); opacity: 0; }
  52%     { transform: scale(.75); opacity: .9; }
  100%    { transform: scale(2.6); opacity: 0; }
}

/* small flash where the glove lands */
.impact {
  position: absolute;
  left: -8%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  animation: flash 2.4s linear infinite;
  pointer-events: none;
}
@keyframes flash {
  0%, 46%, 62%, 100% { opacity: 0; transform: scale(.4); }
  50% { opacity: 1; transform: scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  .ringdown-path, .ringdown-ghost { animation: none; stroke-dashoffset: 0; }
  .dimoni-rig, .d-upper, .d-head, .d-arm-front, .d-arm-rear, .bh, .gw, .impact { animation: none; }
  .gw1 { opacity: .6; transform: scale(1.4); }
  .gw2 { opacity: .35; transform: scale(1.9); }
  .gw3 { opacity: .2; transform: scale(2.4); }
}

/* ---------- Generic sections ---------- */
.section { padding: 4.5rem 1.25rem; }
.section.alt { background: #f1efe9; }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  margin-bottom: 1.6rem;
}
.section h3 { font-family: var(--font-display); margin: 2rem 0 .6rem; }
.section p + p { margin-top: 1rem; }

.kicker {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: .6rem;
}

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.6rem;
}
.card h3 { margin-top: 0; }
.card .kicker { color: var(--accent-2); }

/* ---------- Team ---------- */
.person { text-align: left; }
.person .photo {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, #d8d4ca, #c2bdb1);
  border: 1px solid var(--line);
}
.person .photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: #8b8576;
}
.person h3 { margin: .9rem 0 .1rem; font-size: 1.1rem; }
.person .role { color: var(--muted); font-size: .95rem; }
.person .mail {
  margin-top: .35rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ---------- News ---------- */
.news-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.news-item .date {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--muted);
  padding-top: .25rem;
}
.news-item h3 { margin: 0 0 .3rem; }

/* ---------- Publications ---------- */
.pub {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.pub .title { font-weight: 600; }
.pub .meta { font-size: .92rem; color: var(--muted); }
.pub .links { font-family: var(--font-mono); font-size: .82rem; }

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,.7);
  padding: 3rem 1.25rem;
  font-size: .95rem;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer a { color: rgba(255,255,255,.85); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  margin-top: 2rem;
  padding: .8rem 1.6rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .02em;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }

/* ---------- Page header (interior pages) ---------- */
.page-head {
  background: var(--ink);
  color: #fff;
  padding: 4rem 1.25rem 3rem;
}
.page-head-inner { max-width: var(--maxw); margin: 0 auto; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .nav-toggle {
    display: block;
    background: none;
    border: 0;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--ink);
    flex-direction: column;
    gap: 0;
    padding: .5rem 0 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .nav-links.open { display: flex; }
  .nav-links li { padding: .7rem 1.25rem; }
}
@media (max-width: 640px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .news-item { grid-template-columns: 1fr; gap: .3rem; }
}

/* ---------- Fullscreen black-hole lens hero (home) ---------- */
.hero.hero-fullscreen {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  padding: clamp(5rem, 10vw, 8rem) 1.25rem;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
}
.hero-lens-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-lens-content {
  position: relative;
  z-index: 2;
  width: 100%;
}
.hero-lens-content .eyebrow,
.hero-lens-content h1,
.hero-lens-content .lede {
  text-shadow: 0 2px 20px rgba(0,0,0,.55);
}
.hero-lens-content h1 {
  max-width: 14ch;
}
.hero-lens-content .lede {
  max-width: 58ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  margin-top: 2rem;
}
.hero-actions .btn {
  margin-top: 0;
}
.btn.btn-ghost {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
}
.btn.btn-ghost:hover {
  background: rgba(255,255,255,.14);
}
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.35rem;
  z-index: 3;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  color: rgba(255,255,255,.78);
  font-family: var(--font-display);
  font-size: 1.15rem;
  animation: cue-bob 1.8s ease-in-out infinite;
}
.scroll-cue:hover {
  color: #fff;
  text-decoration: none;
  border-color: rgba(255,255,255,.55);
}
@keyframes cue-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -7px); }
}
@media (max-width: 760px) {
  .hero.hero-fullscreen {
    min-height: calc(100vh - 64px);
    align-items: flex-start;
    padding-top: 5.5rem;
  }
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue { animation: none; }
}



/* ---------- Alternating fullscreen hero visualisations ---------- */

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-canvas[hidden] {
  display: none;
}

.hero-viz-toggle {
  position: absolute;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 4;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.hero-viz-toggle:hover {
  background: rgba(255,255,255,.15);
}

.hero-viz-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 760px) {
  .hero-viz-toggle {
    left: 1.25rem;
    right: auto;
    bottom: 1.1rem;
  }
}

/* ---------- Clickable team cards ---------- */

.person-main {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.person-main:hover {
  text-decoration: none;
  transform: translateY(-3px);
}

.person-main:hover h3 {
  color: var(--accent-2);
}

.person-main:hover .photo {
  opacity: 0.94;
  box-shadow: 0 14px 32px rgba(11, 18, 32, 0.16);
}

.person-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.person-main h3 {
  transition: color 0.18s ease;
}

.person .mail {
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

/* ---------- Personal profile pages ---------- */

.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: start;
}

.profile-side {
  position: sticky;
  top: 92px;
}

.profile-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.profile-side .role {
  margin-top: 1rem;
  color: var(--muted);
}

.profile-side .mail {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.profile-main h2 {
  margin-top: 0;
}

.profile-main h2:not(:first-child) {
  margin-top: 2.5rem;
}

.profile-main ul {
  margin-left: 1.3rem;
}

.profile-main li + li {
  margin-top: 0.35rem;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.profile-links a {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.profile-links a:hover {
  text-decoration: none;
  border-color: var(--accent-2);
}

@media (max-width: 800px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-side {
    position: static;
    max-width: 320px;
  }
}

/* ---------- Publication cards and paper pages ---------- */

.pub-clickable {
  padding: 1.4rem 0;
}

.pub-clickable .title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

.pub-clickable .title a:hover {
  color: var(--accent-2);
  text-decoration: none;
}

.pub .summary {
  margin-top: 0.45rem;
  max-width: 100ch;
  color: var(--text);
}

.paper-hero-meta {
  margin-top: 1rem;
  max-width: 72ch;
  color: rgba(255,255,255,.78);
}

.paper-layout {
  max-width: 980px;
}

.paper-layout h2:not(:first-child) {
  margin-top: 2.7rem;
}

.paper-layout h3 {
  margin-top: 2rem;
}

.paper-lede {
  font-size: 1.18rem;
  color: var(--text);
}

.paper-equation {
  margin: 1.6rem 0;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 1.08rem;
}

.paper-figure {
  margin: 2rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.paper-figure img {
  width: 100%;
  border-radius: 10px;
}

.paper-figure figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.4rem;
}

.paper-actions .btn {
  margin-top: 0;
}

.paper-actions .btn-secondary {
  background: #fff;
  color: var(--accent-2);
  border: 1px solid var(--line);
}

.paper-actions .btn-secondary:hover {
  border-color: var(--accent-2);
}
/* ---------- Two-panel figures in paper pages ---------- */

.paper-figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.paper-panel img {
  width: 100%;
  border-radius: 10px;
}

.paper-panel figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .paper-figure-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Resources page ---------- */

.resources-head {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(4rem, 8vw, 6.5rem) 1.25rem;
  background:
    radial-gradient(800px 420px at 82% 15%, rgba(62, 124, 177, 0.24), transparent 68%),
    radial-gradient(620px 360px at 15% 100%, rgba(242, 118, 46, 0.16), transparent 70%),
    var(--ink);
  color: #fff;
}

.resources-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.resources-head-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: center;
}

.resources-head h1 {
  max-width: 11ch;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 1.02;
}

.resources-head .lede {
  max-width: 58ch;
  margin-top: 1.35rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.18rem;
}

.resources-orbit {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1 / 1;
  justify-self: end;
}

.resources-orbit::before,
.resources-orbit::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  transform: rotate(-18deg) scaleY(0.55);
}

.resources-orbit::after {
  inset: 25%;
  border-color: rgba(242, 118, 46, 0.35);
  transform: rotate(36deg) scaleY(0.55);
}

.orbit-core {
  position: absolute;
  inset: 33%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 37%, #111c30 0%, #080d17 58%, #020409 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 45px rgba(62, 124, 177, 0.28);
}

.orbit-core span {
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.72rem, 2vw, 0.9rem);
  letter-spacing: 0.08em;
}

.orbit-node {
  position: absolute;
  min-width: 104px;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.72);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.orbit-node strong,
.orbit-node span {
  display: block;
}

.orbit-node strong {
  font-family: var(--font-display);
  color: #fff;
  font-size: 0.95rem;
}

.orbit-node span {
  margin-top: 0.12rem;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.orbit-node.code {
  top: 8%;
  right: 0;
}

.orbit-node.theses {
  bottom: 8%;
  left: 0;
}

.resources-nav {
  position: relative;
  z-index: 2;
  margin-top: -1.7rem;
}

.resources-nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.resources-nav-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(11, 18, 32, 0.1);
}

.resources-nav-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: center;
  min-height: 88px;
  padding: 1.15rem 1.35rem;
  color: var(--text);
}

.resources-nav-list a + a {
  border-left: 1px solid var(--line);
}

.resources-nav-list a:hover {
  text-decoration: none;
  background: #fbfaf7;
}

.resources-nav-number {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.resources-nav-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.resources-nav-arrow {
  color: var(--accent-2);
  font-size: 1.3rem;
}

.resource-section {
  scroll-margin-top: 88px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.65fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 2rem;
}

.section-heading h2 {
  max-width: 17ch;
  margin-bottom: 0;
}

.section-heading > p {
  max-width: 52ch;
  color: var(--muted);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.resource-card:hover {
  transform: translateY(-4px);
  border-color: rgba(62, 124, 177, 0.55);
  box-shadow: 0 18px 40px rgba(11, 18, 32, 0.1);
}

.resource-card-top {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  padding: 1.35rem;
  background: var(--ink);
  color: #fff;
}

.resource-card-top::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -70px;
  bottom: -110px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(255, 255, 255, 0.025),
    0 0 0 48px rgba(255, 255, 255, 0.018);
}

.resource-card-index {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.terminal-lines {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.75);
}

.terminal-lines .prompt {
  color: var(--accent);
}

.resource-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.5rem;
}

.resource-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.25rem;
}

.resource-card p {
  color: var(--muted);
}

.resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.resource-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfaf7;
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.72rem;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.35rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.resource-links a {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-weight: 500;
}

.resource-links a::after {
  content: "↗";
  font-size: 0.9em;
}

.resource-card-placeholder {
  border-style: dashed;
  background:
    linear-gradient(135deg, rgba(62, 124, 177, 0.035), transparent 55%),
    #fff;
}

.resource-card-placeholder .resource-card-top {
  background:
    linear-gradient(135deg, rgba(62, 124, 177, 0.3), transparent 55%),
    var(--ink);
}

.thesis-directory {
  display: grid;
  gap: 1.2rem;
}

.thesis-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.thesis-group-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(62, 124, 177, 0.055), transparent 45%),
    #fff;
}

.thesis-group-number {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
}

.thesis-group-head h3 {
  margin: 0;
  font-size: 1.18rem;
}

.thesis-level {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thesis-list {
  list-style: none;
}

.thesis-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.35rem 1.4rem;
}

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

.thesis-year {
  padding-top: 0.15rem;
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 0.82rem;
}

.thesis-title {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.35;
}

.thesis-meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.thesis-description {
  max-width: 72ch;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.thesis-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.thesis-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.thesis-link:hover {
  border-color: var(--accent-2);
  text-decoration: none;
}

.thesis-link-muted {
  color: var(--muted);
  cursor: default;
}

.empty-thesis {
  grid-template-columns: 76px minmax(0, 1fr);
  color: var(--muted);
}

.empty-thesis .thesis-title {
  color: var(--text);
}

.resource-cta {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: clamp(2rem, 5vw, 3.25rem);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(62, 124, 177, 0.28), transparent 70%),
    var(--ink);
  color: #fff;
}

.resource-cta::after {
  content: "</>";
  position: absolute;
  right: clamp(1rem, 5vw, 3.5rem);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.055);
  font-size: clamp(5rem, 15vw, 10rem);
  font-weight: 700;
  line-height: 1;
}

.resource-cta-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.resource-cta h2 {
  margin-bottom: 0.75rem;
}

.resource-cta p {
  max-width: 56ch;
  color: rgba(255, 255, 255, 0.75);
}

.resource-cta .btn {
  margin-top: 1.5rem;
}

@media (max-width: 860px) {
  .resources-head-inner,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .resources-orbit {
    width: min(100%, 330px);
    justify-self: start;
  }

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

  .thesis-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .thesis-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .resources-head {
    padding-top: 3.4rem;
  }

  .resources-orbit {
    margin: 0 auto;
  }

  .resources-nav-list {
    grid-template-columns: 1fr;
  }

  .resources-nav-list a + a {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .thesis-group-head {
    grid-template-columns: auto 1fr;
  }

  .thesis-level {
    display: none;
  }

  .thesis-item,
  .empty-thesis {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .thesis-actions {
    grid-column: 1;
  }

  .resource-cta::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resource-card {
    transition: none;
  }

  .resource-card:hover {
    transform: none;
  }
}

/* =========================================================
   Interactive QNM landscapes
   ========================================================= */

.interactive-landscape {
  margin: 2rem 0 3rem;
}


/* ---------------------------------------------------------
   Selector groups
   --------------------------------------------------------- */

.landscape-selector-group {
  margin-bottom: 1rem;
}

.landscape-selector-group + .landscape-selector-group {
  margin-top: 0.4rem;
  margin-bottom: 1.4rem;
}

.landscape-selector-label {
  display: block;
  margin-bottom: 0.45rem;

  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 500;

  text-transform: uppercase;
  letter-spacing: 0.06em;

  opacity: 0.65;
}


/* ---------------------------------------------------------
   Button containers
   --------------------------------------------------------- */

.landscape-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}


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

.landscape-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  font-weight: 500;

  padding: 0.55rem 1rem;

  border: 1px solid currentColor;
  border-radius: 6px;

  background: transparent;
  color: inherit;

  cursor: pointer;

  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.landscape-btn:hover {
  transform: translateY(-1px);
}

.landscape-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}


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

.landscape-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}


/* ---------------------------------------------------------
   Interactive Plotly frame
   --------------------------------------------------------- */

#landscape-frame {
  display: block;

  width: 100%;
  height: 720px;

  margin-top: 0.4rem;

  border: 1px solid rgba(127, 127, 127, 0.25);
  border-radius: 10px;

  background: #fff;
}


/* ---------------------------------------------------------
   Responsive layout
   --------------------------------------------------------- */

@media (max-width: 900px) {

  #landscape-frame {
    height: 620px;
  }

}


@media (max-width: 700px) {

  .interactive-landscape {
    margin: 1.5rem 0 2.5rem;
  }

  .landscape-controls {
    gap: 0.45rem;
  }

  .landscape-btn {
    font-size: 0.82rem;
    padding: 0.5rem 0.8rem;
  }

  #landscape-frame {
    height: 520px;
  }

}


@media (max-width: 480px) {

  .landscape-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landscape-btn {
    width: 100%;
    text-align: center;
  }

  #landscape-frame {
    height: 460px;
  }

}

/* ---------- Long-form text ---------- */

@media (min-width: 700px) {
  .paper-layout > p,
  .paper-figure > figcaption,
  .profile-main p,
  .research-intro,
  .research-block p:not(.research-related),
  .pub .summary {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}

/* ---------- Research page ---------- */

.research-layout {
  max-width: 980px;
}

.research-intro {
  margin-bottom: 3.5rem;
}

.research-block + .research-block {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--line);
}

.research-block h2 {
  margin-bottom: 1.2rem;
}

.research-related {
  margin-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.research-related a + a::before {
  content: "·";
  margin: 0 0.55rem;
  color: var(--muted);
}

/* ---------- Footer: funding and credit ---------- */

.footer-funding {
  max-width: var(--maxw);
  margin: 2.5rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-funding-title {
  margin-bottom: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.footer-funding-logos {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.8rem;
  max-width: 100%;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  background: #fff;
}

.footer-funding-logos img {
  width: 520px;
  max-width: 100%;
  height: auto;
}

.footer-funding-logos .footer-logo-cost {
  width: 170px;
}

.footer-credit {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  max-width: var(--maxw);
  margin: 2rem auto 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- Team: current position of partners and past members ---------- */

.person .now {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ---------- Research: active projects ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.project-logo {
  display: flex;
  align-items: center;
  height: 72px;
  margin-bottom: 1.3rem;
}

.project-logo img {
  max-width: 260px;
  max-height: 72px;
  width: auto;
  height: auto;
}

.section .project-card h3 {
  margin: 0 0 1.1rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.project-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.project-meta dt {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.15rem;
}

.project-meta dd {
  color: var(--text);
}

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

/* ---------- Team: two people per row on phones ---------- */

@media (max-width: 640px) {
  .grid.team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.6rem 1rem;
  }

  .team-grid .person h3 {
    font-size: 1rem;
  }

  .team-grid .person .role,
  .team-grid .person .now {
    font-size: 0.85rem;
  }

  .team-grid .person .photo.placeholder {
    font-size: 2rem;
  }
}
