/* ── chrome: progress bar ───────────────────────── */
#progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--accent); z-index: 100;
  transition: width 0.1s linear;
}

/* ── chrome: nav ────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 90;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .nav { background: var(--bg); }
}
.nav .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; gap: var(--s4);
}
.monogram {
  font-family: var(--serif); font-size: 1.35rem;
  font-weight: 700; color: var(--ink); letter-spacing: 0.02em;
}
.monogram:hover { color: var(--accent); }

.nav-links { display: flex; gap: var(--s5); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  position: relative; font-size: var(--fs-sm); font-weight: 500;
  color: var(--muted); padding: var(--s2) 0;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="true"] { color: var(--accent); }
.nav-links a[aria-current="true"]::after {
  content: ""; position: absolute; inset: auto 0 -2px 0;
  height: 2px; background: var(--accent); border-radius: 1px;
}
.nav-tools { display: flex; gap: var(--s2); }
.nav-tools .icon-btn { width: 2.15rem; height: 2.15rem; }
.lang-btn { font-size: 0.9rem; font-weight: 600; }

/* ── chrome: back to top ────────────────────────── */
#to-top {
  position: fixed; right: var(--s5); bottom: var(--s5); z-index: 80;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all 0.25s var(--ease);
}
#to-top.is-visible { opacity: 1; visibility: visible; transform: none; }

/* ── chrome: background grain ──────────────────── */
.bg-texture {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .bg-texture { opacity: 0.05; }

/* ── hero ───────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s8);
  align-items: center;
  justify-items: center;
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--s9) 0 var(--s8);
}
.portrait-wrap { position: relative; flex: none; }
.portrait-wrap::before {
  content: ""; position: absolute; inset: -18%;
  background: radial-gradient(circle, var(--accent-14), transparent 68%);
  border-radius: 50%; z-index: -1;
}
.portrait {
  width: 330px; height: 330px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--accent-35);
}
.hero h1 { font-size: var(--fs-name); margin: var(--s2) 0 var(--s3); text-align: center; }
.hero h1 .nick { font-size: 0.5em; color: var(--muted); font-weight: 400; }
.hero .role {
  font-family: var(--serif); font-size: var(--fs-h3);
  color: var(--accent); margin-bottom: var(--s2); text-align: center;
}
.hero .dept { color: var(--text); margin-bottom: var(--s1); text-align: center; }
.hero .affil { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--s4); text-align: center; }
.hero .affil a { text-decoration: underline; text-underline-offset: 2px; }
.hero .keywords {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  font-size: var(--fs-kicker); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 600;
  color: var(--accent); margin-bottom: var(--s5);
  justify-content: center;
}
.hero .keywords li { list-style: none; }
.hero .keywords li + li::before { content: "·"; margin-right: var(--s3); color: var(--faint); }
.hero .keywords { padding: 0; margin-left: 0; }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: center; }

/* ── about ──────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--s8); }
.thesis {
  font-family: var(--serif); font-size: var(--fs-h2);
  line-height: 1.4; color: var(--ink); margin-bottom: var(--s6);
}
.about-body { color: var(--text); }
.about-body strong { color: var(--ink); font-weight: 600; }
.about-foot { font-size: var(--fs-sm); color: var(--faint); margin-top: var(--s5); }

.news h3 { font-size: var(--fs-kicker); text-transform: uppercase;
           letter-spacing: 0.1em; font-family: var(--sans);
           color: var(--muted); margin-bottom: var(--s4); }
.news ul { list-style: none; margin: 0; padding: 0; }
.news li { padding: var(--s3) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.news li:last-child { border-bottom: 0; }
.news .date { color: var(--accent); font-weight: 700; margin-right: var(--s2); }

/* ── research grid ──────────────────────────────── */
.research-intro { font-size: var(--fs-lg); max-width: 48rem; margin-bottom: var(--s7); }
.research-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--s5);
}
.subsection {
  margin-bottom: var(--s8);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5);
}
.subsection h3 { font-size: var(--fs-h3); margin-bottom: var(--s4); }
.section-head { margin-bottom: var(--s6); }
.section-head h2 { font-size: var(--fs-h2); margin-bottom: var(--s3); }
.rcard-img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.rcard-body { padding: var(--s5); }
.rcard-kicker { margin-bottom: var(--s3); }
.rcard-kicker .cat { color: var(--accent); }
.rcard-rule { height: 1px; background: var(--border); margin: var(--s3) 0; }
.rcard h3 { font-size: var(--fs-h3); margin-bottom: var(--s3); transition: color 0.2s var(--ease); }
.rcard:hover h3 { color: var(--accent); }
.rcard p { font-size: var(--fs-sm); color: var(--muted); }
.rcard .tag-row { margin-top: var(--s4); }

/* ── projects (replaces publications) ───────────── */
.projects-list { display: flex; flex-direction: column; gap: var(--s5); }
.pcard { display: grid; grid-template-columns: 14rem 1fr; gap: var(--s5); padding: var(--s5); align-items: stretch; }
.pcard-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.pcard-main { min-width: 0; }
.pcard .badge-row { margin-bottom: var(--s3); }
.pcard h3 { font-size: var(--fs-h3); margin-bottom: var(--s2); }
.pcard .pnote {
  display: flex; gap: var(--s2); align-items: flex-start;
  font-size: var(--fs-sm); color: var(--text);
  font-style: italic; margin-bottom: var(--s3);
}
.pcard .pnote svg { width: 15px; height: 15px; flex: none; margin-top: 0.3em; color: var(--ink); }
.pcard .stack { font-size: var(--fs-sm); color: var(--text); margin-bottom: var(--s1); }
.pcard .stack .lead { font-weight: 700; color: var(--ink); }
.pcard .prole { font-size: var(--fs-sm); font-style: italic; color: var(--muted); margin-bottom: var(--s4); }
.pcard .detail { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--s4);
                 padding-top: var(--s4); border-top: 1px solid var(--border); }

/* ── teaching ───────────────────────────────────── */
.teach-list { display: flex; flex-direction: column; gap: var(--s4); }
.outreach-list { display: flex; flex-direction: column; gap: var(--s4); }
.tcard { display: flex; justify-content: space-between; gap: var(--s5); padding: var(--s5); }
.tcard h3 { font-family: var(--sans); font-size: var(--fs-body); font-weight: 700; margin-bottom: var(--s2); }
.tcard h4 { font-family: var(--sans); font-size: var(--fs-body); font-weight: 700; margin-bottom: var(--s2); }
.tcard p { font-size: var(--fs-sm); color: var(--muted); }
.tcard .meta { font-size: var(--fs-sm); color: var(--faint); text-align: right; white-space: nowrap; flex: none; }

/* outreach card with an embedded photo carousel — image on top, text below */
.tcard-media { display: flex; flex-direction: column; padding: 0; }
.tcard-media .outreach-carousel { margin: 0; }
.tcard-media .tcard-body { display: flex; justify-content: space-between; gap: var(--s5); padding: var(--s5); }
.tcard-media .tcard-body h4 { font-family: var(--sans); font-size: var(--fs-body); font-weight: 700; margin-bottom: var(--s2); }
.tcard-media .tcard-body p { font-size: var(--fs-sm); color: var(--muted); }
.tcard-media .tcard-body .meta { font-size: var(--fs-sm); color: var(--faint); text-align: right; white-space: nowrap; flex: none; }

@media (max-width: 48rem) {
  .tcard-media .tcard-body { flex-direction: column; gap: var(--s3); }
  .tcard-media .tcard-body .meta { text-align: left; }
}

/* ── contact ────────────────────────────────────── */
#contact { background: var(--bg-alt); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s8); }
.contact-rows { display: flex; flex-direction: column; gap: var(--s5); }
.crow { display: flex; gap: var(--s4); align-items: flex-start; }
.crow svg { width: 20px; height: 20px; color: var(--ink); flex: none; margin-top: 0.2em; }
.crow .label { font-size: var(--fs-kicker); text-transform: uppercase;
               letter-spacing: 0.08em; color: var(--muted); margin-bottom: var(--s1); }
.crow .val { color: var(--text); font-size: var(--fs-sm); line-height: 1.6; }

.connect {
  padding: var(--s6); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-08), transparent);
  border: 1px solid var(--border);
}
.connect h3 { font-size: var(--fs-h3); margin-bottom: var(--s3); }
.connect p { font-size: var(--fs-sm); color: var(--muted); }

.footer { text-align: center; padding: var(--s7) 0 var(--s8); border-top: 1px solid var(--border); }
.footer .socials { display: flex; justify-content: center; gap: var(--s3); margin-bottom: var(--s5); }
.footer .copy { font-size: var(--fs-sm); color: var(--muted); }
.footer .updated { font-size: 0.8rem; color: var(--faint); margin-top: var(--s1); }

/* ── responsive ─────────────────────────────────── */
@media (max-width: 62rem) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: var(--s7); }
  .pcard { grid-template-columns: 11rem 1fr; }
}
@media (max-width: 48rem) {
  :root { --s9: 3.5rem; }
  .hero { grid-template-columns: 1fr; text-align: center; gap: var(--s5); padding-top: var(--s7); }
  .portrait-wrap { margin: 0 auto; }
  .hero .keywords, .hero .actions { justify-content: center; }
  .nav-links { display: none; }
  .pcard { grid-template-columns: 1fr; }
  .pcard-thumb { height: auto; aspect-ratio: 4/3; max-width: 100%; }
  .tcard { flex-direction: column; gap: var(--s3); }
  .tcard .meta { text-align: left; }
}
