/* ==========================================================================
   Shahriyar Zaman Ridoy — portfolio stylesheet
   Text-forward academic layout: Newsreader (display) + Inter (body),
   crimson accent. Single column with a compact identity aside on the home page.
   ========================================================================== */

:root {
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --bg: #ffffff;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #6b6f76;
  --accent: #7a1f2b;
  --accent-rgb: 122, 31, 43;
  --accent-hover: #5c1620;
  --on-accent: #ffffff;
  --tint: rgba(122, 31, 43, 0.06);
  --divider: rgba(27, 27, 31, 0.1);
  --divider-strong: rgba(27, 27, 31, 0.22);
  --shadow: rgba(27, 27, 31, 0.12);
  --code-bg: rgba(122, 31, 43, 0.06);
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.6rem;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

strong,
b {
  font-weight: 600;
}

img {
  max-width: 100%;
  height: auto;
}

code,
pre {
  font-family: var(--font-mono);
}

pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: 0;
}

::selection {
  background: rgba(var(--accent-rgb), 0.18);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 20px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Masthead: name, tagline, primary navigation
   -------------------------------------------------------------------------- */

.masthead {
  position: relative;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}

.masthead__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem 1.5rem;
  padding-top: 2.25rem;
  padding-bottom: 1.1rem;
}

.masthead__brand {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.masthead__name {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
}

.masthead__name a {
  color: var(--text);
}

.masthead__name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.masthead__tagline {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.masthead__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  display: block;
  position: relative;
  padding: 0.5rem 0.55rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #2f333a;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.18s ease;
}

.nav__links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav__links a:hover::after {
  transform: scaleX(1);
}

.nav__links a.active {
  color: var(--text);
  font-weight: 700;
}

.nav__links a.active::after {
  transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  .nav__links a::after {
    transition: none;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.nav-toggle {
  display: none;
}

@media (max-width: 1080px) {
  .masthead__inner {
    flex-wrap: nowrap;
    align-items: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 1rem;
  }

  .masthead__name {
    font-size: 1.8rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 20px 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
    box-shadow: 0 20px 40px -24px var(--shadow);
  }

  .nav__links.is-open {
    display: flex;
  }

  .nav__links a {
    padding: 0.8rem 0.25rem;
    border-bottom: 1px solid var(--divider);
    font-size: 1.05rem;
  }

  .nav__links a::after,
  .nav__links a.active::after {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Page header, prose, footer
   -------------------------------------------------------------------------- */

main {
  padding-top: 2.5rem;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--divider);
}

.page-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.35rem;
}

.page-desc {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0;
  max-width: 44rem;
}

.prose {
  max-width: 46rem;
  font-size: 1.04rem;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1.1rem;
}

blockquote {
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
}

.site-footer {
  margin-top: 4rem;
  padding: 1.6rem 0 2.5rem;
  border-top: 1px solid var(--divider);
  font-size: 0.82rem;
  color: var(--muted);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--divider-strong);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Buttons, pills, chips, tags
   -------------------------------------------------------------------------- */

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--divider-strong);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill .icon {
  font-size: 0.9em;
  opacity: 0.85;
}

.btn-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-pill--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-pill--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.link-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--divider-strong);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  transition: all 0.15s ease;
}

.link-pill .icon {
  font-size: 0.95em;
  color: var(--accent);
}

.link-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.link-pill--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.link-pill--primary .icon {
  color: inherit;
}

.link-pill--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--bg);
  color: var(--text);
  line-height: 1.2;
  transition: all 0.15s ease;
}

.chip__venue {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pill-btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--divider-strong);
  color: var(--text);
  background: transparent;
  padding: 0.3rem 0.75rem;
  margin: 0 0.35rem 0.35rem 0;
  cursor: pointer;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.pill-btn:hover,
.pill-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
  text-decoration: none;
}

.pill-btn--award {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.06);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  border-bottom: 1px dashed var(--muted);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.topic {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  white-space: nowrap;
  line-height: 1.4;
}

.topic--vlm {
  background: rgba(31, 74, 122, 0.09);
  color: #1f4a7a;
}

.topic--formal {
  background: rgba(31, 107, 74, 0.1);
  color: #1f6b4a;
}

.topic--nlp {
  background: rgba(139, 94, 20, 0.11);
  color: #7a5212;
}

.topic--award {
  background: #fbf1d3;
  color: #6f5100;
}

.callout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.35rem;
  border-radius: 14px;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  margin: 1.5rem 0 0;
  font-size: 0.98rem;
}

.callout .icon {
  color: var(--accent);
  margin-top: 0.3rem;
  font-size: 1.1rem;
}

.callout p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Home: intro (bio + identity aside)
   -------------------------------------------------------------------------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 3.5rem;
  align-items: start;
  padding: 0.25rem 0 0.5rem;
}

.intro__text {
  font-size: 1.05rem;
  line-height: 1.72;
}

.intro__text p {
  margin: 0 0 1rem;
}

.intro__lede {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.38;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem !important;
}

.intro__text .callout {
  margin-top: 1.25rem;
}

.directions {
  list-style: none;
  counter-reset: dir;
  margin: 0 0 1.1rem;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.directions li {
  position: relative;
  padding-left: 2.6rem;
  counter-increment: dir;
}

.directions li::before {
  content: "0" counter(dir);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--accent);
}

.directions a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.4);
  text-underline-offset: 3px;
}

.directions a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.intro__aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.1rem;
  padding-top: 0.5rem;
}

.intro__aside-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.portrait {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px rgba(var(--accent-rgb), 0.35), 0 26px 40px -28px var(--shadow);
}

.intro__facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 100%;
}

.intro__facts li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
}

.intro__facts .icon {
  color: var(--accent);
  font-size: 0.9em;
}

.intro__facts a {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.intro__facts a:hover {
  color: var(--accent);
}

.intro__aside .link-pills {
  justify-content: center;
}

.intro__status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.intro__status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  margin-top: 3.25rem;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.65rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--divider);
}

.section__title {
  font-size: 1.75rem;
  margin: 0;
  scroll-margin-top: 1.5rem;
}

.section__link {
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.section__link .icon {
  font-size: 0.8em;
  transition: transform 0.15s ease;
}

.section__link:hover {
  text-decoration: none;
}

.section__link:hover .icon {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Home: publication snapshot
   -------------------------------------------------------------------------- */

.snapshot {
  border: 1px solid var(--divider);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  margin-bottom: 1.75rem;
}

.snapshot__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  background: var(--tint);
}

.snapshot__date {
  font-size: 0.78rem;
  color: var(--muted);
}

.snapshot__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.snapshot__cell {
  padding: 1.1rem 1.25rem 1.25rem;
  border-right: 1px solid var(--divider);
}

.snapshot__cell:last-child {
  border-right: 0;
}

.snapshot__num {
  font-family: var(--font-serif);
  font-size: 2.3rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.snapshot__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}

.snapshot__sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.snapshot__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.8rem;
}

.snapshot__tags span {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--tint);
  color: var(--accent);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Home: selected publications (compact)
   -------------------------------------------------------------------------- */

.spub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.spub {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--divider);
}

.spub:last-child {
  border-bottom: 0;
}

.spub__badge {
  align-self: start;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  border-radius: 6px;
  padding: 0.42rem 0.35rem;
  line-height: 1.25;
}

.spub__title {
  font-family: var(--font-serif);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.25rem;
  letter-spacing: -0.005em;
}

.spub__title a {
  color: var(--text);
}

.spub__title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.spub__authors {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.spub__summary {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0.4rem 0 0.5rem;
}

.spub__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.spub__venue {
  font-weight: 600;
  color: var(--accent);
}

.spub__meta a {
  font-weight: 600;
}

.spub__sep {
  color: var(--divider-strong);
}

.me {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.5);
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Home: roles, skills, service groups, contact strip
   -------------------------------------------------------------------------- */

.roles {
  list-style: none;
  margin: 0;
  padding: 0;
}

.roles li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--divider);
}

.roles li:last-child {
  border-bottom: 0;
}

.roles__role {
  font-weight: 600;
}

.roles__role a {
  color: var(--text);
}

.roles__role a:hover {
  color: var(--accent);
  text-decoration: none;
}

.roles__org {
  color: var(--muted);
  font-size: 0.93rem;
}

.roles__date {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.skills {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.7rem 1.5rem;
  margin: 0;
  font-size: 0.96rem;
}

.skills dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.2rem;
}

.skills dd {
  margin: 0;
  line-height: 1.6;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.service-group h3 {
  font-size: 1.15rem;
  margin: 0 0 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--divider);
}

.service-group ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.93rem;
  line-height: 1.55;
}

.service-group li {
  margin-bottom: 0.35rem;
}

.service-group li::marker {
  color: var(--accent);
}

.service-group .roles__date {
  display: block;
  margin-top: 0.1rem;
}

.contact {
  margin-top: 3.5rem;
  padding: 2.5rem 0 1rem;
  border-top: 1px solid var(--divider);
  text-align: center;
}

.contact-icons {
  font-size: 1.6rem;
  display: flex;
  justify-content: center;
  gap: 1.1rem;
}

.contact-icons a {
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.contact-icons a:hover {
  color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.contact-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.9rem auto 0;
  max-width: 36rem;
}

/* --------------------------------------------------------------------------
   On-this-page rail (wide screens only, built by main.js)
   -------------------------------------------------------------------------- */

.toc {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  left: calc(50% + 564px);
  width: 216px;
  padding: 1.15rem 1.2rem 1.25rem;
  font-family: var(--font-serif);
  font-size: 0.86rem;
  background: #f7f7f8;
  border: 1px solid var(--divider);
  border-radius: 14px;
  box-shadow: 0 10px 30px -20px var(--shadow);
  z-index: 10;
}

.toc__title {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0;
  color: var(--text);
  line-height: 1.35;
}

.toc__icon {
  flex: 0 0 auto;
  width: 1.15em;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1;
  text-align: center;
}

.toc a:hover {
  color: var(--accent);
  text-decoration: none;
}

.toc a.active {
  color: var(--accent);
  font-weight: 600;
}

/* The rail is a fixed card beside the content column, so it only appears once
   the viewport is wide enough to hold both without overlap. At that point the
   home page's main column narrows to make room; the masthead keeps its width
   so the header stays identical across pages. */
@media (min-width: 1600px) {
  .toc {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   News timeline
   -------------------------------------------------------------------------- */

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-item {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--divider);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item__date {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}

.news-item__body {
  font-size: 0.95rem;
  line-height: 1.55;
}

.news-item__body p {
  margin: 0 0 0.5rem;
}

.news-item__body p:last-child {
  margin-bottom: 0;
}

.news-item__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

/* Home page: the timeline shows the latest few entries and scrolls for the
   rest. main.js sizes the viewport to the first N items plus a faded peek of
   the next one; the max-height below is only the no-JS fallback. */
.news-scroll {
  --news-fade: 2.5rem;
  position: relative;
  max-height: 24rem;
  overflow-y: auto;
  padding-right: 0.75rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--divider-strong) transparent;
}

.news-scroll::-webkit-scrollbar {
  width: 6px;
}

.news-scroll::-webkit-scrollbar-thumb {
  background: var(--divider-strong);
  border-radius: 999px;
}

.news-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.news-scroll:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.4);
  outline-offset: 6px;
  border-radius: 4px;
}

/* Edge fades: sticky overlays that stay pinned to the viewport's top and
   bottom while the list scrolls beneath them. They don't cover the scrollbar
   and let clicks through. */
.news-scroll::before,
.news-scroll::after {
  content: "";
  position: sticky;
  z-index: 1;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.news-scroll::before {
  top: 0;
  height: 1.25rem;
  margin-bottom: -1.25rem;
  background: linear-gradient(to bottom, var(--bg), rgba(255, 255, 255, 0));
}

.news-scroll::after {
  bottom: 0;
  height: var(--news-fade);
  margin-top: calc(-1 * var(--news-fade));
  background: linear-gradient(to top, var(--bg), rgba(255, 255, 255, 0));
}

.news-scroll.is-scrollable::after {
  opacity: 1;
}

.news-scroll.is-scrolled::before {
  opacity: 1;
}

.news-scroll.is-at-end::after {
  opacity: 0;
}

.news-scroll.is-static {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.news-scroll__hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.2s ease;
}

.news-scroll__hint .icon {
  font-size: 0.9em;
  transform: rotate(90deg);
}

.news-scroll__hint.is-done {
  opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
  .news-scroll::before,
  .news-scroll::after,
  .news-scroll__hint {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Publications (full page)
   -------------------------------------------------------------------------- */

.pub-filter {
  width: 100%;
  margin: 0 0 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--divider-strong);
  background: var(--card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.pub-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.pub-year {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--divider);
  padding: 0 0 0.5rem;
  margin: 2.5rem 0 0.25rem;
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--divider);
  scroll-margin-top: 1.5rem;
}

.pub:last-child {
  border-bottom: 0;
}

.pub__side {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.badge {
  display: inline-block;
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  border-radius: 6px;
  padding: 0.4rem 0.4rem;
  line-height: 1.2;
}

.badge a {
  color: inherit;
}

.badge--muted {
  background: #5f6b7a;
  color: #fff;
}

.badge--review {
  background: #8b9098;
  color: #fff;
}

.pub__preview {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--divider);
  background: #fff;
}

.pub__title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.3rem;
  letter-spacing: -0.005em;
}

.pub__authors {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.pub__authors a {
  color: var(--muted);
  border-bottom: 1px dotted var(--divider-strong);
}

.pub__authors a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.pub__venue,
.pub__note {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.pub__links {
  margin-top: 0.55rem;
}

.pub__panel {
  margin-top: 0.75rem;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--card);
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.pub__panel p {
  margin: 0;
}

.pub__panel pre {
  background: transparent;
  padding: 0;
}

.pub-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 1rem;
}

.pub-empty {
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Research / project cards
   -------------------------------------------------------------------------- */

.overview-figure {
  margin: 0 0 2.5rem;
  text-align: center;
}

.overview-figure img {
  border-radius: 14px;
  border: 1px solid var(--divider);
}

.overview-figure figcaption {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

.project-category {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 0.5rem;
  margin: 2.5rem 0 1.25rem;
  scroll-margin-top: 1.5rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--divider);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -24px var(--shadow);
  border-color: rgba(var(--accent-rgb), 0.3);
  text-decoration: none;
}

.project--noimg {
  grid-template-columns: 1fr;
}

.project__img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: contain;
  background: #fff;
  padding: 0.5rem;
}

.project__body {
  padding: 1.35rem 1.4rem;
}

.project__title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.project__desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Experience / education timelines
   -------------------------------------------------------------------------- */

.xp {
  position: relative;
  padding-left: 1.75rem;
  border-left: 1px solid var(--divider-strong);
  margin: 1.5rem 0 1rem;
}

.xp__item {
  position: relative;
  padding-bottom: 2.1rem;
}

.xp__item:last-child {
  padding-bottom: 0.5rem;
}

.xp__item::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 5px);
  top: 0.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.xp__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
}

.xp__role {
  font-size: 1.3rem;
  margin: 0;
  line-height: 1.25;
}

.xp__meta {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.xp__org {
  font-size: 0.98rem;
  margin: 0.2rem 0 0;
}

.xp__org a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.35);
}

.xp__org a:hover {
  color: var(--accent);
}

.xp__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.xp__link .icon {
  font-size: 0.85em;
}

/* Photo row inside a timeline entry. Each figure grows in proportion to its
   image's aspect ratio (--ar, set inline), so every photo renders at the same
   height without cropping. Stacks on narrow screens. */
.xp__gallery {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.xp__photo {
  flex: var(--ar, 1) 1 0;
  min-width: 0;
  margin: 0;
}

.xp__photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--divider);
}

.xp__photo figcaption {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.xp__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
}

.xp__tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent);
}

.xp__line {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.xp__line a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--divider-strong);
}

.xp__line a:hover {
  color: var(--accent);
}

.xp__bullets {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.xp__bullets li {
  margin-bottom: 0.3rem;
}

.xp__bullets li::marker {
  color: var(--accent);
}

.xp__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.table-clean {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
}

.table-clean th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--divider-strong);
  padding: 0.5rem 0.75rem 0.5rem 0;
  text-align: left;
}

.table-clean td {
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
}

.table-clean .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 0;
}

.stat {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--divider);
}

.stat__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat__value {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.2;
  margin-top: 0.2rem;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.cert {
  padding: 1.15rem 1.25rem;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cert__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.3;
}

.cert__meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.cert__desc {
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0.25rem 0 0.5rem;
}

.cert__link {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Misc facts page
   -------------------------------------------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.fact {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.6rem 1.75rem;
  border: 1px solid var(--divider);
  border-radius: 16px;
  background: var(--card);
  scroll-margin-top: 1.5rem;
}

.fact__figure {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 14px;
  background: var(--tint);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 1;
}

.fact__figure--pi {
  font-style: italic;
  padding-bottom: 0.15em;
}

.fact__title {
  font-size: 1.35rem;
  margin: 0.2rem 0 0.6rem;
}

.fact__body p {
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 0.75rem;
}

.fact__body p:last-child {
  margin-bottom: 0;
}

.fact__aside {
  color: var(--muted);
  font-style: italic;
}

.fact__digits {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  color: var(--text);
}

.fact__digits span {
  display: inline-block;
}

/* A single line of digits that trails off, as if it could go on forever. */
.fact__digits--teaser {
  white-space: nowrap;
  overflow: hidden;
  color: var(--accent);
  -webkit-mask-image: linear-gradient(to right, #000 55%, transparent);
  mask-image: linear-gradient(to right, #000 55%, transparent);
}

.fact__more {
  margin-top: 0.25rem;
}

.fact__more summary {
  display: inline-block;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.fact__more summary::-webkit-details-marker {
  display: none;
}

.fact__more summary::after {
  content: " ↓";
}

.fact__more[open] summary::after {
  content: " ↑";
}

.fact__more summary:hover {
  text-decoration: underline;
}

.fact__more[open] summary {
  margin-bottom: 0.75rem;
}

.fact__more .fact__digits {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--code-bg);
  line-height: 1.9;
  word-spacing: 0.35em;
}

@media (max-width: 575px) {
  .fact {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1.35rem 1.25rem;
  }

  .fact__figure {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 2.1rem;
  }
}

/* --------------------------------------------------------------------------
   Contact page
   -------------------------------------------------------------------------- */

.contact-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  font-size: 0.98rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--divider);
}

.contact-list li:last-child {
  border-bottom: 0;
}

.contact-list .label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.contact-list .note {
  color: var(--muted);
  font-size: 0.88rem;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ref {
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 1.05rem 1.2rem;
  background: var(--card);
}

.ref__name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.ref__name a {
  color: var(--text);
}

.ref__name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.ref__meta {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   CV
   -------------------------------------------------------------------------- */

.cv-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.cv-toc {
  position: sticky;
  top: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--divider);
}

.cv-toc a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.cv-toc a:hover,
.cv-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}

.cv-section {
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 24px;
}

.cv-section h2 {
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--divider);
}

.cv-map {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.45rem 1.5rem;
  margin: 0;
  font-size: 0.95rem;
}

.cv-map dt {
  font-weight: 600;
}

.cv-map dd {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cv-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--divider);
}

.cv-row:last-child {
  border-bottom: 0;
}

.cv-row__year {
  display: inline-block;
  align-self: start;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.4rem 0.5rem;
  text-align: center;
  min-width: 90px;
}

.cv-row__title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 600;
  margin: 0;
}

.cv-row__inst {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

.cv-row__items {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.93rem;
}

.cv-row__items li {
  margin-bottom: 0.2rem;
}

.cv-row__items ul {
  padding-left: 1.1rem;
  margin: 0.2rem 0 0;
}

.cv-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
}

.cv-list li {
  padding: 0.3rem 0;
}

.cv-nested h3 {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 500;
  margin: 0.75rem 0 0.25rem;
}

.cv-nested ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.93rem;
}

.cv-skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.cv-skills h3 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-sans);
  margin: 0 0 0.5rem;
}

.cv-skills ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cv-skills li {
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--bg);
}

/* --------------------------------------------------------------------------
   Back to top
   -------------------------------------------------------------------------- */

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--divider-strong);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px -14px var(--shadow);
  z-index: 40;
}

.to-top.is-visible {
  display: inline-flex;
}

.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {
  .snapshot__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .snapshot__cell:nth-child(2) {
    border-right: 0;
  }

  .snapshot__cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--divider);
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .cv-layout {
    grid-template-columns: 1fr;
  }

  .cv-toc {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-left: 0;
    margin-bottom: 1rem;
  }

  .cv-toc a {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--divider);
    border-radius: 999px;
    margin: 0;
  }

  .cv-toc a.active {
    border-color: var(--accent);
  }
}

@media (max-width: 767px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .intro__aside {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    text-align: left;
    gap: 0.9rem 1.5rem;
    padding-top: 0;
  }

  .portrait {
    width: 132px;
    height: 132px;
  }

  .intro__aside-body {
    flex: 1 1 200px;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .intro__facts li {
    justify-content: flex-start;
  }

  .intro__aside .link-pills {
    justify-content: flex-start;
  }

  .intro__lede {
    font-size: 1.3rem;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .spub {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .spub__badge {
    justify-self: start;
    padding-inline: 0.7rem;
  }

  .roles li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .skills {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
  }

  .skills dd {
    margin-bottom: 0.8rem;
  }

  .xp__meta {
    white-space: normal;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pub__side {
    flex-direction: row;
    align-items: flex-start;
  }

  .badge {
    width: auto;
  }

  .pub__preview {
    width: 120px;
  }

  .cv-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .contact-list li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575px) {
  .xp__gallery {
    flex-direction: column;
  }

  .xp__photo {
    flex: none;
  }

  .snapshot__grid {
    grid-template-columns: 1fr;
  }

  .snapshot__cell {
    border-right: 0;
    border-bottom: 1px solid var(--divider);
  }

  .snapshot__cell:last-child {
    border-bottom: 0;
  }

  .project {
    grid-template-columns: 1fr;
  }

  .project__img {
    max-height: 200px;
  }
}

@media print {
  .masthead__nav,
  .toc,
  .to-top,
  .news-scroll__hint,
  .news-scroll::before,
  .news-scroll::after {
    display: none !important;
  }

  .news-scroll {
    max-height: none !important;
    overflow: visible;
  }
}
