/* ==========================================================================
   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 {
  /* clears the floating nav (≈4.5rem incl. its top offset) plus breathing room */
  padding-top: clamp(6.5rem, 11vw, 8.5rem);
  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); }
/* hero photo */
.hero__photo {
  margin: 0;
  position: relative;
  justify-self: end;
  max-width: 28rem;
  width: 100%;
}
.hero__photo-frame {
  position: relative;
  border-radius: 1rem;
  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);
}

/* ---------- 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)); }
/* keep short photo captions on a single line (overrides the ch caps above) */
.aside--oneline { max-width: none; white-space: nowrap; }

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

/* ---------- about ---------- */
/* keep short photo captions on a single line */
.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); }

/* awards photo (frame class kept from the old service section) */
.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); }

/* ---------- 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: 0; }
/* Awards grouped by year: one year label per group, items beneath */
.awards__year + .awards__year { margin-top: 1.75rem; }
.awards__year-label {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 .35rem;
}
/* no rules between awards — spacing alone groups them */
.awards__year .publist__item { padding: .3rem 0 .45rem; border-bottom: 0; }
.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); }

/* ---------- footer (doubles as contact) ---------- */
.footer {
  margin-top: clamp(3rem, 6vw, 5rem);
  padding: 2rem 0 2.25rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 6rem;
}
.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.75rem;
  font-family: var(--font-mono);
  font-size: .85rem;
}
.footer__links a { color: var(--fg); border-bottom: 1px solid var(--border); }
.footer__links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.at { color: var(--fg-muted); margin: 0 .05em; }
.footer__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--fg-muted);
}
.footer__meta p { margin: 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,
  .awards__grid { grid-template-columns: 1fr; }
  .about__photo,
  .service__photo,
  .awards__photo { max-width: 22rem; }
}

/* ---------- 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 palette — publications carry the accent; everything else is
   muted context so the research output reads first. */
.section--timeline {
  --tl-pub:        var(--accent);
  --tl-pub-dk:     #4f2a9c;
  --tl-funding:    #3a9a82;  --tl-funding-dk:   #1f6e5b;
  --tl-award:      #d6a93f;  --tl-award-dk:     #9c7724;
  --tl-service:    #a3b0c4;  --tl-service-dk:   #73829b;
  --tl-ta:         #e0b493;  --tl-ta-dk:        #c48a62;
  --tl-teaching:   #b0673f;  --tl-teaching-dk:  #8a4426;
  --tl-other:      #c9aab9;  --tl-other-dk:     #94707f;
  --tl-education:  #ada2d4;  --tl-education-dk: #7b6fae;
  --tl-reject:     #c04040;
}

.timeline__legend {
  margin: 0 0 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--fg-dim);
  letter-spacing: .04em;
}
.timeline__legend-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem 1.15rem;
}
.timeline__legend-row li {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.timeline__legend-head {
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .7rem;
  min-width: 9.5rem;
}
.swatch {
  width: .8rem;
  height: .8rem;
  border-radius: 50%;
  border: 1.5px solid transparent;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}
.swatch--publication { background: var(--tl-pub);       border-color: var(--tl-pub-dk); }
.swatch--funding     { background: var(--tl-funding);   border-color: var(--tl-funding-dk); }
.swatch--award       { background: var(--tl-award);     border-color: var(--tl-award-dk); }
.swatch--education   { background: var(--tl-education); border-color: var(--tl-education-dk); }
.swatch--service     { background: var(--tl-service-dk); border-color: var(--tl-service-dk); }
.swatch--ta          { background: var(--tl-ta);        border-color: var(--tl-ta-dk); }
.swatch--teaching    { background: var(--tl-teaching);  border-color: var(--tl-teaching-dk); }
.swatch--other       { background: var(--tl-other);     border-color: var(--tl-other-dk); }
/* Publication encoding keys: shape (full paper) and fill (authorship).
   The shape keys are drawn neutral so they don't imply authorship. */
.swatch--publication.swatch--full { border-radius: .18rem; }
.swatch--publication:not(.swatch--solid):not(.swatch--coauthor) { background: var(--fg-muted); border-color: var(--fg-dim); }
.swatch--coauthor { background: var(--bg) !important; border: 2px solid var(--tl-pub) !important; }
/* rejection swatch: tiny × */
.swatch--rejection { background: transparent; border-color: var(--tl-reject); }
.swatch--rejection::before,
.swatch--rejection::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 1.5px;
  height: 65%;
  background: var(--tl-reject);
  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: .7rem;
  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: .7rem; color: var(--fg-muted); font-family: var(--font-mono); }

/* Swimlane axis: one labeled row per category. Everything inside is
   absolutely positioned by script.js; heights/tops are set inline (rem). */
.tl-axis {
  --tl-l: 9rem;     /* row-label column */
  --tl-r: 1.25rem;
  position: relative;
  flex: 1;
  min-width: 0;
}
.tl-rowlabel {
  position: absolute;
  left: 0;
  top: var(--row-mid);
  transform: translateY(-50%);
  width: calc(var(--tl-l) - .75rem);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  line-height: 1.2;
  pointer-events: none;
}
.tl-rowline {
  position: absolute;
  left: var(--tl-l);
  right: var(--tl-r);
  height: 0;
  border-top: 1px dashed rgba(191,185,174,.45);
  pointer-events: none;
}
.tl-grid {
  position: absolute;
  width: 1px;
  background: rgba(212,207,198,.55);
  pointer-events: none;
}
.tl-axis__line {
  position: absolute;
  left: var(--tl-l);
  right: var(--tl-r);
  height: 1px;
  background: var(--border-hi);
}
.tl-year {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--fg-muted);
  letter-spacing: .04em;
  line-height: 1;
}

/* Point marks: the button is a generous hit area; ::before draws the mark */
.tl-dot {
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}
.tl-dot::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: .62rem;
  height: .62rem;
  border-radius: 50%;
  background: var(--fg-muted);
  transform: translate(-50%, -50%);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.tl-dot:hover::before,
.tl-dot:focus-visible::before { transform: translate(-50%, -50%) scale(1.4); }
.tl-dot.is-active::before {
  transform: translate(-50%, -50%) scale(1.45);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px currentColor;
}
.tl-dot:hover, .tl-dot:focus-visible, .tl-dot.is-active { outline: none; z-index: 9999; }

.tl-dot--publication { color: var(--tl-pub); }
.tl-dot--publication::before { background: var(--tl-pub); }
.tl-dot--full::before { width: .72rem; height: .72rem; border-radius: .12rem; }
.tl-dot--coauthor::before { background: var(--bg); border: 1.75px solid var(--tl-pub); box-sizing: border-box; }
.tl-dot--funding { color: var(--tl-funding-dk); }
.tl-dot--funding::before { background: var(--tl-funding); width: .55rem; height: .55rem; }
.tl-dot--award { color: var(--tl-award-dk); }
.tl-dot--award::before { background: var(--tl-award); width: .55rem; height: .55rem; }
/* rejection: a small × */
.tl-dot--rejection { color: var(--tl-reject); }
.tl-dot--rejection::before {
  background:
    linear-gradient(45deg, transparent 43%, var(--tl-reject) 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, var(--tl-reject) 43% 57%, transparent 57%);
  border-radius: 0;
}

/* Spans: thin rules with round caps; the button is a taller hit area */
.tl-span {
  position: absolute;
  height: .55rem;
  min-width: .5rem;
  transform: translateY(-50%);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}
.tl-span::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: currentColor;
  transition: height .15s var(--ease), margin .15s var(--ease);
}
.tl-span:hover::before,
.tl-span:focus-visible::before,
.tl-span.is-active::before { height: 5px; margin-top: -2.5px; }
.tl-span:hover, .tl-span:focus-visible, .tl-span.is-active { outline: none; z-index: 9999; }
.tl-span--education { color: var(--tl-education-dk); }
.tl-span--service   { color: var(--tl-service-dk); }
.tl-span--ta        { color: var(--tl-ta-dk); }
.tl-span--teaching  { color: var(--tl-teaching-dk); }
.tl-span--other     { color: var(--tl-other-dk); }
.tl-span--future::before {
  background: repeating-linear-gradient(to right, currentColor 0 4px, transparent 4px 7px);
  opacity: .8;
}

/* Full-paper labels above the papers row, with a hairline leader */
.tl-plabel {
  position: absolute;
  transform: translateX(-100%);
  padding-right: .3rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: .92rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--fg);
  pointer-events: none;
}
.tl-leader {
  position: absolute;
  width: 1px;
  background: var(--border-hi);
  pointer-events: none;
}

/* PhD start / end: dashed rule through every row + handwritten label */
.tl-annot {
  position: absolute;
  width: 0;
  border-left: 1.5px dashed rgba(110,64,201,.45);
  pointer-events: none;
  z-index: 1;
}
.tl-annot__text {
  position: absolute;
  top: -.15rem;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}
.tl-annot--left  .tl-annot__text { left: .35rem; }
.tl-annot--right .tl-annot__text { right: .35rem; }

/* Tooltips (desktop hover) */
.tl-dot__tooltip {
  position: absolute;
  bottom: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #fff;
  border: 1px solid var(--border-hi);
  border-radius: .5rem;
  padding: .35rem .65rem;
  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 {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.tl-span .tl-dot__tooltip { left: 0; transform: translateY(4px); }
.tl-span:hover .tl-dot__tooltip,
.tl-span:focus-visible .tl-dot__tooltip { opacity: 1; transform: translateY(0); }
.tl-dot--tip-left .tl-dot__tooltip { left: 0; transform: translateY(4px); }
.tl-dot--tip-left:hover .tl-dot__tooltip,
.tl-dot--tip-left:focus-visible .tl-dot__tooltip { transform: translateY(0); }
.tl-dot--tip-right .tl-dot__tooltip { left: auto; right: 0; transform: translateY(4px); }
.tl-dot--tip-right:hover .tl-dot__tooltip,
.tl-dot--tip-right:focus-visible .tl-dot__tooltip { transform: translateY(0); }

/* Detail panel — styled like an open publication card */
.timeline__detail {
  margin-top: 1.25rem;
  padding: 1.25rem 1.4rem;
  background: #fdfcf9;
  border: 1px solid var(--border);
  border-radius: .75rem;
  min-height: 6rem;
  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;
  background: transparent;
  border-style: dashed;
  color: var(--fg-muted);
  font-family: var(--font-hand);
  font-size: 1.35rem;
  text-align: center;
}
.detail__kind,
.detail__role {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .22rem .6rem;
  border-radius: 999px;
  margin-bottom: .75rem;
}
.detail__role {
  margin-left: .35rem;
  color: var(--fg-dim);
  border: 1px solid var(--border-hi);
}
.detail__kind--paper,
.detail__kind--talk     { background: rgba(110,64,201,.12); color: var(--accent); }
.detail__kind--full     { background: var(--accent); color: #fff; }
.detail__kind--short,
.detail__kind--workshop,
.detail__kind--poster   { background: rgba(110,64,201,.12); color: var(--accent); }
.detail__kind--grant     { background: rgba(58,154,130,.16); color: var(--tl-funding-dk); }
.detail__kind--award     { background: rgba(214,169,63,.20); color: #7f611c; }
.detail__kind--education { background: rgba(173,162,212,.24); color: var(--tl-education-dk); }
.detail__kind--service   { background: rgba(163,176,196,.28); color: #556580; }
.detail__kind--research  { background: rgba(201,170,185,.30); color: #7a5566; }
.detail__kind--ta        { background: rgba(224,180,147,.30); color: #8a5236; }
.detail__kind--teaching  { background: rgba(217,165,133,.28); color: #8a5236; }
.detail__kind--rejection { background: rgba(192,64,64,.10); color: var(--tl-reject); }
.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: .78rem;
}
.detail__links a {
  color: var(--fg-dim);
  margin: 0 .15rem;
}
.detail__links a:first-child { margin-left: 0; }

@media (max-width: 720px) {
  /* Axis fits the viewport — no horizontal scrolling. */
  .timeline {
    flex-direction: column;
    align-items: stretch;
  }

  /* "Previously" panel stacks above the axis as a wrapped row. */
  .tl-previously {
    width: 100%;
    box-sizing: border-box;
    border-right: none;
    border-bottom: 1.5px dashed var(--border-hi);
    padding-right: 0;
    padding-bottom: .75rem;
    margin-right: 0;
    margin-bottom: .75rem;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
  }
  .tl-prev__label { margin-bottom: 0; }

  /* Tooltips are redundant on mobile — tap fills the detail panel. */
  .tl-dot__tooltip { display: none !important; }

  /* No label column: row labels sit above each row instead */
  .tl-axis { flex: none; --tl-l: .35rem; --tl-r: .35rem; }
  .tl-rowlabel {
    top: calc(var(--row-top) - .85rem);
    transform: none;
    width: auto;
    font-size: .6rem;
  }
  .tl-rowline { display: none; }

  /* Every other year label so the dense early years don't collide */
  .tl-year { font-size: .62rem; }
  .tl-year--minor { visibility: hidden; }

  .tl-annot__text { font-size: .9rem; }

  .timeline__legend-head { min-width: 0; width: 100%; }
  .timeline__detail { padding: 1rem 1.1rem; }

}

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

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

/* Small outbound link pushed to the right end of a section head */
.section__link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .04em;
  white-space: nowrap;
  border-bottom: none;
}
@media (max-width: 600px) {
  .section--publist .section__head { flex-wrap: wrap; row-gap: .25rem; }
  .section__link { margin-left: 0; flex-basis: 100%; }
}

.publist__group {
  margin-bottom: 1.5rem;
}

/* Publication groups: full papers / workshop papers / posters */
.publist__sub + .publist__sub { margin-top: 1.4rem; }
.publist__subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--fg-dim);
  margin: 0 0 .6rem;
}

.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; }

.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: .7rem;
  color: var(--fg-muted);
  letter-spacing: .06em;
  display: inline-block;
  margin-right: .5rem;
  margin-bottom: .4rem;
}

/* Publication-type badge in the publication list */
.pub-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .15rem .5rem;
  border-radius: 999px;
  margin-bottom: .4rem;
  vertical-align: baseline;
}
.pub-badge--full     { background: rgba(126,82,216,.22); color: #5a3aa8; }
.pub-badge--short    { background: rgba(126,82,216,.14); color: #6e40c9; border: 1px solid rgba(126,82,216,.35); }
.pub-badge--workshop { background: rgba(126,82,216,.18); color: #6e40c9; }
.pub-badge--poster   { background: rgba(126,82,216,.10); color: #6e40c9; border: 1px solid rgba(126,82,216,.35); }

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

/* ---------- Publication cards ---------- */
.pub-card {
  list-style: none;
  margin: 0 0 .6rem;
  padding: 0;
  background: #fdfcf9;
  border: 1px solid var(--border);
  border-radius: .75rem;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.pub-card:hover,
.pub-card:focus-within {
  border-color: var(--border-hi);
  background: #fff;
  box-shadow: 0 8px 24px -16px rgba(0,0,0,.18);
}
.pub-card[data-open="true"],
.pub-card:has(.pub-card__head[aria-expanded="true"]) {
  border-color: var(--accent);
  background: #fff;
}

.pub-card__head {
  display: grid;
  /* fixed meta column so citations line up regardless of badge width */
  grid-template-columns: 8.75rem 1fr auto;
  align-items: start;
  gap: 1rem;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: .9rem 1.1rem;
  color: var(--fg);
}
.pub-card__head:focus-visible { outline: none; }

.pub-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  min-width: 5rem;
}
.pub-card__meta .publist__year {
  margin: 0;
  display: inline-block;
}

.pub-card__citation {
  font-size: .98rem;
  line-height: 1.55;
}
.pub-card__citation p { margin: 0; }

.pub-card__chevron {
  font-family: var(--font-display);
  color: var(--fg-muted);
  font-size: 1.5rem;
  line-height: 1;
  align-self: center;
  transition: transform .25s var(--ease);
}
.pub-card__head[aria-expanded="true"] .pub-card__chevron {
  transform: rotate(90deg);
}

.pub-card__body {
  padding: 0 1.1rem 1rem 1.1rem;
  color: var(--fg-dim);
}
.pub-card__body[hidden] { display: none; }
.pub-card__body .publist__links {
  margin-top: 1rem;
}

.pub-card__teaser {
  margin: 0 auto 1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
  max-width: 40rem;
}
.pub-card__teaser img {
  display: block;
  width: 100%;
  height: auto;
}

.pub-card__abstract {
  margin: 0 0 .6rem;
  line-height: 1.6;
  font-size: .95rem;
  color: var(--fg);
}
.pub-card__abstract strong { font-weight: 600; color: var(--fg); }

.pub-card__poster {
  margin: 0 auto 1rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
  max-width: 40rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.pub-card__poster:hover {
  border-color: var(--border-hi);
  box-shadow: 0 12px 28px -16px rgba(0,0,0,.22);
}
.pub-card__poster a { display: block; border-bottom: 0; }
.pub-card__poster img { display: block; width: 100%; height: auto; }

@media (max-width: 560px) {
  .pub-card__head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "meta chevron"
      "citation citation";
    gap: .6rem;
    padding: .8rem .9rem;
  }
  .pub-card__meta { grid-area: meta; flex-direction: row; align-items: center; gap: .5rem; }
  .pub-card__chevron { grid-area: chevron; align-self: start; }
  .pub-card__citation { grid-area: citation; }
  .pub-card__body { padding: 0 .9rem .9rem; }
}

/* ---------- Timeline detail-panel previews (mini versions) ---------- */
.detail__teaser,
.detail__poster {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
  max-width: 30rem;
}
.detail__poster a { display: block; border-bottom: 0; }
.detail__teaser img,
.detail__poster img { display: block; width: 100%; height: auto; }

.detail__abstract {
  margin: .75rem 0 0;
  line-height: 1.55;
  font-size: .9rem;
  color: var(--fg-dim);
}
.detail__abstract strong { font-weight: 600; color: var(--fg); }
