/* ==========================================================================
   Harish Haresamudram — personal academic site
   Plain CSS, no build step. Light/dark follow the visitor's OS setting.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #111318;
  --muted: #4b5260;
  --faint: #8a909c;
  --rule: #e6e8ec;
  --accent: #881337;
  --accent-hover: #6b0f2b;
  --accent-soft: #fdf0f4;
  --panel: #f6f7f9;   /* neutral tint for the job-market banner */
  --canvas: #eceef1;  /* grey margins either side of the page column */

  /* News category colours */
  --c-paper: #881337;
  --c-award: #b7791f;
  --c-career: #2f855a;
  --c-event: #7a4fc4;

  --serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;  /* headings */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --book: Georgia, "Times New Roman", serif;  /* book spines on the Interests page */
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 68rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 0.9rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #16181d;
    --text: #ececec;
    --muted: #a3a8b3;
    --faint: #737985;
    --rule: #262a31;
    --accent: #f191ac;
    --accent-hover: #f7b8ca;
    --accent-soft: #2a1520;
    --panel: #16181d;
    --canvas: #08090b;
    --c-paper: #f191ac;
    --c-award: #f0b44c;
    --c-career: #6fcf97;
    --c-event: #b89af0;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

.skip-link {
  position: absolute; left: -999px; top: 0.5rem; z-index: 100;
  background: var(--surface); padding: 0.5rem 0.75rem; border-radius: 6px;
}
.skip-link:focus { left: 0.5rem; }

.icon {
  width: 1.05em; height: 1.05em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0;
}
h2 { font-size: 1.65rem; margin-bottom: 1.25rem; }
p { margin: 0 0 1rem; }

/* ---------- Page column: white sheet on a grey canvas ---------- */

.page {
  max-width: 76rem;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-top: 3px solid var(--accent);
  box-shadow: 0 0 0 1px rgb(16 24 40 / 0.05), 0 0 48px -12px rgb(16 24 40 / 0.14);
}
.page > main { flex: 1; width: 100%; }
.page > .footer { width: calc(100% - 2 * var(--gutter)); }
@media (prefers-color-scheme: dark) {
  .page { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.05); }
}
@media (max-width: 76rem) {
  .page { box-shadow: none; }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0.75rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem 1.4rem; font-size: 0.9rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Layout ---------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
section { scroll-margin-top: 4.5rem; }
.band { border-top: 1px solid var(--rule); margin-top: 3.5rem; padding-top: 3.5rem; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2.25rem;
  align-items: center;
  padding-top: 3.25rem;
}
.portrait {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: 1.25rem; background: var(--rule);
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 2.75rem); margin-bottom: 0.35rem; }
.role { font-size: 1.08rem; margin: 0; }
.role .sep { color: var(--faint); margin: 0 0.1rem; }
.role .nw { white-space: nowrap; }
.lede { color: var(--muted); font-size: 1.02rem; margin: 0.75rem 0 1.1rem; max-width: 46rem; }

.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.links a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface);
  color: var(--text); font-size: 0.875rem; font-weight: 500;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links .icon { color: var(--muted); }
.links a:hover .icon { color: var(--accent); }

.callout {
  margin: 2.25rem 0 0;
  padding: 0.95rem 1.25rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 0.6rem 0.6rem 0;
}
.callout p { margin: 0; }

/* ---------- About + News row ---------- */

.home-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 3rem;
  align-items: stretch;
  margin-top: 3rem;
}


/* News card */
.news-card {
  /* contain: size stops the list from making the row taller, so the card
     takes the About column's height and the list scrolls inside it. */
  contain: size;
  min-height: 22rem;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 0;
}
.news-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.news-card h2 { margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.news-hint { font-size: 0.78rem; color: var(--faint); }
.news-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -0.75rem;
  padding: 0.15rem 0.75rem 2.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 3rem), transparent);
}
.news-scroll:focus-visible { outline-offset: -2px; }
.news-card h2 .pulse {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--c-career);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--c-career) 20%, transparent);
}

.news { list-style: none; padding: 0; margin: 0; position: relative; display: grid; gap: 0.95rem; }
.news::before {
  content: ""; position: absolute; left: 0.875rem; top: 0.9rem; bottom: 0.9rem;
  width: 1px; background: var(--rule);
}
.news li { display: grid; grid-template-columns: 1.75rem 1fr; gap: 0.8rem; position: relative; }
.news .dot {
  --c: var(--c-paper);
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  font-size: 0.85rem;
}
.news [data-type="award"] .dot { --c: var(--c-award); }
.news [data-type="career"] .dot { --c: var(--c-career); }
.news [data-type="event"] .dot { --c: var(--c-event); }
.news time {
  display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--faint); line-height: 1.3; margin-top: 0.05rem;
}
.news p { margin: 0.1rem 0 0; font-size: 0.93rem; line-height: 1.55; }


/* ---------- Research ---------- */

.themes {
  list-style: none; padding: 0; margin: 1.75rem 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem;
  counter-reset: theme;
}
.theme {
  counter-increment: theme;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.3rem 1.4rem 1.2rem;
  display: flex; flex-direction: column;
}
.theme::before {
  content: counter(theme, decimal-leading-zero);
  font-size: 0.78rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums;
  margin-bottom: 0.4rem;
}
.theme h3 { font-size: 1.15rem; margin-bottom: 0.55rem; }
.theme p { font-size: 0.94rem; margin-bottom: 0.9rem; }
.theme .rep { font-size: 0.84rem; color: var(--muted); margin: auto 0 0; padding-top: 0.75rem; border-top: 1px dashed var(--rule); }
.theme-more { display: inline-block; margin-top: 0.7rem; font-size: 0.84rem; font-weight: 500; }

/* ---------- Publications ---------- */

.pub-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pub-head h2 { margin: 0; }
.pub-head .aside { font-size: 0.875rem; font-weight: 500; }

.pub-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.5rem; margin-bottom: 1.25rem;
}
.pub-tabs {
  display: inline-flex; gap: 0.25rem; padding: 0.25rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
}
.pub-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pub-topics-label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--faint); margin-right: 0.2rem;
}
.pub-topics button {
  font: inherit; font-size: 0.82rem; font-weight: 500; line-height: 1;
  padding: 0.45rem 0.8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--muted);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.pub-topics button span { color: var(--faint); font-variant-numeric: tabular-nums; margin-left: 0.15rem; }
.pub-topics button:hover { border-color: var(--accent); color: var(--accent); }
.pub-topics button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pub-topics button[aria-pressed="true"] span { color: var(--accent); }
.pub-tabs button {
  font: inherit; font-size: 0.875rem; font-weight: 500;
  border: 0; background: transparent; color: var(--muted);
  padding: 0.4rem 1rem; border-radius: 999px; cursor: pointer;
}
.pub-tabs button span { color: var(--faint); font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.pub-tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.pub-tabs button[aria-pressed="true"] span { color: inherit; opacity: 0.7; }

.pub-list { display: grid; gap: 0.35rem; }

.pub-year {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--faint);
}
.pub-list > .pub-group:first-child .pub-year { margin-top: 0.25rem; }
.pub-year h3 { font-size: 1.25rem; color: var(--text); font-variant-numeric: tabular-nums; }
.pub-year::after { content: ""; flex: 1; height: 1px; background: var(--rule); order: 1; }
.pub-year span { order: 2; font-size: 0.8rem; }

.pub {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem;
  margin: 0 -1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  scroll-margin-top: 5rem;
  transition: background-color 0.2s, border-color 0.2s;
}
.pub:hover { background: var(--surface); border-color: var(--rule); }
.pub.flash { animation: flash 2.2s ease-out; }
@keyframes flash {
  0%, 30% { background: var(--accent-soft); border-color: var(--accent); }
  100% { background: transparent; border-color: transparent; }
}

/* Each figure keeps its own shape (no letterboxing); very tall ones are capped. */
.pub-thumb {
  align-self: start;
  display: flex;
  justify-content: center;
}
.pub-thumb img {
  width: auto; height: auto;
  max-width: 100%; max-height: 11rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 0.6rem;
  transition: transform 0.35s ease;
}
.pub-thumb img[src$="soar_2023.png"],
.pub-thumb img[src$="soar_2024.png"] { padding: 0; }
.pub:hover .pub-thumb img { transform: scale(1.03); }
/* Papers without a figure get a 16:10 tile */
.pub-thumb.is-tile {
  display: block; position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 0.6rem;
  overflow: hidden;
}
.pub-badge {
  display: inline-block; vertical-align: 0.1em; margin-right: 0.5rem;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; line-height: 1;
  padding: 0.28rem 0.45rem; border-radius: 0.3rem;
  background: var(--text); color: var(--bg); font-style: normal;
}
.pub-tile {
  --h: 210;
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  background:
    radial-gradient(circle at 20% 15%, hsl(var(--h) 60% 97%) 0, transparent 55%),
    linear-gradient(135deg, hsl(var(--h) 45% 92%), hsl(calc(var(--h) + 35) 40% 84%));
  color: hsl(var(--h) 40% 28%);
}
.pub-tile span { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; letter-spacing: -0.01em; }
.pub-tile small { font-size: 0.78rem; font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) {
  .pub-thumb img { border-color: transparent; }
  .pub-tile {
    background:
      radial-gradient(circle at 20% 15%, hsl(var(--h) 35% 30%) 0, transparent 55%),
      linear-gradient(135deg, hsl(var(--h) 25% 20%), hsl(calc(var(--h) + 35) 25% 15%));
    color: hsl(var(--h) 55% 82%);
  }
}

.pub-body { min-width: 0; }
.pub-title { font-family: var(--sans); font-size: 1.02rem; font-weight: 600; line-height: 1.4; letter-spacing: 0; margin: 0.1rem 0 0.3rem; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.2rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-venue { font-size: 0.9rem; color: var(--muted); margin: 0; }
.pub-venue em { color: var(--text); font-style: italic; }
.pub-award {
  display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; font-style: normal;
  color: var(--c-award); background: color-mix(in srgb, var(--c-award) 14%, transparent);
}
.pub-tldr { font-size: 0.9rem; color: var(--muted); margin: 0.45rem 0 0; line-height: 1.55; }

.pub-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.pub-links a,
.pub-links button {
  font: inherit; font-size: 0.75rem; font-weight: 500; line-height: 1;
  padding: 0.35rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--muted);
  cursor: pointer;
}
.pub-links a:hover,
.pub-links button:hover,
.pub-links button[aria-expanded="true"] {
  border-color: var(--accent); color: var(--accent); text-decoration: none;
}

.pub-drawer {
  position: relative; margin-top: 0.75rem;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 0.6rem;
}
.pub-drawer p { font-size: 0.88rem; padding: 0.8rem 1rem; margin: 0; }
.pub-drawer pre {
  margin: 0; padding: 0.85rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: 0.75rem; line-height: 1.55; color: var(--text);
}
.pub-drawer .copy {
  position: absolute; top: 0.5rem; right: 0.5rem;
  font: inherit; font-size: 0.72rem; font-weight: 500;
  padding: 0.25rem 0.6rem; border-radius: 0.4rem; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--muted);
}
.pub-drawer .copy:hover { color: var(--accent); border-color: var(--accent); }

.pub-error {
  padding: 1rem 1.25rem; border: 1px dashed var(--rule); border-radius: var(--radius);
  color: var(--muted); font-size: 0.92rem;
}
.pub-error p { margin: 0.25rem 0; }
.pub-error code { font-family: var(--mono); font-size: 0.85em; }

/* ---------- Interests page ---------- */

.page-head { padding-top: 3.25rem; }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 2.75rem); margin-bottom: 0.5rem; }
#reading { margin-top: 2rem; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 500; }

.now { color: var(--muted); margin-bottom: 0; }
.now strong { color: var(--text); font-weight: 600; }
.now .pulse {
  display: inline-block; vertical-align: 0.1em; margin-right: 0.6rem;
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c-career);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--c-career) 20%, transparent);
}

/* The shelf: books stand on a wooden plank. Each spine's colour, height and
   width come from its position, so new books slot in without extra styling. */
.shelf {
  --wood-1: #c49a6c; --wood-2: #9a7148;
  position: relative;
  list-style: none; margin: 2.25rem 0 0; padding: 0 1.25rem;
  display: flex; align-items: flex-end; gap: 3px;
  min-height: 17rem;
}
.shelf::before {
  content: ""; order: 999; flex: none; width: 2.6rem; height: 7rem; margin-left: 2px;
  background: linear-gradient(to right, #3d434c, #5b626d 40%, #3d434c);
  clip-path: polygon(0 0, 20% 0, 20% 90%, 100% 90%, 100% 100%, 0 100%);
}
.shelf::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.85rem; height: 0.85rem;
  background: linear-gradient(to bottom, var(--wood-1), var(--wood-2));
  border-radius: 3px;
  box-shadow: 0 12px 18px -10px rgb(0 0 0 / 0.45);
}

.spine {
  --c: #1e3a5f; --ink: #f3ead6; --band: rgb(230 196 120 / 0.65);
  --h: 15rem; --w: 3.6rem;
  position: relative; flex: none;
  width: var(--w); height: var(--h);
  writing-mode: vertical-rl;
  text-orientation: sideways;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.2rem;
  padding: 2.25rem 0 1.5rem;
  color: var(--ink);
  border-radius: 3px 3px 1px 1px;
  background:
    /* gilt bands near the top and bottom */
    linear-gradient(to bottom, transparent 1.35rem, var(--band) 1.35rem, var(--band) calc(1.35rem + 1.5px), transparent calc(1.35rem + 1.5px),
                               transparent calc(1.35rem + 4px), var(--band) calc(1.35rem + 4px), var(--band) calc(1.35rem + 5.5px), transparent calc(1.35rem + 5.5px)),
    linear-gradient(to top,    transparent 0.8rem, var(--band) 0.8rem, var(--band) calc(0.8rem + 1.5px), transparent calc(0.8rem + 1.5px)),
    /* rounded-spine shading */
    linear-gradient(to right, rgb(0 0 0 / 0.3), rgb(255 255 255 / 0.14) 16%, rgb(255 255 255 / 0) 40%, rgb(0 0 0 / 0.06) 78%, rgb(0 0 0 / 0.34)),
    var(--c);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12);
  cursor: default;
  transition: transform 0.25s ease;
}
.spine:hover { transform: translateY(-0.55rem); }

.spine-title {
  font-family: var(--book); font-weight: 600; font-size: 0.92rem; letter-spacing: 0.01em;
  line-height: 1.2; white-space: nowrap;
}
.spine-author { font-size: 0.66rem; letter-spacing: 0.03em; line-height: 1.2; opacity: 0.82; white-space: nowrap; }

/* bookmark ribbon on the book being read */
.spine.is-current::after {
  content: ""; position: absolute; z-index: -1;
  top: -1.1rem; left: 22%; width: 0.6rem; height: 1.6rem;
  background: var(--c-career);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

/* colours (cloth-bound tones), heights and widths cycle */
.spine:nth-child(10n+1) { --c: #24406b; }
.spine:nth-child(10n+2) { --c: #7d2a35; }
.spine:nth-child(10n+3) { --c: #2f5d4e; }
.spine:nth-child(10n+4) { --c: #c09443; --ink: #2a2216; --band: rgb(70 50 20 / 0.45); }
.spine:nth-child(10n+5) { --c: #4f3a63; }
.spine:nth-child(10n+6) { --c: #2b6a70; }
.spine:nth-child(10n+7) { --c: #8a4b2a; }
.spine:nth-child(10n+8) { --c: #3b4252; }
.spine:nth-child(10n+9) { --c: #5e6b3a; }
.spine:nth-child(10n+10) { --c: #6b2f4a; }
.spine:nth-child(5n+1) { --h: 15.5rem; --w: 3.7rem; }
.spine:nth-child(5n+2) { --h: 14.25rem; --w: 3.4rem; }
.spine:nth-child(5n+3) { --h: 16.25rem; --w: 3.9rem; }
.spine:nth-child(5n+4) { --h: 14.75rem; --w: 3.5rem; }
.spine:nth-child(5n+5) { --h: 15.75rem; --w: 3.8rem; }


@media (prefers-color-scheme: dark) {
  .shelf { --wood-1: #6b5038; --wood-2: #4a3726; }
  .shelf::before { background: linear-gradient(to right, #6a717c, #8d949f 40%, #6a717c); }
}

/* Narrow screens: the books lie flat in a stack so titles stay readable */
@media (max-width: 640px) {
  .shelf { flex-direction: column; align-items: center; gap: 3px; min-height: 0; padding: 0; }
  .shelf::before { display: none; }
  .spine {
    writing-mode: horizontal-tb;
    width: var(--sw, 92%); height: 2.9rem;
    flex-direction: row; justify-content: space-between; gap: 0.75rem;
    padding: 0 1rem 0 1.15rem;
    border-radius: 2px;
    background:
      linear-gradient(to right, transparent 0.55rem, var(--band) 0.55rem, var(--band) calc(0.55rem + 1.5px), transparent calc(0.55rem + 1.5px)),
      linear-gradient(to left,  transparent 0.55rem, var(--band) 0.55rem, var(--band) calc(0.55rem + 1.5px), transparent calc(0.55rem + 1.5px)),
      linear-gradient(to bottom, rgb(255 255 255 / 0.14), rgb(255 255 255 / 0) 45%, rgb(0 0 0 / 0.25)),
      var(--c);
  }
  .spine:hover { transform: none; }
  .spine-title { white-space: normal; }
  .spine.is-current::after { display: none; }
  .spine:nth-child(5n+1) { --sw: 94%; }
  .spine:nth-child(5n+2) { --sw: 86%; }
  .spine:nth-child(5n+3) { --sw: 98%; }
  .spine:nth-child(5n+4) { --sw: 89%; }
  .spine:nth-child(5n+5) { --sw: 95%; }
}

@media (prefers-reduced-motion: reduce) {
  .spine { transition: none; }
  .spine:hover { transform: none; }
}

/* ---------- Blog post / project write-up ---------- */

.post { max-width: 46rem; margin: 0 auto; padding-top: 2.5rem; }
.post-back { display: inline-block; font-size: 0.875rem; font-weight: 500; margin-bottom: 1.75rem; }
.post-head { margin-bottom: 2.25rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--rule); }
.post-kicker { font-size: 0.875rem; color: var(--muted); margin: 0 0 0.75rem; }
.post-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.5rem); margin-bottom: 0.6rem; }
.post-sub { font-size: 1.05rem; color: var(--muted); margin-bottom: 0.9rem; }
.post-authors { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.4rem; }
.post-authors .me { color: var(--text); font-weight: 600; }
.post h2 { font-size: 1.45rem; margin: 2.5rem 0 0.9rem; }
.post h3 { font-size: 1.12rem; margin: 1.9rem 0 0.6rem; }
.post p, .post li { font-size: 1.02rem; line-height: 1.75; }
.post ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.post li + li { margin-top: 0.6rem; }
.post figure { margin: 1.75rem auto; }
.post figure img {
  width: 100%; height: auto; margin: 0 auto;
  background: #fff; border: 1px solid var(--rule); border-radius: 0.6rem; padding: 0.5rem;
}
.post figcaption { font-size: 0.85rem; color: var(--muted); text-align: center; margin-top: 0.6rem; line-height: 1.5; }
.post .fig-narrow { max-width: 26rem; }
.post .fig-medium { max-width: 36rem; }
.post .fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; margin: 1.75rem 0; }
.post .fig-row figure { margin: 0; }
@media (prefers-color-scheme: dark) { .post figure img { border-color: transparent; } }
@media (max-width: 640px) { .post .fig-row { grid-template-columns: 1fr; } }

.post-list { list-style: none; padding: 0; margin: 2rem 0 0; max-width: 52rem; display: grid; gap: 2rem; }
.post-item { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.post-item-thumb img {
  width: 100%; height: auto; background: #fff;
  border: 1px solid var(--rule); border-radius: 0.6rem; padding: 0.4rem;
}
.post-item h2 { font-size: 1.35rem; margin: 0 0 0.5rem; }
.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--accent); }
.post-item-desc { color: var(--muted); margin-bottom: 0.6rem; }
.post-item-more { font-size: 0.9rem; font-weight: 500; }
@media (max-width: 640px) { .post-item { grid-template-columns: 1fr; } .post-item-thumb { max-width: 18rem; } }
@media (prefers-color-scheme: dark) { .post-item-thumb img { border-color: transparent; } }

/* ---------- Footer ---------- */

.footer {
  max-width: calc(var(--maxw) - 2 * var(--gutter)); margin: 4rem auto 0;
  padding: 1.75rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--faint); font-size: 0.85rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem;
}

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

@media (max-width: 900px) {
  .home-row { grid-template-columns: 1fr; gap: 2.5rem; }
  .home-row #news { order: -1; contain: none; height: 26rem; min-height: 0; }
}

@media (max-width: 720px) {
  .topbar .brand { display: none; }
  .topbar-inner { justify-content: center; }
  .nav { justify-content: center; gap: 0.2rem 1.1rem; }

  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; padding-top: 2rem; }
  .hero .portrait-wrap { width: 7.5rem; }

  .pub { grid-template-columns: 1fr; gap: 0.8rem; margin: 0; padding: 0.75rem 0; }
  .pub:hover { background: transparent; border-color: transparent; }
  .pub-thumb { max-width: 24rem; justify-content: flex-start; }
}

@media (max-width: 480px) {
  .nav { font-size: 0.76rem; gap: 0.2rem 0.55rem; }
  .news-card { padding: 1.2rem 1.1rem 1rem; }
}

@media print {
  .topbar, .skip-link, .pub-links, .pub-tabs, .news-hint { display: none !important; }
  .news-card { contain: none; }
  .news-scroll { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .news-card, .theme { box-shadow: none; break-inside: avoid; }
  .pub { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pub, .pub-thumb img { transition: none; }
  .pub.flash { animation: none; }
}
