/* Andres Drenik — Personal Website
   Direction G · UT burnt-orange + ivory · Playfair Display + Inter + JetBrains Mono
   Static build for GitHub Pages. */

/* ---------- Theme tokens ---------- */
:root {
  --bg:        #FBFAF5;
  --ink:       #111110;
  --muted:     #6E6B63;
  --rule:      #DDDAD0;
  --accent:    #BF5700; /* UT burnt orange */
  --hi-bg:     #F1EEE0;

  --serif:  "Playfair Display", Georgia, serif;
  --sans:   "Inter", -apple-system, system-ui, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, Menlo, monospace;
}
html[data-theme="dark"] {
  --bg:        #181A1D;
  --ink:       #ECEDEF;
  --muted:     #9598A0;
  --rule:      #2D3036;
  --accent:    #E8843B;
  --hi-bg:     #21242A;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  transition: background 300ms ease, color 300ms ease;
  padding: 32px 64px 72px;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 32px;
  /* Extend horizontally past body padding (64px on desktop) */
  margin: 0 -64px 32px;
  padding: 14px 64px;
  border-bottom: 1px solid transparent;
  /* Always-on subtle backdrop so content never bleeds through while scrolling.
     The transition only deepens it slightly when scrolled. */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  /* Extend background upward to cover body's 32px top padding */
  box-shadow: 0 -32px 0 0 color-mix(in srgb, var(--bg) 88%, transparent);
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--rule);
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 -32px 0 0 color-mix(in srgb, var(--bg) 96%, transparent);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-shrink: 1;
}
.brand img { height: 32px; object-fit: contain; flex-shrink: 0; }
.brand img.brand-ut { height: 42px; min-width: 0; flex-shrink: 1; }
html[data-theme="dark"] .brand img { filter: invert(1); }
.brand-divider {
  width: 1px;
  height: 28px;
  align-self: center;
  background: var(--ink);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 28px;
  align-items: center;
  flex-shrink: 0;
}
.site-nav a {
  font-family: var(--sans);
  font-size: 11px;
  white-space: nowrap;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: color 160ms ease, border-color 160ms ease;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.site-nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Link hover system ----------
   Two canonical styles, used consistently:
   1. .link-underline  — body links: underline always, dim on hover.
   2. .link-quiet      — utility/inline nav links: no underline, accent on hover.
*/
.link-underline {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}
.link-underline:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
.link-quiet {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 160ms ease, border-color 160ms ease;
}
.link-quiet:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Theme switch ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 8px;
}
.theme-switch button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 4px;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  opacity: 0.55;
  transition: color 200ms, opacity 200ms;
}
.theme-switch button.is-on { color: var(--ink); opacity: 1; }
.theme-switch .toggle {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: var(--hi-bg);
  border: 1px solid var(--rule);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 220ms ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
html[data-theme="dark"] .theme-switch .toggle {
  background: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}
.theme-switch .toggle::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  transition: left 220ms cubic-bezier(0.4,0,0.2,1), background 220ms ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
html[data-theme="dark"] .theme-switch .toggle::after {
  left: 15px;
  background: var(--bg);
}

/* ---------- Page entry animation ---------- */
@keyframes pageFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes detailFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
main { animation: pageFade 500ms ease both; }

/* ---------- About / Home ---------- */
.about {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 80px;
  align-items: start;
}
.headshot-frame {
  border: 1px solid var(--rule);
  aspect-ratio: 4 / 5;
  position: relative;
  background: var(--hi-bg);
  overflow: hidden;
}
.headshot-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about h1 {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 32px;
}

/* ---------- Hero heading: left-to-right scramble resolving to name ---------- */
.hero-heading {
  position: relative;
  margin: 0 0 24px;
  /* Lock the box to the *resolved* heading height so the lede below
     doesn't shift when junk glyphs (different font metrics) lock in. */
  min-height: 1.05em;
}
.hero-name {
  display: inline-block;
  font-variant-ligatures: none;
  /* Match the line-height the heading uses when resolved. */
  line-height: 1.05;
}
.hero-name .scrm {
  display: inline-block;
  white-space: pre;
  /* Force every cell to the heading's line-box so swapping fonts
     mid-animation cannot grow or shrink the line. */
  line-height: 1.05;
  vertical-align: baseline;
}
.hero-name .scrm.is-junk {
  /* Keep junk in the same Playfair stack and same color as resolved letters
     so the swap is a glyph change only — no font/metric/color shift that
     could read as the line "settling" when it locks in. */
  font-family: inherit;
  color: inherit;
}
.about .lede {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.55;
  max-width: 620px;
  margin: 0 0 20px;
}
.about .lede .accent { color: var(--accent); }
.about .lede a.accent {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease;
}
.about .lede a.accent:hover { border-bottom-color: var(--accent); }
.about .lede a.accent:visited { color: var(--accent); }
.about .editorial-credit {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 620px;
  margin: 0 0 40px;
}
.about .editorial-credit a.accent {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease;
}
.about .editorial-credit a.accent:hover { border-bottom-color: var(--accent); }
.about .editorial-credit a.accent:visited { color: var(--accent); }
.about .editorial-credit em { font-style: italic; }
.about .editorial-credit .label-legacy {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
}
.about .editorial-credit .journals {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}
.about .editorial-credit .journals em {
  font-style: italic;
}
.about .editorial-credit .journals .sep {
  margin: 0 8px;
  opacity: 0.5;
}
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 56px; }
.cta {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: border-color 140ms ease, color 140ms ease;
}
.cta:hover { border-color: var(--accent); color: var(--accent); }
.cta .meta { opacity: 0.6; }
.cta .cta-icon { opacity: 0.7; flex-shrink: 0; }

.contact-block {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.8;
  letter-spacing: 0.02em;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.contact-block .label {
  color: var(--ink);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  margin-bottom: 6px;
}
.contact-block .email { margin-top: 0; }
.contact-block .email-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease;
}
.contact-block .email-link:hover { border-bottom-color: var(--accent); }
.contact-block .email-link:visited { color: var(--accent); }

/* ---------- Section heading shared ---------- */
.section-title {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 40px;
}
.subsection {
  margin-bottom: 48px;
}
.subsection-title {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.subsection-title h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  margin: 0;
}
.subsection-title .legend {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Research ---------- */
.research-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 56px;
  align-items: start;
}
.paper-row {
  border-bottom: 1px solid var(--rule);
  padding: 20px 12px;
  margin: 0 -12px;
  cursor: pointer;
  background: transparent;
  transition: background 160ms ease;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 20px;
  align-items: baseline;
  position: relative;
  text-align: left;
  width: calc(100% + 24px);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  font: inherit;
  color: inherit;
}
.paper-row:hover { background: color-mix(in srgb, var(--hi-bg) 50%, transparent); }
.paper-row.is-selected {
  background: var(--hi-bg);
}
.paper-row.is-selected::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--accent);
}
.paper-row .idx {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.paper-row.is-selected .idx { color: var(--accent); }
.paper-row .title {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.paper-row .coauthors {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}
.paper-row .coauthors a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 120ms ease, border-color 120ms ease;
  color: inherit;
}
.paper-row .coauthors a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.paper-row .venue {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.paper-row .year {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.06em;
}
.paper-row .year.is-forthcoming {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: none;
}

.detail-aside {
  position: sticky;
  top: 88px;
  align-self: start;
  border-left: 1px solid var(--rule);
  padding-left: 32px;
  min-height: 400px;
}
.detail-empty { font-family: var(--sans); font-size: 11px; color: var(--muted); line-height: 1.8; letter-spacing: 0.04em; }
.detail-empty .eyebrow { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 14px; color: var(--accent); }
.detail-empty .body {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}
.detail-empty .waiting {
  margin-top: 20px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.detail-empty .waiting .caret {
  animation: blink 1s steps(2) infinite;
  color: var(--accent);
}

.detail-card { animation: detailFade 240ms ease both; }
.paper-detail-mobile { display: none; }
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.detail-eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.detail-close {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  padding: 0;
}
.detail-card h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.22;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.detail-card .coauthors {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 14px;
}
.detail-card .coauthors a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.detail-card .coauthors a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.detail-card .venue {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--rule);
}
.detail-card .note {
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.detail-card .label-row {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.detail-card .abstract {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 24px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}
.detail-card .links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.detail-card .link-pill {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 12px;
  text-decoration: none;
}
.detail-card .link-pill.primary { color: var(--accent); border-color: var(--accent); }
.detail-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-card .tag {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--rule);
  padding: 3px 8px;
  letter-spacing: 0.06em;
}

/* ---------- Discussions ---------- */
.discussions { max-width: 960px; }
.discussions .subsection-title { justify-content: flex-end; }
.disc-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 24px;
  padding: 18px 0;
  align-items: baseline;
  border-bottom: 1px dashed var(--rule);
}
.disc-row:last-child { border-bottom: none; }
.disc-row .yr {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  padding-top: 2px;
}
.disc-row .body { min-width: 0; }
.disc-row .body .title {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.disc-row .body .authors {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  margin-top: 4px;
}
.disc-row .body .venue {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 8px;
  line-height: 1.5;
}
.disc-row .action { white-space: nowrap; }
.slides-pill {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 7px 12px;
  text-decoration: none;
  display: inline-block;
  transition: background 140ms ease, color 140ms ease;
}
.slides-pill:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Teaching ---------- */
.teaching {
  max-width: 900px;
}
.teaching table { width: 100%; border-collapse: collapse; }
.teaching tr { border-top: none; }
.teaching td { padding: 22px 0; vertical-align: baseline; }
.teaching td.title { font-family: var(--serif); font-size: 18px; }
.teaching td.sem { font-family: var(--serif); font-size: 13px; color: var(--muted); font-style: italic; text-align: right; padding-left: 24px; white-space: nowrap; }
.teaching tr.institution-row { border-top: none; }
.teaching tr.institution-row + tr { border-top: none; }
.teaching td.inst {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  padding: 36px 0 12px;
  border-bottom: 1px solid var(--rule);
  line-height: 1.2;
}
.teaching tr.institution-row:first-child td.inst { padding-top: 4px; }
@media (max-width: 720px) {
  .teaching td.inst { font-size: 18px; }
}

/* ---------- CV ---------- */
.cv { max-width: 960px; }
.cv-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}
.cv .download {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 8px 14px;
}
.cv .row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 10px 0;
}
.cv .row:last-child { border-bottom: none; }
.cv .row .when { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; padding-top: 2px; }
.cv .row .what { font-family: var(--serif); font-size: 15px; line-height: 1.5; }

.cv .seminar-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 8px 0;
}
.cv .seminar-row:last-child { border-bottom: none; }
.cv .seminar-row .yr { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; padding-top: 2px; }
.cv .seminar-row .body { font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--ink); }

.cv .discussion-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 8px 0;
}
.cv .discussion-row:last-child { border-bottom: none; }
/* Cluster-only hairline: a thin rule above each new-year row (i.e. .yr has text), but never above the very first row. */
.cv .discussion-row + .cv .discussion-row:has(.yr:not(:empty)) {
  border-top: 1px solid var(--rule);
  margin-top: 8px;
  padding-top: 14px;
}
.cv .discussion-row .yr { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; padding-top: 2px; }
.cv .discussion-row .body { font-family: var(--serif); font-size: 15px; line-height: 1.55; }

.cv .place-row { padding: 10px 0; }
.cv .place-row:last-child { border-bottom: none; }
.cv .place-row .where {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.cv .place-row .body { font-family: var(--serif); font-size: 15px; line-height: 1.55; }
.cv .advising-note { font-family: var(--sans); font-size: 10px; color: var(--muted); margin-top: 10px; letter-spacing: 0.04em; }

.cv .prose { font-family: var(--serif); font-size: 15px; line-height: 1.65; color: var(--ink); }
.cv ul.service-list { font-family: var(--serif); font-size: 14px; line-height: 1.7; margin: 0; padding-left: 18px; }

/* ---------- Contact ---------- */
.contact { animation: pageFade 500ms ease both; }
.contact .intro { max-width: 960px; margin-bottom: 44px; }
.contact .intro p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.6;
  margin: 0 0 16px;
}
.contact .intro p.fine-print {
  font-family: var(--sans);
  font-style: normal;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-top: 18px;
  padding-top: 0;
  border-top: none;
  max-width: 880px;
}
.contact .intro p:last-child { margin-bottom: 0; }
.contact .intro .oh-season {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 0.92em;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.contact .calendar-frame {
  /* Always-light wrapper — Google Calendar embed inherits parent color-scheme,
     so we lock this region to light regardless of site dark mode. */
  background: #FBFAF5;
  color-scheme: light;
}
.contact iframe {
  border: 0;
  width: 100%;
  height: 640px;
  display: block;
  color-scheme: light;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body { padding: 20px 18px 56px; font-size: 15px; }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin: 0 -18px 32px;
    padding: 14px 18px;
  }
  .site-header.is-scrolled {
    box-shadow: 0 -20px 0 0 color-mix(in srgb, var(--bg) 82%, transparent);
  }
  .site-nav { flex-wrap: wrap; gap: 14px 18px; width: 100%; }

  .about { grid-template-columns: 1fr; gap: 28px; }
  .about h1 { font-size: 40px; line-height: 1.05; }
  .headshot-frame { max-width: 240px; margin: 0 auto; }

  .section-title { font-size: 30px; }
  .subsection-title h3 { font-size: 18px; }

  .research-grid { grid-template-columns: 1fr; gap: 28px; }
  .detail-aside {
    display: none;
  }
  .paper-detail-mobile {
    display: block;
    margin: 0 -12px 4px;
    padding: 18px 12px 22px;
    background: var(--hi-bg);
    border-bottom: 1px solid var(--rule);
    animation: detailFade 240ms ease both;
  }
  .paper-row {
    grid-template-columns: 28px 1fr;
    gap: 12px;
  }
  .paper-row .year { grid-column: 2; margin-top: 6px; }

  .cv .row, .cv .seminar-row, .cv .discussion-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .teaching table, .teaching tbody, .teaching tr { display: block; }
  .teaching td { display: block; width: auto !important; padding: 4px 0; text-align: left !important; }
  .teaching tr { padding: 14px 0; }
}
@media (max-width: 560px) {
  body { padding: 16px 14px 48px; }
  .site-header {
    margin: 0 -14px 32px;
    padding: 14px 14px;
  }
  .site-header.is-scrolled {
    box-shadow: 0 -16px 0 0 color-mix(in srgb, var(--bg) 82%, transparent);
  }
  .about h1 { font-size: 34px; }
  .section-title { font-size: 26px; }
}
