/* =============================================================
   Jaehoon Chung — academic homepage

   1. Tokens        5. Sections (research, activity, papers,
   2. Base             publications)
   3. Primitives    6. Footer
   4. Header/hero   7. Responsive, motion, print
   ============================================================= */

/* 1. Tokens -------------------------------------------------- */

:root {
  color-scheme: light;

  /* Surfaces */
  --paper: #f5f1e8;
  --surface: #fffdf7;
  --surface-cool: #e8f3f0;

  /* Ink. All three clear WCAG AA (4.5:1) on --paper and --surface. */
  --ink: #17324d;
  --ink-soft: #445f6d;
  --muted: #5b6e74;

  /* Rules */
  --rule: #c4d2cf;
  --rule-dark: #9fb6b3;

  /* Accents. Plain token = marks and small text, -soft = fills and shadows.
     Attach a pair to a component with .accent-* below. */
  --teal: #117878;
  --teal-soft: #cfe8e3;
  --blue: #4f7cac;
  --blue-soft: #dce7f2;
  --coral: #c04434;
  --coral-soft: #f4d7cf;
  --ochre: #d9942f;
  --ochre-soft: #f2dfb8;

  /* Tinted bands, derived so the palette above stays the single source */
  --band-rule: color-mix(in srgb, var(--rule-dark) 68%, transparent);
  --band-paper: color-mix(in srgb, var(--surface) 68%, transparent);
  --band-warm: color-mix(in srgb, var(--coral-soft) 34%, transparent);
  --band-cool: color-mix(in srgb, var(--surface-cool) 62%, transparent);
  --header-bg: color-mix(in srgb, var(--paper) 92%, transparent);
  --figure-bg: color-mix(in srgb, var(--surface) 93%, transparent);

  /* Type */
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --fs-micro: 0.69rem;
  --fs-label: 0.74rem;
  --track: 0.065em;

  /* Space */
  --shell: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 72px;
  --section-pad: clamp(4.25rem, 6.5vw + 2rem, 7.5rem);

  /* Offset shadows. Scaled down together on small screens. */
  --lift-lg: 12px;
  --lift-md: 8px;
  --lift-sm: 6px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 2. Base ---------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-synthesis-weight: none;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Graph-paper backdrop */
body::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  content: "";
  pointer-events: none;
}

/* Polygon wash behind the hero */
body::after {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: min(46vw, 720px);
  height: 880px;
  background: color-mix(in srgb, var(--teal) 6%, transparent);
  clip-path: polygon(18% 0, 100% 0, 100% 78%, 74% 100%, 36% 82%, 0 45%);
  content: "";
  pointer-events: none;
}

body.menu-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
ol,
ul,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

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

button,
input {
  font: inherit;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 150ms ease;
}

a:hover {
  color: var(--coral);
}

strong {
  color: var(--ink);
  font-weight: 600;
}

cite {
  font-style: italic;
}

::selection {
  background: var(--ochre-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 4px;
}

/* 3. Primitives ---------------------------------------------- */

/* Accent pairs. Any component reading --accent / --accent-soft picks these up. */
.accent-teal {
  --accent: var(--teal);
  --accent-soft: var(--teal-soft);
}

.accent-blue {
  --accent: var(--blue);
  --accent-soft: var(--blue-soft);
}

.accent-coral {
  --accent: var(--coral);
  --accent-soft: var(--coral-soft);
}

.accent-ochre {
  --accent: var(--ochre);
  --accent-soft: var(--ochre-soft);
}

/* Micro-labels: mono, uppercase, tracked. Components set size and color. */
.eyebrow,
.section-index,
.card-number,
.event-type,
.paper-venue,
.pub-year,
.figure-topline,
.nav a,
.identity-links a,
.paper-link,
.nav-cv,
.paper-links a,
.footer-right p {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

/* Outlined link buttons */
.nav-cv,
.paper-links a {
  padding: 0.5rem 0.72rem;
  border: 1px solid var(--rule-dark);
  color: var(--ink);
  font-size: var(--fs-micro);
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 150ms ease,
    color 150ms ease;
}

.nav-cv:hover,
.paper-links a:hover {
  border-color: var(--coral);
  color: var(--coral);
}

/* Scroll reveal. Scoped to .js (set by an inline script in the head) so the
   page is never left blank if script.js fails to load. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 620ms var(--ease),
    transform 720ms var(--ease);
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

.js .research-card:nth-child(2) {
  transition-delay: 90ms;
}

.js .research-card:nth-child(3) {
  transition-delay: 180ms;
}

.js .activity:nth-child(2),
.js .publication:nth-child(2) { transition-delay: 50ms; }
.js .activity:nth-child(3),
.js .publication:nth-child(3) { transition-delay: 100ms; }
.js .activity:nth-child(4),
.js .publication:nth-child(4) { transition-delay: 150ms; }
.js .activity:nth-child(5),
.js .publication:nth-child(5) { transition-delay: 200ms; }
.js .publication:nth-child(6) { transition-delay: 250ms; }

/* Touch targets. The small mono links render around 19px tall, which is under
   the 24px minimum, so on coarse pointers an invisible overlay grows the hit
   area without moving anything on screen. */
@media (pointer: coarse) {
  .wordmark,
  .identity-links a,
  .paper-link,
  .footer-right a,
  .section-heading a,
  .paper-figure figcaption a {
    position: relative;
  }

  .wordmark::before,
  .identity-links a::before,
  .paper-link::before,
  .footer-right a::before,
  .section-heading a::before,
  .paper-figure figcaption a::before {
    position: absolute;
    inset: -11px -7px;
    content: "";
  }

  /* Keeps the caption link one unbroken box, so the overlay covers all of it
     instead of straddling two wrapped fragments */
  .paper-figure figcaption a {
    display: inline-block;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
  }
}

.external::after {
  margin-left: 0.28em;
  content: "\2197";
  font-family: var(--sans);
  font-size: 0.72em;
  font-style: normal;
  line-height: 1;
  vertical-align: 0.2em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.8rem;
  left: 0.8rem;
  padding: 0.65rem 0.95rem;
  transform: translateY(-180%);
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-decoration: none;
  transition: transform 180ms ease;
}

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

.wrap {
  width: min(100%, var(--shell));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 4. Header and hero ----------------------------------------- */

.site-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition:
    border-color 180ms ease,
    background-color 180ms ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--band-rule);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.wordmark {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.nav a {
  position: relative;
  color: var(--ink-soft);
  font-size: var(--fs-label);
  text-decoration: none;
}

.nav a::before {
  position: absolute;
  right: 0;
  bottom: -0.45rem;
  left: 0;
  height: 2px;
  background: var(--coral);
  content: "";
  opacity: 0;
  transform: scaleX(0.3);
  transition:
    opacity 150ms ease,
    transform 220ms var(--ease);
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
}

.nav a:hover::before,
.nav a.is-active::before {
  opacity: 1;
  transform: scaleX(1);
}

.nav .nav-cv {
  border-color: var(--teal);
  color: var(--teal);
}

.nav .nav-cv::before {
  display: none;
}

.nav .nav-cv:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle > span[aria-hidden] {
  display: block;
  width: 22px;
  height: 1.5px;
  margin: 6px auto;
  background: currentColor;
  transition: transform 220ms var(--ease);
}

.menu-toggle[aria-expanded="true"] > span:nth-child(2) {
  transform: translateY(3.75px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] > span:nth-child(3) {
  transform: translateY(-3.75px) rotate(-45deg);
}

.hero {
  position: relative;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 4.4vw + 1.1rem, 5rem));
  padding-bottom: clamp(2.75rem, 2vw + 1.5rem, 4rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  align-items: center;
  gap: clamp(2.5rem, 7vw, 8rem);
}

.eyebrow,
.section-index,
.card-number {
  color: var(--teal);
  font-size: var(--fs-label);
}

.hero h1 {
  margin-top: 0.85rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.75rem, 6vw + 0.4rem, 4.35rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.appointment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 2.5vw, 1.8rem);
  margin-top: 1.6rem;
  color: var(--ink);
  line-height: 1.4;
}

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

.position-title {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.32rem, 2.5vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.position-title > span {
  display: block;
  margin-top: 0.08rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.66em;
  font-weight: 500;
  letter-spacing: 0;
}

.institution {
  display: block;
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.kias-logo {
  flex: 0 0 auto;
  width: clamp(140px, 13vw, 170px);
  padding-left: clamp(0.8rem, 1.8vw, 1.25rem);
  border-left: 1px solid var(--rule-dark);
  line-height: 0;
}

.kias-logo img {
  width: 100%;
  height: auto;
}

.summary {
  max-width: 51ch;
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 1.03rem;
  line-height: 1.7;
}

.identity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  max-width: 520px;
  margin-top: 1.8rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
}

.identity-links a {
  color: var(--ink);
  font-size: var(--fs-label);
  text-decoration-color: var(--teal);
}

.identity-links a:hover {
  color: var(--coral);
}

.hero-photo {
  position: relative;
  justify-self: end;
  width: min(100%, 300px);
  aspect-ratio: 4 / 5;
  min-width: 0;
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: var(--lift-lg) var(--lift-lg) 0 var(--teal-soft);
}

/* Ochre corner bracket */
.hero-photo::before {
  position: absolute;
  z-index: 1;
  top: -1px;
  right: -1px;
  width: 64px;
  height: 64px;
  border-top: 5px solid var(--ochre);
  border-right: 5px solid var(--ochre);
  content: "";
  pointer-events: none;
}

/* Coral cut corner */
.hero-photo::after {
  position: absolute;
  z-index: 1;
  right: -1px;
  bottom: -1px;
  width: 44px;
  height: 44px;
  background: var(--coral);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  content: "";
  pointer-events: none;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Analytic maximum trajectory, presented as one of the page's figure panels.
   The browser displays a static surface and only interpolates the synchronized
   ridge/profile markers and matching rectangle during animation. */

.demo-band {
  padding-bottom: 0;
}

.research-demo {
  margin-top: clamp(3rem, 6vw, 5rem);
}

.demo-intro {
  margin-bottom: clamp(1.25rem, 2vw, 1.8rem);
  text-align: left;
}

.demo-intro-kicker {
  margin-bottom: 0.8rem;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.demo-intro h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.3vw, 2.05rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.demo-intro-summary {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 1.15vw, 0.98rem);
  line-height: 1.65;
  text-align: left;
  text-wrap: pretty;
}

.demo-complexity {
  display: inline-block;
  padding-inline: 0.18em;
  background: color-mix(in srgb, var(--teal-soft) 52%, transparent);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92em;
  font-weight: 700;
  white-space: nowrap;
}


.paper-figure .demo-caption {
  padding: 0.78rem 0.95rem 0.86rem;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: clamp(0.76rem, 1vw, 0.86rem);
  line-height: 1.58;
  text-transform: none;
}

.paper-figure .demo-caption-paper {
  color: var(--ink);
  font-weight: 600;
  text-decoration-color: color-mix(in srgb, var(--teal) 58%, transparent);
}

.paper-figure .demo-caption-paper:hover {
  color: var(--coral);
  text-decoration-color: currentColor;
}

.demo-surface-frame {
  position: relative;
  max-width: 860px;
  margin-inline: auto;
  background: #fff;
}

.demo-surface {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  cursor: default;
  touch-action: pan-y;
  user-select: none;
}

.demo-surface.is-scrubbing {
  cursor: grabbing;
}

.demo-ridge-trail {
  fill: none;
  stroke: var(--coral);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 9;
  filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 2px #fff);
  pointer-events: none;
}

.demo-ridge-marker {
  color: var(--ochre);
  filter: drop-shadow(0 3px 3px rgba(23, 50, 77, 0.32));
  pointer-events: none;
}

.demo-marker-pulse {
  fill: color-mix(in srgb, currentColor 18%, transparent);
  stroke: color-mix(in srgb, currentColor 55%, transparent);
  stroke-width: 3;
}

.demo-marker-ring {
  fill: #fff;
  stroke: currentColor;
  stroke-width: 8;
}

.demo-marker-core {
  fill: var(--coral);
  stroke: #fff;
  stroke-width: 3;
}

.demo-polygon-inset > rect {
  fill: rgba(255, 253, 247, 0.94);
  stroke: rgba(23, 50, 77, 0.42);
  stroke-width: 3;
}

.demo-inset-title,
.demo-inset-width {
  fill: var(--muted);
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.demo-inset-title {
  font-size: 28px;
}

.demo-inset-width {
  font-size: 22px;
  text-anchor: end;
}

.demo-inset-polygon {
  fill: rgba(17, 120, 120, 0.08);
  stroke: var(--ink);
  stroke-linejoin: round;
  stroke-width: 5;
}

.demo-inset-rectangle {
  fill: rgba(17, 120, 120, 0.22);
  stroke: var(--teal);
  stroke-linejoin: round;
  stroke-width: 5;
}

.demo-inset-unit {
  stroke: var(--coral);
  stroke-linecap: round;
  stroke-width: 9;
}

.demo-readout {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 0.7rem 1.5rem;
  padding: 0.8rem 0.95rem 0.9rem;
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 78%, #fff);
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(0.68rem, 1.1vw, 0.78rem);
  font-variant-numeric: tabular-nums;
}

.demo-readout span:not(.demo-contact) {
  display: grid;
  gap: 0.15rem;
}

.demo-readout small {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.demo-readout output {
  white-space: nowrap;
}

.demo-contact {
  justify-self: end;
  min-width: 6.4rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid currentColor;
  color: var(--ochre);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: var(--track);
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.demo-contact.is-t2 {
  color: var(--blue);
}

.demo-contact.is-global {
  color: var(--teal);
}

.demo-scrubber {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  cursor: ew-resize;
  opacity: 0.92;
  accent-color: var(--coral);
}

.demo-scrubber:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* Clean analytic surface with synchronized ridge, profile, and rectangle. */

.demo-stage {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 0.95fr);
  align-items: stretch;
  background: #fff;
}

.demo-landscape-panel,
.demo-companion-column {
  min-width: 0;
}

.demo-landscape-panel {
  background: #fbfcfa;
}

.demo-companion-column {
  display: grid;
  grid-template-rows: minmax(145px, 0.34fr) minmax(0, 1fr);
  border-left: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 82%, #fff);
}

.demo-profile-panel {
  min-width: 0;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface-cool) 24%, #fff);
}

.demo-rectangle-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  background: color-mix(in srgb, var(--surface) 82%, #fff);
}

.demo-panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.demo-panel-head output {
  min-width: 9.6rem;
  padding: 0.27rem 0.48rem;
  border: 1px solid color-mix(in srgb, var(--teal) 42%, transparent);
  background: color-mix(in srgb, var(--teal-soft) 32%, transparent);
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
}

.demo-profile-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.42rem 0.8rem 0.28rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.demo-profile-head i {
  font-family: var(--serif);
  font-size: 0.72rem;
  text-transform: none;
}

.demo-profile-head sub {
  font-size: 0.72em;
  line-height: 0;
}

.demo-profile {
  display: block;
  width: 100%;
  height: auto;
  max-width: 420px;
  margin-inline: auto;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
}

.demo-profile.is-scrubbing {
  cursor: grabbing;
}

.demo-profile-axis {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.35;
}

.demo-profile-ticks {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.35;
}

.demo-profile-area {
  fill: color-mix(in srgb, var(--teal-soft) 58%, transparent);
  stroke: none;
}

.demo-profile-route,
.demo-profile-trail {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-profile-route {
  stroke: color-mix(in srgb, var(--ink-soft) 54%, #fff);
  stroke-width: 2;
}

.demo-profile-trail {
  stroke: var(--ochre);
  stroke-width: 3.6;
}

.demo-profile-maximum circle {
  fill: #fff;
  stroke: var(--coral);
  stroke-width: 1.8;
}

.demo-profile-maximum path {
  fill: var(--teal);
  stroke: #fff;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.demo-profile-maximum.is-active circle {
  fill: var(--coral);
  stroke: #fff;
  stroke-width: 2.4;
}

.demo-profile-maximum.is-global.is-active path {
  fill: var(--coral);
}

.demo-profile-marker {
  color: var(--ochre);
  pointer-events: none;
}

.demo-profile-marker-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.demo-profile-marker-core {
  fill: currentColor;
  stroke: #fff;
  stroke-width: 1.4;
}

.demo-profile-labels {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}

.demo-rectangle-panel .demo-panel-head output {
  min-width: 4.8rem;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: right;
}

.demo-landscape-bg {
  fill: #fbfcfa;
}

.demo-surface-axis-key {
  display: none;
}

.demo-surface-floor {
  fill: color-mix(in srgb, var(--surface-cool) 38%, transparent);
  stroke: color-mix(in srgb, var(--rule-dark) 46%, transparent);
  stroke-width: 1;
}

.demo-surface-floor path + path {
  fill: none;
}

.demo-terrain-band {
  stroke: none;
}

.demo-terrain-band[data-band="0"] { fill: #eaf1ef; }
.demo-terrain-band[data-band="1"] { fill: #cfe3df; }
.demo-terrain-band[data-band="2"] { fill: #73aaa8; }
.demo-terrain-band[data-band="3"] { fill: #5b9697; }
.demo-terrain-band[data-band="4"] { fill: #bdd9d5; }
.demo-terrain-band[data-band="5"] { fill: #e3eeeb; }

.demo-terrain-line,
.demo-terrain-crossline {
  fill: none;
  pointer-events: none;
}

.demo-terrain-line {
  stroke: rgba(23, 50, 77, 0.14);
  stroke-width: 1;
}

.demo-terrain-crossline {
  stroke: rgba(255, 255, 255, 0.52);
  stroke-width: 1;
}

.demo-ridge-base,
.demo-ridge-trail {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.demo-ridge-base {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 12;
}

.demo-ridge-trail {
  stroke: var(--ochre);
  stroke-width: 6;
  filter: none;
}

.demo-plateau-annotation path {
  fill: none;
  stroke: var(--ochre);
  stroke-width: 2;
}

.demo-plateau-annotation rect {
  fill: rgba(255, 255, 255, 0.94);
  stroke: var(--ochre);
  stroke-width: 2;
}

.demo-plateau-annotation text {
  fill: color-mix(in srgb, var(--ochre) 68%, var(--ink));
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.demo-max-point {
  pointer-events: none;
  transition: opacity 160ms ease;
}

.demo-max-point circle {
  fill: #fff;
  stroke: var(--coral);
  stroke-width: 2.4;
}

.demo-max-point text {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
}

.demo-max-point.is-active circle {
  fill: var(--coral);
  stroke: #fff;
  stroke-width: 3;
}

.demo-max-point.is-active text {
  fill: #fff;
}

.demo-global-point path {
  fill: var(--teal);
  stroke: #fff;
  stroke-linejoin: round;
  stroke-width: 2.8;
  filter: drop-shadow(0 1px 2px rgba(23, 50, 77, 0.34));
}

.demo-global-point.is-active path {
  fill: var(--coral);
}

.demo-global-callout {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  filter: drop-shadow(0 0 2px var(--teal));
}

.demo-global-label {
  fill: #fff;
  stroke: var(--teal);
  stroke-width: 4px;
  paint-order: stroke;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.demo-global-tag-bg {
  fill: rgba(255, 255, 255, 0.94);
  stroke: var(--teal);
  stroke-width: 2;
}

.demo-profile-global-guide {
  fill: none;
  stroke: color-mix(in srgb, var(--teal) 52%, transparent);
  stroke-dasharray: 3 3;
  stroke-width: 1.2;
}

.demo-profile-global-label {
  fill: var(--teal);
  stroke: #fff;
  stroke-width: 3px;
  paint-order: stroke;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.demo-axis-labels {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.demo-ridge-marker {
  color: var(--ochre);
  filter: drop-shadow(0 2px 2px rgba(23, 50, 77, 0.28));
  pointer-events: none;
}

.demo-marker-pulse {
  fill: color-mix(in srgb, currentColor 16%, transparent);
  stroke: color-mix(in srgb, currentColor 46%, transparent);
  stroke-width: 1.5;
}

.demo-marker-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}

.demo-marker-core {
  fill: var(--coral);
  stroke: none;
}

.demo-ridge-marker.is-global .demo-marker-core {
  fill: var(--teal);
}

.demo-ridge-marker.is-paused .demo-marker-pulse {
  animation: ridge-marker-pulse 700ms ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes ridge-marker-pulse {
  50% { transform: scale(1.34); }
}

.demo-polygon {
  align-self: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: clamp(0.5rem, 1.4vw, 1rem);
}

.demo-unit-label,
.demo-origin-label,
.demo-theta-label,
.demo-x-label {
  font-family: var(--mono);
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-linejoin: round;
}

.demo-unit-label {
  fill: var(--coral);
  stroke-width: 5px;
  font-size: 14px;
  text-anchor: middle;
}

.demo-coordinate-frame,
.demo-corner-contacts {
  pointer-events: none;
}

#demo-axis-arrow path {
  fill: var(--ink-soft);
}

.demo-reference-ray,
.demo-theta-ray,
.demo-theta-arc,
.demo-x-vector,
.demo-x-tick {
  fill: none;
  stroke-linecap: round;
}

.demo-reference-ray {
  stroke: color-mix(in srgb, var(--ink-soft) 44%, transparent);
  stroke-dasharray: 3 3;
  stroke-width: 1.4;
}

.demo-theta-ray,
.demo-theta-arc {
  stroke: var(--ink-soft);
  stroke-width: 1.6;
}

.demo-theta-ray {
  marker-end: url(#demo-axis-arrow);
}

.demo-coordinate-origin {
  fill: var(--ink-soft);
  stroke: #fff;
  stroke-width: 1.4;
}

.demo-origin-label {
  fill: var(--ink);
  stroke-width: 5px;
  font-size: 11.5px;
  text-anchor: middle;
}

.demo-theta-label {
  fill: var(--ink);
  stroke-width: 4px;
  font-size: 12px;
  text-anchor: middle;
}

.demo-x-vector,
.demo-x-tick {
  stroke: var(--coral);
  stroke-width: 2.2;
}

.demo-x-vector {
  stroke-dasharray: 3 2;
}

.demo-x-label {
  fill: var(--coral);
  stroke-width: 6px;
  font-size: 11.5px;
  text-anchor: middle;
}

.demo-contact-point {
  opacity: 0;
  transition: opacity 120ms ease;
}

.demo-contact-point.is-contact {
  opacity: 1;
}

.demo-contact-halo {
  fill: #fff;
  stroke: var(--coral);
  stroke-width: 2;
}

.demo-contact-core {
  fill: var(--coral);
}

.demo-rectangle-key {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0.35rem 0.72rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.demo-rectangle-key span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.demo-rectangle-key i {
  width: 8px;
  height: 8px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  background: #fff;
}

.demo-polygon-shape {
  fill: color-mix(in srgb, var(--teal-soft) 44%, transparent);
  stroke: var(--ink);
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.demo-polygon-vertices {
  fill: var(--ink);
}

.demo-current-rectangle {
  fill: color-mix(in srgb, var(--teal) 18%, transparent);
  stroke: var(--teal);
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.demo-unit-side {
  stroke: var(--coral);
  stroke-linecap: round;
  stroke-width: 4.5;
}

.demo-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.demo-metrics > span {
  display: grid;
  gap: 0.1rem;
}

.demo-metrics small {
  color: var(--muted);
  font-size: 0.55rem;
  text-transform: uppercase;
}

.demo-metrics output {
  white-space: nowrap;
}

.demo-controls {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 1.2rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.demo-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.57rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.demo-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  white-space: nowrap;
}

.legend-ridge {
  width: 1.35rem;
  height: 3px;
  background: var(--ochre);
}

.legend-local {
  width: 8px;
  height: 8px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  background: #fff;
}

.legend-global {
  color: var(--teal);
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1;
}

.demo-controls .demo-scrubber {
  position: static;
  width: 100%;
  height: 24px;
  margin: 0;
}

/* Dragging the orientation shouldn't also nudge the panel around */
.demo-figure:hover {
  box-shadow: var(--lift-md) var(--lift-md) 0 var(--accent-soft);
  transform: none;
}

/* 5. Sections ------------------------------------------------ */

.section {
  padding-block: var(--section-pad);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.65fr);
  grid-template-areas:
    "index index"
    "title lede";
  align-items: end;
  row-gap: 0.7rem;
  column-gap: 3rem;
  margin-bottom: 3.25rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule-dark);
}

.section-heading .section-index {
  grid-area: index;
}

.section-heading h2 {
  grid-area: title;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.2rem, 4.5vw, 3.55rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.section-heading > p:last-child {
  grid-area: lede;
  max-width: 49ch;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.65;
}

/* Research areas */

.research-section {
  position: relative;
  border-block: 1px solid var(--band-rule);
  background: var(--band-paper);
}

/* Four shared row tracks — number, figure, title, body — so every card lines
   up across all three columns no matter how many lines a title takes.
   The parent's row-gap becomes the spacing inside each card. */
.research-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, auto);
  column-gap: 1.25rem;
  row-gap: 0.95rem;
}

.research-card {
  position: relative;
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  padding: 1.6rem 1.5rem 1.55rem;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  background: var(--surface);
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms ease;
}

.research-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent);
  content: "";
}

.research-card:hover {
  box-shadow: var(--lift-sm) var(--lift-sm) 0 var(--accent-soft);
  transform: translate(-3px, -3px);
}

.research-card h3 {
  align-self: end;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.research-card > p:not(.card-number) {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* Card diagrams */

.card-figure {
  align-self: center;
  justify-self: start;
  width: min(100%, 158px);
  height: auto;
  margin-block: 0.3rem;
  overflow: visible;
}

.fig-edge,
.fig-edge-thin {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 50%, transparent);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fig-edge {
  stroke-width: 1.5;
}

.fig-edge-thin {
  stroke-width: 1.1;
}

.fig-cut {
  fill: none;
  stroke: var(--accent);
  stroke-dasharray: 3 2.4;
  stroke-linecap: round;
  stroke-width: 1.2;
}

.fig-face {
  fill: color-mix(in srgb, var(--accent-soft) 60%, transparent);
  stroke: none;
}

.fig-bars rect {
  fill: color-mix(in srgb, var(--accent-soft) 65%, transparent);
  stroke: color-mix(in srgb, var(--ink) 40%, transparent);
  stroke-width: 1.1;
}

.fig-dot circle {
  fill: color-mix(in srgb, var(--ink) 58%, transparent);
  stroke: none;
}

.fig-mark {
  fill: var(--accent);
  stroke: none;
}

/* Recent activity */

.activity-section {
  border-bottom: 1px solid var(--band-rule);
  background: var(--band-warm);
}

.activity-list {
  padding: 0;
  list-style: none;
}

.activity {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 5.5rem;
  align-items: start;
  gap: 1.8rem;
  padding: 1.5rem 0;
}

.activity + .activity {
  border-top: 1px solid var(--rule);
}

.activity-date {
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.5;
  text-transform: uppercase;
}

.event-type {
  color: var(--teal);
  font-size: var(--fs-micro);
}

/* Organizing is the one entry that is not a talk, so it keeps its own accent */
.activity-organizing .event-type {
  color: var(--coral);
}

.activity-body h3 {
  margin-top: 0.3rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.26rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.35;
}

.activity-context {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Featured papers */

.papers-section {
  padding-bottom: 4rem;
}

.featured-paper {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(330px, 0.86fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5.5rem);
  padding-bottom: 4rem;
}

/* Rules sit between papers, never above the first one */
.featured-paper + .featured-paper {
  padding-top: 4rem;
  border-top: 1px solid var(--rule);
}

.featured-paper-reverse {
  grid-template-columns: minmax(330px, 0.86fr) minmax(0, 1.14fr);
}

.featured-paper-reverse .paper-figure {
  order: 2;
}

.featured-paper-reverse .paper-copy {
  order: 1;
}

.paper-figure {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  background: var(--figure-bg);
  box-shadow: var(--lift-md) var(--lift-md) 0 var(--accent-soft, var(--teal-soft));
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms ease;
}

.paper-figure:hover {
  box-shadow:
    calc(var(--lift-md) + 3px) calc(var(--lift-md) + 3px) 0
    var(--accent-soft, var(--teal-soft));
  transform: translate(-3px, -3px);
}

.figure-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.64rem;
}

.figure-link {
  display: block;
  padding: clamp(1.2rem, 2.6vw, 2rem);
  background: #fff;
}

.figure-link img {
  width: 100%;
  height: auto;
}

.paper-figure-wide .figure-link {
  padding-block: clamp(1.4rem, 3vw, 2.35rem);
}

.paper-figure figcaption {
  padding: 0.85rem 0.95rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-micro);
  line-height: 1.5;
}

.paper-copy {
  max-width: 500px;
}

.paper-venue {
  color: var(--teal);
  font-size: var(--fs-micro);
}

.paper-copy h3 {
  margin-top: 0.75rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.3vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.038em;
  line-height: 1.08;
}

.paper-copy .authors {
  margin-top: 0.85rem;
  font-size: 0.84rem;
}

.paper-summary {
  margin-top: 1.15rem;
  color: var(--ink-soft);
  line-height: 1.72;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.45rem;
}

.paper-links a {
  background: var(--surface);
}

/* Publications */

.publications-section {
  border-top: 1px solid var(--band-rule);
  background: var(--band-cool);
}

.pub-group + .pub-group {
  margin-top: clamp(2.75rem, 4vw, 4rem);
}

.pub-group-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule-dark);
}

.pub-group-head h3 {
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.pub-group-head p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.publication-list {
  padding: 0;
  list-style: none;
  counter-reset: publications;
}

.publication {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 5.5rem;
  align-items: start;
  gap: 1.8rem;
  padding: 1.45rem 0;
  counter-increment: publications;
}

.publication + .publication {
  border-top: 1px solid var(--rule);
}

.pub-year {
  color: var(--teal);
  font-size: var(--fs-label);
}

.pub-year::before {
  margin-right: 0.5rem;
  color: var(--muted);
  content: counter(publications, decimal-leading-zero);
}

.pub-body h4 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.26rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.35;
}

.authors {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.venue {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.venue cite {
  color: var(--ink-soft);
  font-weight: 500;
}

.paper-link {
  justify-self: end;
  padding-top: 0.12rem;
  color: var(--ink);
  font-size: var(--fs-micro);
  text-decoration-color: var(--teal);
}

/* 6. Footer -------------------------------------------------- */

.site-footer {
  --footer-ink: #d8e3e2;
  --footer-muted: #a9babc;
  --footer-link: #82d2ca;

  border-top: 1px solid var(--ink);
  background: var(--ink);
  color: var(--footer-ink);
}

.footer-inner {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  font-size: 0.82rem;
}

.footer-name {
  margin-bottom: 0.25rem;
  color: var(--surface);
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
}

.footer-right {
  text-align: right;
}

.footer-right a {
  color: var(--footer-link);
}

.footer-right p {
  margin-top: 0.25rem;
  color: var(--footer-muted);
  font-size: var(--fs-micro);
}

/* 7. Responsive ---------------------------------------------- */

@media (max-width: 860px) {
  :root {
    --header-h: 64px;
  }

  .site-header,
  .site-header.is-scrolled {
    border-bottom-color: var(--band-rule);
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .menu-toggle {
    position: relative;
    z-index: 102;
    display: block;
    margin-right: -0.55rem;
  }

  .nav {
    position: fixed;
    z-index: 101;
    inset: var(--header-h) 0 auto;
    max-height: calc(100dvh - var(--header-h));
    padding: 0.8rem var(--gutter) 1.35rem;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    border-bottom: 1px solid var(--rule-dark);
    background: var(--paper);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    visibility: hidden;
    transition:
      opacity 170ms ease,
      transform 250ms var(--ease),
      visibility 0s linear 250ms;
  }

  .nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .nav a,
  .nav .nav-cv {
    padding: 0.9rem 0;
    border: 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-soft);
    font-family: var(--serif);
    font-size: 1.08rem;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
  }

  .nav a:hover,
  .nav .nav-cv:hover {
    border-color: var(--rule);
    color: var(--ink);
  }

  /* The panel already draws its own bottom edge */
  .nav a:last-child {
    border-bottom: 0;
  }

  .nav a::before {
    display: none;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4rem;
  }

  .hero-copy {
    min-width: 0;
    max-width: 650px;
  }

  .hero-photo {
    justify-self: start;
    width: min(100%, 280px);
  }

  /* Single column: rows no longer need to line up, so drop the subgrid */
  .research-cards {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    row-gap: 1.25rem;
  }

  .research-card {
    grid-row: auto;
    grid-template-rows: none;
    row-gap: 0.85rem;
  }

  .activity {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 0.35rem 1.5rem;
  }

  .activity .paper-link {
    grid-column: 2;
    justify-self: start;
  }

  .featured-paper,
  .featured-paper-reverse {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }

  .featured-paper-reverse .paper-figure,
  .featured-paper-reverse .paper-copy {
    order: initial;
  }

  .paper-copy {
    max-width: 650px;
  }
}

@media (max-width: 900px) {
  .demo-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .demo-companion-column {
    grid-template-rows: auto auto;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .demo-rectangle-panel {
    min-height: 370px;
  }

  .demo-polygon {
    height: 285px;
    max-width: 390px;
    margin-inline: auto;
  }
}

@media (max-width: 620px) {
  :root {
    --lift-lg: 9px;
    --lift-md: 5px;
    --lift-sm: 4px;
  }

  body::before {
    background-size: 48px 48px;
  }

  /* In one column the wash runs a hard diagonal across the summary text
     instead of sitting behind the photo, so drop it */
  body::after {
    display: none;
  }

  .wordmark {
    font-size: 1rem;
  }

  .hero h1 span {
    display: block;
  }

  /* Roomy enough that the expanded hit areas above never touch */
  .identity-links {
    gap: 0.9rem 1.15rem;
  }

  .hero-grid {
    gap: 2.75rem;
  }

  .kias-logo {
    width: 132px;
    padding-left: 0.8rem;
  }

  .hero-photo {
    width: min(100%, 260px);
  }

  /* 0.58rem rendered at 9.3px — too small to read. The tighter gap keeps both
     labels on one line down to 320px at this size. */
  .figure-topline {
    gap: 0.5rem;
    font-size: 0.62rem;
  }

  .demo-figure .figure-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
    line-height: 1.45;
  }

  .demo-landscape-panel .demo-panel-head {
    gap: 0.5rem;
    padding-inline: 0.65rem;
  }

  .demo-landscape-panel .demo-panel-head > span {
    white-space: nowrap;
  }

  .demo-landscape-panel .demo-panel-head output {
    min-width: 7.8rem;
  }

  .demo-surface-axis-key {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--rule);
    background: color-mix(in srgb, var(--surface-cool) 24%, #fff);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
  }

  .demo-surface-axis-key span {
    display: grid;
    gap: 0.05rem;
    padding: 0.48rem 0.55rem;
  }

  .demo-surface-axis-key span + span {
    border-left: 1px solid var(--rule);
  }

  .demo-surface-axis-key i {
    font-family: var(--serif);
  }

  .demo-surface-axis-key small {
    color: var(--muted);
    font-size: 0.48rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .demo-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem 1rem;
    padding-bottom: 1rem;
  }

  .demo-contact {
    justify-self: stretch;
  }

  .demo-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }

  .demo-legend {
    gap-inline: 0.75rem;
  }

  .demo-polygon {
    max-width: 330px;
  }

  .section-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "index"
      "title"
      "lede";
    row-gap: 0.8rem;
    margin-bottom: 2.3rem;
  }

  .section-heading h2 {
    font-size: 2.5rem;
  }

  .research-card {
    padding-inline: 1.15rem;
  }

  .activity {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 1rem;
  }

  .activity-body {
    grid-column: 1 / -1;
  }

  .activity-body h3 {
    font-size: 1.14rem;
  }

  .activity .paper-link {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .featured-paper {
    padding-bottom: 3rem;
  }

  .featured-paper + .featured-paper {
    padding-top: 3rem;
  }

  .figure-link {
    padding: 0.85rem;
  }

  .paper-copy h3 {
    font-size: 2.05rem;
  }

  .publication {
    grid-template-columns: 1fr auto;
    gap: 0.45rem 1rem;
  }

  .pub-year {
    grid-column: 1;
  }

  .pub-body {
    grid-column: 1 / -1;
  }

  .pub-body h4 {
    font-size: 1.14rem;
  }

  .paper-link {
    grid-column: 2;
    grid-row: 1;
  }

  .footer-inner {
    min-height: 175px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
  }

  .footer-right {
    text-align: left;
  }
}

@media (max-width: 460px) {
  .appointment {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.9rem;
  }

  .kias-logo {
    width: 145px;
    padding-left: 0;
    border-left: 0;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Show everything outright rather than relying on the observer */
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .paper-figure:hover {
    transform: none;
  }
}

@media print {
  :root {
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --ink-soft: #222;
    --muted: #444;
    --rule: #bbb;
    --rule-dark: #888;
    --lift-lg: 0;
    --lift-md: 0;
    --lift-sm: 0;
  }

  body::before,
  body::after,
  .site-header,
  .hero-photo,
  .demo-band {
    display: none !important;
  }

  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .research-cards,
  .research-card {
    grid-template-rows: none;
  }

  .research-card {
    grid-row: auto;
  }

  .hero,
  .section {
    padding-block: 1.5rem;
  }

  .hero-grid,
  .section-heading,
  .featured-paper,
  .featured-paper-reverse {
    display: block;
  }

  .research-cards {
    grid-template-columns: 1fr;
  }

  .research-card,
  .activity,
  .publication,
  .featured-paper {
    break-inside: avoid;
  }

  a {
    color: #000;
  }
}
