/* =============================================================================
   Zhiwei (Vivi) Li — single-page research homepage
   Theme: Porcelain, Ink & Iris. All colors are defined once, here.
   Signature: an editorial double rule (ink + soft grey) at three points only.
   ========================================================================== */

:root {
  /* Palette (exact values) */
  --bg:            #FFFFFF;  /* main background */
  --surface:       #F5F6FA;  /* secondary surface — sparingly */
  --ink:           #20232D;  /* primary text */
  --ink-2:         #606575;  /* secondary text */
  --accent:        #5145A6;  /* iris: links, nav state, small labels */
  --accent-hover:  #3E3484;
  --accent-tint:   #EEECF8;  /* small labels, selected states */
  --divider:       #DEE1E9;
  --divider-soft:  #EBEDF2;  /* lightest hairline: between publications */
  --wash:          #F7F6FC;  /* faint lavender behind the research-theme cards */
  --rule-1:        #20232D;  /* double rule: primary line */
  --rule-2:        #AEB3C0;  /* double rule: secondary line */
  --footer-bg:     #202432;  /* midnight */
  --footer-ink:    #F7F8FC;
  --footer-ink-2:  #C3C8D6;

  /* Type */
  --sans: "Inter", "Inter var", -apple-system, BlinkMacSystemFont,
          "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto,
          "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --wrap: 80rem;
  --gutter: clamp(1.25rem, 4vw, 2.75rem);
  --header-h: 72px;                     /* sticky header height */
  --label-col: 13rem;                   /* portrait column / publication group labels */
  --col-gap: clamp(2rem, 4vw, 3.5rem);
  --measure: 68ch;
  --radius: 12px;
  --section-pad: clamp(4rem, 5vw, 5.5rem);   /* ≈ 64–88 px */
}

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
/* Every anchor target lands below the sticky header. */
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; }
::selection { background: var(--accent-tint); color: var(--ink); }

/* Links: iris, underlined within prose. Navigation-style links opt out. */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.me { color: var(--ink); font-weight: 700; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Draft preview only (python build.py --drafts): never in the release build. */
.preview-bar {
  margin: 0; padding: .45rem var(--gutter); text-align: center;
  font-size: .82rem; font-weight: 600; color: #5C3B00; background: #FFF1D6;
  border-bottom: 1px solid #E8C98F;
}
.draft-badge {
  display: inline-block; margin: 0 0 1rem; padding: .2rem .65rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  color: #5C3B00; background: #FFF1D6; border: 1px solid #E8C98F;
}

/* ---- Editorial double rule ----------------------------------------------- */
/* Two precise 1px lines, 3px apart; placed inside .wrap so it aligns with the
   content width. Used only below the intro, before Publications, above footer. */
.drule {
  box-sizing: content-box; height: 3px; margin: 0; border: 0;
  border-top: 1px solid var(--rule-1); border-bottom: 1px solid var(--rule-2);
}
.rule { height: 0; margin: 0; border: 0; border-top: 1px solid var(--divider); }

/* ---- Shared small parts -------------------------------------------------- */
.tag, .tags .tag {
  display: inline-block; font-size: .75rem; font-weight: 500; line-height: 1.5;
  color: var(--accent); background: var(--accent-tint);
  border-radius: 999px; padding: .08rem .55rem; white-space: nowrap;
}
.tags { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.mini-h {
  font-size: .72rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 .75rem;
}
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .55rem 1.05rem; border-radius: 8px;
  background: var(--accent); color: var(--bg); border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }
.ph-tag { font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.ph-note { font-size: .82rem; color: var(--ink-2); line-height: 1.45; }

/* ---- Header -------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--divider); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .25rem 1.5rem; min-height: var(--header-h); flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 650; font-size: 1.02rem; letter-spacing: -.01em; color: var(--ink); text-decoration: none;
}
/* ZL monogram before the name (decorative: the name is the link text). */
.brand-logo { width: 1.625rem; height: 1.625rem; flex: none; }
.brand:hover { color: var(--ink); }
.site-nav { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500;
  padding-block: .3rem; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current], .site-nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.nav-short { display: none; }
@media (max-width: 34rem) { .nav-short { display: inline; } }

/* =============================================================================
   HOME — compact introduction
   ========================================================================== */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 27fr) minmax(0, 73fr);   /* left column ≈ 27% */
  grid-template-areas:
    "portrait intro"
    "journey  intro";
  grid-template-rows: auto 1fr;
  column-gap: var(--col-gap);
  row-gap: 1.5rem;
  align-items: start;
  padding-block: clamp(3.5rem, 4vw, 4rem);          /* ≈ 56–64 px */
}
.intro-portrait { grid-area: portrait; width: 100%; max-width: 12.5rem; }
.intro-body { grid-area: intro; padding-top: .15rem; }
.portrait { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
.portrait-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  text-align: center; border: 1px dashed var(--divider);
}
.intro-name { font-size: clamp(2rem, 3.4vw, 2.6rem); font-weight: 700; letter-spacing: -.028em; margin-bottom: .35rem; }
.intro-name + .intro-statement { margin-top: .9rem; }
.intro-statement, .intro-motivation { max-width: var(--measure); margin-bottom: .75rem; }
.intro-statement strong { font-weight: 650; }
.intro-motivation { color: var(--ink-2); }

/* Email + profile links: official logo (monochrome) + visible label */
.contact-row { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.contact-link {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .9rem; font-weight: 500; text-decoration: none; color: var(--ink);
  border: 1px solid var(--divider); border-radius: 8px; padding: .38rem .8rem;
}
.contact-link svg { width: 20px; height: 20px; flex: none; color: var(--ink); }
.contact-link:hover { color: var(--ink); border-color: var(--accent); background: var(--accent-tint); }
.contact-link:hover svg { color: var(--accent); }

/* Email + copy button. The status text ("Email copied") is announced politely. */
.email-actions { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.copy-email {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.15rem; height: 2.15rem; padding: 0; cursor: pointer;
  color: var(--ink-2); background: var(--bg); border: 1px solid var(--divider); border-radius: 8px;
}
.copy-email svg { width: 18px; height: 18px; }
.copy-email:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.copy-email.is-copied { color: var(--accent); border-color: var(--accent); }
.copy-status { font-size: .8rem; font-weight: 500; color: var(--accent); }
.copy-status:empty { display: none; }
.site-footer .copy-email { width: 1.9rem; height: 1.9rem; background: transparent; color: var(--footer-ink-2); border-color: rgba(247, 248, 252, .25); }
.site-footer .copy-email:hover, .site-footer .copy-email.is-copied { color: var(--footer-ink); border-color: var(--footer-ink); background: transparent; }
.site-footer .copy-status { color: var(--footer-ink); }

/* Journey: vertical timeline below the portrait. Filled marker = research,
   outlined marker = education; a thin line joins marker to marker. */
.journey { grid-area: journey; width: 100%; max-width: 19rem; }
.journey-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.journey-head .mini-h { margin: 0; }
.journey-legend { display: flex; align-items: center; gap: .3rem; margin: 0; font-size: .72rem; color: var(--ink-2); white-space: nowrap; }
.journey-legend .j-mark { width: 7px; height: 7px; margin-left: .45rem; }
.journey-legend .j-mark:first-child { margin-left: 0; }
.j-mark {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; box-sizing: border-box;
  background: var(--bg); border: 1.5px solid var(--accent);
}
.j-research .j-mark, .j-mark-research { background: var(--accent); }
.journey-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.j-item { position: relative; display: grid; grid-template-columns: 9px minmax(0, 1fr); column-gap: .8rem; }
.j-item > .j-mark { grid-column: 1; grid-row: 1; margin-top: 5.5px; position: relative; z-index: 1; }
.j-item:not(:last-child)::before {       /* connector to the next marker */
  content: ""; position: absolute; left: 4px; width: 1px; background: var(--divider);
  top: 14.5px; bottom: calc(-.7rem - 5.5px);
}
.j-years { grid-column: 2; font-size: .78rem; font-weight: 600; line-height: 1.25rem; color: var(--ink-2); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.j-label { grid-column: 2; font-size: .9rem; font-weight: 500; line-height: 1.35; color: var(--ink); }
.j-field { grid-column: 2; font-size: .86rem; line-height: 1.35; color: var(--ink); }
.j-org { grid-column: 2; font-size: .82rem; line-height: 1.4; color: var(--ink-2); }

/* =============================================================================
   SECTIONS
   ========================================================================== */
.section { padding-block: var(--section-pad); }
#research { padding-top: 4rem; }   /* first section after the intro: 64 px */
.section-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.022em; margin-bottom: 1.6rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem 1.5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.section-head .section-title { margin: 0; }
.section-note { font-size: .92rem; color: var(--ink-2); margin-bottom: 1.6rem; }
.subsection-title { font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: 1.1rem; }

/* ---- Research themes: two small orientation cards ----------------------- */
/* A faint lavender wash holds the pair; the cards float on it with a hairline
   border and a soft, shallow shadow. Not clickable: no hover state. */
.themes {
  list-style: none; margin: 0 0 2.5rem; padding: clamp(.75rem, 1.6vw, 1.1rem);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.75rem, 1.6vw, 1.1rem);
  background: var(--wash); border-radius: 16px;
}
.theme {
  background: rgba(255, 255, 255, .86); border: 1px solid rgba(222, 225, 233, .9); border-radius: 12px;
  padding: 1.1rem 1.35rem 1.2rem;
  box-shadow: 0 1px 2px rgba(32, 35, 45, .04), 0 8px 20px -12px rgba(81, 69, 166, .22);
}
.theme-title { font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.35; margin-bottom: .5rem; }
.theme-title::before {                  /* short iris accent above the heading */
  content: ""; display: block; width: 1.6rem; height: 2px; border-radius: 2px;
  background: var(--accent); margin-bottom: .65rem;
}
.theme-text { font-size: .95rem; line-height: 1.6; color: var(--ink); margin: 0; max-width: var(--measure); }

/* ---- Selected projects: one column of rows -------------------------------- */
/* Figure (or its placeholder) on the left, about a third of the width; title,
   subtitle, description, and links together on the right. On phones: figure,
   then text. Rows grow with their content — no fixed heights. */
.selected-h { margin-bottom: 0; }
.programs { display: grid; }
.program {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: clamp(1.5rem, 3vw, 2.5rem); align-items: start;
  padding-block: 1.75rem; border-top: 1px solid var(--divider);
}
.program:first-child { border-top: 0; padding-top: 1rem; }
/* No figure yet (release build): the text simply uses the full width. */
.program.no-fig { grid-template-columns: minmax(0, 1fr); }
.resource-note { font-size: .85rem; color: var(--ink-2); margin: .45rem 0 0; }
.program-fig, .program-text { min-width: 0; }
.program-fig { margin: 0; }
.program-fig-link { display: block; background: var(--bg); border: 1px solid var(--divider); border-radius: var(--radius); padding: .6rem; text-decoration: none; }
.program-fig-link:hover { border-color: var(--accent); }
/* Real figures keep their natural aspect ratio and are never cropped
   (contain), so diagram labels stay intact; very tall ones are capped. If the
   image fails to load, its alt text shows inside this frame. */
.program-fig-link img {
  width: 100%; height: auto; max-height: 30rem; object-fit: contain;
  min-height: 4rem; border-radius: 6px; color: var(--ink-2); font-size: .85rem;
}
.program-fig figcaption { font-size: .82rem; color: var(--ink-2); margin-top: .5rem; }
/* Placeholder until a figure is supplied: 3:2, quiet, labeled. */
.fig-ph {
  aspect-ratio: 3 / 2; display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: .3rem; padding: 1rem 1.25rem; text-align: center;
  background: var(--surface); border: 1px dashed var(--rule-2); border-radius: var(--radius);
}
.fig-ph .ph-note { max-width: 24ch; }
.program-num { font-size: .78rem; font-weight: 600; letter-spacing: .06em; color: var(--accent); font-variant-numeric: tabular-nums; margin-bottom: .2rem; }
.program-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; margin-bottom: .25rem; overflow-wrap: anywhere; }
.program-title a { color: var(--ink); text-decoration: none; }
.program-title a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.program-sub { font-size: .95rem; line-height: 1.45; color: var(--ink-2); margin-bottom: .7rem; }
.program-summary { max-width: var(--measure); margin-bottom: .75rem; }
.program-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.35rem; }
.program-links a { display: inline-block; padding-block: .25rem; font-size: .9rem; font-weight: 600; text-decoration: none; }  /* ≥ 24 px tap target */
.program-links svg, .extra-links svg, .pub-extra svg, .link-list svg { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; margin-right: .3rem; }
.program-links a:hover { text-decoration: underline; }

/* ---- Additional projects ------------------------------------------------- */
.extras { margin-top: .4rem; padding-top: 1.75rem; border-top: 1px solid var(--divider); }
.extra-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 3rem; }
.extra-label { font-size: .78rem; font-weight: 500; color: var(--ink-2); margin-bottom: .2rem; }
.extra-title { font-size: 1rem; font-weight: 650; line-height: 1.35; margin-bottom: .35rem; overflow-wrap: anywhere; }
.extra-title a { color: var(--ink); text-decoration: none; }
.extra-title a:hover { color: var(--accent); text-decoration: underline; }
.extra-sum { font-size: .93rem; color: var(--ink-2); line-height: 1.55; margin-bottom: .35rem; max-width: var(--measure); }
.extra-note { font-size: .85rem; color: var(--ink-2); margin-bottom: .2rem; }
.extra-links { list-style: none; padding: 0; margin: .15rem 0 0; display: flex; flex-wrap: wrap; gap: 0 1rem; }
.extra-links a { display: inline-block; padding-block: .25rem; font-size: .86rem; font-weight: 600; text-decoration: none; }
.extra-links a:hover { text-decoration: underline; }

/* ---- Selected Publications: grouped by year ------------------------------ */
/* Year column on the left, aligned with the first title of its group; each
   entry is three lines (title / authors / venue + type). Years are separated
   by a clearer line, entries by the lightest hairline. Every margin here is
   explicit, so spacing comes only from the entry padding (10 px) and the
   small gap between years (≈16 px in total) — nothing stacks on top. */
.section-aside { font-size: .92rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.section-aside:hover { text-decoration: underline; }
/* Section padding: top as for Research (64 px), and a shorter tail so the
   list does not end in a large blank area before the double rule. */
#publications { padding-top: min(var(--section-pad), 4rem); padding-bottom: min(var(--section-pad), 3rem); }
#publications .section-head { margin-bottom: .8rem; }
.pub-group {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: 2.25rem; row-gap: 0;
  margin: 0; padding: 0; border-top: 1px solid var(--rule-2);
}
.pub-group + .pub-group { margin-top: .4rem; }      /* year change: a little more air */
.pub-group-title {                                   /* same top offset as the first title */
  font-size: 1.05rem; font-weight: 650; line-height: 1.4rem; margin: 0; padding-top: .625rem;
  font-variant-numeric: tabular-nums; letter-spacing: -.005em; align-self: start;
}
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { margin: 0; padding-block: .625rem; border-bottom: 1px solid var(--divider-soft); }
.pub:last-child { border-bottom: 0; }
.pub-title { font-weight: 600; font-size: 1rem; line-height: 1.4rem; color: var(--ink); margin: 0 0 .22rem; overflow-wrap: anywhere; }
.pub-title a { color: var(--ink); text-decoration-color: var(--rule-2); text-decoration-thickness: 1px; }
.pub-title a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.pub-title .ext { color: var(--ink-2); font-weight: 500; }
.pub-authors { font-size: .93rem; line-height: 1.4; color: var(--ink-2); margin: 0 0 .15rem; overflow-wrap: anywhere; }
.pub-meta { font-size: .88rem; line-height: 1.4; color: var(--ink-2); margin: 0; overflow-wrap: anywhere; }
.pub-meta .tag { font-size: .72rem; padding: 0 .55rem; margin-left: .45rem; vertical-align: 1px; }
.pub-venue { font-style: italic; }
.pub-extra { font-weight: 600; text-decoration: none; margin-left: .6rem; white-space: nowrap; }
.pub-extra:hover { text-decoration: underline; }

/* ---- Earlier research (end of Research) ---------------------------------- */
.earlier { margin-top: 1.75rem; }
.earlier-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.earlier-title { font-weight: 600; font-size: .93rem; }
.earlier-meta { font-size: .85rem; color: var(--ink-2); }

/* ---- Teaching, Service & Recognition ------------------------------------- */
.section-experience { padding-top: calc(var(--section-pad) * .8); }
.exp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.75rem var(--col-gap); }
.exp-h { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: .2rem; }
.exp-role { font-size: .9rem; color: var(--ink-2); margin-bottom: .55rem; }
.exp-h + .exp-list { margin-top: .55rem; }
.exp-list { list-style: none; padding: 0; margin: 0; }
.exp-row { display: grid; gap: .05rem; padding-block: .65rem; border-bottom: 1px solid var(--divider); }
.exp-row:first-child { border-top: 1px solid var(--divider); }
.exp-when { font-size: .82rem; line-height: 1.4; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.exp-what { font-size: .95rem; font-weight: 600; line-height: 1.4; }
.exp-where { font-size: .86rem; line-height: 1.45; color: var(--ink-2); }

/* =============================================================================
   INNER PAGES (project details, privacy, redirects, 404)
   ========================================================================== */
.page-head { padding-top: clamp(2.5rem, 6vw, 3.75rem); padding-bottom: 1.5rem; }
.page-title { font-size: clamp(2rem, 3.6vw, 2.5rem); font-weight: 700; letter-spacing: -.028em; margin-bottom: .6rem; overflow-wrap: anywhere; }
.page-lede { font-size: 1.1rem; color: var(--ink-2); max-width: var(--measure); }

.detail { max-width: calc(48rem + 2 * var(--gutter)); padding-top: clamp(2rem, 5vw, 3rem); padding-bottom: 3rem; }
.crumb { font-size: .88rem; color: var(--ink-2); margin-bottom: 1rem; }
.crumb a { text-decoration: none; font-weight: 500; }
.crumb a:hover { text-decoration: underline; }
.proj-label { font-size: .78rem; font-weight: 500; color: var(--ink-2); margin-bottom: .3rem; }
.detail-context { color: var(--ink-2); font-size: .95rem; margin-bottom: .9rem; }
.detail-lede { font-size: 1.2rem; line-height: 1.55; margin: .5rem 0 2rem; }
.field { margin: 2.25rem 0; }
.field-title { font-size: 1.12rem; font-weight: 650; margin-bottom: .75rem; }
.field-list { padding-left: 1.15rem; }
.field-list li { margin-bottom: .5rem; }
.field-list li::marker { color: var(--accent); }
.field-note { color: var(--ink-2); font-size: .95rem; margin-top: .85rem; }
.study { border-left: 2px solid var(--divider); padding-left: 1.4rem; }
.study .pub-list { margin-top: 1rem; }
.attribution { background: var(--surface); border-radius: 10px; padding: 1rem 1.25rem; color: var(--ink-2); font-size: .95rem; margin: 2rem 0; }
.link-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.link-list li { margin-bottom: .4rem; }
.link-list a { font-weight: 500; word-break: break-word; }

.narrow { max-width: calc(46rem + 2 * var(--gutter)); }
.prose { max-width: var(--measure); padding-bottom: 3rem; }
.prose .field-list li { margin-bottom: .55rem; }

/* =============================================================================
   FOOTER — midnight; doubles as the Contact section (#contact)
   ========================================================================== */
.site-footer { background: var(--footer-bg); color: var(--footer-ink-2); padding-top: clamp(3rem, 5vw, 4rem); padding-bottom: 1.75rem; }
.site-footer :focus-visible { outline-color: var(--footer-ink); }
.footer-grid {
  display: grid; gap: 2rem 2.5rem;
  grid-template-columns: minmax(14rem, 1.4fr) repeat(auto-fit, minmax(11rem, 1fr));
}
.footer-name { color: var(--footer-ink); font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: .45rem; }
.footer-tag { color: var(--footer-ink-2); font-size: .95rem; max-width: 32ch; margin: 0; }
.footer-h { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--footer-ink-2); margin-bottom: .85rem; }
.footer-list { list-style: none; padding: 0; margin: 0; }
.footer-list li { color: var(--footer-ink); margin-bottom: .45rem; font-size: .95rem; overflow-wrap: anywhere; }
.footer-list a { color: var(--footer-ink); text-decoration: none; }
.footer-list a:hover { color: var(--footer-ink); text-decoration: underline; text-decoration-thickness: 1px; }
.footer-link { display: inline-flex; align-items: center; gap: .5rem; }
.footer-link svg { width: 18px; height: 18px; flex: none; color: var(--footer-ink-2); }
.footer-link:hover svg { color: var(--footer-ink); }
.footer-base {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 2.5rem; padding-top: 1.1rem; border-top: 1px solid rgba(247, 248, 252, .14);
  font-size: .85rem; color: var(--footer-ink-2);
}
.footer-base p { margin: 0; }
.footer-base a { color: var(--footer-ink-2); }
.footer-base a:hover { color: var(--footer-ink); }

/* =============================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 64rem) {
  :root { --label-col: 11.5rem; }
}
/* Tablets in portrait: the four footer groups sit in two even columns
   instead of three plus a lone fourth. Phones (≤ 34rem) use one column. */
@media (max-width: 56rem) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 48rem) {
  :root { --section-pad: 3.25rem; }
}
@media (max-width: 40rem) {
  /* Introduction stacks: portrait, introduction, then the vertical Journey.
     (Tablets, including iPad portrait, keep the two-column introduction.) */
  .intro {
    grid-template-columns: 1fr;
    grid-template-areas: "portrait" "intro" "journey";
    grid-template-rows: auto;
    row-gap: 1.25rem; padding-block: 2rem 2.5rem;
  }
  .intro-portrait { max-width: 7rem; }
  .journey { max-width: 26rem; border-top: 1px solid var(--divider); padding-top: 1.25rem; }
  .journey-list { gap: .65rem; }
  .j-item:not(:last-child)::before { bottom: calc(-.65rem - 5.5px); }
  .extra-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .exp-cols { grid-template-columns: 1fr; }
  .themes { grid-template-columns: 1fr; margin-bottom: 2rem; }
  .program { grid-template-columns: 1fr; row-gap: 1rem; padding-block: 1.5rem; }
  .fig-ph { aspect-ratio: 2 / 1; }      /* empty placeholder stays modest on phones */
  .pub-group { grid-template-columns: 1fr; }
  .pub-group-title { padding-top: .65rem; }
  .pub-group-title + .pub-list .pub:first-child { padding-top: .35rem; }
}
@media (max-width: 34rem) {
  :root { --header-h: 92px; }
  body { font-size: 1rem; }
  .header-inner { flex-direction: column; align-items: flex-start; justify-content: center; gap: .3rem; padding-block: .6rem; }
  /* One row of five links; on very narrow phones the row scrolls sideways
     rather than wrapping (padding keeps focus outlines visible). */
  .site-nav {
    gap: .55rem; flex-wrap: nowrap; max-width: 100%;
    overflow-x: auto; scrollbar-width: none; padding: .2rem .25rem; margin-inline: -.25rem;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { font-size: .84rem; white-space: nowrap; flex: none; }
  .nav-long {                            /* still read by screen readers */
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .section-head { margin-bottom: .9rem; }
  .footer-grid { grid-template-columns: 1fr; }
}
