/* ==========================================================================
   Ryan Smith PhD — styles
   Light, playful-professional, dataviz-adjacent
   ========================================================================== */

:root {
  /* ground / surface */
  --bg:          #f9f8f4;
  --bg-elev:    #f0eee8;
  --bg-card:    #e8e5de;
  --border:     #d4cfc6;
  --border-hi:  #bfb9ae;

  /* text */
  --fg:         #1c1a17;
  --fg-dim:     #58554d;
  --fg-muted:   #979390;

  /* accents */
  --accent:     #6e40c9;      /* warm purple */
  --accent-hi:  #7e52d8;
  --accent-ink: #ffffff;
  --mark:       #c9b0f4;
  --link:       #6e40c9;
  --link-hi:    #7e52d8;

  /* spots — used sparingly */
  --teal:       #16856e;
  --rose:       #c04040;

  /* type */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Georgia', serif;
  --font-body:    'Inter Tight', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-hand:    'Caveat', 'Marker Felt', cursive;
  --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* rhythm */
  --maxw:        72rem;
  --gutter:      clamp(1.25rem, 4vw, 2.5rem);
  --section-pad: clamp(2.25rem, 5vw, 4rem);

  /* motion */
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(110,64,201,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(22,133,110,.04), transparent 60%);
  /* background-attachment: fixed removed — caused scroll jank on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

html { overflow-x: hidden; }

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

a { color: var(--link); text-decoration: none; border-bottom: 1px solid rgba(158,207,255,.25); transition: color .2s var(--ease), border-color .2s var(--ease); }
a:hover { color: var(--link-hi); border-bottom-color: var(--link-hi); }

strong { color: var(--fg); font-weight: 600; }
em { font-style: italic; color: var(--fg); }

mark {
  background: linear-gradient(180deg, transparent 55%, rgba(110,64,201,.15) 55%, rgba(110,64,201,.15) 90%, transparent 90%);
  color: inherit;
  padding: 0 .1em;
}

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

/* grain overlay removed — mix-blend-mode + fixed position caused repaint on every scroll */
.grain { display: none; }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 1rem), var(--maxw));
  max-width: calc(100vw - 1rem);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .625rem .875rem .625rem 1rem;
  background: rgba(249,248,244,.96);
  /* backdrop-filter removed — was the biggest scroll-perf cost on the page */
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 32px -8px rgba(0,0,0,.12);
}

.nav__brand {
  display: flex; align-items: center; gap: .625rem;
  color: var(--fg); border: none; font-weight: 500;
}
.nav__brand:hover { color: var(--accent); }
.nav__brand-mark {
  display: inline-grid; place-items: center;
  width: 1.9rem; height: 1.9rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  letter-spacing: .02em;
}
.nav__brand-text {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -.01em;
}

.nav__links {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; align-items: center; gap: .25rem;
  font-size: .92rem;
}
.nav__links a {
  color: var(--fg-dim);
  padding: .4rem .75rem;
  border-radius: 999px;
  border: none;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav__links a:hover { color: var(--fg); background: rgba(0,0,0,.05); }
.nav__links .nav__cta {
  color: var(--accent-ink) !important;
  background: var(--accent);
  font-weight: 500;
}
.nav__links .nav__cta:hover { background: var(--accent-hi); }

.nav__toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 2.25rem; height: 2.25rem;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  padding: 0;
}
.nav__toggle span {
  display: block; width: 20px; height: 1.5px;
  background: var(--fg);
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.25px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3.25px) rotate(-45deg); }

@media (max-width: 780px) {
  .nav { padding: .5rem .5rem .5rem .875rem; }
  .nav__brand-text { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(249,248,244,.99);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: .5rem;
    min-width: 12rem;
    box-shadow: 0 16px 48px -12px rgba(0,0,0,.14);
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .3s var(--ease), opacity .2s var(--ease), padding .3s var(--ease);
  }
  .nav__links.is-open {
    max-height: 420px; opacity: 1; padding: .5rem;
  }
  .nav__links a { display: block; }
}

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.section { padding-top: var(--section-pad); position: relative; }
.section:last-of-type { padding-bottom: var(--section-pad); }

.section__head {
  display: flex; align-items: baseline; gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border);
}
.section__num {
  display: none;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -.005em;
  margin: 0;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.section__sub {
  font-family: var(--font-hand);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  color: var(--fg-dim);
  margin: .15rem 0 0 .15rem;
  opacity: .85;
  font-weight: 500;
}

/* ---------- HERO ---------- */
.hero {
  padding-top: clamp(5rem, 9vw, 7rem);
  padding-bottom: clamp(1.25rem, 3vw, 2.5rem);
  position: relative;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--fg-dim);
  letter-spacing: .05em;
  text-transform: lowercase;
  margin: 0 0 1.5rem;
  padding: .4rem .8rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
}
/* Handwritten override: when the eyebrow is also an aside, ditch the pill */
.hero__eyebrow.aside {
  display: block;
  font-family: var(--font-hand);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 .75rem;
  opacity: .92;
}
.hero__eyebrow.aside .dot { display: none; }
.dot {
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(22,133,110,.5);
  animation: pulse 2.5s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,133,110,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(22,133,110,0); }
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: .95;
  letter-spacing: -.04em;
  margin: 0 0 .9rem;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.hero__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}

.hero__lede {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.45;
  margin: 0 0 .75rem;
  color: var(--fg);
  font-weight: 400;
  max-width: 36ch;
}
.hero__sub {
  color: var(--fg-dim);
  margin: 0 0 1.25rem;
  max-width: 46ch;
}

.hero__actions {
  display: flex; flex-wrap: wrap; gap: .75rem;
}
.hero__announce {
  margin: .75rem 0 0;
  padding: .65rem 1rem;
  background: rgba(110,64,201,.07);
  border: 1px solid rgba(110,64,201,.18);
  border-radius: .75rem;
  font-size: .9rem;
  color: var(--fg-dim);
  max-width: fit-content;
  line-height: 1.4;
}
.hero__announce strong { color: var(--fg); }
.hero__announce a { color: var(--accent); border-bottom-color: rgba(110,64,201,.25); }
.hero__announce a:hover { color: var(--accent-hi); }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .75rem 1.25rem;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { background: var(--accent-hi); transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-hi);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* hero photo */
.hero__photo {
  margin: 0;
  position: relative;
  justify-self: end;
  max-width: 28rem;
  width: 100%;
}
.hero__photo-frame {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 4/5;
  transform: rotate(1.5deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.hero__photo:hover .hero__photo-frame { transform: rotate(0deg); }
.hero__photo-frame::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.08) 100%);
  pointer-events: none;
}
.hero__photo-frame img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.9) contrast(1.02);
}

/* marquee */
.hero__marquee {
  margin-top: clamp(3rem, 6vw, 5rem);
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}
.marquee__track {
  display: inline-flex; gap: 2rem;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--fg-muted);
}
.marquee__track span:nth-child(odd) { color: var(--fg-dim); }
.marquee__track span:nth-child(even) { color: var(--accent); opacity: .6; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- asides (handwritten captions) ---------- */
.aside {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--accent);
  margin: 1rem 0 0;
  display: block;
}
.aside--right {
  text-align: right;
  margin-left: auto;
  max-width: 28ch;
}
.aside--stack {
  display: flex; flex-direction: column; gap: .25rem;
  max-width: 22ch;
}
.aside--stack span { display: block; position: relative; }
.aside--stack span:nth-child(1) { --ink-offset: 0;      color: var(--accent); }
.aside--stack span:nth-child(2) { --ink-offset: .75rem; color: var(--fg-dim); }
.aside--stack span:nth-child(3) { --ink-offset: .25rem; color: var(--accent); opacity: .85; }
.aside--stack span:nth-child(4) { --ink-offset: 1.1rem; color: var(--teal); }
.aside--stack span { transform: translateX(var(--ink-offset, 0)); }

/* aside text always rendered (handwritten reveal animation removed for perf) */
.aside .ink { display: inline; }
.aside .nib { display: none; }

/* ---------- about ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
.about__body p {
  font-size: 1.02rem;
  margin: 0 0 .7rem;
  max-width: 56ch;
}
.about__photo { margin: 0; }
.about__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 5/4;
  max-height: 18rem;
  transform: rotate(-1.8deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.about__photo:hover .about__photo-frame { transform: rotate(0deg); }
.about__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- research ---------- */
.research__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
.research__big {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 1rem;
  padding: 1rem 0 1rem 1.5rem;
  border-left: 3px solid var(--accent);
  color: var(--fg);
  max-width: 28ch;
}
.research__statement p {
  margin: 0 0 .7rem;
  max-width: 56ch;
}
.research__photo { margin: 0; }
.research__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 5/4;
  max-height: 18rem;
  transform: rotate(2deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.research__photo:hover .research__photo-frame { transform: rotate(0deg); }
.research__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- teaching ---------- */
.teaching__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
.teaching__statement { max-width: none; }
.teaching__big {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -.015em;
  margin: 0 0 1rem;
  padding: .75rem 0 .75rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--fg);
  max-width: 34ch;
}
.teaching__statement p {
  margin: 0 0 .7rem;
  max-width: none;
}
.teaching__full,
.service__full {
  margin-top: 1rem !important;
}
.teaching__photo { margin: 0; }
.teaching__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 5/4;
  max-height: 18rem;
  transform: rotate(-2deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.teaching__photo:hover .teaching__photo-frame { transform: rotate(0deg); }
.teaching__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- hobbies ---------- */
.hobbies__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
.hobbies__body p {
  margin: 0 0 .7rem;
  max-width: 56ch;
}
.hobbies__lede {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.35;
  color: var(--fg-dim);
  margin: 0 0 1.25rem;
}
.hobbies__list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: .9rem;
  max-width: 58ch;
}
.hobbies__row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.25rem;
  align-items: baseline;
  padding: .65rem 0;
  border-top: 1px solid var(--border);
}
.hobbies__row:last-child { border-bottom: 1px solid var(--border); }
.hobbies__list dt {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0;
}
.hobbies__list dd {
  margin: 0;
  color: var(--fg);
  line-height: 1.55;
}
@media (max-width: 640px) {
  .hobbies__row { grid-template-columns: 1fr; gap: .25rem; }
}
.hobbies__photo { margin: 0; }
.hobbies__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 5/4;
  max-height: 18rem;
  transform: rotate(2deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.hobbies__photo:hover .hobbies__photo-frame { transform: rotate(0deg); }
.hobbies__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- service & leadership ---------- */
.service__grid,
.awards__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

/* Research interests list — short high-level bullets */
.research__ideas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.research__ideas li {
  padding: .85rem 0 .9rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}
.research__ideas li:last-child { border-bottom: none; }
.research__ideas strong { color: var(--fg); }
.service__statement p {
  margin: 0 0 .7rem;
  max-width: 60ch;
}
.service__photo { margin: 0; }
.service__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  aspect-ratio: 5/4;
  max-height: 18rem;
  transform: rotate(-2deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.service__photo:hover .service__photo-frame { transform: rotate(0deg); }
.service__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- projects ---------- */
.project {
  margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
  padding: clamp(.75rem, 2vw, 1.5rem) 0;
  background: transparent;
  border: none;
  border-radius: 0;
  position: relative;
}
/* hairline between consecutive projects, but no line right under the section head */
.project + .project { border-top: 1px solid var(--border); }
.project::before { content: none; }
.project__header { margin-bottom: .75rem; position: relative; }
.project__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .05em;
  color: var(--accent);
  padding: .3rem .7rem;
  background: rgba(110,64,201,.07);
  border: 1px solid rgba(110,64,201,.2);
  border-radius: 999px;
  margin-bottom: .85rem;
  text-transform: lowercase;
}
.project__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  letter-spacing: -.01em;
  margin: 0;
  color: var(--fg);
}
.project__content {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
  align-items: start;
}
.project__body { position: relative; }
.project__body p { max-width: 62ch; margin: 0 0 1rem; }
/* In side-by-side layout the grid column constrains width; drop the per-p max-width */
.project__content .project__body p { max-width: none; }
.project__visual {
  margin-top: 0;
}
.project__visual .gallery__item {
  margin-top: 0;
  aspect-ratio: 16/11;
}
.project__caption {
  font-family: var(--font-hand);
  color: var(--accent);
  font-size: 1.15rem;
  margin-top: 1.5rem !important;
}
.project__gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .85rem;
  margin-top: 1.25rem;
}
.project__gallery--two {
  grid-template-columns: repeat(2, 1fr);
  max-width: 44rem;
}
.project__gallery--one {
  grid-template-columns: 1fr;
  max-width: 36rem;
}
.gallery__item {
  border-radius: .75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  aspect-ratio: 4/3;
  transition: transform .3s var(--ease), border-color .3s var(--ease);
}
.gallery__item:hover { transform: translateY(-2px); border-color: var(--accent); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- publications ---------- */
.pubs { display: grid; gap: 2.25rem; }
.pubs__group { display: grid; grid-template-columns: 5rem 1fr; gap: 1.5rem; align-items: start; }
.pubs__year {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 2rem;
  color: var(--accent);
  margin: 0;
  letter-spacing: -.01em;
  position: sticky;
  top: 5rem;
}
.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.pub {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub__cite {
  margin: 0 0 .5rem;
  font-size: 1rem;
  line-height: 1.55;
  max-width: 70ch;
}
.pub__links {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--fg-muted);
}
.pub__links a { color: var(--fg-dim); border-bottom: 1px solid transparent; margin: 0 .25rem; }
.pub__links a:first-child { margin-left: 0; }
.pub__links a:hover { color: var(--accent); border-color: var(--accent); }

.pubs__aside {
  margin-top: 1rem;
}
.pubs__aside .aside {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.2;
}

/* ---------- awards ---------- */
.awards__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.awards__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.award {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}
.award:first-child { border-top: 2px solid var(--accent); }
.award__year {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--accent);
  padding-top: .2rem;
  letter-spacing: .05em;
}
.award__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0 0 .4rem;
  color: var(--fg);
}
.award__body p { margin: 0; color: var(--fg-dim); font-size: .98rem; }

.awards__photo { margin: 0; }
.awards__photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  aspect-ratio: 4/5;
  transform: rotate(-2deg);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.18);
  transition: transform .4s var(--ease);
}
.awards__photo:hover .awards__photo-frame { transform: rotate(0deg); }
.awards__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }

/* ---------- contact ---------- */
.section--contact { padding-bottom: var(--section-pad); }
.contact {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  position: relative;
}
.contact::before { content: none; }
.contact__lede {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  color: var(--fg);
  margin: 0 0 2rem;
  max-width: 32ch;
  position: relative;
}
.contact__emails {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem;
  position: relative;
}
.contact__email {
  display: grid;
  grid-template-columns: 6rem 1fr;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1rem 0;
  border: none;
  color: var(--fg);
  transition: color .2s var(--ease);
}
/* hairline between the two emails, but no line right under the section head */
.contact__emails li + li .contact__email { border-top: 1px solid var(--border); }
.contact__email:hover { color: var(--accent); }
.contact__email:hover .contact__email-address { color: var(--accent); }
.contact__email-label {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .1em;
  color: var(--fg-dim);
  text-transform: uppercase;
}
.contact__email-address {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--fg);
  transition: color .2s var(--ease);
}
.at { color: var(--fg-dim); font-size: .85em; margin: 0 .1em; }

/* contact grid (emails + award photo side by side) */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.5rem;
  align-items: start;
}
.contact__award {
  margin: 0;
  flex-shrink: 0;
}
.contact__award .awards__photo-frame {
  width: 13rem;
  height: 13rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  transform: rotate(2deg);
  transition: transform .3s var(--ease);
}
.contact__award:hover .awards__photo-frame { transform: rotate(0deg); }
.contact__award .awards__photo-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); }
.contact__award figcaption {
  margin-top: .6rem;
  font-size: .85rem;
}

/* ---------- footer / colophon ---------- */
.footer {
  margin-top: clamp(3rem, 6vw, 5rem);
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
}
.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.colophon {
  max-width: 42rem;
}
.colophon__title {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .75rem;
}
.colophon p {
  font-size: .92rem;
  color: var(--fg-dim);
  margin: 0 0 .5rem;
  line-height: 1.6;
}
.colophon a {
  color: var(--fg-dim);
  border-bottom: 1px solid rgba(182,179,168,.3);
}
.colophon a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.colophon__repo {
  display: inline-block;
  margin-top: .35rem;
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--accent) !important;
  border-bottom: none !important;
}
.colophon__repo:hover {
  color: var(--accent-hi) !important;
}

.footer__meta {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--fg-muted);
  text-align: right;
  padding-top: 1.75rem;
}
.footer__meta p { margin: 0 0 .25rem; }

@media (max-width: 720px) {
  .footer__inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer__meta { text-align: left; padding-top: 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__photo { justify-self: start; max-width: 22rem; margin-top: 1rem; }
  .about__grid,
  .research__grid,
  .teaching__grid,
  .hobbies__grid,
  .service__grid,
  .awards__grid { grid-template-columns: 1fr; }
  .about__photo,
  .research__photo,
  .teaching__photo,
  .hobbies__photo,
  .service__photo,
  .awards__photo { max-width: 22rem; }
  .project__gallery { grid-template-columns: repeat(2, 1fr); }
  .pubs__group { grid-template-columns: 1fr; gap: .5rem; }
  .pubs__year { position: static; font-size: 1.5rem; }
  .award { grid-template-columns: 1fr; gap: .25rem; }
}

@media (max-width: 680px) {
  .project__content { grid-template-columns: 1fr; }
  .project__visual { order: -1; }
  .timeline { flex-direction: column; }
  .tl-previously { width: 100%; border-right: none; border-bottom: 1.5px dashed var(--border-hi); padding-right: 0; padding-bottom: .75rem; margin-right: 0; margin-bottom: .5rem; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem; }
  .tl-prev__label { margin-bottom: 0; }
}
@media (max-width: 520px) {
  .project__gallery { grid-template-columns: 1fr; }
  .contact__email { grid-template-columns: 1fr; gap: .1rem; }
  .contact__grid { grid-template-columns: 1fr; }
  .contact__award .awards__photo-frame { width: 10rem; height: 10rem; }
}

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ========================================================================
   TIMELINE  (publications / talks / grants / awards)
   ======================================================================== */

.timeline__lede {
  color: var(--fg-dim);
  font-size: 1.02rem;
  margin: 0 0 1.5rem;
  max-width: 52ch;
}

.timeline__legend {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--fg-dim);
  letter-spacing: .05em;
}
.timeline__legend li {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  text-transform: lowercase;
}
.swatch {
  width: .75rem;
  height: .75rem;
  border-radius: 50%;
  border: 1.5px solid transparent;
  display: inline-block;
}
/* 7 visual groups */
.swatch--publication { background: #cc99ff; border-color: #cc99ff; }
.swatch--funding     { background: #99d6d6; border-color: #99d6d6; }
.swatch--award       { background: #ffeb99;       border-color: #ffeb99; }
.swatch--education   { background: #99ccff;       border-color: #99ccff; }
.swatch--service     { background: #99ccff;       border-color: #99ccff; }
.swatch--teaching    { background: #ffb366;       border-color: #ffb366; }
.swatch--other       { background: #ff99dd;       border-color: #ff99dd; }
/* rejection swatch: tiny × */
.swatch--rejection {
  background: transparent;
  border-color: #ff9999;
  position: relative;
}
.swatch--rejection::before,
.swatch--rejection::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 1.5px;
  height: 65%;
  background: #ff9999;
  transform-origin: center;
}
.swatch--rejection::before { transform: translate(-50%, -50%) rotate(45deg); }
.swatch--rejection::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* The timeline itself */
.timeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  padding: 1.5rem 0 1rem;
  margin-bottom: 1.5rem;
}

/* "Previously" sidebar — pre-2019 education entries */
.tl-previously {
  position: relative;
  flex-shrink: 0;
  width: 11rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 2.5rem;       /* aligns entries to the axis line */
  padding-right: 1rem;
  border-right: 1.5px dashed var(--border-hi);
  margin-right: .5rem;
}
.tl-prev__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 1rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
  display: block;
}
.tl-prev__entry {
  display: block;
  width: 100%;
  text-align: left;
  padding: .4rem 0;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-bottom: .3rem;
  font-size: .8rem;
  line-height: 1.35;
  color: var(--fg);
  transition: color .2s var(--ease);
}
.tl-prev__entry:hover { color: var(--accent); }
.tl-prev__entry.is-active { color: var(--accent); }
.tl-prev__entry strong { display: block; font-size: .78rem; }
.tl-prev__entry span { font-size: .72rem; color: var(--fg-muted); font-family: var(--font-mono); }

/* Desktop: horizontal axis — line sits at the bottom, everything stacks up */
.tl-axis {
  position: relative;
  flex: 1;
  height: 11rem;
  padding: 0 2.25rem;
}
.tl-axis__line {
  position: absolute;
  left: 2.25rem; right: 2.25rem;
  bottom: 2.5rem;               /* just above the year labels */
  top: auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi) 10%, var(--border-hi) 90%, transparent);
}
/* Year labels sit at the very bottom of the axis so bars don't collide with them */
.tl-year {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  text-align: center;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--fg-muted);
  letter-spacing: .04em;
  width: 3.6rem;
  line-height: 1.2;
}
.tl-year__tick {
  display: block;
  width: 1px;
  height: .55rem;
  background: var(--border-hi);
  margin: 0 auto .2rem;
}
.tl-year__label {
  display: block;
}

/* Dots — anchored to the bottom axis line, stacking upward */
.tl-dot {
  position: absolute;
  bottom: 2.5rem;               /* bottom edge sits on the axis line */
  top: auto;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--fg-dim);
  cursor: pointer;
  transform: translate(-50%, 0); /* horizontally centered on year; dot sits ABOVE the line */
  padding: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.14);
  transition: transform .25s var(--ease), border-color .25s var(--ease),
              background .25s var(--ease), box-shadow .25s var(--ease);
  z-index: 2;
}
.tl-dot:hover,
.tl-dot:focus-visible {
  transform: translate(-50%, 0) scale(1.25);
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.14), 0 0 0 4px rgba(110,64,201,.18);
  z-index: 50;                /* lift whole stacking context so the tooltip clears sibling dots/bars */
}
.tl-dot.is-active {
  transform: translate(-50%, 0) scale(1.3);
  box-shadow: 0 1px 2px rgba(0,0,0,.14), 0 0 0 5px rgba(110,64,201,.25);
  z-index: 50;
}
/* Dot colours — 7 visual groups. Border = darker shade of fill for visual weight. */
.tl-dot--publication { background: #cc99ff; border-color: #9966cc; }
.tl-dot--funding     { background: #99d6d6; border-color: #5ea3a3; }
.tl-dot--award       { background: #ffeb99; border-color: #c9a13d; }
.tl-dot--education   { background: #99ccff; border-color: #6699cc; }
.tl-dot--service     { background: #99ccff; border-color: #6699cc; }
.tl-dot--teaching    { background: #ffb366; border-color: #cc7a33; }
.tl-dot--other       { background: #ff99dd; border-color: #cc66aa; }
/* rejection: X mark via pseudo-elements */
.tl-dot--rejection {
  background: transparent;
  border-color: #ff9999;
}
.tl-dot--rejection::before,
.tl-dot--rejection::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 2px;
  height: 70%;
  background: #ff9999;
  border-radius: 1px;
  transform-origin: center;
}
.tl-dot--rejection::before { transform: translate(-50%, -50%) rotate(45deg); }
.tl-dot--rejection::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* ── Span bars (education / service / other) ───────────────────────── */
.tl-span {
  position: absolute;
  height: 1.1rem;
  min-width: .8rem;
  border-radius: .55rem;
  border: 1px solid rgba(0,0,0,.18);
  cursor: pointer;
  padding: 0;
  top: auto;                     /* bottom-anchored; value set by JS */
  transform: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
  z-index: 2;
  transition: filter .2s var(--ease), box-shadow .2s var(--ease);
}
.tl-span:hover,
.tl-span:focus-visible {
  filter: brightness(.88);
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 3px rgba(0,0,0,.08);
  outline: none;
  z-index: 50;                /* lift so tooltip clears sibling dots/bars */
}
.tl-span.is-active {
  filter: brightness(.82);
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 4px rgba(0,0,0,.12);
  z-index: 50;
}
.tl-span--education { background: #99ccff; border-color: #6699cc; }
.tl-span--service   { background: #99ccff; border-color: #6699cc; }
.tl-span--teaching  { background: #ffb366; border-color: #cc7a33; }
.tl-span--other     { background: #ff99dd; border-color: #cc66aa; }
/* Future / dashed segments: no border, no drop-shadow — pure dashed fill */
.tl-span--future    { border: none; box-shadow: none; }

/* Future / planned portion of a span bar — same lane, same color, dashed */
.tl-span--future.tl-span--education {
  background: repeating-linear-gradient(to right,
    #99ccff 0, #99ccff 5px, transparent 5px, transparent 10px);
}
.tl-span--future.tl-span--service {
  background: repeating-linear-gradient(to right,
    #99ccff 0, #99ccff 5px, transparent 5px, transparent 10px);
}
.tl-span--future.tl-span--teaching {
  background: repeating-linear-gradient(to right,
    #ffb366 0, #ffb366 5px, transparent 5px, transparent 10px);
}
.tl-span--future.tl-span--other {
  background: repeating-linear-gradient(to right,
    #ff99dd 0, #ff99dd 5px, transparent 5px, transparent 10px);
}
.tl-span--future { opacity: .85; }

/* Span tooltip — same system as dots, anchored to left edge of bar */
.tl-span .tl-dot__tooltip {
  left: 0;
  transform: translateX(0) translateY(4px);
}
.tl-span:hover .tl-dot__tooltip,
.tl-span:focus-visible .tl-dot__tooltip,
.tl-span.is-active .tl-dot__tooltip {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

.tl-span__mobile-label { display: none; }

/* ── Hand-drawn annotations (replaces the old PhD education bar) ───── */
.tl-annot {
  position: absolute;
  top: .25rem;
  pointer-events: none;
  z-index: 60;      /* sit above dots/spans (z 2) and their hover z (50) */
  width: 0;
  height: 7.5rem;
}
.tl-annot__text {
  position: absolute;
  top: 0;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--accent);
  opacity: .9;
  white-space: nowrap;
  line-height: 1.1;
}
/* Line's top endpoint after 14° rotation over 6.1rem height sits at roughly
   (1.48rem across, 1.58rem down) from the anchor corner — text is centered
   on that point so the line enters through the middle of the label. */
/* Text sits above the SVG stroke's top endpoint so the line points up to
   the label. Line top endpoint (at path "M 3 82 ... 28 4") lands near
   x=1.75rem, y=2.4rem from the annotation container top. */
.tl-annot--left  .tl-annot__text { left:  1.75rem; top: 1.3rem; transform: translate(-50%, -50%) rotate(-2deg); }
.tl-annot--right .tl-annot__text { right: 1.75rem; top: 1.3rem; transform: translate(50%, -50%) rotate(-2deg); }

/* Inline-SVG stroke with two gentle control points — a curved path reads
   as hand-drawn where a rotated rectangle never will. */
.tl-annot__line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2rem;
  height: 5.3rem;
  overflow: visible;
  pointer-events: none;
}
.tl-annot__line path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .7;
}
/* Right annotation: mirror the same path so the curve heads inward */
.tl-annot--right .tl-annot__line {
  left: auto;
  right: 0;
  transform: scaleX(-1);
}

.tl-dot__tooltip {
  position: absolute;
  bottom: calc(100% + .75rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: .5rem;
  padding: .4rem .7rem;
  font-size: .78rem;
  font-family: var(--font-body);
  color: var(--fg);
  white-space: nowrap;
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 3;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.14);
}
.tl-dot:hover .tl-dot__tooltip,
.tl-dot:focus-visible .tl-dot__tooltip,
.tl-dot.is-active .tl-dot__tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* edge-aware tooltips: pin to the dot side so they don't overflow */
.tl-dot--tip-left .tl-dot__tooltip {
  left: 0;
  transform: translateX(0) translateY(4px);
}
.tl-dot--tip-left:hover .tl-dot__tooltip,
.tl-dot--tip-left:focus-visible .tl-dot__tooltip,
.tl-dot--tip-left.is-active .tl-dot__tooltip {
  transform: translateX(0) translateY(0);
}
.tl-dot--tip-right .tl-dot__tooltip {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(4px);
}
.tl-dot--tip-right:hover .tl-dot__tooltip,
.tl-dot--tip-right:focus-visible .tl-dot__tooltip,
.tl-dot--tip-right.is-active .tl-dot__tooltip {
  transform: translateX(0) translateY(0);
}

/* Dot vertical position is set entirely via inline style in JS — no margin classes needed */

/* Detail panel */
.timeline__detail {
  margin-top: 1.5rem;
  padding: 1.5rem 0 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  min-height: 8rem;
  position: relative;
  transition: border-color .3s var(--ease);
}
.timeline__detail:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.timeline__detail--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-family: var(--font-hand);
  font-size: 1.35rem;
  text-align: center;
}
.detail__kind {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .25rem .6rem;
  border-radius: 999px;
  margin-bottom: .75rem;
}
/* Publications group (paper = filled, talk = outlined) */
.detail__kind--paper { background: rgba(204,153,255,.22); color: #9966cc; }
.detail__kind--talk  { background: rgba(204,153,255,.12); color: #9966cc; border: 1px solid rgba(204,153,255,.4); }
/* Funding group */
.detail__kind--grant { background: rgba(153,214,214,.28); color: #5ea3a3; }
.detail__kind--award { background: rgba(255,235,153,.3);  color: #c9a13d; border: 1px solid rgba(201,161,61,.35); }
/* Education, Service, Other */
.detail__kind--education { background: rgba(153,204,255,.22); color: #6699cc; }
.detail__kind--service   { background: rgba(153,204,255,.22); color: #6699cc; }
.detail__kind--research  { background: rgba(255,153,221,.22); color: #cc66aa; }
.detail__kind--teaching  { background: rgba(255,179,102,.22); color: #cc7a33; }
/* Rejection */
.detail__kind--rejection { background: rgba(255,153,153,.22); color: #cc6666; border: 1px solid rgba(255,153,153,.4); }
.detail__year {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--fg-muted);
  margin-left: .5rem;
  letter-spacing: .05em;
}
.timeline__detail p {
  margin: 0 0 .5rem;
  line-height: 1.55;
}
.detail__links {
  margin-top: .75rem !important;
  font-family: var(--font-mono);
  font-size: .8rem;
}
.detail__links a {
  color: var(--fg-dim);
  margin: 0 .15rem;
}
.detail__links a:first-child { margin-left: 0; }

/* Footer: aside + mom photo */
.timeline__footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
  margin-top: 2.5rem;
}
.awards__photo--inline {
  max-width: 14rem;
  margin: 0;
}
.awards__photo--inline .awards__photo-frame {
  aspect-ratio: 4/5;
}

/* Vertical axis — mobile-only, rotated copy of the desktop horizontal axis.
   Hidden above the mobile breakpoint. */
.tl-axis-vert { display: none; }

@media (max-width: 720px) {
  /* Hide desktop horizontal axis on mobile; "previously" panel still shows above */
  .tl-axis { display: none !important; }
  .timeline { display: block; padding: 0; margin-bottom: 0; }
  .tl-previously { margin-bottom: 1rem; }

  /* Side-by-side on mobile: axis on the left, detail panel on the right
     (same height as the axis). Head + legend stay full-width above. */
  .section--timeline {
    display: grid;
    grid-template-columns: 12rem 1fr;
    column-gap: 1rem;
    row-gap: 1rem;
    align-items: stretch;
  }
  .section--timeline > .section__head,
  .section--timeline > .timeline__legend { grid-column: 1 / -1; }
  .section--timeline > #timeline         { grid-column: 1; min-width: 0; }
  .section--timeline > #timeline-detail {
    grid-column: 2;
    margin-top: 0;
    padding: 0;
    border-top: none;
    min-height: 0;
    align-self: stretch;
    overflow-y: auto;
  }

  .tl-axis-vert {
    display: block;
    position: relative;
    width: 100%;
    height: 44rem;
    padding: 0;
  }

  /* Tooltips are redundant on mobile — tap already fills the detail panel
     and cramped columns make them overflow the screen. */
  .tl-dot__tooltip { display: none !important; }

  /* Mobile annotations — positioned on the vertical axis (axisV) at their
     year's Y. Text extends rightward past axisV into the detail column;
     pointer-events: none so detail-panel taps aren't blocked. Container is
     tall (3.2rem) so the curved line has vertical room to bend away from
     the tick toward the label. */
  .tl-annot--vert {
    display: block;
    position: absolute;
    left: 3rem;
    width: auto;
    height: 3.2rem;
    pointer-events: none;
    z-index: 3;
  }
  /* Top variant ("started my PhD"): annotation sits BELOW the tick so the
     line starts at top-left (tick) and bends down-right toward the label. */
  .tl-annot--vert.tl-annot--top    { /* top: yearPosV(year) — no translate */ }
  /* Bottom variant ("ending my PhD"): annotation sits ABOVE the tick so
     the line starts at bottom-left (tick) and bends up-right to the label. */
  .tl-annot--vert.tl-annot--bottom { transform: translateY(-100%); }

  .tl-annot__line--vert {
    position: absolute;
    left: 0;
    top: 0;
    width: 3rem;
    height: 3.2rem;
    overflow: visible;
  }
  /* Text is vertically centered inside the annotation container — which
     puts its center at the midpoint of the curve where the path lands. */
  .tl-annot__text--vert {
    position: absolute;
    top: 50%;
    left: 3.2rem;
    transform: translateY(-50%) rotate(-2deg);
    transform-origin: left center;
    white-space: nowrap;
    font-size: 1.05rem;
  }
  .tl-axis-vert__line {
    position: absolute;
    top: 1rem; bottom: 1rem;
    left: 3.25rem;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--border-hi) 10%, var(--border-hi) 90%, transparent);
  }

  /* Year labels — positioned to the left of the axis, tick extends toward it */
  .tl-year--vert {
    position: absolute;
    left: 0;
    width: 3rem;
    bottom: auto;
    transform: translateY(-50%);
    text-align: right;
    white-space: nowrap;
    line-height: 1;
  }
  .tl-year--vert .tl-year__tick {
    display: inline-block;
    vertical-align: middle;
    width: .55rem;
    height: 1px;
    margin: 0 0 0 .25rem;
  }
  .tl-year--vert .tl-year__label {
    display: inline-block;
    vertical-align: middle;
  }

  /* Dots in vertical mode — centered on the axis, stacking rightward for same-year */
  .tl-dot--vert {
    bottom: auto;
    transform: translate(-50%, -50%);
  }
  .tl-dot--vert:hover,
  .tl-dot--vert:focus-visible {
    transform: translate(-50%, -50%) scale(1.25);
  }
  .tl-dot--vert.is-active {
    transform: translate(-50%, -50%) scale(1.3);
  }

  /* Span bars in vertical mode — narrow vertical rectangles */
  .tl-span--vert {
    width: 1.1rem;
    height: auto;
    min-width: 0;
    min-height: .8rem;
    bottom: auto;
    transform: translateX(-50%);
  }
  /* Future segments: vertical dashed pattern (top→bottom instead of left→right) */
  .tl-span--vert.tl-span--future.tl-span--education {
    background: repeating-linear-gradient(180deg,
      #99ccff 0, #99ccff 5px, transparent 5px, transparent 10px);
  }
  .tl-span--vert.tl-span--future.tl-span--service {
    background: repeating-linear-gradient(180deg,
      #99ccff 0, #99ccff 5px, transparent 5px, transparent 10px);
  }
  .tl-span--vert.tl-span--future.tl-span--teaching {
    background: repeating-linear-gradient(180deg,
      #ffb366 0, #ffb366 5px, transparent 5px, transparent 10px);
  }
  .tl-span--vert.tl-span--future.tl-span--other {
    background: repeating-linear-gradient(180deg,
      #ff99dd 0, #ff99dd 5px, transparent 5px, transparent 10px);
  }

  .timeline__footer { grid-template-columns: 1fr; }
  .awards__photo--inline { max-width: 18rem; }
}

/* ========================================================================
   PUBLICATIONS  (standalone list section)
   ======================================================================== */

.section--publist .section__head { margin-bottom: 1rem; }

.publist__lede {
  color: var(--fg-dim);
  font-size: 1.02rem;
  margin: 0 0 1.5rem;
  max-width: 52ch;
}

.publist__group {
  margin-bottom: 1.5rem;
}

.publist__group-title {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.publist__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.publist__item {
  padding: 1rem 0 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  transition: none;
}
.publist__item:last-child { border-bottom: none; }

/* Paper teaser image (e.g. workshop presentation photo) */
.pub__teaser {
  float: right;
  margin: .25rem 0 .5rem 1.25rem;
  width: clamp(9rem, 20vw, 13rem);
  transform: rotate(-1.2deg);
}
.pub__teaser img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: .5rem;
  border: 1px solid var(--border-hi);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.2);
}
.pub__teaser figcaption {
  font-family: var(--font-hand);
  font-size: .95rem;
  color: var(--fg-dim);
  margin-top: .35rem;
  line-height: 1.3;
  text-align: center;
}
.publist__item::after { content: ""; display: block; clear: both; }

/* In the timeline detail panel, show the teaser full-width below the text */
.timeline__detail .pub__teaser {
  float: none;
  margin: 1rem 0 0;
  width: min(22rem, 100%);
  transform: rotate(-1deg);
}
@media (max-width: 640px) {
  .pub__teaser { float: none; margin: .75rem 0 0; width: min(18rem, 100%); }
}

.publist__item:hover {
  border-color: var(--border-hi);
}

.publist__item p {
  margin: 0 0 .4rem;
  line-height: 1.55;
}
.publist__item p:last-child { margin-bottom: 0; }

.publist__year {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--fg-muted);
  letter-spacing: .06em;
  display: block;
  margin-bottom: .4rem;
}

.publist__links {
  margin-top: .6rem;
  font-family: var(--font-mono);
  font-size: .8rem;
}
.publist__links a {
  color: var(--fg-dim);
  margin: 0 .15rem;
}
.publist__links a:first-child { margin-left: 0; }

.publist__empty {
  color: var(--fg-muted);
  font-style: italic;
  font-size: .95rem;
}

/* Handwritten aside used inline in detail panel */
.handwritten-note {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--fg-muted);
  display: inline-block;
  transform: rotate(-1.5deg);
  margin-left: .25em;
  opacity: .85;
}
