/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #F1EEE3;
  --bg-2:         #ebe5d4;
  --bg-3:         #e3dcc7;
  --ink:          #1a1611;
  --ink-2:        #2c2620;
  --muted:        #6b6253;
  --muted-2:      #8a8170;
  --rule:         rgba(26, 22, 17, 0.14);
  --rule-soft:    rgba(26, 22, 17, 0.08);
  --maroon:       #521929;
  --maroon-2:     #5c1a24;
  --maroon-ink:   #F1EEE3;

  --serif: "Palatino Linotype", Palatino, serif;
  --mono:  "Roboto Mono", "IBM Plex Mono", ui-monospace, "Menlo", monospace;

  --max-w: 1024px;

  /* Shared footer theme (consumed by /footer.css). These mirror the homepage's
     light-mode footer (index.css html.light) verbatim so the footer reads
     identically on the homepage and the news pages. */
  --footer-fg:          #8a7e6f;
  --footer-fg-hover:    #521929;
  --footer-rule:        #d9d2c1;
  --footer-tip-bg:      #fbf9f2;
  --footer-tip-border:  rgba(82, 25, 41, 0.15);
  --footer-tip-fg:      #6f655a;
  --footer-pbc-fg:      #a89b88;
  --footer-pbc-hover:   #521929;
  --footer-icon-filter: none;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-padding-top: 76px;
  scrollbar-gutter: stable;
  /* Also clip on the root: on narrow viewports an absolutely-positioned but
     hidden hovercard (e.g. a centered footnote tooltip near the right edge of a
     line) extends the page past the viewport. `clip` on body alone doesn't stop
     that from growing the document's scroll width, so the page becomes pannable
     and loses its right margin. Clipping x here contains it; `clip` (not hidden)
     is x-axis only and leaves vertical scroll + sticky positioning intact. */
  overflow-x: clip;
}

body {
  font-family: var(--serif);
  background-color: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Clip horizontal overflow (e.g. a hidden footnote tooltip extending past the
     edge) so it never triggers a horizontal scrollbar. `clip` (not `hidden`)
     keeps the sticky TOC working and leaves vertical overflow visible. */
  overflow-x: clip;
}

/* Nav + footer are shared chrome with the homepage, which uses the browser's
   default font smoothing. The article body above opts into antialiased
   smoothing for reading; opt the chrome back out so its text weight matches
   the homepage exactly (otherwise the same Palatino looks slightly lighter). */
nav,
footer {
  -webkit-font-smoothing: auto;
  text-rendering: auto;
}

/* ── Nav (light tan variant) ─────────────────────────────────────────────────  */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: #F1EEE3;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

nav.scrolled { border-bottom-color: #d9d2c1; }

.nav-inner {
  max-width: var(--max-w);
  width: 95%;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav img.logo {
  height: 28px;
  width: auto;
  display: block;
  cursor: pointer;
  user-select: none;
  filter: brightness(0);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: clamp(0.7rem, 1.3vw, 0.82rem);
  letter-spacing: 0.04em;
}

.nav-links a {
  color: rgba(26, 26, 26, 0.6);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:visited { color: rgba(26, 26, 26, 0.6); }
.nav-links a.active  { color: #1a1a1a; }

.nav-dot { color: rgba(26, 26, 26, 0.28); margin: 0 7px; }

@media (hover: hover) {
  .nav-links a:hover { color: #521929; }
}

/* ── Page wrapper (used by post pages) ───────────────────────────────────────  */
.page-wrapper {
  flex: 1;
  max-width: var(--max-w);
  width: 95%;
  margin: 0 auto;
  padding-top: 100px;
  padding-bottom: 64px;
}

/* ── NEWS LIST PAGE ───────────────────────────────────────────────────────────  */

.news-section {
  flex: 1;
  max-width: var(--max-w);
  width: 95%;
  margin: 0 auto;
  padding: 88px 0 80px;
}

/* Page title row */
.news-page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.news-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.news-h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.news-intro {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  max-width: 320px;
  line-height: 1.5;
  text-align: right;
  flex-shrink: 0;
}

/* Featured hero card */
.news-hero {
  background: var(--maroon);
  color: var(--maroon-ink);
  border-radius: 6px;
  padding: 40px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: stretch;
  min-height: 320px;
  margin-bottom: 36px;
  text-decoration: none;
}

.hero-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--maroon-ink);
  flex-shrink: 0;
}

.hero-sep { opacity: 0.5; }

.hero-h2 {
  margin: 10px 0 14px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-dek {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  opacity: 0.88;
  margin: 0;
}

.hero-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-byline {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
  letter-spacing: 0.04em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 20px;
}

.hero-cta {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--maroon-ink);
  border-bottom: 1px solid rgba(245, 236, 217, 0.4);
  padding-bottom: 2px;
  text-decoration: none;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

@media (hover: hover) {
  .hero-cta:hover { border-color: var(--maroon-ink); }
}

/* Hero figure panel */
.hero-figure {
  /* background: rgba(0, 0, 0, 0.18);
  border-style: solid;
  border-width: 1px;
  border-color: rgba(241, 238, 227, 0.1);
  border-radius: 4px; */
  position: relative;
  overflow: hidden;
  min-height: 180px;
}

.hero-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245, 236, 217, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 236, 217, 0.10) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center center;
}

.hero-figure svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 28px;
  border-radius: 4px;
}

.hero-figure--photo {
  background: none;
  border: none;
}

.hero-figure--photo img {
  object-fit: contain;
  padding: 0;
}

/* Cinematic layout when featured post has a photo */
.news-hero--photo {
  display: flex;
  flex-direction: column;
  position: relative;
  background: #000;
  /* Clip the cover image (which has its own rounded corners baked in) to the
     card's rounded rectangle so all four corners round uniformly. */
  overflow: hidden;
}

/* Fill the card height so the footer (byline + CTA) anchors to the bottom
   even when the title and dek are short. */
.news-hero--photo .hero-body {
  flex: 1;
}

/* Image covers right ~55% of the card */
.news-hero--photo .hero-figure--photo {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 55%;
  z-index: 0;
  min-height: unset;
}

.news-hero--photo .hero-figure--photo img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Gradient fades from card bg into the image */
.news-hero--photo::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    #000 40%,
    rgba(0, 0, 0, 0.6) 68%,
    transparent 85%
  );
}

.news-hero--photo .hero-body {
  position: relative;
  z-index: 2;
  max-width: 55%;
}

@media (max-width: 768px) {
  .news-hero--photo .hero-figure--photo { width: 45%; }
  .news-hero--photo .hero-body { max-width: 60%; }
}

.hero-fig-caption {
  position: absolute;
  bottom: 14px;
  left: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 236, 217, 0.7);
}

/* ── Filter bar ──────────────────────────────────────────────────────────────  */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-pills-wrap {
  position: relative;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.filter-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Article grid ─────────────────────────────────────────────────────────────  */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.news-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.card-image {
  height: 180px;
  border-radius: 4px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-2);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.04) 0 1px,
    transparent 1px 9px
  );
  flex-shrink: 0;
}

.card-image.has-image {
  background-color: transparent;
  background-image: none;
}

.card-placeholder-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image img.fit-contain {
  object-fit: contain;
}

.card-cat-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 3px 8px;
  border-radius: 3px;
}

.card-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.card-h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}

.card-dek {
  margin: 10px 0 14px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 12px;
  border-top: 1px solid var(--rule-soft);
}

.card-read {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  text-decoration: none;
  transition: border-color 0.15s;
}

@media (hover: hover) {
  .card-read:hover { border-color: var(--ink); }
}

/* Empty state */
.news-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 16px;
}

/* ── POST PAGE ────────────────────────────────────────────────────────────────  */

.article-outer {
  flex: 1;
  max-width: 1240px;
  width: 95%;
  margin: 0 auto;
  padding: 88px 56px 80px;
}

.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 36px;
}

.back-arrow {
  font-family: var(--serif);
}

@media (hover: hover) {
  .back-link:hover { color: var(--ink); }
}

.post-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 14px;
}

.post-header { margin-bottom: 44px; }

.post-title {
  font-size: 44px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.012em;
  /* max-width: 820px; */
  color: var(--ink);
}

.post-subtitle {
  margin: 14px 0 0;
  font-style: italic;
  font-size: 22px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 740px;
}

/* Links inside the excerpt/subtitle — match the body link style (maroon with a
   soft underline) rather than the browser default blue. */
.post-subtitle a {
  color: var(--maroon);
  border-bottom: 1px solid rgba(82, 25, 41, 0.3);
  text-decoration: none;
}

.post-byline-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-wrap: wrap;
}

.post-actions {
  margin-left: auto;
  display: flex;
  gap: 14px;
}

.post-actions a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s;
}

@media (hover: hover) {
  .post-actions a:hover { color: var(--maroon); }
}

/* Two-column article layout */
.article-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  column-gap: 64px;
  align-items: start;
}

/* Posts without a table of contents have no .article-toc, so drop the empty
   200px TOC track — otherwise the lone reading column auto-places into it and
   gets squished. The reading column then centers at the site nav/footer width
   (--max-w) instead of hugging the left as a narrow column. */
.article-layout:not(:has(.article-toc)) {
  grid-template-columns: 1fr;
}
.article-layout:not(:has(.article-toc)) .article-reading-col {
  width: 100%;            /* fill the grid track; without this the auto margins
                             below make the item size to its content, letting a
                             wide child (e.g. the hero gallery) blow it out */
  max-width: var(--max-w);
  margin-inline: auto;
}

/* ...and narrow the post header + back-link to the same width so the title,
   byline, and "← News" link all align with the centered body (these are
   siblings of .article-layout, so key off the article-outer having no TOC). */
.article-outer:not(:has(.article-toc)) .post-header,
.article-outer:not(:has(.article-toc)) .back-link {
  max-width: var(--max-w);
  margin-inline: auto;
}
.article-outer:not(:has(.article-toc)) .back-link {
  display: block;
}

/* Sticky TOC */
.article-toc {
  position: sticky;
  top: 88px;
  align-self: start;
  padding-top: 4px;
}

.toc-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

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

.toc-item { border-top: 1px solid var(--rule-soft); }

.toc-item a {
  display: block;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 400;
  transition: color 0.15s;
}

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

.toc-active-bar {
  display: none;
  margin-top: 6px;
  height: 2px;
  width: 26px;
  background: var(--maroon);
}

.toc-item.toc-active .toc-active-bar { display: block; }

@media (hover: hover) {
  .toc-item a:hover { color: var(--ink); }
}

/* Reading column */
/* min-width:0 so this grid item can shrink below its content's min-content
   instead of forcing the column (and the page) wider than the viewport — e.g. a
   horizontally-scrolling hero gallery would otherwise blow the column out on
   narrow screens. */
.article-reading-col { max-width: 720px; min-width: 0; }

/* Abstract */
.post-abstract {
  border-left: 3px solid var(--maroon);
  padding-left: 22px;
  margin-bottom: 40px;
  font-style: italic;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  text-align: justify;
  hyphens: auto;
}

.post-abstract .abstract-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 8px;
  font-style: normal;
}

/* Action links — Share / Cite / PDF in byline */
.post-action-link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s;
  cursor: pointer;
}

@media (hover: hover) {
  .post-action-link:hover { color: var(--maroon); }
}

/* Hero cover */
.post-cover { margin: 0 0 40px; }

.post-cover img {
  width: 100%;
  max-height: 560px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

/* Figure captions (hero + inline) */
.post-figcap {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 10px;
}

.figcap-label {
  color: var(--maroon);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-right: 4px;
}

/* ── Post body ──────────────────────────────────────────────────────────────── */
.post-body {
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink-2);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.post-body p { margin-bottom: 1.1em; }

.post-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 2em 0 0.5em;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-align: left;
  hyphens: none;
  scroll-margin-top: 88px;
}

.post-body h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 1.4em 0 0.35em;
  color: var(--ink);
  text-align: left;
  hyphens: none;
}

.post-body strong { color: var(--ink); font-weight: 700; }

.post-body a {
  color: var(--maroon);
  border-bottom: 1px solid rgba(82, 25, 41, 0.3);
  text-decoration: none;
}

.post-body ul, .post-body ol {
  padding-left: 1.4em;
  margin-bottom: 1.2em;
  text-align: left;
}

.post-body li { margin-bottom: 0.45em; }

.post-body code {
  font-family: var(--mono);
  font-size: 0.83em;
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
}

.post-body pre {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 22px 0;
  line-height: 1.55;
  text-align: left;
}

.post-body pre code { background: none; padding: 0; font-size: 0.87em; }

.post-body figure { margin: 32px 0; text-align: center; }

/* Image stays centered; its caption is justified to match the body text. */
.post-body figure figcaption { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }

.post-body figure img { max-width: 100%; border-radius: 3px; }

/* Figure gallery — a horizontally swipeable / button-navigable carousel of
   figures (one slide visible at a time, snap-scrolled). */
.figure-gallery { margin: 32px 0; }

/* As the hero, match the single hero image's spacing. */
.figure-gallery--hero { margin: 0 0 40px; }

.figure-gallery-viewport { position: relative; }

.figure-gallery-track {
  display: flex;
  align-items: flex-start;          /* don't stretch every slide to the tallest;
                                       JS sizes the track to the active slide */
  gap: 20px;                        /* spacing between slides; also means a sub-pixel
                                       snap reveals the gap, not the next photo */
  overflow-x: auto;
  overflow-y: hidden;               /* clip taller off-screen slides while scrolled away */
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;            /* Firefox */
  transition: height 0.25s ease;    /* smoothly grow/shrink to the current slide */
}
.figure-gallery-track::-webkit-scrollbar { display: none; }

/* Hover-reveal left/right arrows overlaid on the image */
.gallery-edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0 0 3px;                 /* optically center the chevron glyph */
  border: none;
  border-radius: 999px;
  background: rgba(20, 18, 14, 0.4);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.gallery-edge-prev { left: 14px; }
.gallery-edge-next { right: 14px; }
.gallery-edge:disabled { opacity: 0 !important; pointer-events: none; }

@media (hover: hover) {
  .figure-gallery-viewport:hover .gallery-edge:not(:disabled) { opacity: 0.55; }
  .gallery-edge:not(:disabled):hover { opacity: 1; background: rgba(20, 18, 14, 0.7); }
}
@media (hover: none) {
  .gallery-edge { display: none; }  /* touch: swipe + the controls bar */
}

.figure-gallery .gallery-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;         /* one swipe advances exactly one slide */
  margin: 0;                        /* the gallery owns the vertical rhythm */
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}

.gallery-nav {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 1px solid var(--rule);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, opacity 0.15s;
}
.gallery-nav:disabled { opacity: 0.3; cursor: default; }

.gallery-status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-width: 52px;
  text-align: center;
}

@media (hover: hover) {
  .gallery-nav:not(:disabled):hover { color: var(--ink); border-color: var(--muted-2); }
}

/* Thumbnail timeline — click a thumb to jump to that slide */
.gallery-thumbs {
  display: flex;
  justify-content: safe center;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  /* Shrink to fit when the strip is crowded (e.g. 6 thumbs on a narrow phone)
     so it never overflows and shows a clipped sliver; capped at 56px otherwise. */
  flex: 0 1 56px;
  min-width: 0;
  width: 56px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 3px;
  overflow: hidden;
  background: #4a4339;              /* dark taupe placeholder until the thumb image loads */
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.gallery-thumb.is-loaded { background: none; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.is-active { opacity: 1; }

@media (hover: hover) {
  .gallery-thumb:not(.is-active):hover { opacity: 0.75; }
}

/* Click-to-zoom lightbox for figure images */
.post-body figure img.zoomable,
.post-cover img.zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 5vh 5vw;
  background: rgba(18, 15, 11, 0.93);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }

.lightbox-img {
  max-width: 92vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  border-radius: 4px;
}

.lightbox-cap {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  max-width: 720px;
  cursor: auto;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* Prev/next within the lightbox (page through every figure on the page) */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0 0 4px;                 /* optically center the chevron */
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-prev { left: 3vw; }
.lightbox-next { right: 3vw; }
.lightbox-nav[hidden] { display: none; }
.lightbox-nav:disabled { opacity: 0.25; pointer-events: none; cursor: default; }

@media (hover: hover) {
  .lightbox-close:hover { color: #fff; }
  .lightbox-nav:hover { background: rgba(255, 255, 255, 0.18); }
}

.post-body figcaption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 10px;
}

.post-body blockquote {
  font-style: italic;
  font-size: 1.4em;
  line-height: 1.32;
  color: var(--ink);
  letter-spacing: -0.005em;
  border-left: 2px solid var(--maroon);
  padding: 4px 0 4px 22px;
  margin: 1.6em 0;
  text-align: left;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 22px 0;
  font-size: 0.9em;
  text-align: left;
}

.post-body th, .post-body td {
  border: 1px solid var(--rule);
  padding: 8px 12px;
}

.post-body th {
  background: var(--bg-2);
  font-weight: normal;
  font-family: var(--mono);
  font-size: 0.78em;
  letter-spacing: 0.04em;
}

.post-body .footnote-ref {
  text-decoration: none;
  font-size: 0.8em;
  font-weight: 700;
  padding: 0 1px;
  font-style: normal;
  border-bottom: none;
  color: var(--maroon);
}

/* Keep footnote-reference superscripts from enlarging the line they sit on:
   raise them with relative positioning instead of vertical-align: super, and
   give them zero line-height so they contribute nothing to the line box. */
.post-body sup[id^="fnref:"] {
  vertical-align: baseline;
  position: relative;
  top: -0.45em;
  line-height: 0;
}

/* "About Valgo" section — same top-rule + label treatment as Notes, sits at the
   end of the content (before Notes). Its label is a styled div, not an <h2>, so
   it never appears in the Contents/TOC. */
.post-about { margin-top: 48px; }

.post-about-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.post-about-body {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.post-about-body p { margin: 0 0 0.8em; }
.post-about-body p:last-child { margin-bottom: 0; }
.post-about-body a {
  color: var(--maroon);
  border-bottom: 1px solid rgba(82, 25, 41, 0.3);
  text-decoration: none;
}

.post-about-contact {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}

.post-body .footnote {
  margin-top: 48px;
}

.post-body .footnote::before {
  content: "Notes";
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

/* hide the markdown-generated hr — our ::before provides the rule */
.post-body .footnote hr { display: none !important; }

.post-body .footnote ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: fn-counter;
}

.post-body .footnote li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0 8px;
  margin-bottom: 14px;
  counter-increment: fn-counter;
}

.post-body .footnote li::before {
  content: counter(fn-counter) ".";
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--maroon);
}

.post-body .footnote li p {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  text-align: left;
  hyphens: none;
  margin: 0;
}

/* hide the ↩ back-reference link */
.post-body .footnote .footnote-backref { display: none !important; }

/* Tufte-style sidenotes: hidden by default; the bottom footnote list is used
   instead. On wide screens (below) they move into the right margin. */
.post-body .sidenote { display: none; }
.post-body .sidenote-num {
  color: var(--maroon);
  font-weight: 700;
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
  margin-right: 3px;
}

/* Wide screens: footnotes become margin notes beside their reference. The
   reading measure narrows to free room; the bottom list is hidden. */
@media (min-width: 1320px) {
  .article-reading-col { max-width: 640px; }

  .post-body .footnote { display: none; }

  .post-body .sidenote {
    display: block;
    float: right;
    clear: right;
    width: 180px;
    margin-right: -224px;   /* -(width + 44px gap) → flush to the right margin */
    margin-top: 4px;
    margin-bottom: 16px;
    font-family: var(--serif);
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
  }

  /* No TOC → the body is centered at the nav/footer width, so there is no right
     margin for margin notes: keep that width and leave footnotes at the bottom
     instead of floating them. */
  .article-layout:not(:has(.article-toc)) .article-reading-col { max-width: var(--max-w); }
  .article-layout:not(:has(.article-toc)) .post-body .footnote { display: block; }
  .article-layout:not(:has(.article-toc)) .post-body .sidenote { display: none; }
}

/* Related posts */
.post-related {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.post-related-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-item {
  display: block;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.related-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 6px;
}

.related-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  color: var(--ink);
  transition: color 0.15s;
}

@media (hover: hover) {
  .related-item:hover .related-title { color: var(--maroon); }
}

/* Legacy: news-tag used in list page cards */
.news-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-3);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
}

/* ── Footer ───────────────────────────────────────────────────────────────────
   Footer + footer-tooltip styles live in /footer.css (shared with the homepage);
   theme colors come from the --footer-* vars in :root above. */

/* Tooltip */
.tooltip { position: relative; display: inline-block; cursor: pointer; }
.tooltip::before { content: ""; position: absolute; inset: -8px -10px; }

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  background-color: var(--bg-2);
  border: 1px solid var(--rule);
  color: var(--muted);
  text-align: justify;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  border-radius: 3px;
  padding: 1em;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  font-family: var(--serif);
  font-size: 0.75rem;
  line-height: 1.6;
}

.tooltip:hover .tooltiptext,
.tooltip.tooltip-open .tooltiptext,
.tooltip:has(.tooltiptext:hover) .tooltiptext { visibility: visible; opacity: 1; }

/* The footer copyright tooltip sits at the right edge, so anchor its bubble to
   the right (like the homepage) instead of centering it as the citation /
   sidenote tooltips do. */
footer .tooltip .tooltiptext {
  left: auto;
  right: 0;
  transform: none;
}

/* Share tooltip — CSS ::after, monospaced, sized to URL width */
.post-action-link[data-tooltip] { position: relative; }

.post-action-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  /* anchored right (opens leftward) so it stays on-screen near the right edge */
  right: 0;
  width: max-content;
  max-width: 420px;
  white-space: nowrap;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.6em 0.9em;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--muted);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.post-action-link[data-tooltip]:hover::after {
  visibility: visible;
  opacity: 1;
}

/* Cite tooltip — uses .tooltip wrapper with HTML content (mixed fonts) */
.tooltip-cite::before { pointer-events: none; }

.tooltip-cite .tooltiptext {
  width: 280px;
  text-align: justify;
  hyphens: none;
  overflow-wrap: break-word;
  /* "Cite" sits near the right edge of the byline, so anchor the bubble to the
     right and open it leftward — centering it pokes ~2px past the viewport
     (causing horizontal scroll) even while hidden. */
  left: auto;
  right: 0;
  transform: none;
}

.tt-cite-body {
  font-family: var(--serif);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

.tt-cite-url {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted-2);
  word-break: break-all;
}

/* Footnote-reference tooltip — hover the [^n] superscript in the body to
   preview the note. Reuses the .tooltip/.tooltiptext hovercard. */
.tooltip-fn .tooltiptext {
  width: 420px;
  max-width: 90vw;
  font-size: 0.78rem;
  color: var(--ink-2);
}

/* Where the margin sidenote is shown (wide screens with a TOC), the note is
   already visible beside the reference, so suppress the redundant hover bubble. */
@media (min-width: 1320px) {
  .article-layout:has(.article-toc) .post-body .tooltip-fn .tooltiptext { display: none; }
}

/* On touch devices a tap momentarily triggers :hover, which would flash the
   footnote bubble at its default centered position (spilling off-screen near a
   line edge) for a frame before the tap handler repositions it. Suppress the
   hover reveal here so the bubble only appears via .tooltip-open, which the tap
   handler positions *before* revealing — so it opens correctly placed. */
@media (hover: none), (pointer: coarse) {
  .post-body .tooltip-fn:hover .tooltiptext { visibility: hidden; opacity: 0; }
  .post-body .tooltip-fn.tooltip-open .tooltiptext { visibility: visible; opacity: 1; }
}

/* .pbc + footer hover styles live in /footer.css (shared with the homepage). */

/* ── Dark mode ───────────────────────────────────────────────────────────────  */
html.dark {
  --bg:        #030303;
  --bg-2:      #241e18;
  --bg-3:      #2e2720;
  --ink:       #F1EEE3;
  --ink-2:     #ddd5c4;
  --maroon:    #884B5D;
  --muted:     #8a8170;
  --muted-2:   #6b6253;
  --rule:      rgba(240, 235, 221, 0.10);
  --rule-soft: rgba(240, 235, 221, 0.06);
}

html.dark nav {
  /* background: rgba(28, 24, 19, 0.94); */
  background: rgba(3, 3, 3, 0.94);
}

html.dark nav img.logo {
  filter: none;
}

/* Theme toggle — news pages are always light, so it's rendered disabled in the
   footer (matching the homepage's footer toggle / social-icon styling). */
.theme-toggle {
  padding: 0;
  background: none;
  border: none;
  color: var(--footer-fg);
  display: flex;
  align-items: center;
  cursor: not-allowed;
  opacity: 0.55;
}

.theme-toggle svg { width: 15px; height: 15px; display: block; }

/* ── Responsive ───────────────────────────────────────────────────────────────  */
@media (max-width: 960px) {
  .article-outer { padding-left: 32px; padding-right: 32px; }
  .article-layout { grid-template-columns: 1fr; }
  .article-toc { display: none; }
  .article-reading-col { max-width: 100%; }
}

@media (max-width: 768px) {
  .news-hero { grid-template-columns: 1fr; }
  .hero-figure { min-height: 200px; order: 2; }
  .hero-body { order: 1; }

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

  .news-page-header { flex-direction: column; gap: 12px; }
  .news-intro { text-align: left; max-width: 100%; }
}

@media (max-width: 640px) {
  /* News list — hero goes full-bleed */
  .news-section {
    width: 100%;
    padding: 80px 0 64px;
  }
  .news-page-header,
  .news-grid,
  .news-empty {
    padding-left: 20px;
    padding-right: 20px;
  }
  .filter-bar {
    padding-left: 20px;
    padding-right: 0;
    flex-wrap: nowrap;
    gap: 0;
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-pills-wrap {
    width: 100%;
    overflow: hidden;
    margin-bottom: 12px;
  }
  .filter-pills-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 48px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--bg));
  }
  .filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    padding-right: 48px;
  }
  .filter-pills::-webkit-scrollbar { display: none; }
  .filter-count { display: none; }
  .news-hero {
    border-radius: 0;
    padding: 28px 20px;
    min-height: auto;
    gap: 24px;
    margin-bottom: 28px;
  }
  .hero-meta {
    font-size: 9px;
    letter-spacing: 0.08em;
    gap: 7px;
  }
  .hero-dot { width: 4px; height: 4px; }
  .hero-figure { min-height: 160px; }
  .news-hero--photo .hero-figure--photo {
    top: auto; width: 100%; height: 45%;
    bottom: 0; right: 0;
  }
  .news-hero--photo .hero-body { max-width: 100%; }
  .news-hero--photo::after {
    background: linear-gradient(
      180deg,
      #000 0%, #000 65%,
      rgba(0,0,0,0.5) 90%,
      transparent 100%
    );
  }

  /* Article page — smaller type, no justify/hyphens on narrow screens */
  .article-outer { padding: 88px 20px 48px; }
  .post-title { font-size: clamp(1.5rem, 7vw, 1.9rem); }
  .post-subtitle { font-size: 14px; }
  .post-abstract {
    font-size: 14px;
  }
  .post-body {
    font-size: 14px;
  }
  .post-body h2 {
    font-size: 18px;
  }
  .post-body .footnote li p {
    font-size: 12px;
  }
  .hero-cta {
    font-size: 14px;
  }
  .post-byline-row { flex-wrap: wrap; gap: 10px; }
  .related-grid { grid-template-columns: 1fr; }
}
