/* ==========================================================================
   gautam8387.github.io
   Paper, ink and one vermilion accent. Serif for reading, mono for metadata.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --ink: #1c1b18;
  --ink-2: #3a3731;
  --muted: #6b665e;
  --rule: #d6cfbf;
  --accent: #b4441e;
  --selection: #efcdb6;

  /* Cluster palette for the atlas and glyphs: muted pigments. */
  --c1: #2f5d62; --c2: #b4441e; --c3: #b08a1c; --c4: #56688f;
  --c5: #6b7c42; --c6: #8c4a6b; --c7: #3a7aa3; --c8: #9c6239;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Contract with assets/js/atlas.js (hero atlas and project glyphs). */
  --atlas-ink: var(--ink);
  --atlas-muted: var(--muted);
  --atlas-font: var(--mono);
  --atlas-c1: var(--c1); --atlas-c2: var(--c2); --atlas-c3: var(--c3); --atlas-c4: var(--c4);
  --atlas-c5: var(--c5); --atlas-c6: var(--c6); --atlas-c7: var(--c7); --atlas-c8: var(--c8);

  --maxw: 74rem;
  --gutter: clamp(1rem, 4vw, 2.75rem);
  --label-col: 12rem;
  --measure: 40rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121311;
  --paper-2: #1a1c19;
  --ink: #ece7dc;
  --ink-2: #cdc7ba;
  --muted: #979185;
  --rule: #2f322d;
  --accent: #e8825a;
  --selection: #5a2f1f;

  --c1: #74b5b8; --c2: #ec8a5e; --c3: #dfbd5c; --c4: #9dafd6;
  --c5: #afc27c; --c6: #d18cae; --c7: #7cbbe0; --c8: #d59d70;
}

/* No-JS fallback: follow the system theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #121311; --paper-2: #1a1c19; --ink: #ece7dc; --ink-2: #cdc7ba;
    --muted: #979185; --rule: #2f322d; --accent: #e8825a; --selection: #5a2f1f;
    --c1: #74b5b8; --c2: #ec8a5e; --c3: #dfbd5c; --c4: #9dafd6;
    --c5: #afc27c; --c6: #d18cae; --c7: #7cbbe0; --c8: #d59d70;
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

::selection { background: var(--selection); color: var(--ink); }

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

h1, h2, h3, h4 { font-weight: 400; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

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

code, kbd, .mono { font-family: var(--mono); font-size: 0.86em; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: .5rem .75rem;
  background: var(--ink);
  color: var(--paper);
  font: 500 .8rem/1 var(--mono);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

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

/* ---------- Header / nav ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .01em;
}

.brand {
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.brand::before {
  content: "";
  display: inline-block;
  width: .5rem; height: .5rem;
  margin-right: .55rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: .05em;
}

.site-nav ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .25rem 1.25rem;
  list-style: none;
}
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .35em;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  margin: -.5rem -.5rem -.5rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, transform .4s ease;
}
.theme-toggle:hover { color: var(--ink); transform: rotate(180deg); }

/* ---------- Shared bits ---------- */

.kicker, .meta, .label {
  font-family: var(--mono);
  font-size: .75rem;
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--muted);
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  list-style: none;
  font-family: var(--mono);
  font-size: .8rem;
}
.inline-links a { text-decoration: none; color: var(--muted); }
.inline-links a:hover { color: var(--accent); }

/* External-link arrows, drawn in CSS so the markup stays clean. */
.arrow::after, .links a[href^="http"]::after {
  content: "↗";
  display: inline-block;
  margin-left: .2em;
  font-size: .85em;
  transition: transform .15s ease;
}
.arrow:hover::after, .links a[href^="http"]:hover::after { transform: translate(1px, -1px); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  list-style: none;
  font-family: var(--mono);
  font-size: .8rem;
}
.links a { text-decoration: none; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom: .05rem; }
.links a:hover { color: var(--accent); border-color: var(--accent); }

.more {
  display: inline-block;
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: .8rem;
  text-decoration: none;
  color: var(--ink-2);
  border-bottom: 1px solid var(--accent);
}
.more::after { content: " →"; }
.more:hover { color: var(--accent); }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding-block: clamp(1.5rem, 5vw, 4rem) clamp(2.5rem, 6vw, 5rem);
}

.hero__text { padding-bottom: 2.5rem; }

.hero__name {
  margin: .9rem 0 1.4rem;
  font-size: clamp(3.4rem, 8.5vw, 6.6rem);
  font-weight: 350;
  line-height: .92;
  letter-spacing: -0.035em;
}
.hero__name em { font-style: italic; font-weight: 300; }

.hero__lede {
  max-width: 28rem;
  font-size: clamp(1.15rem, 1.6vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: 1.1rem;
}

.hero__interests {
  max-width: 28rem;
  margin-bottom: 1.75rem;
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.7;
  color: var(--muted);
}
.hero__interests .label { display: block; color: var(--ink); }

/* ---------- Atlas figure ---------- */

.atlas {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.atlas__canvas {
  display: block;
  width: 100%;
  height: clamp(20rem, 64vh, 38rem);
  touch-action: pan-y;
}

.atlas__caption {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.55;
  color: var(--muted);
}
.atlas__caption b { color: var(--ink); font-weight: 500; }
.atlas__caption code { font-size: 1em; color: var(--ink); }
.atlas__caption p { margin: 0; max-width: 34rem; }

/* Numbered legend, used instead of on-canvas labels on narrow screens. */
.atlas__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .35rem 1.25rem;
  font-family: var(--mono);
  font-size: .7rem;
  line-height: 1.35;
  color: var(--ink-2);
}
.atlas__legend[hidden] { display: none; }
.atlas__legend li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; align-items: baseline; cursor: default; transition: opacity .15s ease; }
.atlas__legend code { font-size: 1em; color: var(--muted); white-space: nowrap; }
.atlas__legend .atlas__n {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 1.2rem;
  height: 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: .65rem;
  color: var(--ink);
}
.atlas__legend.has-hot li:not(.is-hot) { opacity: .4; }
.atlas__legend li.is-hot .atlas__n { border-color: var(--accent); color: var(--accent); }

/* Countdown to the next atlas, drawn over the caption's top rule by atlas.js. */
.atlas__timer {
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}
.atlas__timer i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}
.atlas[data-cycle="off"] .atlas__timer { display: none; }
.atlas[data-cycle="paused"] .atlas__timer i { opacity: .45; }

.atlas__controls { flex: none; display: flex; gap: .5rem; }

.atlas__btn, .fig3__btn,
.atlas__regen {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.atlas__btn:hover, .fig3__btn:hover,
.atlas__regen:hover { border-color: var(--accent); color: var(--accent); }
.atlas__btn[aria-pressed="true"] { border-color: var(--ink-2); }
.atlas__regen svg { transition: transform .5s ease; }
.atlas__regen:hover svg { transform: rotate(180deg); }

/* ---------- Sections (home) ---------- */

.section {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 1.25rem 2.5rem;
  padding-block: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
}

.section__label {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.section__label h2 { font: inherit; letter-spacing: inherit; color: var(--ink); }
.section__label .num { color: var(--accent); white-space: nowrap; }

@media (min-width: 761px) {
  .section__label { position: sticky; top: 1.5rem; align-self: start; }
}

.prose { max-width: var(--measure); }
.prose p { font-size: 1.15rem; line-height: 1.65; }
.prose p:last-child { margin-bottom: 0; }
.prose .lead { font-size: clamp(1.3rem, 2vw, 1.5rem); line-height: 1.45; color: var(--ink); }

/* About: text + portrait */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 2.5rem;
  align-items: start;
}
.portrait { margin: 0; }
.portrait img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(.25) contrast(1.02);
  border-radius: 2px;
}
.portrait figcaption { margin-top: .6rem; }

/* Now: focus list */
.focus {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0 2.5rem;
  max-width: 52rem;
}
.focus li {
  padding: .8rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.1rem;
  line-height: 1.4;
}
.focus li::before {
  content: attr(data-n);
  display: block;
  margin-bottom: .15rem;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--accent);
}

/* ---------- Projects ---------- */

.projects {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.project {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: 1.25rem 1.25rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  transition: border-color .2s ease, background-color .2s ease;
}
.project:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--rule)); background: color-mix(in srgb, var(--paper-2) 55%, transparent); }

.project__head { display: flex; align-items: center; gap: .9rem; }
.project__glyph { width: 3rem; height: 3rem; flex: none; }
.project__name { font-size: 1.45rem; letter-spacing: -.01em; }
.project__name a { text-decoration: none; }
.project__role { margin-top: .1rem; }
.project__desc { font-size: 1.02rem; line-height: 1.5; color: var(--ink-2); margin: 0; flex: 1; }
.project .links { margin-top: .35rem; }

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

.pubs { list-style: none; }

.pub {
  padding: 1.1rem 0 1.2rem;
  border-bottom: 1px solid var(--rule);
}
.pub:first-child { padding-top: 0; }
.pub[hidden] { display: none; }

.pub__title { font-size: 1.22rem; line-height: 1.35; letter-spacing: -.005em; }
.pub__title a { text-decoration: none; }
.pub__title a:hover { text-decoration: underline; }
.pub__authors { margin: .35rem 0 0; font-size: 1rem; line-height: 1.5; color: var(--muted); }
.pub__authors .me { color: var(--ink); font-weight: 500; }
.pub__venue { margin: .25rem 0 0; font-size: 1rem; color: var(--ink-2); }
.pub__summary { margin: .45rem 0 0; font-size: 1rem; line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }
.pub__foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; margin-top: .6rem; }

.tag {
  display: inline-block;
  padding: .12rem .45rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .68rem;
  line-height: 1.4;
  text-transform: lowercase;
  color: var(--muted);
}
.note {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent);
}

.year-group { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: 1rem 2.5rem; padding-top: 2rem; border-top: 1px solid var(--rule); margin-top: 2rem; }
.year-group:first-of-type { margin-top: 0; }
.year-group[hidden] { display: none; }
.year-group__year { font-family: var(--mono); font-size: .85rem; color: var(--accent); }
@media (min-width: 761px) {
  .year-group__year { position: sticky; top: 1.5rem; align-self: start; }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 2.5rem;
  padding: 0;
  border: 0;
}
.filters legend { width: 100%; margin-bottom: .6rem; padding: 0; }
.filter {
  padding: .35rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: .75rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter .count { opacity: .6; margin-left: .3rem; }

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

.news { list-style: none; max-width: 52rem; }
.news li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.05rem;
  line-height: 1.5;
}
.news li:first-child { padding-top: 0; }
.news time { font-family: var(--mono); font-size: .75rem; color: var(--muted); padding-top: .25rem; white-space: nowrap; }
.news p { margin: 0; }
.news strong { font-weight: 500; }

/* ---------- Page header (inner pages) ---------- */

.page-head {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 1rem 2.5rem;
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
}
.page-head h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 350;
  letter-spacing: -.03em;
  line-height: 1;
}
.page-head .intro { margin: 1.1rem 0 0; max-width: var(--measure); font-size: 1.15rem; color: var(--ink-2); }
.page-head .kicker { padding-top: .6rem; }

.page-body { padding-bottom: clamp(3rem, 6vw, 5rem); }

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

.cv-section {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: 1rem 2.5rem;
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--rule);
}
.cv-section > h2 {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-top: .35rem;
}
@media (min-width: 761px) {
  .cv-section > h2 { position: sticky; top: 1.5rem; align-self: start; }
}

.entries { list-style: none; }
.entry {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: .25rem 1.5rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry:first-child { padding-top: .1rem; }
.entry:last-child { border-bottom: 0; }
.entry__when { font-family: var(--mono); font-size: .75rem; color: var(--muted); padding-top: .3rem; }
.entry__title { font-size: 1.15rem; line-height: 1.35; }
.entry__org { margin: .1rem 0 0; font-size: 1rem; color: var(--ink-2); }
.entry__org a { text-decoration-color: var(--rule); }
.entry__org .place { color: var(--muted); }
.entry__notes { margin-top: .45rem; padding-left: 1.1rem; font-size: .98rem; line-height: 1.5; color: var(--ink-2); }
.entry__notes li { margin: .15rem 0; }
.entry__notes li::marker { color: var(--muted); }

.cv-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.25rem; }
.button-link {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--accent);
  background: none;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: .8rem;
  cursor: pointer;
}
.button-link:hover { color: var(--accent); }

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

.contact-line { font-size: clamp(1.35rem, 2.6vw, 1.9rem); line-height: 1.35; letter-spacing: -.01em; margin-bottom: 1.25rem; max-width: 34rem; }
.email { font-family: var(--mono); font-size: .95rem; }

/* ---------- Fig. 3: two panels, (a) reaction–diffusion and (b) flocking ---------- */

.fig3 { margin: 0; min-width: 0; display: grid; gap: 1rem; }
.fig3__panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.fig3__panel { position: relative; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.fig3__canvas {
  display: block;
  width: 100%;
  height: clamp(14rem, 38vh, 21rem);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: crosshair;
  touch-action: pan-y;
}
.fig3__tag { /* panel letters, as in a journal figure */
  position: absolute;
  top: .45rem; left: .5rem;
  z-index: 1;
  padding: .1rem .35rem;
  border-radius: 2px;
  background: var(--paper);
  font: 600 .8rem/1.2 var(--mono);
  color: var(--ink);
  pointer-events: none;
}
.fig3__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem 1rem;
  font-family: var(--mono);
  font-size: .68rem;
  line-height: 1.5;
  color: var(--muted);
}
.fig3__meta p { margin: 0; }
.fig3__meta code { font-size: 1em; color: var(--ink); }
.fig3__caption {
  display: grid;
  gap: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.55;
  color: var(--muted);
}
.fig3__caption p { margin: 0; }
.fig3__caption b { color: var(--ink); font-weight: 500; }
.fig3__parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.fig3__parts > div { display: grid; gap: .6rem; align-content: start; }
html:not(.js) .figure-section { display: none; }
.eq {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 2rem;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink-2);
}
.eq i { font-style: italic; }
.eq b { font-weight: 600; color: inherit; }
.eq sub { font-size: .65em; }

@media (max-width: 760px) {
  .fig3__panels, .fig3__parts { grid-template-columns: minmax(0, 1fr); }
}

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

.cryptogram {
  margin-top: 1.25rem !important;
  letter-spacing: .18em;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  cursor: help;
  user-select: all;
}

.hero__cipher { margin: 1.4rem 0 0 !important; font-family: var(--mono); font-size: .72rem; }

/* ---------- Journal ---------- */

.entries-list { list-style: none; max-width: 52rem; }
.entry-card {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1rem 0 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.entry-card:first-child { padding-top: 0; }
.entry-card time { font-family: var(--mono); font-size: .75rem; color: var(--muted); padding-top: .35rem; white-space: nowrap; }
.entry-card__title { font-size: 1.3rem; line-height: 1.3; letter-spacing: -.005em; }
.entry-card__title a { text-decoration: none; }
.entry-card__title a:hover { text-decoration: underline; }
.entry-card__dek { margin: .35rem 0 0; font-size: 1.02rem; line-height: 1.5; color: var(--ink-2); }
.entry-card__tags { margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }

/* Journal parts: entries, then the shelf of slides, posters and write-ups. */
.journal-part + .journal-part { margin-top: clamp(3rem, 6vw, 4.5rem); }
.journal-part__title {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  letter-spacing: -.01em;
}
.journal-part .year-group:first-of-type, .journal-part .filters + .year-group { border-top: 0; padding-top: 0; margin-top: 0; }
.journal-part .filters { margin-bottom: 2rem; }

.shelf {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
  gap: 2rem 1.5rem;
}
.res { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.res[hidden] { display: none; }
.res__thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin-bottom: .35rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-2);
  transition: border-color .2s ease;
}
.res__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .35s ease; }
.res__thumb:hover { border-color: var(--accent); }
.res__thumb:hover img { transform: scale(1.025); }
.res__glyph { width: 4.5rem; height: 4.5rem; }
:root[data-theme="dark"] .res__thumb img { opacity: .88; }
.res__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.res__title { font-size: 1.12rem; line-height: 1.3; letter-spacing: -.005em; }
.res__title a { text-decoration: none; }
.res__title a:hover { text-decoration: underline; }
.res__venue { margin: 0; font-size: .95rem; line-height: 1.4; color: var(--ink-2); font-style: italic; }
.res__desc { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--ink-2); }
.res .links { margin-top: .25rem; }

/* Invisible ink: this line only shows when selected. */
.invisible-ink { color: var(--paper); font-style: italic; margin-top: 2rem !important; }
.invisible-ink::selection { background: #4b2a85; color: #d9c7ff; }

/* ---------- Journal entry ---------- */

.post { padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 6vw, 5rem); }
.post__head, .post__body, .post__foot { max-width: 42rem; margin-inline: auto; }
.post__head { margin-bottom: 2.5rem; }
.post__head .kicker a { color: inherit; }
.post__title {
  margin-top: .9rem;
  font-size: clamp(2.3rem, 5.5vw, 3.6rem);
  font-weight: 350;
  line-height: 1.05;
  letter-spacing: -.025em;
}
.post__dek { margin: 1rem 0 0; font-size: 1.3rem; line-height: 1.45; color: var(--ink-2); }

.article { font-size: 1.15rem; line-height: 1.7; }
.article > * + * { margin-top: 1.1em; }
.article p { margin: 0; }
.article h2 { margin-top: 2.2em; font-size: 1.65rem; letter-spacing: -.01em; }
.article h3 { margin-top: 1.8em; font-size: 1.3rem; }
.article h4 { margin-top: 1.5em; font: 500 .8rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.article ul, .article ol { padding-left: 1.3em; }
.article li + li { margin-top: .35em; }
.article li::marker { color: var(--muted); }
.article blockquote {
  margin-inline: 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
  font-style: italic;
}
.article hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.5em; }
.article img { margin-inline: auto; border-radius: 2px; }
.article img + em, .article p > img + em { display: block; margin-top: .6rem; font: .75rem/1.55 var(--mono); font-style: normal; color: var(--muted); }
.article table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.article th, .article td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; }
.article th { font: 500 .75rem/1.4 var(--mono); color: var(--muted); }
.article code { padding: .08em .3em; border-radius: 3px; background: var(--paper-2); }
.article pre, .article .highlight {
  overflow-x: auto;
  border-radius: 3px;
  background: var(--paper-2);
}
.article pre { padding: 1rem 1.15rem; font-size: .88rem; line-height: 1.6; }
.article pre code { padding: 0; background: none; font-size: 1em; }
.article .highlight pre { background: none; }
.article .katex-display { overflow-x: auto; overflow-y: hidden; padding-block: .25rem; }
.article .footnotes { margin-top: 3em; padding-top: 1em; border-top: 1px solid var(--rule); font-size: .95rem; color: var(--ink-2); }

/* Syntax highlighting (Rouge), drawn from the page palette. */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kc, .highlight .ow { color: var(--c6); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx { color: var(--c5); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: var(--c8); }
.highlight .nf, .highlight .fm, .highlight .nc, .highlight .nn { color: var(--c7); }
.highlight .nb, .highlight .bp, .highlight .nd { color: var(--c1); }
.highlight .o, .highlight .p { color: var(--ink-2); }
.highlight .err { color: var(--accent); }

.post__foot { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.post__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.5rem; }
.post__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.post__nav a { text-decoration: none; font-size: 1.05rem; line-height: 1.35; }
.post__nav a:hover { color: var(--accent); }
.post__nav .label { display: block; margin-bottom: .2rem; }
.post__next { grid-column: 2; text-align: right; }

/* ---------- 404 ---------- */

.lost { padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 6vw, 5rem); }
.lost .atlas__canvas { height: clamp(16rem, 48vh, 28rem); }

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

.site-footer {
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }
.site-footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; }
.colophon { margin-top: 1rem !important; max-width: 46rem; line-height: 1.6; }

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

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero__text { padding-bottom: 0; }
  .atlas__canvas { height: clamp(18rem, 78vw, 30rem); }
}

@media (max-width: 760px) {
  body { font-size: 1.0625rem; }
  .section, .page-head, .cv-section, .year-group { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .page-head .kicker { padding-top: 0; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .portrait { max-width: 11rem; order: -1; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .entry__when { padding-top: 0; }
  .news li { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .news time { padding-top: 0; }
}

@media (max-width: 520px) {
  .site-header { gap: .75rem; }
  .site-nav ul { flex-wrap: nowrap; gap: .25rem .8rem; }
  .site-nav .nav-work, .site-nav .nav-news { display: none; }
  .entry-card { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .entry-card time { padding-top: 0; }
  .atlas__controls { width: 100%; }
}

@media (max-width: 400px) {
  .site-nav { font-size: .74rem; }
  .site-nav ul { gap: .25rem .7rem; }
}

@media (max-width: 350px) {
  .brand { font-size: 0; }          /* the dot alone links home; the name is still read out */
  .brand::before { margin-right: 0; width: .6rem; height: .6rem; }
}

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

/* ---------- Print (the CV page prints as a clean CV) ---------- */

@media print {
  :root, :root[data-theme="dark"] {
    --paper: #fff; --paper-2: #fff; --ink: #000; --ink-2: #222; --muted: #555; --rule: #ccc; --accent: #000;
  }
  body { font-size: 10.5pt; background: #fff; }
  .site-header, .site-footer, .skip-link, .cv-actions, .filters, .atlas, .figure-section { display: none !important; }
  .wrap { max-width: none; padding-inline: 0; }
  .page-head, .cv-section, .year-group { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .page-head { padding: 0 0 1rem; }
  .page-head h1 { font-size: 24pt; }
  .page-head .kicker { display: none; }
  .cv-section { padding-block: 1rem 1.25rem; }
  .entry { grid-template-columns: 9.5rem minmax(0, 1fr); padding: .5rem 0; }
  .cv-section, .entry { break-inside: avoid; }
  .section__label, .cv-section > h2, .year-group__year { position: static !important; }
  a { text-decoration: none; }
  .links a[href^="http"]::after, .arrow::after { content: ""; }
}

/* Without JavaScript there is no atlas to draw, so leave the hero as text. */
html:not(.js) .atlas { display: none; }
