/* StatML Reading Group.
   Structure, section rhythm, navbar and theme mechanics follow
   ericchen28.github.io. Restraint over decoration: the page is neutral --
   even links and the nav underline -- and a single accent, rouge, appears
   only for the present tense: the running term, the next talk, a life
   remembered. Twice a page, never as decoration. Type comes from --fs-*. */

/* ================ Theme variables ================ */
:root {
  color-scheme: light;

  /* surfaces: ivory rather than #fff */
  --bg: #fdfdfb;
  --bg-elev: #ffffff;
  --bg-sunk: #f7f6f2;
  --nav-bg: #fdfdfb;
  --nav-bg-docked: rgba(253, 253, 251, 0.88);

  /* ---- text ramp */
  --text-strong: #14161c;
  --text: #22252c;
  --text-mid: #333740;
  --text-soft: #555a63;
  --text-muted: #6f747c;   /* 4.61:1 on paper -- AA at 13px */
  --text-faint: #8d939c;   /* decorative only */

  /* ---- lines & borders */
  --hairline: #ebe9e4;
  --hairline-strong: #ded9d1;
  --border-mid: #bcb8ae;

  /* ---- accents */
  --rouge: #8c2731;
  --rouge-wash: rgba(140, 39, 49, 0.07);

  --link: #34647b;            /* sky-leaning blue, half the chroma of a default web link */
  --link-hover: #174c62;

  --shadow-soft: rgba(20, 22, 28, 0.05);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161a;
  --bg-elev: #1d2026;
  --bg-sunk: #191c21;
  --nav-bg: #14161a;
  --nav-bg-docked: rgba(20, 22, 26, 0.85);

  --text-strong: #f2f3f5;
  --text: #d7d9dd;
  --text-mid: #c4c7cc;
  --text-soft: #a3a7ad;
  --text-muted: #7d828a;
  --text-faint: #62666d;

  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.17);
  --border-mid: rgba(255, 255, 255, 0.28);

  /* lifted: the light values sit near 2:1 on #14161a */
  --rouge: #e4868d;
  --rouge-wash: rgba(228, 134, 141, 0.12);

  --link: #8ebcd6;
  --link-hover: #acdbf5;

  --shadow-soft: rgba(0, 0, 0, 0.35);
}

/* ================ Type scale ================
   Root is 62.5%, so 1rem = 10px. Every font-size comes from here. */
:root {
  --fs-micro: 1.1rem;   /* badges, counts                    */
  --fs-label: 1.2rem;   /* uppercase micro-labels, nav        */
  --fs-meta:  1.3rem;   /* dates, affiliations, footer        */
  --fs-small: 1.4rem;   /* bylines, name lists                */
  --fs-body:  1.5rem;   /* body copy                          */
  --fs-lead:  1.7rem;   /* lede, "up next" title              */
  --fs-sub:   1.9rem;   /* semester names                     */
  --fs-head:  3.0rem;   /* h4 -- the section heading          */
  --fs-disp:  3.4rem;   /* wordmark                           */
  --fs-disp-lg: 4.2rem; /* wordmark, >=550px                  */
  --fs-disp-sm: 2.6rem; /* wordmark, small screens            */
  --fs-icon:  1.6rem;   /* icon buttons                       */

  --tracking-label: .2rem;   /* uppercase micro-labels */
  --tracking-head:  .1rem;   /* section headings       */
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
}

/* Positive tracking, overriding Skeleton's negative. */
h4 {
  font-size: var(--fs-head);
  letter-spacing: var(--tracking-head);
  color: var(--text-strong);
}

.container { max-width: 1140px; }

a { color: inherit; }
a:hover { color: inherit; }

/* Colour marks the link; the underline is the hover state. Petrol sits far
   enough from the ink to register at a glance (dE ~29) while staying deep
   enough not to protrude -- a link lighter than its surrounding text reads
   as disabled, which is what the earlier grey did. */
.text-link, .prose a, .person-name a, .footer a, .abstract a, .talk-byline a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.text-link:hover, .prose a:hover, .person-name a:hover,
.footer a:hover, .abstract a:hover, .talk-byline a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

/* ================ Header ================ */
.header { margin-top: 40px; margin-bottom: 30px; text-align: center; }
@media (min-width: 550px) { .header { margin-top: 5rem; } }

.wordmark { display: block; text-decoration: none; }
.wordmark-main {
  display: block;
  font-size: var(--fs-disp);
  font-weight: 300;
  letter-spacing: .08rem;
  line-height: 1.12;
  color: var(--text-strong);
}
.wordmark-sub {
  display: block;
  margin-top: 8px;
  text-transform: uppercase;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: .3rem;
  color: var(--text-muted);
}
@media (min-width: 550px) { .wordmark-main { font-size: var(--fs-disp-lg); } }

/* A quiet mark, not a flag. */
.wordmark-rule {
  display: flex; justify-content: center; gap: 0;
  margin: 16px auto 0; width: 48px; height: 2px;
}
.wordmark-rule span { flex: 1; }
.wordmark-rule span:nth-child(1) { background: var(--text-mid); }
.wordmark-rule span:nth-child(2) { background: var(--hairline-strong); }
.wordmark-rule span:nth-child(3) { background: var(--rouge); }

.header-affil {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: var(--fs-sub);
  letter-spacing: .02rem;
  color: var(--text-mid);
}
.header-affil a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s ease;
}
.header-affil a:hover { text-decoration-color: var(--text-faint); }

/* ================ Sections ================ */
.docs-section {
  border-top: 1px solid var(--hairline);
  padding: 4rem 0;
  margin-bottom: 0;
}

/* Heading rule. Neutral by default; rouge marks the running term. */
.docs-section > h4,
.section-header-row h4 {
  position: relative;
  padding-top: 14px;
  margin-bottom: 1.8rem;
}
.docs-section > h4:before,
.section-header-row h4:before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 26px; height: 2px;
  background: var(--text-mid);
  transition: width 0.3s ease;
}
.docs-section > h4.is-current:before,
.section-header-row h4.is-current:before { background: var(--rouge); }

/* Newest semester, distinguished from the thirty behind it. */
.term-section:first-of-type .term-name { color: var(--text-strong); }
.term-section:first-of-type .term-header { border-bottom-color: var(--rouge); }

.section-header-row {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 10px; margin-bottom: 1.8rem;
}
.section-header-row h4 { margin-bottom: 0; }

.prose { max-width: none; }
.prose p { margin-bottom: 1.6rem; font-size: var(--fs-body); }
.lede { font-size: var(--fs-lead); line-height: 1.6; color: var(--text-mid); }

/* ================ Nav ================ */
.navbar { display: none; }

@media (min-width: 750px) {
  .navbar + .docs-section { border-top-width: 0; }
  .navbar, .navbar-spacer {
    display: block; width: 100%; height: 5.2rem;
    background: var(--nav-bg); z-index: 99;
    border-top: none; border-bottom: 1px solid var(--hairline);
    transition: background 0.3s ease, box-shadow 0.3s ease;
  }
  .navbar-spacer { display: none; }
  .navbar > .container { width: 100%; }
  .navbar-list { list-style: none; margin-bottom: 0; display: flex; align-items: center; gap: 42px; }
  .navbar-item { position: relative; margin-bottom: 0; }
  .navbar-link {
    text-transform: uppercase;
    font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--tracking-label);
    text-decoration: none; line-height: 5.2rem; color: var(--text-mid);
    position: relative; transition: color 0.3s ease, opacity 0.3s ease;
  }
  .navbar-link:after {
    content: ''; position: absolute; bottom: 50%; left: 0; width: 100%; height: 1.5px;
    background: var(--text-strong);
    transform: translateY(14px) scaleX(0); transform-origin: center;
    transition: transform 0.3s ease;
  }
  /* Hovering the list dims every link but the hovered one. */
  .navbar-list:hover .navbar-link { opacity: 0.25; }
  .navbar-list:hover .navbar-link:hover,
  .navbar-list:hover .navbar-link.active { opacity: 1; }
  .navbar-link:hover { color: var(--text-strong); }
  .navbar-link:hover:after { transform: translateY(14px) scaleX(1); }
  .navbar-link.active { color: var(--text-strong); }
  .navbar-link.active:after { transform: translateY(14px) scaleX(1); }

  .has-docked-nav .navbar {
    position: fixed; top: 0; left: 0;
    background: var(--nav-bg-docked);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
    box-shadow: 0 1px 4px var(--shadow-soft);
  }
  .has-docked-nav .navbar-spacer { display: block; }
  .has-docked-nav .navbar > .container { width: 80%; }
}

.navbar-mobile {
  display: flex; gap: 22px; justify-content: center; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.navbar-mobile a {
  text-transform: uppercase; font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .18rem; color: var(--text-soft); text-decoration: none;
}
.navbar-mobile a.active { color: var(--text-strong); }
@media (min-width: 750px) { .navbar-mobile { display: none; } }

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 6.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ================ Talk rows ================ */
.term-section { margin-bottom: 3.4rem; }
.term-section:last-child { margin-bottom: 0; }

.term-header {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 1.4rem; padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}
.term-name {
  font-size: var(--fs-sub); font-weight: 600;
  color: var(--text-mid); letter-spacing: .04rem;
}
.term-meta {
  font-size: var(--fs-meta); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.talk-list { display: flex; flex-direction: column; gap: 14px; }

.talk {
  display: flex; gap: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--hairline-strong);
  transition: border-left-color 0.2s ease;
}
.talk:hover { border-left-color: var(--text-muted); }
.talk.open { border-left-color: var(--text-mid); }
.talk.is-break { border-left-style: dotted; }
.talk.is-break:hover { border-left-color: var(--hairline-strong); }

.talk-date {
  color: var(--text-muted); font-size: var(--fs-meta); font-weight: 500;
  min-width: 74px; flex-shrink: 0; padding-top: 1px;
  font-variant-numeric: tabular-nums;
}
.talk-body { min-width: 0; flex: 1; }

.talk-title {
  font-size: var(--fs-body);
  font-weight: 600; color: var(--text); line-height: 1.4;
  cursor: pointer; display: block;
  transition: color 0.2s ease;
}
.talk-title.is-static { cursor: default; }
.talk:hover .talk-title:not(.is-static) { color: var(--text-strong); }

/* Only on titles that open: inline-block, so on a wrapping title it would
   otherwise land on its own line as a blank row. */
.talk-title:not(.is-static):after {
  content: '\203A';
  font-size: var(--fs-body); font-weight: 300; color: var(--text-muted);
  margin-left: 6px; display: inline-block;
  opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease;
}
.talk:hover .talk-title:not(.is-static):after { opacity: 1; }
.talk.open .talk-title:after { opacity: 1; transform: rotate(90deg); }

.talk-byline { color: var(--text-soft); font-size: var(--fs-small); margin-top: 2px; }
.talk-affil { color: var(--text-muted); }
.talk-where { color: var(--text-muted); font-size: var(--fs-meta); margin-top: 2px; }
.talk-note { color: var(--text-muted); font-size: var(--fs-meta); font-style: italic; }

.talk-abstract {
  color: var(--text-soft); line-height: 1.65; font-size: var(--fs-small);
  max-height: 0; overflow: hidden;
  transition: max-height 0.28s ease, margin 0.28s ease, padding 0.28s ease;
  margin-top: 0;
}
.talk.open .talk-abstract {
  max-height: 260rem;
  margin-top: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--hairline);
}

.talk-links { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.talk-badge {
  font-size: var(--fs-micro); padding: 0 5px; border-radius: 2px; line-height: 1.6;
  display: inline-block; text-decoration: none;
  background: transparent; border: 1px solid var(--border-mid); color: var(--text-soft);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.talk-badge:hover { border-color: var(--text-muted); color: var(--text-mid); }

.talk-tbd .talk-title { color: var(--text-faint); font-weight: 500; }
.talk-no_meeting .talk-title,
.talk-cancelled .talk-title {
  color: var(--text-muted); font-weight: 500; font-style: italic;
}

/* "Up next" -- where rouge carries the most weight. */
.next-talk {
  border-left: 2px solid var(--rouge);
  background: var(--rouge-wash);
  padding: 12px 0 12px 14px;
  margin-bottom: 2.4rem;
  border-radius: 0 2px 2px 0;
}
.next-label {
  text-transform: uppercase; font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: var(--tracking-label); color: var(--rouge);
}
.next-title {
  font-size: var(--fs-lead); font-weight: 600; line-height: 1.35;
  margin: 5px 0 2px; color: var(--text-strong);
}
.meeting-line { font-size: var(--fs-body); color: var(--text-mid); }
.meeting-line strong { font-weight: 600; color: var(--text-strong); }

/* The only button on the site. */
.btn-quiet {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--hairline-strong); border-radius: 3px;
  text-transform: uppercase; font-size: var(--fs-label); font-weight: 600;
  letter-spacing: var(--tracking-label);
  color: var(--text-mid); text-decoration: none; background: transparent;
  transition: border-color .22s ease, color .22s ease, background .22s ease;
}
.btn-quiet:after {
  content: '\2192'; font-size: var(--fs-small); letter-spacing: 0;
  transition: transform .22s ease;
}
.btn-quiet:hover {
  border-color: var(--text-muted); color: var(--text-strong); background: var(--bg-sunk);
}
.btn-quiet:hover:after { transform: translateX(3px); }

/* ================ Archive controls ================ */
.archive-controls {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 2.2rem;
}
.archive-search {
  flex: 1 1 260px; min-width: 0;
  height: 38px; padding: 0 12px;
  font-family: inherit; font-size: var(--fs-small);
}
.archive-count {
  font-size: var(--fs-meta); color: var(--text-muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.term-jump { font-size: var(--fs-meta); height: 38px; padding: 0 8px; }
.is-hidden { display: none !important; }
.archive-empty { color: var(--text-muted); font-style: italic; }

mark {
  background: transparent;
  color: var(--rouge);
  font-weight: 600;
  padding: 0;
}

/* ================ People ================ */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 30px 22px;
  margin-top: 1.8rem;
}
.person { text-align: center; min-width: 0; }
.person-photo {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  object-position: 50% 25%;   /* sources are 4:5; bias up for faces */
  border-radius: 3px; display: block;
  background: var(--bg-sunk);
}

.person-name {
  display: block; margin-top: 10px;
  font-size: var(--fs-small); font-weight: 600; line-height: 1.3; color: var(--text);
}
.person-role { font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.35; margin-top: 2px; }
.person-affil { font-size: var(--fs-meta); color: var(--text-faint); line-height: 1.35; }
.person.is-memorial .person-name:after,
.person-row.is-memorial .person-name:after {
  content: 'in memoriam';
  display: block; font-size: var(--fs-micro); font-weight: 500; font-style: italic;
  text-transform: uppercase; letter-spacing: .1rem; color: var(--rouge);
  margin-top: 2px;
}

.people-group { margin-bottom: 3.4rem; }
.people-group:last-child { margin-bottom: 0; }
.people-group-title {
  display: flex; align-items: baseline; gap: 10px;
  text-transform: uppercase; font-size: var(--fs-label); font-weight: 600;
  letter-spacing: var(--tracking-label); color: var(--text-mid);
  padding-bottom: 8px; border-bottom: 1px solid var(--hairline);
}
.people-count {
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: .08rem;
  color: var(--text-muted); background: var(--bg-sunk);
  padding: 1px 6px; border-radius: 2px;
  font-variant-numeric: tabular-nums;
}

/* Postdocs, students, alumni. Multi-column so 60+ alumni read as a roster. */
.people-list {
  list-style: none; margin: 1.6rem 0 0; padding: 0;
  columns: 2; column-gap: 32px;
}
@media (min-width: 750px) { .people-list { columns: 3; } }
.person-row {
  break-inside: avoid; -webkit-column-break-inside: avoid;
  margin-bottom: 11px; line-height: 1.35;
}
.person-row .person-name { display: block; margin-top: 0; font-size: var(--fs-small); }
.person-row .person-affil { font-size: var(--fs-meta); }

/* ================ Footer ================ */
.footer {
  text-align: center; color: var(--text-muted);
  border-top: 1px solid var(--hairline);
  padding: 24px 0 40px; margin-bottom: 0; font-size: var(--fs-meta);
}
.footer-history {
  max-width: 54rem; margin: 0 auto;
  font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.55;
}

/* ================ Theme toggle ================ */
.theme-toggle {
  background: none; border: none; padding: 0; margin: 0; height: auto;
  line-height: 1; letter-spacing: normal; color: inherit; font-size: var(--fs-icon); cursor: pointer;
}
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-floating {
  position: fixed; top: 16px; right: 20px; z-index: 200;
  font-size: var(--fs-lead); color: var(--text-muted);
  transition: color 0.2s ease;
}
.theme-toggle-floating:hover { color: var(--text-strong); }

/* Dissolve the old frame as one unit (View Transitions). */
::view-transition-new(root) { animation: none; }
::view-transition-old(root) { animation-duration: 0.3s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root) { animation: none; }
}
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after { transition: none !important; }

/* ================ Skeleton repairs ================
   Skeleton hardcodes light greys here, so they break in dark mode -- most
   visibly the search box. Overridden rather than edited into skeleton.css,
   which stays a clean upstream copy. */
input[type="text"], input[type="search"], input[type="email"],
input[type="number"], textarea, select {
  background-color: var(--bg-elev);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  border-radius: 3px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus, input[type="search"]:focus, textarea:focus, select:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px var(--bg-sunk);
  outline: 0;
}
input::placeholder { color: var(--text-faint); }

code, pre > code {
  background: var(--bg-sunk);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
}
th, td { border-bottom: 1px solid var(--hairline); }
hr { border-top: 1px solid var(--hairline); }

.button, button { color: var(--text-soft); border-color: var(--border-mid); }
.button:hover, button:hover, .button:focus, button:focus {
  color: var(--text-strong); border-color: var(--text-muted);
}

/* Skeleton styles focus on inputs only. */
a:focus-visible, button:focus-visible, .talk-title:focus-visible {
  outline: 2px solid var(--rouge);
  outline-offset: 2px;
  border-radius: 1px;
}

/* ================ Small screens ================ */
@media (max-width: 549px) {
  .talk { gap: 10px; }
  .talk-date { min-width: 58px; font-size: var(--fs-micro); }
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 16px; }
  .wordmark-main { font-size: var(--fs-disp-sm); }
  .people-list { columns: 1; }
}
