:root {
  /* palette sampled from the lab's own thermal-imaging photo of a torpid vs. active mouse */
  --navy-900: #05082b;   /* deep background of the thermal image */
  --blue-500: #0278cd;   /* sampled directly from the "cold" mouse's body in the thermal photo */
  --gold-400: #ffb703;   /* "hot" mouse tone */
  --orange-600: #fb5533;
  --bg: #fdfcf9;
  --ink: #14162c;
  --muted: #5b5f78;
  --border: #e3e2ee;
  --max-width: 1080px;
  --bg-alt: #f2f0ea;
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --gradient-thermal: linear-gradient(90deg, var(--navy-900), var(--blue-500), var(--gold-400), var(--orange-600));
  /* The same four colours, reordered coolest-to-hottest for the team page's
     sleeping-temperature scale. --gradient-thermal is decorative and only ever
     drawn a few px tall, so its blue->gold leg going through olive green never
     shows; across an 860px axis it does, and olive is where most of the lab
     clusters. Going by way of orange lands on a slate plum instead, which is
     the path real thermal colormaps take, and ends on gold -- the "hot" mouse
     tone. Swap this back to the line above for exact parity with the header. */
  --gradient-thermogram: linear-gradient(90deg, var(--navy-900), var(--blue-500), var(--orange-600), var(--gold-400));
  /* same ramp running bottom-to-top, for the vertical axis on the team page */
  --gradient-thermogram-v: linear-gradient(to top, var(--navy-900), var(--blue-500), var(--orange-600), var(--gold-400));
  --shadow-card: 0 2px 16px rgba(5, 8, 43, 0.08);
  --shadow-card-hover: 0 10px 28px rgba(5, 8, 43, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Georgia", "Iowan Old Style", serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a { color: var(--blue-500); }

h1, h2, h3,
.brand-title,
.site-header nav a,
.tier-label,
.hero-button,
.news-archive-link a,
.topic-text h3,
.team-card h3,
.news-overlay time {
  font-family: var(--font-display);
}

/* Header */
.site-header {
  border-bottom: none;
  background: var(--bg);
  position: relative;
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--gradient-thermal);
}
.site-header.overlay::after { display: none; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  /* two-line brand block (1.75rem + 1.25rem at line-height 1.6 = 4.8rem) plus
     this box's own padding, since box-sizing is border-box. Held even where the
     brand is hidden, so the nav sits at the same height on every page and the
     links only travel sideways between them. */
  min-height: 7.3rem;
}
/* homepage: no brand block, so the nav spreads evenly across the full width;
   view transitions slide the links back into their clustered spacing on nav */
.header-inner.nav-only nav { flex: 1; }
.header-inner.nav-only nav ul { justify-content: space-between; }
@media (max-width: 700px) {
  /* too narrow to spread: wrapped rows look better centered */
  .header-inner.nav-only nav ul { justify-content: center; }
}
.brand {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-size: 1.75rem;
  font-weight: bold;
  letter-spacing: 0.03em;
}
.brand-sub {
  font-size: 1.25rem;
  color: var(--muted);
}
.site-header nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-header nav a {
  /* inline-block and relative so the overlay header can hang a gradient bar
     off ::after in a predictable box; inner pages still use the border */
  display: inline-block;
  position: relative;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.25rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
}

/* Transparent header overlaid on the homepage hero */
.site-header.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: transparent;
  border-bottom: none;
}
.site-header.overlay .brand-title,
.site-header.overlay .brand-sub,
.site-header.overlay nav a {
  color: #fff;
}
.site-header.overlay nav a:hover,
.site-header.overlay nav a[aria-current="page"] {
  color: var(--gold-400);
  border-bottom-color: var(--gold-400);
}

/* Header morph between the home page and inner pages. The links use the
   browser's own morph (transition:animate="initial" in Base.astro), which
   cross-fades old and new without dipping to blank; Astro's default "fade"
   faded each label out and in over 180ms while it slid over 250ms, so the
   labels blinked out mid-slide. One duration and curve for slide and fade. */
::view-transition-group(brand),
::view-transition-group(nav-research),
::view-transition-group(nav-team),
::view-transition-group(nav-news),
::view-transition-group(nav-publications),
::view-transition-group(nav-contact),
::view-transition-old(brand), ::view-transition-new(brand),
::view-transition-old(nav-research), ::view-transition-new(nav-research),
::view-transition-old(nav-team), ::view-transition-new(nav-team),
::view-transition-old(nav-news), ::view-transition-new(nav-news),
::view-transition-old(nav-publications), ::view-transition-new(nav-publications),
::view-transition-old(nav-contact), ::view-transition-new(nav-contact) {
  animation-duration: 350ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Homepage hero */
.hero-landing {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  text-align: center;
  color: #fff;
  /* rgba stops below match --navy-900 (#05082b) at varying opacity, for legibility over the photo */
  background-image:
    linear-gradient(to bottom, rgba(5, 8, 43, 0.55) 0%, rgba(5, 8, 43, 0.1) 35%, rgba(5, 8, 43, 0.15) 60%, rgba(5, 8, 43, 0.8) 100%),
    url('/images/hero/thermal-mice.jpeg');
  background-size: cover;
  background-position: center;
}
.hero-landing h1 {
  font-size: 4rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}
.hero-landing p.hero-org {
  margin: 0.25rem 0 0;
  font-size: 1.25rem; /* matches .brand-sub in the site header */
  color: #e7e9f7;
}
.hero-button {
  display: inline-block;
  margin-top: 2.5rem;
  padding: 1rem 2.25rem;
  background: rgba(28, 111, 214, 0.35);
  border: 2px solid var(--blue-500);
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  border-radius: 4px;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, transform 0.2s ease, color 0.4s ease;
  box-shadow: 0 0 0 rgba(255, 183, 3, 0);
}
.hero-button:hover {
  background: none;
  border-color: var(--gold-400);
  color: var(--gold-400);
  box-shadow: 0 0 32px 8px rgba(255, 183, 3, 0.55);
  transform: translateY(-2px);
}

/* Generic inner-page hero */
.hero {
  padding: 1rem 0 1rem;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.hero p {
  max-width: 70ch;
  color: var(--muted);
}

/* Sections */
section.block {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}
section.block:last-of-type { border-bottom: none; }
section.block:nth-of-type(even) { background: var(--bg-alt); }
section.block h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
/* Both of these override section.block:nth-of-type(even) rather than relying
   on it: the stripe wants to sit on Alumni, which is an odd section. Equal
   specificity, so they win on source order -- keep them after that rule. */
section.block.outside-block { background: none; }
section.block.alumni-block { background: var(--bg-alt); }
/* Outside of the lab reads as a continuation of the team grid above it, not as
   its own titled section, so the rule between them goes and the gap closes up.
   :has() rather than a class on the team section, because the divider being
   removed belongs to the section *before* this one. */
section.block:has(+ .outside-block) {
  border-bottom: none;
  padding-bottom: 0.5rem;
}
section.block.outside-block { padding-top: 1.25rem; }
/* This one section breaks the page's 1080px measure. Both panels were cramped
   inside it, and 1280px is the useful ceiling rather than an arbitrary one: it
   puts the carousel at ~596px, which is the social photos' own native width, so
   they fill the frame without being upscaled and going soft. Wider than this and
   they would be. */
.outside-block .wrap { max-width: 1280px; }
h2.alumni-heading,
h2.outside-heading {
  text-align: center;
  color: var(--blue-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* Research page — overview up top, then alternating text/image rows */
/* The topic headings keep their thermal rule. This used to be one rule shared
   with every section.block h2, and removing it from the headings took these
   with it; they are on their own selector now so the two cannot drift. */
.topic-text h3::before {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--gradient-thermal);
  margin-bottom: 0.75rem;
}
.research-overview {
  padding-top: 1rem;
}

.topic-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  /* image sits centered against the whole text block, not pinned to the heading */
  align-items: center;
  margin-bottom: 3.5rem;
}
.topic-row:last-child { margin-bottom: 0; }
.topic-row .topic-text { order: 1; }
.topic-row .topic-image { order: 2; }
.topic-row.reverse { grid-template-columns: 1fr 2fr; }
.topic-row.reverse .topic-text { order: 2; }
.topic-row.reverse .topic-image { order: 1; }

.topic-text h3 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.topic-image img {
  width: 100%;
  border-radius: 4px;
  display: block;
}
.topic-pub {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.topic-pub strong {
  display: block;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: normal;
  margin-bottom: 0.35rem;
}
@media (max-width: 700px) {
  .topic-row, .topic-row.reverse { grid-template-columns: 1fr; }
  .topic-row .topic-text, .topic-row.reverse .topic-text { order: 1; }
  .topic-row .topic-image, .topic-row.reverse .topic-image { order: 2; }
}

/* Team */
/* every tier is capped at four cards across and centred: 4 cards + 3 gaps */
.team-tier {
  max-width: calc(4 * 220px + 3 * 2.25rem);
  margin: 0 auto 3.5rem;
}
.team-tier .tier-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-transform: uppercase;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--blue-500);
  margin-bottom: 1.5rem;
  text-align: center;
}
.team-tier .tier-label::before,
.team-tier .tier-label::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--blue-500);
}
.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.25rem;
}
.team-card { width: 220px; text-align: center; }
.team-card .photo-flip {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.team-card:hover .photo-flip {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}
.team-card .photo-flip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}
.team-card .photo-flip img.photo-2 { opacity: 0; }
.team-card .photo-flip:hover img.photo-1 { opacity: 0; }
.team-card .photo-flip:hover img.photo-2 { opacity: 1; }
.team-card h3 { margin: 0.25rem 0 0.2rem; font-size: 1.2rem; }
.team-card a { font-size: 1rem; }

/* Sleeping temperature — a vertical thermogram sharing the Social section with
   the photo carousel. Each face is ringed and positioned by sampling
   --gradient-thermogram at that person's temperature (see src/pages/team.astro),
   so a ring and its place on the axis are always the same colour. The rings live
   only here, not on the team cards above. */

h2.outside-heading { margin: 0 0 1.75rem; }
/* Centred by dropping its own half-height off the panel's midpoint. Both `top`
   and `margin-top` are plain interpolable values, so the rise to the top is a
   real transition with nothing for the layout to renegotiate. --thermo-head is
   this block's height, fixed rather than measured, because the chart's own
   offset has to agree with it. */
.thermo-head {
  position: absolute;
  left: var(--thermo-pad-x);
  right: var(--thermo-pad-x);
  top: 50%;
  margin-top: calc(var(--thermo-head) / -2);
  /* Above .thermo-views, which is its absolutely positioned sibling, comes
     later in the DOM and -- while the panel is closed -- covers the whole box
     BELOW the head's centred position, head included. Without this the views
     box painted over the switch and ate every click on it, so the panel could
     never be opened at all. Paired with pointer-events on .thermo-views; either
     one fixes it, and both are cheap. */
  z-index: 2;
  transition: top 0.5s cubic-bezier(0.22, 0.61, 0.36, 1),
              margin-top 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* Once risen there is no overlap left to win, and dropping back to auto lets a
   top-lane face's hover caption -- which overflows the plot upwards on purpose,
   see .is-settled -- draw over the question rather than under it. */
.thermogram.is-open .thermo-head {
  top: var(--thermo-pad-y);
  margin-top: 0;
  z-index: auto;
}

.thermo-question {
  /* no font-family: inheriting the body serif is the point */
  margin: 0;
  text-align: center;
  /* evens the lines out instead of letting the last word wrap on its own */
  text-wrap: balance;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.35;
}

/* Ambient / Internal, directly under the question and the same size in both
   states -- the panel no longer resizes anything when it opens. */
.thermo-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.55rem 0 0.85rem;
}
.thermo-switch-btn {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease,
              box-shadow 0.3s ease, transform 0.2s ease;
  box-shadow: 0 0 0 rgba(255, 183, 3, 0);
}
/* The gold glow off .hero-button on the front page, scaled down for a smaller
   control -- 28px/6px rather than 32px/8px. */
.thermo-switch-btn:hover {
  background: none;
  border-color: var(--gold-400);
  color: var(--gold-400);
  box-shadow: 0 0 28px 6px rgba(255, 183, 3, 0.45);
  transform: translateY(-2px);
}
/* The selected button does not respond to hover at all -- there is nothing to
   select, so offering the affordance is a lie. Every hover declaration above
   has to be undone explicitly, not just the colours. */
.thermo-switch-btn[aria-pressed="true"]:hover {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 rgba(255, 183, 3, 0);
  transform: none;
  cursor: default;
}
.thermo-switch-btn[aria-pressed="true"] {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
}
/* Pinned to the box below the head, so its height is the same in both states --
   which is what makes the view's translateY(100%) a stable distance. It used to
   be a grid row whose height changed as the panel opened, so 100% meant two
   different things and the chart started from the wrong place. */
.thermo-views {
  position: absolute;
  top: calc(var(--thermo-pad-y) + var(--thermo-head));
  left: var(--thermo-pad-x);
  right: var(--thermo-pad-x);
  bottom: var(--thermo-pad-y);
  display: grid;
  min-height: 0;
  /* Closed, this box is empty (its chart is translated out and clipped) but it
     still overlaps the centred head, so it has to be transparent to the pointer
     or the switch underneath is unclickable. Restored on opening, where the
     faces need their own hover. */
  pointer-events: none;
  /* clipped so the chart is hidden below the box while closed and during the
     slide up. .is-settled lifts it once that has finished -- the hover captions
     overflow the plot on purpose and would be cut off. */
  overflow: hidden;
}
.thermogram.is-open .thermo-views { pointer-events: auto; }
.thermogram.is-settled .thermo-views { overflow: visible; }
/* Parked one row-height down, so opening slides it up into place rather than
   the panel resizing around it. */
.thermo-view {
  min-height: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  opacity: 0;
  /* Overshoots slightly and settles, so it springs up rather than just easing
     in. The overshoot carries the chart's top a few px past its resting place,
     where .thermo-views clips it -- which is the part that reads as the spring.
     The head's own rise stays a plain ease-out; springing both looked busy. */
  transition: transform 0.6s cubic-bezier(0.34, 1.32, 0.64, 1),
              opacity 0.4s ease;
}
.thermogram.is-open .thermo-view {
  transform: translateY(0);
  opacity: 1;
}

/* Carousel left, thermogram right. The carousel column is deliberately capped
   near the native width of the social photos (~600px): at the old full-width
   820px they were upscaled 1.37x and looked soft. */
/* align-items: stretch (the default, and why it is not set here) is what makes
   the temperature bar end level with the bottom of the carousel: the carousel's
   3/2 aspect sets the row height, the thermogram stretches to match it, and the
   axis fills whatever the question leaves. The carousel drives rather than
   being driven so the hand-tuned photo crops keep their framing.
   The axis being fluid is safe only because the beeswarm assigns slots against
   AXIS_LENGTH = a *floor* on the axis rather than a typical length -- a longer
   axis just spreads the faces further apart, so slots packed for the floor
   never overlap above it. The layout's real axis runs ~230-280px -- the
   carousel caps its height, and the question and switch above it take ~75px of
   what is left. .thermo-plot's min-height is the floor; keep it equal to
   AXIS_LENGTH in team.astro. 230px is not slack, it is the cliff edge: at 220px
   these ten sleepers need a sixth lane. */
/* Even columns, down from 1.6/1 and then 1.25/1. The chart's width is set by
   the densest 2 F of the distribution, so every added sleeper in that cluster
   takes width from the carousel: ten sleepers need five lanes, and five lanes
   is 432px. Squeezing both into the 1080px page is what made them cramped --
   .outside-block widens the measure to 1280px, which puts the carousel at
   ~596px and the axis at ~317px.
   The face circles deliberately stay 46px. Growing them to 52px tips the swarm
   to a sixth lane, since the vertical clearance a lane needs is the ring
   diameter: that costs ~90px, puts the outermost face ~300px from the bar, and
   stacks the columns below 1200px instead of 1024px. */
.social-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 2.5rem;
}
.social-layout.single { grid-template-columns: minmax(0, 1fr); }
.social-layout .carousel { max-width: 100%; margin: 0; }
/* The dark box, holding only the question and the chart -- the carousel sits
   outside it on the page. The fill is a lifted navy rather than --navy-900
   flat, for two reasons: flat full-strength navy read as a hole in the page
   when this panel tried it before, and the cold end of --gradient-thermogram-v
   *is* --navy-900, so on a flat navy fill the bottom of the temperature bar
   would disappear into its own background. The bar also gets a hairline ring
   (see .thermo-bar) to guarantee its silhouette. If you restyle either, check
   the other. */
.thermogram {
  min-width: 0;
  /* Height of the question-plus-switch block. Fixed, not measured, because the
     chart is positioned against it: one line of question (1.15rem x 1.35) plus
     the switch's 0.55rem gap, its ~28px buttons and its 0.85rem tail, with a
     couple of px of air. If the question ever wraps to two lines this needs to
     grow with it. */
  --thermo-head: 78px;
  /* the absolutely positioned children inset themselves by these, so padding
     and insets cannot drift apart -- the narrow layout narrows the x one */
  --thermo-pad-y: 1.25rem;
  --thermo-pad-x: 1.25rem;
  /* No animated grid here any more. Three attempts at animating
     grid-template-rows all leaked the chart's height into the closed box in one
     way or another -- fr tracks resolve against content, and the two templates
     have to agree on their track types to interpolate at all. Both children are
     absolutely positioned instead, so the box has NO in-flow content and its
     height can only come from the carousel beside it. Every offset below is a
     definite length or a percentage of a definite height.
     Consequence: stacked, where there is no carousel, the min-height in the
     media query at the bottom is the only thing giving this box a height. */
  position: relative;
  padding: var(--thermo-pad-y) var(--thermo-pad-x);
  border-radius: 10px;
  background: linear-gradient(165deg, #0d1544, #05082b 62%);
  border: 1px solid var(--blue-500);
  box-shadow: 0 6px 30px rgba(5, 8, 43, 0.28);
}
.thermo-plot {
  --thermo-axis-len: 230px;  /* the floor; keep equal to AXIS_LENGTH in team.astro */
  --thermo-size: 46px;       /* face diameter; +3px of ring, so 52px visible */
  /* One visible diameter, so rings in adjacent lanes just touch -- which is
     what the original 40px/46px pairing did. Was 54px; the tenth sleeper needed
     the 8px back. */
  --thermo-lane: 52px;
  /* Room for the tick labels left of the bar. 46, up from 40: the internal
     axis now runs past 100 F, and a three-digit label is wider than the
     two-digit ones this was sized for. */
  --thermo-labels: 46px;
  --thermo-gap: 12px;        /* bar edge to the first lane's faces */
  --thermo-animal: 34px;     /* model-system circles, left of the bar */
  --thermo-animal-gap: 5px;  /* between their lanes */
  --thermo-herd: 48px;       /* the three of them collapsed into one circle */
  /* The block left of the tick labels the model systems occupy. Driven by the
     internal panel's LANE COUNT, not the species count: on ambient the animals
     are one circle, and on internal they are a little beeswarm of their own
     whose depth is what needs room. Three lanes as the temperatures stand,
     which is the same 112px the three side-by-side species used to take -- so
     the plot's total width did not move when they were rearranged.
     max() against --thermo-herd because the collapsed circle is wider than a
     single lane, and against 0px because the markup passes a lane count of 0
     when the markers are not drawn at all, which would leave a negative
     gutter. */
  --thermo-left: max(0px, var(--thermo-herd), calc(
    var(--thermo-animal-lanes) * var(--thermo-animal)
    + (var(--thermo-animal-lanes) - 1) * var(--thermo-animal-gap)
  ));
  position: relative;
  flex: 1;
  /* The floor only applies once the panel is open. Closed, the chart has no
     height of its own at all, which is belt and braces on top of the
     minmax(0, ...) tracks: whatever a browser does when resolving fr tracks
     against content, there is now no content here for the closed box to be
     sized off. Everything inside the plot is absolutely positioned, so this
     min-height is its only intrinsic height. */
  width: calc(
    var(--thermo-left) + var(--thermo-labels) + 8px + var(--thermo-gap)
    + (var(--thermo-lanes) - 1) * var(--thermo-lane) + var(--thermo-size)
  );
  margin: 0 auto;
}
.thermogram.is-open .thermo-plot { min-height: var(--thermo-axis-len); }
/* Above the stems (z-index 0) and faces (1) so a stem can overshoot into the
   bar and be covered by it -- see .thermo-stem. Safe because with one-sided
   lanes no face ever overlaps the bar horizontally. */
.thermo-axis {
  position: absolute;
  left: calc(var(--thermo-left) + var(--thermo-labels));
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 2;
}
.thermo-bar {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--gradient-thermogram-v);
  /* the cold end of the ramp is --navy-900, near enough the box fill to vanish;
     this ring keeps the bar's full extent legible */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.thermo-tick {
  position: absolute;
  right: calc(100% + 8px);   /* just left of the bar */
  transform: translateY(50%);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.55);
}
/* Both panels' positions live on the dot; data-active on the .thermogram picks
   which pair applies, so switching slides the faces instead of swapping charts.
   `left` transitions even though --lane is the thing that changes: custom
   properties are substituted at computed-value time, so left's own computed
   length is what interpolates. */
.thermo-dot {
  position: absolute;
  bottom: var(--bottom-ambient);
  --lane: var(--lane-ambient);
  transition: bottom 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  left: calc(
    var(--thermo-left) + var(--thermo-labels) + 8px + var(--thermo-gap)
    + var(--lane) * var(--thermo-lane)
  );
  width: var(--thermo-size);
  height: var(--thermo-size);
  /* `bottom` is set inline as a percentage of the axis, and this pulls the box
     down by half its height so the face is centred on that line. It has to be
     a margin, not translateY(-50%): a transform would make every dot its own
     stacking context, which confines the z-indexes below to a single dot and
     leaves cross-dot paint order decided by DOM order alone -- that is exactly
     what put one person's leader line on top of another's face. */
  margin-bottom: calc(var(--thermo-size) / -2);
}
/* On the internal panel everyone converges on one point and fades, leaving the
   group circle that fades in underneath them. */
.thermogram[data-active="internal"] .thermo-dot {
  bottom: var(--bottom-internal);
  --lane: 0;
  pointer-events: none;
}
/* Fade the parts, never the dot itself. An element with opacity below 1 becomes
   its own stacking context, so fading .thermo-dot confined its stem's z-index 0
   to that one dot and left cross-dot paint order to DOM order alone: one
   person's stem drew over another's face for the length of the fade, then
   snapped behind the instant opacity hit 1 and the contexts dissolved. This is
   the same trap the margin-bottom note above avoids for transforms. */
/* Scoped to .thermo-dot: unscoped, this also faded the group circle's own
   stem, which is the one stem that has to stay visible on this panel. */
.thermogram[data-active="internal"] .thermo-dot .thermo-face { opacity: 0; }
/* Width 0, not just transparent. At its natural --lane: 0 width it is still a
   20px stub, and on the way back that stub faded in before the faces had
   finished moving. Nothing, then it grows. */
.thermogram[data-active="internal"] .thermo-dot .thermo-stem {
  opacity: 0;
  width: 0;
}
/* Both scales sit on the axis at once and cross-fade. */
.thermo-ticks {
  position: absolute;
  inset: 0;
  transition: opacity 0.45s ease;
}
.thermo-ticks[data-set="internal"] { opacity: 0; }
.thermogram[data-active="internal"] .thermo-ticks[data-set="ambient"] { opacity: 0; }
.thermogram[data-active="internal"] .thermo-ticks[data-set="internal"] { opacity: 1; }

/* The whole lab as one circle, at body temperature. Bigger than a face because
   it stands for all of them, and it arrives slightly after the faces start
   moving so the collapse reads as cause and effect. */
.thermo-group {
  --thermo-group-size: 58px;
  position: absolute;
  left: calc(var(--thermo-left) + var(--thermo-labels) + 8px + var(--thermo-gap));
  bottom: var(--bottom-internal);
  width: var(--thermo-group-size);
  height: var(--thermo-group-size);
  margin-bottom: calc(var(--thermo-group-size) / -2);
  z-index: 3;
  opacity: 0;
  transform: scale(0.55);
  pointer-events: none;
  transition: opacity 0.5s ease 0.15s,
              transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1) 0.15s;
}
.thermogram[data-active="internal"] .thermo-group {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
/* Stops at the bar's edge instead of overshooting into it. Every other stem
   overshoots and is covered by the bar at z-index 2, but .thermo-group has a
   z-index and a transform of its own, so it is a stacking context and its
   stem paints above the bar however low its own z-index is. The bar's 1px
   ring covers the join. */
.thermo-group .thermo-stem { width: var(--thermo-gap); }
.thermo-group-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 0 0 3px var(--dot-color), 0 2px 10px rgba(5, 8, 43, 0.15);
  transition: transform 0.2s ease;
}
/* Grey, to sit with the team headshots -- they are black and white, and the
   whole point of this circle is that it IS those same faces collapsed into
   one, so a colour lab-lunch photo read as a different kind of mark rather
   than the sum of them. */
.thermo-group-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.thermo-group:hover .thermo-group-face {
  z-index: 6;
  transform: scale(1.1);
}
.thermo-group:hover .thermo-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Stems sit in their own layer *below* every face, so the leader line of a
   face in an outer lane passes behind the faces it crosses rather than being
   drawn across them. .thermo-dot has z-index:auto, so these z-indexes are
   compared across all the dots rather than only within one. */
.thermo-stem {
  position: absolute;
  right: 100%;
  top: 50%;
  z-index: 0;
  height: 3px;
  margin-top: -1.5px;
  /* Deliberately overshoots the bar by 8px -- its own width -- instead of
     stopping at the bar's edge. Stopping exactly at the edge is what kept
     reading as a gap: any sub-pixel rounding in the lane arithmetic, and the
     3px ring drawn over the stem's own near end, leave a hairline. The bar
     sits at z-index 2 so the overshoot is covered rather than drawn across it,
     which means this cannot come apart however the arithmetic rounds. */
  width: calc(var(--thermo-gap) + var(--lane) * var(--thermo-lane) + 8px);
  background: var(--dot-color);
  /* The stem's width follows --lane, so without this it snapped to full length
     while its face was still sliding. The delay makes the two directions
     differ: a transition is read off the state being entered, so returning to
     ambient (this rule) lets the face arrive first and then extends the stem
     out to the bar, while collapsing inward (the rule below) pulls it in at
     once. */
  /* Both delayed by the 0.7s the faces take to slide, so on the way back there
     is no stem at all until every face has landed -- then they fade in and
     extend out to the bar together. */
  transition: width 0.4s ease 0.7s, opacity 0.25s ease 0.7s;
}
/* Collapsing inward, the stem shrinks on the same curve and duration as its
   face's `left`, so the two stay joined as they travel. */
.thermogram[data-active="internal"] .thermo-stem {
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}
/* Sleep z's drifting off a face's upper-right on hover, in that person's own
   place on the gradient. Sits above the caption chip (z-index 2) rather than
   under it: the chip is centred directly over the face, so anything rising off
   the top with a lower z-index would just disappear behind it. The glow is
   there because the coldest sleeper's colour is a near-navy blue, which on the
   navy box would otherwise be all but invisible. */
.thermo-zzz {
  position: absolute;
  left: 78%;
  bottom: 72%;
  z-index: 3;
  pointer-events: none;
}
.thermo-zzz span {
  position: absolute;
  font-family: var(--font-display);
  /* bold rather than glowing: the glow was what made these look hazy, but it
     was also carrying legibility for the coldest sleeper, whose colour is a
     near-navy blue. Weight does that job without the haze. */
  font-weight: 700;
  line-height: 1;
  color: var(--dot-color);
  opacity: 0;
}
/* Big, then medium, then small, each a third of the cycle behind the last.
   They all travel the same distance in the same time, which is the whole
   point: they used to drift 24px, 40px and 54px on a shared 2.7s cycle, so
   the small one covered its path more than twice as fast as the big one and
   the three visibly moved at different speeds. Same path, same duration,
   same speed -- only the size and the timing differ.
   The delays were being thrown away until the shorthand below was split into
   longhands; see the note there. */
.thermo-zzz span:nth-child(1) { font-size: 1.15rem; animation-delay: 0s; }
.thermo-zzz span:nth-child(2) { font-size: 0.85rem; animation-delay: 0.8s; }
.thermo-zzz span:nth-child(3) { font-size: 0.62rem; animation-delay: 1.6s; }
/* Longhands, not the `animation` shorthand. The shorthand resets every
   sub-property it omits, so `animation: ... infinite` here was setting
   animation-delay back to 0s -- and this selector outspecifies the
   :nth-child rules above, so all three z's were firing at once however
   the delays were written. That is what kept them looking stacked. */
.thermo-dot:hover .thermo-zzz span,
.thermo-animal:hover .thermo-zzz span,
.thermo-herd:hover .thermo-zzz span,
.thermo-group:hover .thermo-zzz span {
  animation-name: thermo-snooze;
  animation-duration: 2.4s;
  /* linear, not ease-out. A timing function applies between each *pair* of
     keyframes, and transform is only declared at 0% and 100% -- so ease-out
     spanned the whole 2.4s: the z covered roughly 40% of its path in the
     first 15% of the time and then crawled. Held at full opacity until 65%,
     it visibly hung almost still before fading. */
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes thermo-snooze {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-12deg); }
  12%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translate(28px, -44px) rotate(12deg); }
}
/* Model systems. The mirror of the people: one circle on ambient, where all
   three species are housed at the same 22 C and there is only one number to
   show, expanding into a marker per state on internal, where each species has
   both a body temperature and a torpid one. Everything lives in the block
   outboard of the tick labels, so no animal marker ever collides with the human
   swarm on the far side of the bar.

   Tardigrades appear only in the collapsed circle. They have no core body
   temperature, so there is no honest place to put them on the internal axis --
   see ANIMAL_STATES in src/pages/team.astro. */

/* --- collapsed: all three species, ambient only ------------------------- */
/* Right-aligned against the gutter's inner edge, so its stem is the short one
   and the expanded markers grow leftwards out from under it. */
.thermo-herd {
  position: absolute;
  left: calc(var(--thermo-left) - var(--thermo-herd));
  bottom: var(--bottom-ambient);
  width: var(--thermo-herd);
  height: var(--thermo-herd);
  /* a margin, not translateY, for the same reason .thermo-dot uses one: a
     transform would make this its own stacking context and cut its stem's
     z-index off from the rest of the plot */
  margin-bottom: calc(var(--thermo-herd) / -2);
  z-index: 3;
  transition: opacity 0.5s ease 0.15s,
              transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1) 0.15s;
}
/* Leaves on the internal panel, where the markers below have taken over. Same
   delayed shrink-and-fade as .thermo-group's arrival, so the two exchanges read
   as the same gesture run in opposite directions. */
.thermogram[data-active="internal"] .thermo-herd {
  opacity: 0;
  transform: scale(0.55);
  pointer-events: none;
}
/* Crosses the label gutter -- at 71.6 F there is no tick in the way -- and
   stops at the bar's edge rather than overshooting into it. Same reason
   .thermo-group's stem does: this element has a z-index of its own, so it is a
   stacking context and its stem would paint ABOVE the bar however low the
   stem's own z-index is. The bar's 1px ring covers the join. */
.thermo-herd .thermo-stem {
  right: auto;
  left: 100%;
  width: var(--thermo-labels);
}
.thermo-herd-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* the triangle's corners would otherwise poke out of the circle */
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--dot-color), 0 2px 10px rgba(5, 8, 43, 0.15);
  transition: transform 0.2s ease;
}
/* One up top, two below -- see TRIANGLE in components/ThermoPlot.astro. Each is
   centred on its own point, so the arrangement holds at any circle size. */
.thermo-herd-face .thermo-art {
  position: absolute;
  left: var(--tri-x);
  top: var(--tri-y);
  width: 48%;
  height: 48%;
  transform: translate(-50%, -50%);
}
.thermo-herd:hover .thermo-herd-face {
  z-index: 6;
  transform: scale(1.12);
}
.thermo-herd:hover .thermo-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- expanded: one marker per species per state, internal only ---------- */
/* Lane 0 is the lane NEAREST the bar and the gutter fills from its right edge
   inwards, which is the people's lanes mirrored -- theirs count outwards from
   the bar on the other side. Collapsed, every marker sits in lane 0 at the herd
   circle's own height, so they converge under it and fade rather than sliding
   off somewhere of their own. */
.thermo-animal {
  position: absolute;
  --lane: 0;
  left: calc(
    var(--thermo-left)
    - (var(--lane) + 1) * var(--thermo-animal)
    - var(--lane) * var(--thermo-animal-gap)
  );
  bottom: var(--bottom-ambient);
  width: var(--thermo-animal);
  height: var(--thermo-animal);
  margin-bottom: calc(var(--thermo-animal) / -2);
  /* NO z-index, deliberately -- .thermo-dot has none either, and for the same
     reason. A z-index here makes the marker a stacking context, which confines
     its stem's z-index: 0 to that one marker and leaves cross-marker paint
     order to DOM order alone. That is exactly what drew the mouse's leader line
     across the hamster's face: the two body temperatures are ~2 F apart, the
     mouse is in the outer lane, and it sorts last. With this at auto the stems
     all sit in one layer beneath every face.
     The hover caption still clears the bar without it: .thermo-caption's own
     z-index of 2 now competes globally, ties with .thermo-axis, and wins on
     being later in the document. */
  pointer-events: none;
  transition: bottom 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.thermogram[data-active="internal"] .thermo-animal {
  bottom: var(--bottom-internal);
  --lane: var(--lane-internal);
  pointer-events: auto;
}
/* Fade the parts, never the marker itself -- the same trap .thermo-dot documents
   at length: opacity below 1 makes an element its own stacking context, which
   would cut each marker's stem off from the cross-marker paint order. */
.thermo-animal .thermo-animal-face { opacity: 0; }
.thermogram[data-active="internal"] .thermo-animal .thermo-animal-face { opacity: 1; }
/* Width 0, not just transparent, for the reason .thermo-dot's stem is: at its
   natural lane-0 length it is still a stub, and a stub fading in under the herd
   circle looks like a mistake. Nothing, then it grows. */
.thermo-animal .thermo-stem {
  right: auto;
  left: 100%;
  opacity: 0;
  width: 0;
  /* Collapsing inward, the stem shrinks on the same curve and duration as the
     marker's `left`, so the two stay joined as they travel. */
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}
/* Delayed by the 0.7s the markers take to slide, so on the way out there is no
   stem at all until every marker has landed -- then they fade in and extend to
   the bar together. Note this is the OPPOSITE way round from the people's
   stems: their delay is on the return to ambient, because that is the direction
   in which they expand. */
.thermogram[data-active="internal"] .thermo-animal .thermo-stem {
  opacity: 1;
  /* Overshoots the bar by 8px -- its own width -- and is covered by it, which
     is what every stem but .thermo-herd's and .thermo-group's does. Stopping
     exactly at the edge kept reading as a hairline gap wherever the lane
     arithmetic rounded. Safe again now that .thermo-animal carries no z-index
     of its own; while it did, the overshoot was drawn OVER the bar instead.
     One lane step further out for every lane out from the bar. */
  width: calc(
    var(--thermo-labels) + 8px
    + var(--lane) * (var(--thermo-animal) + var(--thermo-animal-gap))
  );
  transition: width 0.4s ease 0.7s, opacity 0.25s ease 0.7s;
}
/* Only the circle grows on hover, which is why it is a separate element from
   .thermo-animal -- scaling the whole marker would drag the caption and the
   z's along with it. Same split, and same 1.12, as the people's .thermo-face. */
.thermo-animal-face {
  position: absolute;
  inset: 0;
  /* 1, like .thermo-face: above every stem at 0, below a hovered circle at 6 */
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--dot-color), 0 2px 10px rgba(5, 8, 43, 0.15);
  transition: transform 0.2s ease, opacity 0.45s ease;
}
/* Sized, and centred by the circle's own flex box. This was `position: absolute;
   inset: 2px` with the size left to resolve from the offsets, which is right for
   a block but NOT for a replaced element: an abspos <img> with width/height auto
   takes its INTRINSIC size and the over-constrained offset is simply dropped, so
   each animal rendered at the source PNG's 320px, anchored top-left, and the
   circle's overflow: hidden showed a 30px window onto its transparent corner.
   The animals were there the whole time, 10x too big to see.
   Percentages, like the herd's 48%, so both scale with their circle. */
.thermo-animal-face .thermo-art {
  /* flex: none so neither the grow nor the shrink factor can touch these. A
     replaced flex item's automatic minimum size is its INTRINSIC size unless it
     has a definite preferred size to clamp against -- it does here, but saying
     so outright is cheaper than relying on that clause. */
  flex: none;
  width: 88%;
  height: 88%;
}
/* Only the circle lifts, never the marker -- see the z-index note on
   .thermo-animal. Its 6 below already beats a neighbour's face at 1, so there
   is nothing for a marker-level z-index to add, and adding one would put the
   stem back in front of the faces it crosses for as long as the hover lasted. */
/* z-index 6 for the same reason .thermo-face has it: it has to beat the z's at
   3, or they are drawn over the circle instead of rising from behind it. */
.thermo-animal:hover .thermo-animal-face {
  z-index: 6;
  transform: scale(1.12);
}
/* Full colour, on purpose -- the one thing on this panel that is. This used to
   carry filter: grayscale(1) to sit with the team headshots, which are black
   and white, but the drawings lose most of what makes them legible at 30px when
   they are grey on grey. The photos being uniformly grey is what lets the art
   stay the exception. If it ever needs to go back, it is one line here rather
   than a re-cut of the PNGs. */
.thermo-art {
  display: block;
  /* contain, not cover: these are drawn characters on transparency, and cropping
     one to fill a circle cuts its ears off */
  object-fit: contain;
}
.thermo-animal .thermo-caption { bottom: calc(100% + 8px); }
.thermo-animal:hover .thermo-caption { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Snowflakes off a torpor marker, where a sleeping one gets z's. They radiate
   in all six directions rather than drifting up and to the right: the animal is
   not asleep, it is cold, and the difference should be visible before you read
   the caption. Directions come from FLAKES in components/ThermoPlot.astro. */
.thermo-flakes {
  position: absolute;
  inset: 0;
  /* same layer as .thermo-zzz, and above the caption chip for the same reason:
     the chip is centred over the marker, so a flake behind it would vanish */
  z-index: 3;
  pointer-events: none;
}
.thermo-flakes span {
  position: absolute;
  left: 50%;
  top: 50%;
  /* em, so a flake stays centred on its point at whatever size it is given */
  margin: -0.4em 0 0 -0.4em;
  /* a fallback only: the real per-flake size is inline, from FLAKE_SIZES in
     components/ThermoPlot.astro */
  font-size: 0.8rem;
  line-height: 1;
  /* A pale ice tint, NOT --dot-color the way the z's are. The coldest marker is
     the whole reason these exist, and its own colour is the near-navy bottom of
     the ramp -- on this navy box its flakes would have been invisible on the
     one marker that needed them. The ring already carries the exact
     temperature; the flakes only have to say "cold".
     The z's get away with --dot-color because font-weight: 700 carries them;
     a snowflake glyph has no weight to lean on. */
  color: #dbeeff;
  opacity: 0;
}
/* Longhands, not the `animation` shorthand -- the shorthand resets every
   sub-property it omits, which is what silently threw away the z's delays for
   so long. animation-delay is deliberately absent here: each flake carries its
   own inline, and omitting it is what lets that survive this rule.
   animation-duration must stay equal to FLAKE_CYCLE in ThermoPlot, which is
   what the inline delays are spread across. */
.thermo-animal[data-mode="torpor"]:hover .thermo-flakes span {
  animation-name: thermo-frost;
  /* 1.7s, down from 2.2. Keep equal to FLAKE_CYCLE in ThermoPlot -- the inline
     per-flake delays are spread across exactly this long, so if the two drift
     apart the ring stops being evenly staggered. */
  animation-duration: 1.7s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
/* linear for the same reason thermo-snooze is: a timing function applies
   between each PAIR of keyframes, and transform is only declared at the ends,
   so anything eased would cover most of the path in the first fraction of the
   time and then crawl. */
/* Fading in by 9% rather than 18%: at 2.2s the first flake did not reach full
   opacity until 0.4s after the pointer landed, and the last one not for 2.4s,
   which felt like the frost had to warm up. Now it is 0.15s and 1.7s. */
@keyframes thermo-frost {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  9%   { opacity: 1; }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(1) rotate(150deg); }
}
.thermo-face {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 0 0 3px var(--dot-color), 0 2px 10px rgba(5, 8, 43, 0.15);
  transition: transform 0.2s ease, opacity 0.45s ease;
}
.thermo-face img,
.thermo-initials {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thermo-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dot-color);
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: #fff;
}
.thermo-caption {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 10px);
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.65rem;
  border-radius: 5px;
  /* the colour cue is the bottom edge, so the text stays legible at both ends
     of the gradient -- gold on a light chip would not be */
  border-bottom: 3px solid var(--dot-color);
  background: #fff;
  box-shadow: var(--shadow-card);
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.thermo-caption strong {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
}
.thermo-caption .thermo-temp {
  font-size: 0.8rem;
  color: var(--muted);
}
/* Raise the face and its chip, never the whole dot -- lifting the dot would
   carry its stem up with it and draw it back over the faces it crosses. */
.thermo-dot:hover .thermo-face {
  z-index: 6;
  transform: scale(1.12);
}
.thermo-dot:hover .thermo-caption {
  z-index: 7;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .thermogram,
  .thermo-question,
  .thermo-switch,
  .thermo-switch-btn,
  .thermo-face,
  .thermo-animal-face,
  .thermo-herd-face,
  .thermo-caption { transition: none; }
  .thermo-dot:hover .thermo-face,
  .thermo-animal:hover .thermo-animal-face,
  .thermo-herd:hover .thermo-herd-face,
  .thermo-group:hover .thermo-group-face { transform: none; }
  /* the panel switch stops sliding and just cuts */
  .thermo-dot,
  .thermo-ticks,
  .thermo-animal,
  .thermo-herd,
  .thermo-group,
  .thermo-stem,
  .thermo-view { transition: none; }
  /* both outspecify the .thermo-stem above, so they need saying separately */
  .thermogram[data-active="internal"] .thermo-stem,
  .thermo-animal .thermo-stem,
  .thermogram[data-active="internal"] .thermo-animal .thermo-stem { transition: none; }
  .thermo-group,
  .thermo-herd { transform: none; }
  /* Both the z's and the flakes are motion and nothing but; without it they
     would stack up unmoving in one spot, so drop them rather than freeze
     them. The flakes go with them: six glyphs piled on a 34px circle is not a
     legible still. */
  .thermo-dot:hover .thermo-zzz span,
  .thermo-animal:hover .thermo-zzz span,
  .thermo-herd:hover .thermo-zzz span,
  .thermo-group:hover .thermo-zzz span,
  .thermo-animal[data-mode="torpor"]:hover .thermo-flakes span { animation: none; }
}
/* Stack the two columns before the right column gets narrower than the plot's
   own width, and before the box's contents outgrow the carousel's height and
   leave the bar stopping short of the carousel's bottom edge. The third model
   panel's header is what binds now, not the plot's 432px width: the question
   plus the Ambient/Internal switch cost ~75px above the axis, so the box needs
   a carousel about 348px tall to keep the axis at its 230px floor, and it stops
   getting one below ~1150px. The head is a fixed 78px now, so the sum is
   42px of padding + 78 + the 230px floor = 350px of carousel. */
@media (max-width: 1160px) {
  .social-layout { grid-template-columns: 1fr; gap: 2rem; }
  /* width has to be said outright. A grid item with auto side margins is no
     longer stretched -- it shrinks to its content -- and every slide in here is
     absolutely positioned, so the content width is 0 and the whole carousel
     vanished whenever the columns stacked. 820px is .carousel's own cap, which
     the two-column rule above overrides to 100%. */
  .social-layout .carousel { width: 100%; max-width: 820px; margin: 0 auto; }
  /* Stacked, there is no carousel to match, and minmax(0, 1fr) means the box
     will not size itself off the chart either -- so it needs an explicit
     height. 460px leaves 343px for the axis, just over its 340px floor here. */
  .thermogram.is-open .thermo-plot { min-height: 340px; }
  .thermogram { --thermo-pad-x: 1rem; min-height: 460px; }
}
/* Phones. Everything above assumes the box is at least as wide as the plot,
   and the plot is a fixed 432px: five lanes of 46px faces plus the animals'
   gutter. Below ~520px it is not, and three things broke at once -- the plot
   ran off the right of the screen and made the whole page scroll sideways, the
   question wrapped to two lines and the switch to two rows so the head was
   138px against the 78px the chart is offset by, and the chart then sat on top
   of the Internal button, which could not be tapped.
   The lane ASSIGNMENT is not touched: it only needs faces in one lane to be a
   face-height apart vertically, and smaller faces on this taller stacked axis
   clear that with room to spare. Only the horizontal sizes shrink. */
@media (max-width: 520px) {
  .outside-block .wrap { padding: 0 0.75rem; }
  /* a hover chip is centred on its face and may be wider than the room left
     beside an outer-lane face; opacity 0 still counts towards page width */
  .outside-block { overflow-x: clip; }
  .thermogram {
    --thermo-pad-x: 0.5rem;
    /* two lines of question rather than one: 78px + one more 1.15rem x 1.35 line */
    --thermo-head: 104px;
    /* 40px of padding + the head + the 340px axis floor */
    min-height: 486px;
  }
  /* one row at any phone width, which is what --thermo-head budgets for */
  .thermo-switch { flex-wrap: nowrap; gap: 0.4rem; }
  .thermo-switch-btn {
    font-size: 0.7rem;
    letter-spacing: 0;
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
  }
  .thermo-plot {
    --thermo-labels: 40px;
    --thermo-gap: 8px;
    --thermo-animal: 24px;
    --thermo-animal-gap: 3px;
    --thermo-herd: 36px;
    /* Whatever is left of the screen after the gutter, labels and bar, shared
       between the lanes. 62px = the wrap's and the box's side padding, the
       box's border, and a scrollbar's worth of slack. Tops out at the desktop
       46px, so this hands over to the rules above without a jump. */
    --thermo-size: clamp(20px, calc(
      (100vw - 62px - var(--thermo-left) - var(--thermo-labels) - 8px
       - var(--thermo-gap) - (var(--thermo-lanes) - 1) * 6px)
      / var(--thermo-lanes)
    ), 46px);
    /* one visible diameter, as on desktop: the face plus its 3px ring each side */
    --thermo-lane: calc(var(--thermo-size) + 6px);
  }
  .thermo-tick { font-size: 0.65rem; }
  .thermo-group { --thermo-group-size: 48px; }
  /* Lean each chip back towards the middle of the plot, further the further
     out its lane is, so the outermost ones are not cut off at the screen edge. */
  .thermo-dot .thermo-caption { left: calc(50% - var(--lane) * 13px); }
  .thermo-animal .thermo-caption { left: calc(50% + var(--lane) * 12px); }
}

/* Social — rotating photo carousel on the team page */
.carousel {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.carousel-track {
  position: relative;
  aspect-ratio: 3 / 2;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.carousel-slide.is-active { opacity: 1; }
.carousel-slide { pointer-events: none; }
.carousel-slide.is-active { pointer-events: auto; }
.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.carousel-slide figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.5rem 1.25rem 0.9rem;
  color: #fff;
  font-size: 0.95rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
}
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-nav:hover { background: rgba(0, 0, 0, 0.65); }
.carousel-nav.prev { left: 0.75rem; }
.carousel-nav.next { right: 0.75rem; }
.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.75rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}
.carousel-dots .dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-dots .dot.is-active { background: #fff; }
@media (prefers-reduced-motion: reduce) {
  .carousel-slide { transition: none; }
}

.alumni-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem 2rem;
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}
.alumni-grid li { margin: 0; }
.alumni-grid .role { color: var(--muted); font-size: 0.9rem; }
.alumni-grid .note { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }

/* News */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
/* Each post is a photo tile; the date and blurb sit behind a frosted panel
   that fades in on hover. */
.news-card .news-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 1;
  box-shadow: var(--shadow-card);
}
.news-card .news-thumb.no-photo { background: var(--bg-alt); }
/* Buttons rather than links-in-prose. align-self keeps them shrink-wrapped and
   centred instead of stretching to the overlay's full width. */
/* One pill for every outline button on the site -- the news tiles, the archive
   control and the back links. Blue outline at rest, filling blue with white
   text on hover, plus a soft blue glow. No text-transform: the labels are
   written in sentence case and stay that way. Gold is left to the front-page
   hero and the thermogram switch. Only padding and font-size vary below. */
.news-overlay .news-more,
.news-archive-link a,
.back-link {
  display: inline-block;
  border: 2px solid var(--blue-500);
  border-radius: 999px;
  background: none;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--blue-500);
  box-shadow: 0 0 0 rgba(2, 120, 205, 0);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease,
              box-shadow 0.3s ease, transform 0.2s ease;
}
.news-overlay .news-more:hover,
.news-archive-link a:hover,
.back-link:hover {
  background: var(--blue-500);
  color: #fff;
  box-shadow: 0 0 20px 4px rgba(2, 120, 205, 0.4);
  transform: translateY(-2px);
}
.news-overlay .news-more {
  align-self: center;
  margin-top: 0.7rem;
  padding: 0.4rem 1rem;
  font-size: 0.78rem;
}
.back-link {
  padding: 0.4rem 1rem;
  font-size: 0.78rem;
}
/* The paper button carries its citation on a second line rather than swapping
   to it on hover. Tight leading so the two lines read as one control. */
.news-overlay .news-more-paper { line-height: 1.15; }
.news-overlay .news-more-paper > span { display: block; }
.news-overlay .news-more-cite {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  opacity: 0.78;
}
.news-card .news-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.news-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* `safe` keeps overflowing content reachable instead of clipping it off the
     top; the plain value above is the fallback where safe is not supported. */
  justify-content: safe center;
  /* A visible scrollbar takes its width out of the content box on the right
     only, which is what shifted the centred text a few px left on the tiles
     with long titles. scrollbar-gutter: stable both-edges was the first fix and
     depends on both-edges being supported; hiding the scrollbar outright does
     not. Content still scrolls by wheel, touch and keyboard. */
  overflow-y: auto;
  scrollbar-width: none;
  padding: 1.25rem;
  text-align: center;
  background: rgba(242, 240, 234, 0.86);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.news-overlay::-webkit-scrollbar { display: none; }
.news-card .news-thumb:hover .news-overlay { opacity: 1; }
.news-overlay time {
  display: block;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--blue-500);
  margin-bottom: 0.5rem;
}
.news-overlay p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink);
}
/* Nothing to reveal without a photo. Touch screens: see "news tiles" below. */
.news-card .news-thumb.no-photo .news-overlay { opacity: 1; }
@media (max-width: 820px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .news-grid { grid-template-columns: 1fr; }
}
.news-archive-link {
  margin-top: 2.5rem;
  text-align: center;
}
/* the page's main control, so it is the largest of the pills */
.news-archive-link a {
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
}

/* Publications */
.pub-list { list-style: none; padding: 0; }
.pub-list li { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.pub-list .pub-title { font-weight: bold; }
.pub-list .pub-meta { color: var(--muted); font-size: 0.9rem; }

/* Contact */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2.5rem;
  align-items: start;
}
.contact-map {
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.contact-map iframe {
  width: 100%;
  height: 450px;
  border: 0;
  display: block;
}
@media (max-width: 700px) {
  .contact-layout { grid-template-columns: 1fr; }
  .contact-map iframe { height: 350px; }
}

/* Footer */
/* The thermal rule closes every page as well as opening it -- same 3px
   full-bleed bar as .site-header's ::after, and it replaces the plain border
   this used to have rather than sitting alongside it. */
.site-footer {
  position: relative;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--gradient-thermal);
}
.site-footer p { margin: 0.2rem 0; }
.site-footer a { color: inherit; }
/* The MIT-required Accessibility link, on pages that hide the footer (the home hero). */
.a11y-corner-link {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  font-size: 0.85rem;
  color: #e7e9f7;
}

/* Dev-only photo editor (npm run dev only — see src/components/DevPhotoEditor.astro) */
.dev-edit-photo-btn {
  display: block;
  margin: 0 auto 0.6rem;
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.dev-edit-photo-btn:hover {
  border-color: var(--blue-500);
  color: var(--blue-500);
}
/* on the social carousel the button rides on top of the photo itself */
.carousel-slide .dev-edit-photo-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  margin: 0;
  z-index: 2;
}
#dev-crop-modal {
  width: min(900px, 92vw);
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  border: none;
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--bg);
  color: var(--ink);
}
#dev-crop-modal h2 { font-size: 1.1rem; margin: 0; }
#dev-crop-modal::backdrop {
  background: rgba(5, 8, 43, 0.55);
}
.dev-crop-panes {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.dev-crop-pane-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}
.dev-crop-image-wrap {
  width: min(380px, 100%);
}
.dev-crop-image-wrap img {
  display: block;
  max-width: 100%;
}
/* Round the crop window itself wherever the photo lands in a circle, so the
   dimmed part of the picture is exactly the part that gets thrown away. The
   selector reaches into Cropper.js's own markup, which it builds as a sibling
   of the <img> inside .dev-crop-image-wrap. */
.dev-crop-pane[data-shape="circle"] .cropper-view-box,
.dev-crop-pane[data-shape="circle"] .cropper-face {
  border-radius: 50%;
}
/* Cropper renders a live copy of the crop into .dev-crop-preview and sets its
   own width/height on it -- to the box's existing size, since the crop and the
   box share an aspect ratio. Everything else here is ours. */
.dev-crop-preview-wrap {
  margin-top: 0.9rem;
  text-align: center;
}
.dev-crop-preview {
  /* Cropper sets overflow: hidden here itself; stated anyway, because it is
     what makes the rounding actually clip the copy it draws inside. */
  overflow: hidden;
  margin: 0 auto;
  border-radius: 4px;
  background: var(--bg-alt);
  box-shadow: var(--shadow-card);
}
.dev-crop-pane[data-shape="circle"] .dev-crop-preview {
  border-radius: 50%;
}
.dev-crop-preview-label {
  margin: 0.4rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}
.dev-crop-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
}
.dev-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.dev-crop-actions button {
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
#dev-crop-save {
  background: var(--blue-500);
  color: #fff;
  border-color: var(--blue-500);
}

/* ---- Phones: home hero and header ---- */
@media (max-width: 700px) {
  /* Five links cannot share one row at phone width; keep the two rows tight
     so they read as one menu rather than two stacked bars. */
  .site-header nav ul { gap: 0.35rem 1.1rem; }
  .site-header nav a { font-size: 1.1rem; }
  /* Narrow enough that the links always break 3 + 2: at 390px they otherwise
     fit four across and leave "Contact" alone on the second row. */
  .site-header nav ul { max-width: 20rem; }
  .header-inner.nav-only nav ul { margin: 0 auto; }
  /* Smaller brand block so the institute name stays on one line and the
     header doesn't take half the screen on inner pages. */
  .brand-title { font-size: 1.5rem; }
  .brand-sub { font-size: 0.9rem; }
  .header-inner { min-height: 0; }
  /* Fit "HRVATIN LAB" on one line at any phone width. */
  .hero-landing h1 { font-size: clamp(2.2rem, 11vw, 4rem); white-space: nowrap; }
  .hero-landing p.hero-org { font-size: 1rem; padding: 0 1rem; }
  /* On a tall narrow screen "cover" cropped both mice off the sides. Show the
     whole photo width instead, below the title; its border is one flat navy
     (rgb 2,1,71), so the fill colour hides the photo's edges. */
  .hero-landing {
    background-color: rgb(2, 1, 71);
    background-size: 100% 100%, 110% auto;
    background-repeat: no-repeat;
    background-position: center, center 75%;
  }
}

/* ---- Touch screens: news tiles ---- */
/* No hover on a phone, so the text used to sit over every photo permanently.
   Now the photo shows first; a tap opens that tile's text (is-open, toggled by
   the script in Base.astro) and a second tap closes it. The closed overlay
   takes no taps, so the first tap can't land on a hidden link. The selector
   out-ranks .news-thumb:hover, which phones leave stuck on after a tap. */
@media (hover: none) {
  .news-card .news-thumb:not(.is-open):not(.no-photo) .news-overlay { opacity: 0; pointer-events: none; }
  .news-card .news-thumb.is-open .news-overlay { opacity: 1; }
  .news-card .news-thumb:not(.no-photo) { cursor: pointer; }
  .news-card .news-thumb:not(.no-photo)::after {
    content: "Tap to read";
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(242, 240, 234, 0.9);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .news-card .news-thumb.is-open::after { opacity: 0; }
}
