/*
 * Site styles for every layout (default, home, archive, single).
 * Dark "night" palette by default; [data-theme="light"] swaps to "paper".
 */

@font-face {
  font-family: "fa-brands";
  src: url("../webfonts/fa-brands-400.woff2") format("woff2");
  font-display: block;
}

@font-face {
  font-family: "academicons";
  src: url("../fonts/academicons.woff") format("woff");
  font-display: block;
}

@font-face {
  font-family: "fa-solid";
  src: url("../webfonts/fa-solid-900.woff2") format("woff2");
  font-weight: 900;
  font-display: block;
}

:root {
  --bg: #0c1016;
  --ink: #edf0f4;
  --muted: #939ba6;
  --line: #252b34;
  --line-strong: #3f4753;
  --panel: #131821;
  --accent: #a2c3e2;
  --hero-bg: #0a0d12;
  --hero-ink: #f2f4f7;

  /* one grade for every photo so they sit in the palette instead of looking pasted in */
  --grade: saturate(0.78) contrast(1.03) brightness(0.97);
  --grade-hover: saturate(0.9) contrast(1.02) brightness(1);
  --grade-tint: rgba(70, 112, 165, 0.16);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");

  --font-sans: "Helvetica Neue", Helvetica, "Inter Tight", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1280px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #edf0f4;
  --ink: #11151b;
  --muted: #5b6472;
  --line: #d1d7df;
  --line-strong: #a7b0bc;
  --panel: #e2e7ee;
  --accent: #2e5d86;

  color-scheme: light;
}

/* ---------- base ---------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* keep the scrollbar's space when the menu locks scrolling, so the bar doesn't shift */
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

body.menu-open {
  overflow: hidden;
}

/* short pages keep the footer at the bottom of the viewport */
main {
  flex: 1 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

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

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.accent {
  color: var(--accent);
}

.dot {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* ---------- icons (Font Awesome + Academicons glyphs from assets/) ---------- */

.ico {
  display: inline-block;
  font-style: normal;
  font-size: 15px;
  line-height: 1;
}

.ico--gh::before {
  font-family: "fa-brands";
  content: "\f09b";
}

.ico--in::before {
  font-family: "fa-brands";
  content: "\f0e1";
}

.ico--mail::before {
  font-family: "fa-solid";
  font-weight: 900;
  content: "\f0e0";
}

.ico--scholar::before {
  font-family: "academicons";
  content: "\e9d4";
}

.ico--doc::before {
  font-family: "fa-solid";
  font-weight: 900;
  content: "\f15c";
}

/* ---------- buttons & chips ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--btn-line, var(--line-strong));
  background: var(--btn-bg, color-mix(in srgb, var(--bg) 72%, transparent));
  color: inherit;
  font: 400 13px/1 var(--font-sans);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.btn:hover {
  border-color: currentColor;
}

.btn--icon {
  width: 34px;
  padding: 0;
  justify-content: center;
}

.btn--solid {
  height: 42px;
  padding: 0 18px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.btn--solid:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.burger {
  position: relative;
  width: 12px;
  height: 7px;
}

.burger::before,
.burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: top 0.4s var(--ease), transform 0.4s var(--ease);
}

.burger::before {
  top: 0;
}

.burger::after {
  top: 6px;
}

[aria-expanded="true"] > .burger::before {
  top: 3px;
  transform: rotate(45deg);
}

[aria-expanded="true"] > .burger::after {
  top: 3px;
  transform: rotate(-45deg);
}

/* both words share one cell, so the button keeps its width while they swap */
.btn__swap {
  display: inline-grid;
  overflow: hidden;
  height: 1.25em;
  line-height: 1.25em;
}

.btn__swap > span {
  grid-area: 1 / 1;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}

.btn__swap > span:last-child {
  opacity: 0;
  transform: translateY(100%);
}

[aria-expanded="true"] .btn__swap > span:first-child {
  opacity: 0;
  transform: translateY(-100%);
}

[aria-expanded="true"] .btn__swap > span:last-child {
  opacity: 1;
  transform: none;
}

.theme-glyph {
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform 0.5s var(--ease);
}

[data-theme="light"] .theme-glyph {
  transform: rotate(180deg);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  font: 400 12px/1 var(--font-mono);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------- top bar ---------- */

.bar {
  --btn-line: rgba(242, 244, 247, 0.34);
  --btn-bg: rgba(9, 13, 18, 0.32);

  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
  padding-inline: var(--gutter);
  color: var(--hero-ink);
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease), color 0.35s var(--ease);
}

.is-scrolled .bar {
  --btn-line: var(--line-strong);
  --btn-bg: transparent;

  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.bar__left {
  position: relative;
  min-width: 0;
  flex: 1;
  height: 20px;
}

.bar__name,
.bar__status {
  position: absolute;
  inset: 0 auto auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 20px;
  white-space: nowrap;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.bar__name {
  font-size: 15px;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.is-scrolled .bar__name {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.is-scrolled .bar__status {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.bar__status {
  overflow: hidden;
  max-width: 100%;
  font-size: 12.5px;
}

.bar__status .sep {
  opacity: 0.45;
}

.bar__status a {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar__status a:hover {
  color: var(--accent);
}

.bar__crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 20px;
  overflow: hidden;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.bar__crumbs .sep {
  opacity: 0.4;
}

.bar__crumbs a:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.bar__crumbs a:hover,
.bar__crumbs a:last-child:hover {
  color: var(--accent);
}

.bar__actions {
  display: flex;
  flex: none;
  gap: 6px;
}

/* ---------- menu overlay ---------- */

/* sits under the bar (z 40) so the bar's menu button can act as close */
.menu {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 68px;
  background: var(--bg);
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), visibility 0s linear 0.45s;
}

.menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), visibility 0s;
}

.menu__label {
  max-width: none;
  padding-top: clamp(20px, 4vh, 40px);
}

.menu.is-open .menu__list a {
  animation: menu-item-in 0.7s var(--ease) backwards;
  animation-delay: calc(0.08s + var(--i) * 50ms);
}

@keyframes menu-item-in {
  from {
    opacity: 0;
    transform: translateY(0.35em);
  }
}

/* while the menu is open the bar becomes part of it */
.menu-open .bar {
  --btn-line: var(--line-strong);
  --btn-bg: transparent;

  color: var(--ink);
  background: var(--bg);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.menu-open .bar__name {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.menu-open .bar__status {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.menu__list {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding-block: clamp(24px, 6vh, 72px);
}

.menu__list a {
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 2vw, 28px);
  padding-block: 0.06em;
  font-size: clamp(48px, 9vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.055em;
  transition: color 0.25s var(--ease), transform 0.4s var(--ease);
}

.menu__list a .mono {
  min-width: 2.5em;
  color: var(--muted);
  letter-spacing: 0;
}

.menu__list a:hover {
  color: var(--accent);
  transform: translateX(8px);
}

.menu__pages {
  max-width: none;
  margin-top: auto;
}

.menu__pages ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding-block: 14px 28px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.menu__pages a:hover {
  color: var(--accent);
}

.menu__sys {
  max-width: none;
  padding-bottom: 24px;
}

/* ---------- right rail + resume tab ---------- */

.rail {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateY(-50%);
}

.rail a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: -1px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--ink);
  font-size: 15px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.rail a:hover {
  color: var(--bg);
  background: var(--accent);
}

.tab {
  position: fixed;
  right: 0;
  bottom: 18px;
  z-index: 30;
  padding: 14px 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  letter-spacing: 0.02em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: background-color 0.25s var(--ease), padding 0.3s var(--ease);
}

.tab:hover {
  background: var(--accent);
  padding-bottom: 18px;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--hero-bg);
  color: var(--hero-ink);
  isolation: isolate;
}

.hero__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 40%;
  /* the source is small (500px), so soften it a touch and let the grain carry the texture */
  filter: grayscale(0.85) contrast(1.08) brightness(0.62) blur(0.4px);
  transform: scale(1.06);
  animation: hero-settle 2.4s var(--ease) both;
}

@keyframes hero-settle {
  from {
    opacity: 0;
    transform: scale(1.12);
  }
}

.hero__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(9, 13, 18, 0.62) 0%, rgba(9, 13, 18, 0) 26%, rgba(9, 13, 18, 0) 48%, rgba(9, 13, 18, 0.9) 100%),
    var(--grain);
}

/* same cool wash the other photos get */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grade-tint);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.hero__inner {
  max-width: none;
}

.hero__mark {
  margin-left: -0.055em;
  font-size: clamp(92px, 23.5vw, 400px);
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: -0.072em;
  white-space: nowrap;
}

/* each letter rises on its own, 70ms apart */
.hero__letters > span {
  display: inline-block;
  animation: letter-rise 1s var(--ease) both;
  animation-delay: calc(0.25s + var(--i) * 70ms);
}

@keyframes letter-rise {
  from {
    opacity: 0;
    transform: translateY(0.42em);
  }
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  margin-top: clamp(18px, 2.4vw, 32px);
  padding-block: 14px 22px;
  border-top: 1px solid rgba(242, 244, 247, 0.22);
  color: rgba(242, 244, 247, 0.78);
  animation: fade 1.2s 0.6s var(--ease) both;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.hero__clock:not(:empty)::before {
  content: "· ";
}

/* ---------- sections ---------- */

.sec {
  padding-top: clamp(96px, 13vw, 184px);
}

.sec--last {
  padding-bottom: clamp(96px, 12vw, 160px);
}

.sec-head {
  /* the dashes and the note sit a little below the middle of the big lowercase word */
  --head-size: clamp(54px, 10vw, 136px);
  --head-drop: calc(var(--head-size) * 0.12);

  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
  margin-bottom: clamp(40px, 6vw, 80px);
  font-size: var(--head-size);
}

.sec-head h1,
.sec-head h2 {
  flex: 0 1 auto;
  min-width: 0;
  padding-bottom: 0.06em;
  font-size: 1em;
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.058em;
}

.sec-head__dash,
.sec-head__rule {
  height: max(2px, 0.022em);
  margin-top: var(--head-drop);
  background: repeating-linear-gradient(90deg, var(--accent) 0 0.11em, transparent 0.11em 0.19em);
  transform-origin: left center;
  transition: transform 1.1s 0.2s var(--ease);
}

.sec-head__dash {
  flex: none;
  width: 0.22em;
  background: var(--accent);
}

.sec-head__rule {
  flex: 1;
  min-width: 24px;
}

.sec-head__note {
  flex: none;
  margin-top: var(--head-drop);
  font-size: 12px;
  color: var(--muted);
}

.tag {
  color: var(--accent);
}

.label-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 400 12px/1.5 var(--font-mono);
  color: var(--muted);
}

.label-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.footnote {
  margin-top: 22px;
}

.footnote a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.footnote a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.big {
  font-size: clamp(34px, 5.1vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.048em;
  text-wrap: balance;
}

/* Shared 12-col grid so every row lines up: label in cols 1–3, content from col 4. */
.who,
.feature,
.pub,
.job summary,
.job__body,
.note-row,
.cv-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

.who > :first-child,
.feature > :first-child,
.pub > :first-child {
  grid-column: 1 / 4;
}

.who > :nth-child(2),
.feature > :nth-child(2),
.pub > :nth-child(2) {
  grid-column: 4 / -1;
}

/* ---------- about ---------- */

.who {
  row-gap: 32px;
}

.who .tag {
  padding-top: 0.5em;
}

.who__side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- photos (shared grade) ---------- */

.photo {
  margin: 0;
}

.photo__frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  isolation: isolate;
}

.photo__frame img {
  width: 100%;
  height: auto;
  filter: var(--grade);
  transform: scale(1.03);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.6s var(--ease);
}

.photo__frame::before,
.photo__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.photo__frame::before {
  z-index: 1;
  background: var(--grade-tint);
  mix-blend-mode: soft-light;
}

.photo__frame::after {
  z-index: 2;
  background: var(--grain);
  opacity: 0.14;
  mix-blend-mode: overlay;
}

.is-in .photo__frame img,
.no-js .photo__frame img {
  transform: none;
}

/* hover: the frame stays put, the picture slowly zooms inside it */
.photo:hover .photo__frame img {
  filter: var(--grade-hover);
  transform: scale(1.035);
}

.photo__caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}

.photo__caption .sep {
  color: var(--line-strong);
}

/* about: portrait under the "who" label */
.portrait {
  max-width: 300px;
}

.portrait img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 22%;
}

.who__body {
  max-width: 60ch;
  margin-top: clamp(28px, 3.4vw, 44px);
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
}

.who__body p + p {
  margin-top: 1em;
}

.who__body strong {
  font-weight: 500;
  color: var(--ink);
}

.facts {
  grid-column: 4 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 var(--gutter);
  border-top: 1px solid var(--line);
}

.facts div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-block: 16px;
}

.facts dt {
  color: var(--accent);
}

/* ---------- research ---------- */

.feature {
  padding-block: 8px clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--line);
}

.feature--cover {
  align-items: start;
}

.feature--cover > .cover {
  grid-column: 1 / 6;
}

.feature--cover > .feature__main {
  grid-column: 6 / -1;
}

.feature--cover .feature__meta {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 22px;
  padding-top: 0;
}

.feature--cover .feature__meta .accent {
  margin-bottom: 0;
}

.feature--cover .feature__title {
  max-width: 18ch;
  font-size: clamp(30px, 3.8vw, 56px);
}

.cover {
  max-width: 560px;
}

.cover img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 32%;
}

.feature__meta,
.pub__when {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 0.45em;
}

.feature__meta .accent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.feature__title {
  max-width: 20ch;
  font-size: clamp(32px, 4.8vw, 66px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.046em;
  text-wrap: balance;
}

.feature__title a,
.pub__title a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.5s var(--ease), color 0.25s var(--ease);
}

.feature__title a:hover,
.pub__title a:hover {
  background-size: 100% 1px;
}

.authors {
  max-width: 72ch;
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.authors b {
  font-weight: 500;
  color: var(--ink);
}

.feature__excerpt {
  max-width: 60ch;
  margin-top: 22px;
  font-size: 17px;
  line-height: 1.55;
}

.feature .links {
  margin-top: 30px;
}

.pub {
  padding-block: clamp(26px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
}

.pub__title {
  max-width: 44ch;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.026em;
}

.pub .authors {
  margin-top: 10px;
}

.pub .links {
  margin-top: 18px;
}

/* ---------- work ---------- */

.jobs {
  border-top: 1px solid var(--line);
}

.job {
  border-bottom: 1px solid var(--line);
}

.job summary {
  align-items: baseline;
  padding-block: 24px;
  cursor: pointer;
  list-style: none;
  transition: color 0.25s var(--ease);
}

.job summary::-webkit-details-marker {
  display: none;
}

.job__when {
  grid-column: 1 / 4;
}

.job__what {
  grid-column: 4 / 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job__where {
  grid-column: 10 / 12;
}

.job__role {
  font-size: clamp(19px, 1.9vw, 25px);
  line-height: 1.15;
  letter-spacing: -0.026em;
}

.job__org {
  color: var(--muted);
  transition: color 0.25s var(--ease);
}

.job__toggle {
  grid-column: 12 / 13;
  position: relative;
  align-self: center;
  width: 12px;
  height: 12px;
  justify-self: end;
}

.job__toggle::before,
.job__toggle::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: currentColor;
  transition: transform 0.35s var(--ease);
}

.job__toggle::after {
  transform: rotate(90deg);
}

.job[open] .job__toggle::after {
  transform: rotate(0deg);
}

.job summary:hover .job__org,
.job[open] .job__org {
  color: var(--accent);
}

.job__body {
  row-gap: 10px;
  padding-bottom: 28px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.job__body li {
  grid-column: 4 / 12;
  position: relative;
  max-width: 72ch;
  padding-left: 22px;
}

.job__body li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--line-strong);
}

.job[open] .job__body {
  animation: fade 0.5s var(--ease);
}

/* ---------- projects & writing ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 14px;
}

.tiles--links {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.tile:hover {
  border-color: var(--ink);
  background: var(--panel);
}

.tile__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.tile__arrow {
  font-size: 16px;
  color: var(--ink);
  transition: transform 0.35s var(--ease), color 0.25s var(--ease);
}

.tile:hover .tile__arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

.tile__bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile__name {
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.tile__sub {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.tiles--links {
  margin-top: clamp(48px, 6vw, 80px);
}

.tile--link {
  min-height: 136px;
  gap: 28px;
}

.tile--link .tile__top {
  color: var(--ink);
}

.tile--link .tile__sub {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.notes {
  margin-top: clamp(56px, 7vw, 96px);
}

.note-list {
  margin-top: 10px;
}

.note-row {
  align-items: baseline;
  padding-block: 18px;
  border-bottom: 1px solid var(--line);
}

.note-row > .mono:first-child {
  grid-column: 1 / 4;
}

.note-row__title {
  grid-column: 4 / 12;
  font-size: clamp(18px, 1.7vw, 22px);
  letter-spacing: -0.02em;
  transition: color 0.25s var(--ease);
}

.note-row__go {
  grid-column: 12 / 13;
  justify-self: end;
  white-space: nowrap;
  color: var(--muted);
  transition: color 0.25s var(--ease), transform 0.35s var(--ease);
}

.note-row:hover .note-row__title,
.note-row:hover .note-row__go {
  color: var(--accent);
}

.note-row:hover .note-row__go {
  transform: translateX(4px);
}

/* ---------- inner pages: list pages (research, projects, writing, cv) ---------- */

.page-head {
  padding-top: calc(68px + clamp(56px, 9vw, 128px));
}

.page-head .sec-head {
  margin-bottom: 0;
}

.page-lead {
  max-width: 34ch;
  margin-top: clamp(28px, 4vw, 48px);
  margin-left: calc((100% - 11 * var(--gutter)) / 12 * 3 + 3 * var(--gutter));
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.archive {
  padding-block: clamp(48px, 6vw, 80px) clamp(96px, 12vw, 160px);
}

.group + .group {
  margin-top: clamp(56px, 7vw, 96px);
}

.group .pubs,
.group .cv-list {
  margin-top: 10px;
}

.cv-actions {
  margin-bottom: clamp(48px, 6vw, 80px);
}

.cv-row {
  align-items: baseline;
  padding-block: clamp(22px, 2.6vw, 30px);
  border-bottom: 1px solid var(--line);
}

.cv-row__when {
  grid-column: 1 / 4;
}

.cv-row__what {
  grid-column: 4 / 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cv-row__where {
  grid-column: 10 / -1;
}

.cv-row__title {
  font-size: clamp(19px, 1.9vw, 25px);
  line-height: 1.15;
  letter-spacing: -0.026em;
}

.cv-row__sub {
  color: var(--muted);
}

.bullets {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.bullets li {
  position: relative;
  max-width: 72ch;
  padding-left: 22px;
}

.bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--line-strong);
}

/* Template includes still used by sample pages (archive-single.html etc.). */
.archive h2 {
  margin-top: 56px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font: 400 12px/1.5 var(--font-mono);
  color: var(--muted);
}

.archive hr {
  display: none;
}

.archive .list__item {
  padding-block: 22px;
  border-bottom: 1px solid var(--line);
}

.archive .archive__item-title {
  margin: 0;
  padding: 0;
  border: 0;
  font: 400 clamp(20px, 2vw, 26px) / 1.15 var(--font-sans);
  letter-spacing: -0.026em;
  color: var(--ink);
}

.archive .archive__item-title a:hover {
  color: var(--accent);
}

.archive .archive__item p {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.archive .page__date,
.archive .page__meta {
  font: 400 12px/1.5 var(--font-mono);
}

/* ---------- inner pages: articles (papers, posts, projects) ---------- */

.article {
  padding-bottom: clamp(96px, 12vw, 160px);
}

.article__head {
  padding-top: calc(68px + clamp(56px, 9vw, 120px));
  padding-bottom: clamp(40px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: clamp(20px, 2.6vw, 32px);
}

.article__meta .accent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.article__title {
  max-width: 22ch;
  font-size: clamp(36px, 5.4vw, 76px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.048em;
  text-wrap: balance;
}

.article__head .authors {
  margin-top: 22px;
  font-size: 15px;
}

.article__head .links {
  margin-top: 28px;
}

.article__body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding-top: clamp(40px, 5vw, 72px);
}

.article__side {
  grid-column: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.article__cover {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
}

.article__body .prose {
  grid-column: 4 / 11;
}

.cite {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  margin-top: clamp(56px, 7vw, 96px);
}

.cite .label-rule {
  grid-column: 1 / -1;
}

.cite__text {
  grid-column: 4 / 11;
  margin-top: 18px;
  font: 400 13px/1.7 var(--font-mono);
  color: var(--muted);
}

.cite__text i {
  font-style: normal;
  color: var(--ink);
}

.article__nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(56px, 7vw, 96px);
}

.article__step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.article__step--next {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}

.article__step:hover {
  border-color: var(--ink);
  background: var(--panel);
}

.article__step-title {
  margin-top: auto;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.article__back {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 10px;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.article__back:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- prose (markdown content) ---------- */

.prose {
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.68;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3,
.prose h4 {
  font-weight: 400;
  line-height: 1.12;
}

.prose h2 {
  margin-top: 2.2em;
  font-size: clamp(26px, 2.6vw, 34px);
  letter-spacing: -0.032em;
}

.prose h3 {
  margin-top: 1.9em;
  font-size: 22px;
  letter-spacing: -0.022em;
}

.prose h4 {
  margin-top: 1.8em;
  font: 400 12px/1.5 var(--font-mono);
  color: var(--accent);
}

.prose > :first-child {
  margin-top: 0;
}

.prose strong {
  font-weight: 500;
}

.prose a:not(.btn) {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.25s var(--ease);
}

.prose a:not(.btn):hover {
  color: var(--accent);
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-top: 0.45em;
}

.prose li::marker {
  color: var(--muted);
}

.prose blockquote {
  margin: 1.6em 0 0;
  padding-left: 20px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.prose code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.84em;
}

.prose pre {
  overflow-x: auto;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose img {
  height: auto;
  border: 1px solid var(--line);
}

.prose hr {
  margin-block: 2.4em;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.prose th {
  font: 400 12px/1.5 var(--font-mono);
  color: var(--muted);
}

.prose .btn--primary {
  height: 42px;
  padding: 0 18px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.prose .btn--primary:hover {
  border-color: var(--accent);
  background: var(--accent);
}

/* ---------- photo slots: work band, projects, writing, contact ---------- */

.band {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 80px);
}

.band__photo {
  grid-column: 1 / 9;
}

.band__photo img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.stats {
  grid-column: 9 / -1;
  border-top: 1px solid var(--line);
}

.stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}

.stats dd {
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.projects--photo {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: 24px;
}

.projects--photo .tiles {
  grid-column: 1 / 9;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.projects__photo {
  grid-column: 9 / -1;
}

.projects__photo img {
  aspect-ratio: 1;
  object-fit: cover;
}

.notes--photo {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

.notes--photo .label-rule {
  grid-column: 1 / -1;
}

.notes__photo {
  grid-column: 1 / 4;
  margin-top: 24px;
}

.notes__photo img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.notes--photo .notes__list {
  grid-column: 4 / -1;
}

.notes--photo .note-row {
  grid-template-columns: minmax(0, 2fr) minmax(0, 7fr) auto;
}

.notes--photo .note-row > .mono:first-child {
  grid-column: 1;
}

.notes--photo .note-row__title {
  grid-column: 2;
}

.notes--photo .note-row__go {
  grid-column: 3;
}

/* contact sits on a full-width photo, like saesh; the section stays dark in both themes */
.sec.sec--photo {
  --bg: var(--hero-bg);
  --ink: var(--hero-ink);
  --muted: rgba(242, 244, 247, 0.72);
  --line: rgba(242, 244, 247, 0.16);
  --line-strong: rgba(242, 244, 247, 0.34);
  --panel: rgba(242, 244, 247, 0.07);
  --accent: #a2c3e2;

  position: relative;
  isolation: isolate;
  margin-top: clamp(96px, 13vw, 184px);
  padding-top: clamp(80px, 10vw, 140px);
  background: var(--hero-bg);
  color: var(--ink);
}

.sec--photo::before,
.sec--photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sec--photo::before {
  z-index: -2;
  background: var(--bg-photo) center 62% / cover no-repeat;
  filter: var(--grade);
}

.sec--photo::after {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(9, 13, 18, 0.5), rgba(9, 13, 18, 0.8)),
    var(--grain);
}

.sec__credit {
  align-items: flex-end;
  margin-top: clamp(40px, 5vw, 64px);
  text-align: right;
}

/* ---------- footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: none;
  padding-block: 22px 28px;
  border-top: 1px solid var(--line);
}

.foot a:hover {
  color: var(--accent);
}

/* ---------- scroll reveal (only when JS runs and motion is allowed) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }

  .js .sec-head[data-reveal] {
    transform: none;
  }

  .js .sec-head[data-reveal] .sec-head__dash,
  .js .sec-head[data-reveal] .sec-head__rule {
    transform: scaleX(0);
  }

  .js .sec-head[data-reveal].is-in .sec-head__dash,
  .js .sec-head[data-reveal].is-in .sec-head__rule {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .rail,
  .tab {
    display: none;
  }

  .who,
  .feature,
  .pub {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 14px;
  }

  .who > :nth-child(n),
  .feature > :nth-child(n),
  .pub > :nth-child(n) {
    grid-column: 1 / -1;
  }

  .feature__meta,
  .pub__when {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 14px;
    padding-top: 0;
  }

  .feature__meta .accent {
    margin-bottom: 0;
  }

  .job summary {
    grid-template-columns: minmax(0, 1fr) 20px;
    row-gap: 8px;
  }

  .job__when,
  .job__what,
  .job__where {
    grid-column: 1;
  }

  .job__toggle {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .job__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .job__body li {
    grid-column: 1 / -1;
  }

  .note-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
  }

  .note-row > .mono:first-child {
    grid-column: 1 / -1;
  }

  .note-row__title {
    grid-column: 1;
  }

  .note-row__go {
    grid-column: 2;
  }

  .cv-row,
  .article__body,
  .cite {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .cv-row > :nth-child(n),
  .article__body > :nth-child(n),
  .cite > :nth-child(n) {
    grid-column: 1 / -1;
  }

  .page-lead {
    margin-left: 0;
  }

  .portrait {
    max-width: 220px;
  }

  .feature--cover > .cover,
  .feature--cover > .feature__main {
    grid-column: 1 / -1;
  }

  .cover {
    max-width: 340px;
  }

  .band {
    row-gap: 20px;
  }

  .band__photo,
  .stats,
  .projects--photo .tiles,
  .notes--photo .notes__list {
    grid-column: 1 / -1;
  }

  .projects__photo {
    grid-column: 4 / -1;
  }

  .notes__photo {
    grid-column: 1 / 8;
  }

  .notes--photo .note-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .notes--photo .note-row > .mono:first-child {
    grid-column: 1 / -1;
  }

  .notes--photo .note-row__title {
    grid-column: 1;
  }

  .notes--photo .note-row__go {
    grid-column: 2;
  }

  .article__side:empty {
    display: none;
  }

  .article__side {
    margin-bottom: 24px;
  }

  .article__cover {
    max-width: 160px;
  }
}

@media (min-width: 861px) {
  /* keep the homepage footer's right edge clear of the fixed resume tab */
  body:not(.is-page) .foot {
    padding-right: calc(var(--gutter) + 40px);
  }
}

@media (max-width: 560px) {
  .bar {
    height: 60px;
  }

  .menu {
    padding-top: 60px;
  }

  .btn--hide-sm {
    display: none;
  }

  .bar__status > span:nth-child(n + 2):nth-child(-n + 5) {
    display: none;
  }

  .hero__meta {
    flex-direction: column;
  }

  .sec-head__note {
    display: none;
  }

  .tile {
    min-height: 180px;
  }

  .tiles--links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tile--link {
    min-height: 120px;
    gap: 18px;
    padding: 14px;
  }

  .tile--link .tile__name {
    font-size: 20px;
  }

  .tiles--links > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .article__nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .article__step--next {
    grid-column: 1;
  }
}
