/* ==========================================================================
   Abdul Muntakim Rafi — personal site
   Same design language as bsri-bd.github.io: bottle green as ink, vermilion
   spent only on actions, neutrals biased green.
   Type: Newsreader / Public Sans / IBM Plex Mono.
   ========================================================================== */

/* --- Tokens: light is the base; both dark states redefine only tokens ----- */
:root {
  --paper:        #FAFBF8;
  --surface:      #FFFFFF;
  --sunk:         #F1F5F0;
  --ink:          #131E19;
  --ink-2:        #3D4E47;
  --ink-3:        #6B7C74;
  --rule:         #D9E1DB;
  --rule-strong:  #B7C5BD;
  --green:        #0A5C43;
  --green-deep:   #063B2C;
  --green-soft:   #E3EFE8;
  --flame:        #C8402C;
  --flame-ink:    #FFFFFF;
  --flame-soft:   #FBE9E5;
  --focus:        #0A5C43;

  --font-display: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --font-body:    "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 34rem;
  --page-max: 74rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);

  --step-0:  1.0625rem;
  --step-1:  1.1875rem;
  --step-2:  1.4rem;
  --step-3:  1.75rem;
  --step-4:  2.25rem;
  --step-5:  clamp(2.4rem, 1.5rem + 3.6vw, 4rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:       #0A120F;
    --surface:     #101A16;
    --sunk:        #16221D;
    --ink:         #E6EDE8;
    --ink-2:       #AEBEB6;
    --ink-3:       #7E8F87;
    --rule:        #23322B;
    --rule-strong: #35473E;
    --green:       #4FB08A;
    --green-deep:  #2E7A5D;
    --green-soft:  #15251E;
    --flame:       #EC8068;
    --flame-ink:   #1A0D09;
    --flame-soft:  #291611;
    --focus:       #4FB08A;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:       #0A120F;
  --surface:     #101A16;
  --sunk:        #16221D;
  --ink:         #E6EDE8;
  --ink-2:       #AEBEB6;
  --ink-3:       #7E8F87;
  --rule:        #23322B;
  --rule-strong: #35473E;
  --green:       #4FB08A;
  --green-deep:  #2E7A5D;
  --green-soft:  #15251E;
  --flame:       #EC8068;
  --flame-ink:   #1A0D09;
  --flame-soft:  #291611;
  --focus:       #4FB08A;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html { background: var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  text-wrap: balance;
  letter-spacing: -0.012em;
  margin: 0;
}

p { margin: 0; }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

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

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--green); color: #fff; padding: .7rem 1rem; z-index: 100;
}
.skip:focus { left: 0; }

/* --- Shared type utilities ---------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.lede {
  font-size: var(--step-2);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: var(--measure);
  font-weight: 300;
}

.prose { max-width: var(--measure); display: flex; flex-direction: column; gap: 1.1em; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose--wide { max-width: 46rem; }

/* --- Header ------------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.1rem;
  min-height: 4rem;
  padding-block: .6rem;
}

.brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; color: var(--ink); flex: 0 1 auto; min-width: 0; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 1.25rem; flex: 0 0 auto; }
.nav a {
  font-size: .875rem;
  white-space: nowrap;
  color: var(--ink-2);
  text-decoration: none;
  padding-block: .25rem;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--green); border-bottom-color: var(--green); }
.nav a.is-current { color: var(--green); border-bottom-color: var(--green); }

/* Below the breakpoint the nav becomes a panel under the bar, opened by the
   menu button. Without this there is no navigation on a phone at all. */
.nav-toggle { display: none; }

@media (max-width: 62rem) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--rule);
    border-radius: 6px;
    cursor: pointer;
  }
  .nav-toggle:hover { color: var(--green); border-color: var(--green); }
  .nav-toggle svg { width: 1.35rem; height: 1.35rem; max-width: none; }
  .nav-toggle__x { display: none; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { display: none; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__x { display: block; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .35rem var(--gutter) 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 12px 24px -18px rgba(0,0,0,.5);
  }
  .nav.is-open { display: flex; }
  .nav a {
    padding-block: .85rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--rule);
  }
  .nav a:last-child { border-bottom: 0; }
  .nav a:hover { border-bottom-color: var(--rule); }
  .nav a.is-current { color: var(--green); border-bottom-color: var(--rule); }
}

.theme-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .35rem .75rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--green); border-color: var(--green); }
.theme-toggle__icon { display: none; }

.masthead__end { display: flex; align-items: center; gap: .85rem; flex: 0 0 auto; }

.masthead__social {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding-right: .95rem;
  border-right: 1px solid var(--rule);
  flex: 0 0 auto;
}
.masthead__social a {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--ink-2);
  border-radius: 4px;
  transition: color .15s ease;
}
.masthead__social a:hover { color: var(--green); }
/* The global `svg { max-width: 100% }` would let a squeezed flex parent
   collapse these to a dot, so they opt out of it and refuse to shrink. */
.masthead__icon {
  width: 1.35rem;
  height: 1.35rem;
  max-width: none;
  flex: 0 0 auto;
  display: block;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  padding: .72rem 1.2rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--flame); color: var(--flame-ink); }
.btn--primary:hover { background: var(--ink); color: var(--paper); }
.btn--ghost { border-color: var(--rule-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* --- Sections ----------------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 7vw, 6rem); border-top: 1px solid var(--rule); }
.section--plain { border-top: 0; }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section--sunk { background: var(--green-soft); }

.section__head {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  margin-bottom: 2.75rem;
  max-width: 46rem;
}
.section__head h2 { font-size: var(--step-4); }

/* Page-opening headline: same scale as a section h2, since there is no hero */
.section--plain .section__head h1 {
  font-size: var(--step-4);
  font-weight: 500;
  letter-spacing: -0.012em;
}

/* --- Hero: the claim on the left, the person and the facts on the right -- */
.hero { padding-block: clamp(3rem, 6vw, 5.5rem) clamp(3rem, 6vw, 5rem); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: start;
}
@media (max-width: 62rem) { .hero__grid { grid-template-columns: 1fr; } }

.hero__thesis { display: flex; flex-direction: column; gap: 1.5rem; }

.hero h1 {
  font-size: var(--step-5);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.06;
}
.hero h1 em { font-style: italic; color: var(--green); }

.hero__mission {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .4rem; }

.hero__note {
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.6;
  color: var(--ink-3);
  letter-spacing: .01em;
}

.hero__aside { display: flex; flex-direction: column; gap: 1.6rem; }

.portrait {
  width: min(17rem, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--sunk);
  border: 1px solid var(--rule);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* --- Status note: says what is currently open, next to the claim --------- */
.status {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  max-width: 34rem;
  margin: 0;
  padding: .75rem .95rem;
  background: var(--sunk);
  border-left: 3px solid var(--green);
  font-size: .88rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.status strong { color: var(--ink); font-weight: 600; }
.status__dot {
  width: .5rem;
  height: .5rem;
  margin-top: .48rem;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
}


/* An icon sitting on the baseline inside running text. */
.inlineicon {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: -0.16em;
  margin-left: .1em;
}
.status--wide { max-width: 46rem; margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* --- Facts rail --------------------------------------------------------- */
.facts { display: flex; flex-direction: column; border-top: 1px solid var(--rule-strong); margin: 0; }
.fact {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: .8rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
@media (max-width: 26rem) { .fact { grid-template-columns: 1fr; gap: .2rem; } }
.fact dt {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.fact dd { margin: 0; font-size: .92rem; line-height: 1.5; color: var(--ink); }

/* --- The field index: the span of the work, shown rather than claimed ---- */
.fieldindex {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 1.5rem 1.6rem 1.7rem;
}
.fieldindex__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.fieldindex__count {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--green);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.fieldindex__list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3;
  column-gap: 1.6rem;
}
@media (max-width: 52rem) { .fieldindex__list { columns: 2; } }
@media (max-width: 30rem) { .fieldindex__list { columns: 1; } }
.fieldindex__list li {
  font-family: var(--font-mono);
  font-size: .74rem;
  line-height: 1.5;
  color: var(--ink-2);
  padding-block: .3rem;
  break-inside: avoid;
  border-bottom: 1px solid var(--rule);
}

/* --- Themes: a set, not a sequence — no numbering ----------------------- */
.themes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
@media (max-width: 48rem) { .themes { grid-template-columns: 1fr; } }

.theme {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.9rem 1.8rem 2.1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.theme h3 { font-size: var(--step-2); }
.theme p { color: var(--ink-2); font-size: .95rem; line-height: 1.6; }

/* --- A link to another page reads as a destination, not a content card --- */
.cardlink {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--green);
  background: var(--surface);
  padding: 1.1rem 1.3rem;
  transition: border-color .15s ease, background-color .15s ease;
}
.cardlink + .cardlink { margin-top: -1px; }
.cardlink:hover { background: var(--green-soft); border-color: var(--rule-strong); border-left-color: var(--green); }
.cardlink__label {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--green);
  flex: 0 0 auto;
  min-width: 9rem;
}
.cardlink__text { flex: 1; font-size: .95rem; color: var(--ink-2); }
.cardlink__arrow { color: var(--green); font-size: 1.1rem; flex: 0 0 auto; }
@media (max-width: 34rem) {
  .cardlink { flex-direction: column; align-items: flex-start; gap: .35rem; }
  .cardlink__arrow { display: none; }
}

/* --- Pills -------------------------------------------------------------- */
.pill {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  padding: .28rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill--muted { background: var(--sunk); color: var(--ink-3); border: 1px solid var(--rule); }
.pill--live { background: var(--flame-soft); color: var(--flame); border: 1px solid var(--flame); }
.pill--green { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }

/* --- Publications --------------------------------------------------------
   A dated record, so the year is the structural device and the title leads.
   Authors sit under it in body type; the venue is the only italic. */
.pubs {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule-strong);
}

.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: .2rem 1.75rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 40rem) { .pub { grid-template-columns: 1fr; gap: .45rem; } }

.pub__year {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  padding-top: .3rem;
}
@media (max-width: 40rem) { .pub__year { padding-top: 0; } }

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

.pub__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  max-width: 46rem;
}
.pub__title a { color: var(--ink); text-decoration: none; }
.pub__title a:hover { color: var(--green); text-decoration: underline; text-underline-offset: .16em; }

.pub__authors {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 50rem;
}
.pub__authors strong { color: var(--ink); font-weight: 600; }
.pub__authors sup { font-size: .72em; }

.pub__venue {
  font-family: var(--font-display);
  font-style: italic;
  font-size: .98rem;
  color: var(--ink-2);
}

.pub__links { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .2rem; }
.pub__link {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 1px;
}
.pub__link:hover { color: var(--ink); border-bottom-color: var(--green); }

.legend {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--ink-3);
  margin-top: 1.5rem;
}

/* A group heading inside a long list, so the list keeps one rule system */
.grouplabel {
  padding-block: 1.6rem .7rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.pubs > .grouplabel:first-child { padding-top: 1.1rem; }

/* --- Talks and posters ---------------------------------------------------
   One entry per occasion, so the venue leads. The mark is a typographic tile
   standing in for a logo, in the same idiom as the rest of the page. */
.talks { display: flex; flex-direction: column; border-top: 1px solid var(--rule-strong); }

.talkcard {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  gap: 0 1.15rem;
  align-items: start;
  padding-block: 1.15rem;
  border-bottom: 1px solid var(--rule);
}

.talkcard__mark--logo { background: var(--surface); padding: .3rem; }
.talkcard__logo { width: 100%; height: 100%; object-fit: contain; display: block; }

.talkcard__mark {
  width: 3.4rem;
  height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--green-soft);
  font-family: var(--font-display);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--green);
  flex: 0 0 auto;
}

.talkcard__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }

.talkcard__venue {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  color: var(--ink);
}
.talkcard__place { font-size: .85rem; line-height: 1.5; color: var(--ink-2); }
.talkcard__topic { font-size: .82rem; line-height: 1.55; color: var(--ink-3); max-width: 44rem; }

.talkcard__when {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: .2rem;
}

@media (max-width: 40rem) {
  .talkcard { grid-template-columns: 2.8rem minmax(0, 1fr); }
  .talkcard__mark { width: 2.8rem; height: 2.8rem; font-size: .72rem; }
  .talkcard__when { grid-column: 2; justify-content: flex-start; padding-top: .45rem; }
}

/* --- A labelled record: name on the left, detail on the right ------------ */
.records { display: flex; flex-direction: column; border-top: 1px solid var(--rule-strong); }
.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  gap: .35rem 2rem;
  padding-block: 1.3rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
@media (max-width: 46rem) { .record { grid-template-columns: 1fr; gap: .3rem; } }

.record__main { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.record__name {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}
.record__where { font-size: .88rem; line-height: 1.5; color: var(--ink-2); }
.record__note { font-size: .9rem; line-height: 1.6; color: var(--ink-2); max-width: 46rem; }
.record__when {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 46rem) { .record__when { text-align: left; order: -1; } }

.record__links { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .15rem; }
.record__links:empty { display: none; }

/* A flat list of courses or items under a record */
.itemlist { list-style: none; margin: .45rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.itemlist li {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .05em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .26rem .5rem;
  background: var(--surface);
}
.itemlist a { color: inherit; text-decoration: none; }
.itemlist li:hover { border-color: var(--rule-strong); }
.itemlist a:hover { color: var(--green); }

/* --- Funded projects: each grant is its own object ----------------------- */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
@media (max-width: 52rem) { .projects { grid-template-columns: 1fr; } }

.project {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.6rem 1.7rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.project__head { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.project__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  flex: 1 1 14rem;
}
/* A project card carries prose and a link rather than a metadata table */
.project__text { font-size: .92rem; line-height: 1.65; color: var(--ink-2); }
.project__links { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: auto; padding-top: .3rem; }
.project__links:empty { display: none; }

/* --- Figures: a small count, read as a number ---------------------------- */
.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin: 0 0 clamp(2.5rem, 5vw, 3.5rem);
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule);
}
.figure { display: flex; flex-direction: column-reverse; gap: .1rem; }
.figure dt {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.figure dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* --- A plain two-column reference list (reviewing, memberships) ---------- */
.reflist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); max-width: 52rem; }
.reflist li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: .7rem;
  border-bottom: 1px solid var(--rule);
  font-size: .92rem;
  color: var(--ink);
}
.reflist li span:last-child {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .06em;
  color: var(--ink-3);
  white-space: nowrap;
  text-align: right;
}

.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
@media (max-width: 52rem) { .cols { grid-template-columns: 1fr; } }

.subhead {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .9rem;
}

/* --- Downloads ---------------------------------------------------------- */
.downloads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
@media (max-width: 48rem) { .downloads { grid-template-columns: 1fr; } }

.download {
  background: var(--paper);
  padding: 1.7rem 1.7rem 1.9rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  align-items: flex-start;
  text-decoration: none;
  color: var(--ink);
  border-left: 3px solid transparent;
  transition: background-color .15s ease, border-left-color .15s ease;
}
.download:hover { background: var(--sunk); border-left-color: var(--green); }
.download__name { font-family: var(--font-display); font-size: var(--step-2); font-weight: 500; line-height: 1.2; }
.download__text { font-size: .92rem; line-height: 1.6; color: var(--ink-2); }
.download__meta {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green);
  margin-top: .2rem;
}

/* --- Footer ------------------------------------------------------------- */
.footer { border-top: 1px solid var(--rule); padding-block: 2.75rem 3.5rem; }
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}
.footer p, .footer a { font-size: .82rem; color: var(--ink-3); }
.footer__name {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
}
.footer__links { display: flex; flex-wrap: wrap; gap: 1.25rem; max-width: 34rem; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--green); }

.social { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: .9rem; }
.social__link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--ink-3);
  text-decoration: none;
}
.social__link:hover { color: var(--green); }
.social__icon { width: 1.05em; height: 1.05em; flex: 0 0 auto; }

/* --- Mobile control sizing ----------------------------------------------
   Must come after the base .theme-toggle / .masthead__social rules: at equal
   specificity the later declaration wins, and an earlier media query loses. */
@media (max-width: 62rem) {
  .theme-toggle {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .theme-toggle__label { display: none; }
  .theme-toggle__icon { display: block; width: 1.3rem; height: 1.3rem; max-width: none; }

  .masthead__social { gap: .6rem; padding-right: .75rem; }
  .masthead__end { gap: .55rem; }
}

@media (max-width: 34rem) {
  .masthead__social { display: none; }
}
