/* ==========================================================================
   Custom layer for adepope.github.io
   Loaded after the compiled Contrast theme stylesheet, so it wins on ties.
   Everything is driven by the tokens in :root, incl. light/dark theming.
   ========================================================================== */

/* ---------- 1. Design tokens ---------------------------------------- */

:root {
  --accent:        #0b3d7a;
  --accent-strong: #062a55;
  --link:          #14509b;
  --link-hover:    #0b3d7a;

  --bg:            #ffffff;
  --bg-alt:        #f5f7fa;
  --surface:       #ffffff;
  --surface-alt:   #f7f9fc;

  --fg:            #1e2430;
  --fg-muted:      #5a6478;
  --fg-faint:      #7c869a;

  --border:        #e2e7ef;
  --border-strong: #cdd6e4;

  --header-bg:     #0d2137;
  --header-fg:     #eef3f9;

  --tint:          rgba(11, 61, 122, 0.07);
  --tint-strong:   rgba(11, 61, 122, 0.13);

  --shadow-sm: 0 1px 2px rgba(16, 28, 48, .05), 0 1px 3px rgba(16, 28, 48, .05);
  --shadow-md: 0 2px 4px rgba(16, 28, 48, .05), 0 8px 24px rgba(16, 28, 48, .08);

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --container: 53rem;
  --gutter:    1.5rem;

  --font-body: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent:        #8ab6ef;
    --accent-strong: #a9cbf7;
    --link:          #8ab6ef;
    --link-hover:    #b0cef8;

    --bg:            #14171d;
    --bg-alt:        #1a1e26;
    --surface:       #1b1f27;
    --surface-alt:   #21262f;

    --fg:            #e4e8f0;
    --fg-muted:      #a5aec0;
    --fg-faint:      #848ea2;

    --border:        #2b313c;
    --border-strong: #3a4250;

    --header-bg:     #0e1218;
    --header-fg:     #e8edf5;

    --tint:          rgba(138, 182, 239, 0.10);
    --tint-strong:   rgba(138, 182, 239, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --accent:        #8ab6ef;
  --accent-strong: #a9cbf7;
  --link:          #8ab6ef;
  --link-hover:    #b0cef8;

  --bg:            #14171d;
  --bg-alt:        #1a1e26;
  --surface:       #1b1f27;
  --surface-alt:   #21262f;

  --fg:            #e4e8f0;
  --fg-muted:      #a5aec0;
  --fg-faint:      #848ea2;

  --border:        #2b313c;
  --border-strong: #3a4250;

  --header-bg:     #0e1218;
  --header-fg:     #e8edf5;

  --tint:          rgba(138, 182, 239, 0.10);
  --tint-strong:   rgba(138, 182, 239, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---------- 2. Base ------------------------------------------------- */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: .002em;
}

@media (max-width: 30em) { body { font-size: 16px; } }

body > header,
body > article,
body > footer,
body > div.page {
  padding-left:  max(var(--gutter), calc(50% - var(--container) / 2));
  padding-right: max(var(--gutter), calc(50% - var(--container) / 2));
}

body > article { padding-top: 2.5rem; padding-bottom: 3.5rem; }

p { text-align: left; }
p, li { text-wrap: pretty; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 3px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

img { border-radius: var(--radius-sm); }

::selection { background: var(--tint-strong); }

/* headings ----------------------------------------------------------- */

h1, h2, h3, h4 {
  color: var(--fg);
  line-height: 1.25;
  letter-spacing: -.012em;
  text-wrap: balance;
}

article h2 {
  font-size: 1.32rem;
  margin: 2.75rem 0 1.1rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

article h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.6rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

article h3 { font-size: 1.08rem; margin: 1.9rem 0 .6rem; }

article > header h1 {
  font-size: 1.95rem;
  margin: 0 0 1.75rem;
  letter-spacing: -.02em;
}
article > header h1 a { color: inherit; }
article > header h1 a:hover { text-decoration: none; }

/* lists -------------------------------------------------------------- */

article ul, article ol { padding-left: 1.2rem; }
article li { margin: .4rem 0; }
article ul li::marker { color: var(--accent); }

blockquote {
  background: var(--surface-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--fg-muted);
  opacity: 1;
  padding: .1rem 1.25rem;
}

pre {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

:not(pre) > code {
  background: var(--tint);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: .86em;
  opacity: 1;
  padding: .15em .4em;
  border-radius: 4px;
}

table { box-shadow: 0 0 0 1px var(--border) inset; }
th, td { box-shadow: 0 0 0 1px var(--border); }
tr:hover, tr:nth-child(odd) td { background: var(--surface-alt); }

/* ---------- 3. Site header + nav ------------------------------------ */

body > header {
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding-top: .9rem;
  padding-bottom: .9rem;
  gap: .5rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

body > header a.title {
  color: var(--header-fg);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: .015em;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}

body > header a.title:hover { text-decoration: none; opacity: .88; }

body > header a.title::before {
  content: "AD";
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 7px;
  background: linear-gradient(140deg, #2f6fc0, #17457f);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

body > header nav { margin: 0; display: flex; flex-wrap: wrap; gap: .15rem; }

body > header nav a {
  color: rgba(255, 255, 255, .78);
  margin: 0;
  padding: .32rem .62rem;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  transition: background .18s ease, color .18s ease;
}

body > header nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  text-decoration: none;
}

body > header nav a.selected {
  color: #fff;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 -2px 0 var(--accent-strong);
}

/* theme toggle ------------------------------------------------------- */

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font: inherit;
  font-size: .85rem;
  height: 1.9rem;
  width: 1.9rem;
  padding: 0;
  margin-left: .25rem;
  transition: background .18s ease, color .18s ease;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .sun  { display: none; }
}

/* ---------- 4. Footer ----------------------------------------------- */

body > footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  box-shadow: none;
  color: var(--fg-muted);
  font-size: .88rem;
  opacity: 1;
  padding-top: 1.6rem;
  padding-bottom: 1.6rem;
  gap: .75rem 1.5rem;
}

body > footer nav { margin: 0; display: flex; gap: .35rem; }

body > footer nav a {
  color: var(--fg-muted);
  margin: 0;
  padding: .4rem;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  transition: color .18s ease, background .18s ease;
}
body > footer nav a:hover { color: var(--accent); background: var(--tint); }
body > footer nav a .icon { height: 1.05em; width: 1.05em; }
body > footer nav a:hover .icon { color: inherit !important; }

.footer-note { display: flex; flex-direction: column; gap: .15rem; }
.footer-note strong { color: var(--fg); font-weight: 700; }
.footer-note small { color: var(--fg-faint); font-size: .82rem; }

/* ---------- 5. Hero ------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 2.25rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.hero-name {
  font-size: 2.15rem;
  line-height: 1.1;
  letter-spacing: -.028em;
  margin: 0 0 .35rem;
}

.hero-role {
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .01em;
  margin: 0 0 .15rem;
}

.hero-affil {
  color: var(--fg-muted);
  font-size: .95rem;
  margin: 0 0 1.1rem;
}

.hero-lede { margin: 0 0 1.25rem; color: var(--fg); }

.hero-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 22%;
  border-radius: var(--radius-lg);
  margin: 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.hero-photo-wrap { position: relative; }

.hero-photo-wrap::after {
  content: "";
  position: absolute;
  inset: auto -.55rem -.55rem auto;
  width: 4.5rem;
  height: 4.5rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  border-radius: 0 0 var(--radius-lg) 0;
  opacity: .5;
  pointer-events: none;
}

@media (max-width: 44em) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-photo-wrap { max-width: 11rem; }
  .hero-name { font-size: 1.8rem; }
}

/* contact / social row ----------------------------------------------- */

.hero-links { display: flex; flex-wrap: wrap; gap: .5rem; }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: .855rem;
  font-weight: 700;
  padding: .34rem .85rem;
  transition: color .18s ease, border-color .18s ease, background .18s ease,
              transform .18s ease;
}
.pill-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--tint);
  text-decoration: none;
  transform: translateY(-1px);
}
.pill-link .icon { height: .95em; width: .95em; }
.pill-link:hover .icon { color: inherit !important; }

.pill-link.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .pill-link.is-primary,
.pill-link.is-primary { color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-link.is-primary { color: #0e1218; }
}
:root[data-theme="dark"] .pill-link.is-primary { color: #0e1218; }
.pill-link.is-primary:hover { filter: brightness(1.08); color: #fff; }
:root[data-theme="dark"] .pill-link.is-primary:hover { color: #0e1218; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-link.is-primary:hover { color: #0e1218; }
}

/* ---------- 6. Generic blocks --------------------------------------- */

.lede {
  font-size: 1.06rem;
  color: var(--fg-muted);
  max-width: 44rem;
  margin: -.35rem 0 1.75rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-head .more-link { font-size: .85rem; font-weight: 700; white-space: nowrap; }

.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .85rem 0 0; padding: 0; list-style: none; }

.tag {
  background: var(--tint);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .2rem .68rem;
  margin: 0;
  white-space: nowrap;
}
.tag.is-quiet {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--fg-muted);
}

/* card grid ----------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
}

.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.card h3 { margin: 0; font-size: 1.02rem; }
.card h3 a { color: var(--fg); }
.card h3 a:hover { color: var(--link); text-decoration: none; }
.card p { margin: 0; color: var(--fg-muted); font-size: .92rem; line-height: 1.6; }

.card-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: var(--tint);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: .15rem;
}
.card-icon .icon { height: 1.05rem; width: 1.05rem; }

.card-foot {
  margin-top: auto;
  padding-top: .55rem;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .9rem;
  font-size: .84rem;
  font-weight: 700;
}
.card-foot a { display: inline-flex; align-items: center; gap: .35rem; }
.card-foot .icon { height: .9em; width: .9em; }

/* stat strip ---------------------------------------------------------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: .75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.stat {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin: 0;
}
.stat b {
  display: block;
  color: var(--accent);
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.stat span { color: var(--fg-muted); font-size: .82rem; line-height: 1.4; display: block; margin-top: .15rem; }

/* ---------- 7. News timeline ---------------------------------------- */

.timeline { list-style: none; margin: 1.25rem 0 0; padding: 0 0 0 1.4rem; position: relative; }

.timeline::before {
  content: "";
  position: absolute;
  left: .28rem;
  top: .55rem;
  bottom: .55rem;
  width: 2px;
  background: linear-gradient(var(--border-strong), var(--border));
  border-radius: 2px;
}

.timeline > li { position: relative; margin: 0 0 1.15rem; padding: 0; }

.timeline > li::before {
  content: "";
  position: absolute;
  left: -1.4rem;
  top: .62rem;
  width: .62rem;
  height: .62rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
}

.timeline > li.is-new::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--tint);
}

.timeline time {
  display: block;
  color: var(--fg-faint);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.timeline p { margin: .1rem 0 0; font-size: .95rem; }

/* ---------- 8. Publications ----------------------------------------- */

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

.pub {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--border);
  margin: 0;
}
.pub:last-child { border-bottom: 1px solid var(--border); }

.pub-year {
  color: var(--fg-faint);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding-top: .2rem;
}

.pub-title { font-size: 1.02rem; font-weight: 700; line-height: 1.4; margin: 0 0 .3rem; }
.pub-title a { color: var(--fg); }
.pub-title a:hover { color: var(--link); text-decoration: none; }

.pub-authors { color: var(--fg-muted); font-size: .9rem; margin: 0 0 .3rem; line-height: 1.55; }
.pub-authors .me { color: var(--fg); font-weight: 700; }

.pub-venue { font-size: .89rem; margin: 0 0 .55rem; color: var(--fg-muted); }
.pub-venue em { color: var(--fg); font-style: normal; font-weight: 700; }

.badge {
  display: inline-block;
  background: var(--tint);
  color: var(--accent);
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .1rem .45rem;
  margin-right: .4rem;
  vertical-align: 1px;
}
.badge.is-award { background: rgba(196, 138, 18, .14); color: #a5760a; }
:root[data-theme="dark"] .badge.is-award { color: #e7b64b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.is-award { color: #e7b64b; }
}

.link-row { display: flex; flex-wrap: wrap; gap: .3rem .85rem; font-size: .85rem; font-weight: 700; }
.link-row a { display: inline-flex; align-items: center; gap: .3rem; }
.link-row .icon { height: .88em; width: .88em; }

@media (max-width: 36em) {
  .pub { grid-template-columns: 1fr; gap: .25rem; }
  .pub-year { padding-top: 0; }
}

/* ---------- 9. Project / research cards ------------------------------ */

.project-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }

.project {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin: 0 0 1.1rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.project:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.project-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  margin: 0;
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 0;
  transition: transform .3s ease;
}
.project:hover .project-thumb img { transform: scale(1.04); }

.project-body { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.project-title { font-size: 1.08rem; font-weight: 700; line-height: 1.35; margin: 0; }
.project-title a { color: var(--fg); }
.project-title a:hover { color: var(--link); text-decoration: none; }
.project-authors { color: var(--fg-muted); font-size: .88rem; margin: 0; }
.project-summary { font-size: .93rem; line-height: 1.62; margin: 0; color: var(--fg); }
.project .link-row { margin-top: auto; padding-top: .35rem; }

@media (max-width: 40em) {
  .project { grid-template-columns: 1fr; gap: 1rem; }
  .project-thumb { max-width: 9rem; }
}

/* ---------- 10. CV page --------------------------------------------- */

.cv-entry {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: .35rem 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}
.cv-entry:first-of-type { border-top: 0; padding-top: .35rem; }

.cv-when {
  color: var(--fg-faint);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding-top: .25rem;
}
.cv-what h3 { margin: 0 0 .1rem; font-size: 1.02rem; }
.cv-where { color: var(--accent); font-size: .9rem; font-weight: 700; margin: 0 0 .45rem; }
.cv-what p { margin: 0 0 .4rem; font-size: .95rem; }
.cv-what ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.cv-what li { font-size: .94rem; }

@media (max-width: 40em) {
  .cv-entry { grid-template-columns: 1fr; gap: .2rem; }
  .cv-when { padding-top: 0; }
}

.skill-table { display: grid; gap: .8rem; margin: 1.25rem 0 0; }
.skill-row { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: .35rem 1.5rem; align-items: start; }
.skill-row > b { color: var(--fg); font-size: .88rem; padding-top: .28rem; }
@media (max-width: 40em) { .skill-row { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: .3rem 1.5rem; margin: 1rem 0 0; }
.kv dt { color: var(--fg-faint); font-size: .82rem; font-weight: 700; letter-spacing: .03em; padding-top: .18rem; }
.kv dd { margin: 0; }
@media (max-width: 40em) { .kv { grid-template-columns: 1fr; gap: .1rem 0; } .kv dd { margin-bottom: .6rem; } }

/* ---------- 11. Callout --------------------------------------------- */

.callout {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .95rem 1.15rem;
  margin: 1.5rem 0;
  font-size: .94rem;
}
.callout .icon { color: var(--accent); flex: none; margin-top: .3rem; height: 1rem; width: 1rem; }
.callout p { margin: 0; }
.callout p + p { margin-top: .4rem; }

/* ---------- 11b. Photo grid ------------------------------------------ */

/* Four across on desktop: one tidy row rather than 3 + an orphan, and each
   tile stays small enough to read as a thumbnail strip. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.photo { margin: 0; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }

.photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 0;
  filter: saturate(.96);
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}

.photo img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: saturate(1.05);
}

.photo-caption {
  color: var(--fg-faint);
  font-size: .76rem;
  line-height: 1.45;
  text-wrap: pretty;
}

@media (max-width: 48em) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
  .photo-caption { font-size: .8rem; }
}

/* a lone photo should not stretch across the full width */
.photo-grid:has(> .photo:only-child) { grid-template-columns: minmax(0, 22rem); }

/* ---------- 12. Misc ------------------------------------------------- */

.icon { fill: currentColor; vertical-align: -.125em; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

article:not(:last-of-type) { border-bottom: 0; }

/* KaTeX overflow guard */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .35rem 0; }
