/* ===========================================================
   Cesare M. Scartozzi — personal site
   Shared design system
   =========================================================== */

:root {
  /* Light theme (default) */
  --bg:        #f5f5f2;
  --bg-grad:   #efefe9;
  --card:      #ffffff;
  --card-2:    #fafaf8;
  --text:      #1c1e1d;
  --muted:     #6c706c;
  --faint:     #9a9e99;
  --border:    #e6e6e0;
  --border-2:  #eeeee9;
  --accent:    #1f8a5b;
  --accent-ink:#176d48;
  --accent-soft:rgba(31,138,91,0.10);
  --accent-contrast:#ffffff;
  /* non-peer-reviewed accent (warm clay) */
  --clay:      #b06a2c;
  --clay-soft: rgba(176,106,44,0.10);
  --shadow:    0 1px 2px rgba(26,30,26,0.04), 0 1px 1px rgba(26,30,26,0.03);
  --shadow-lg: 0 8px 30px rgba(26,30,26,0.08), 0 2px 6px rgba(26,30,26,0.04);
  --stripe:    rgba(28,30,29,0.05);
}

[data-theme="dark"] {
  --bg:        #111312;
  --bg-grad:   #0c0e0d;
  --card:      #191c1a;
  --card-2:    #1f2320;
  --text:      #e9ebe7;
  --muted:     #9aa09a;
  --faint:     #6b716b;
  --border:    #2a2e2b;
  --border-2:  #242824;
  --accent:    #4cc38a;
  --accent-ink:#6ad19f;
  --accent-soft:rgba(76,195,138,0.12);
  --accent-contrast:#0a0d0b;
  --clay:      #d49a5e;
  --clay-soft: rgba(212,154,94,0.14);
  --shadow:    0 1px 2px rgba(0,0,0,0.30);
  --shadow-lg: 0 10px 34px rgba(0,0,0,0.45);
  --stripe:    rgba(233,235,231,0.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-grad) 0%, var(--bg) 55%) fixed,
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}

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

::selection { background: var(--accent-soft); }

.mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ---------- Top bar (floating pill nav) ---------- */
.topbar {
  position: static;
  background: var(--bg);
}
.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 13px 28px;
  position: relative;
  min-height: 44px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 16px;
}

/* Brand with leaf mark */
.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  color: var(--text);
}
.brand__mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.brand__mark svg { width: 17px; height: 17px; }
.brand .dot { color: var(--accent); }

/* Center nav — a white pill. This is the ONLY part that stays put (fixed) when
   scrolling; the rest of the bar (brand + icons) scrolls away with the page.
   It morphs into a burger circle (phase 1) and slides toward the right (phase 2). */
.navpill {
  position: fixed;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 44px;
  padding: 5px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .6s cubic-bezier(.5,.05,.2,1), box-shadow .55s ease;
}
/* soft, diffuse multi-colour halo — rendered as box-shadows so it stays fully
   OUTSIDE the pill and the pill's interior remains white */
.navpill:hover {
  box-shadow:
    var(--shadow),
    -30px 0 34px -16px rgba(54,179,163,.60),
    30px 0 34px -16px rgba(234,166,63,.55),
    0 0 32px -6px rgba(93,192,109,.45),
    0 0 16px -2px rgba(230,211,86,.42);
}

.navpill__links {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  max-width: 680px;
  opacity: 1;
  transition: max-width .44s cubic-bezier(.5,.05,.2,1), opacity .3s ease;
}
.navpill__item {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s ease, background-color .2s ease;
}
.navpill__item:hover { color: var(--text); background: var(--accent-soft); }
.navpill__item.is-active { background: var(--accent); color: var(--accent-contrast); }
.navpill__item.is-active:hover { background: var(--accent); color: var(--accent-contrast); }

/* burger icon — grows in as the links collapse */
.navpill__burger {
  flex: none;
  width: 0;
  height: 34px;
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0;
  border: 0; background: transparent; cursor: pointer; padding: 0;
  border-radius: 50%;
  pointer-events: none;
  transition: width .44s cubic-bezier(.5,.05,.2,1), opacity .3s ease;
}
.navburger__lines { position: relative; display: block; width: 18px; height: 12px; }
.navburger__lines i {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .26s cubic-bezier(.4,.1,.2,1), opacity .18s ease;
}
.navburger__lines i:nth-child(1) { top: 0; }
.navburger__lines i:nth-child(2) { top: 5px; }
.navburger__lines i:nth-child(3) { top: 10px; }
.navpill__burger.is-open .navburger__lines i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.navpill__burger.is-open .navburger__lines i:nth-child(2) { opacity: 0; }
.navpill__burger.is-open .navburger__lines i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* phase 1: compact to a centred circle (links collapse, burger appears) */
.topbar.is-compact .navpill__links { max-width: 0; opacity: 0; pointer-events: none; }
.topbar.is-compact .navpill__burger { width: 34px; opacity: 1; pointer-events: auto; }
/* phase 2: slide the circle toward the right, stopping just before the icons */
.topbar.is-right .navpill {
  transform: translateX(-50%) translateX(var(--slideX, 30vw));
}

/* dropdown from the burger */
.navpill__panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  min-width: 196px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s cubic-bezier(.4,.1,.2,1);
  z-index: 60;
}
.navpill.is-open .navpill__panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.navpill__link {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.navpill__link:hover { color: var(--text); background: var(--accent-soft); }
.navpill__link.is-active { color: var(--accent); font-weight: 600; }
.navpill__panel-sep { height: 1px; background: var(--border-2); margin: 6px 6px; }
.navpill__panel-theme {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 4px 8px 4px 14px;
}
.navpill__panel-label { font-size: 13px; font-weight: 500; color: var(--muted); }

/* suppress the slide/morph transitions until after first paint */
.topbar:not(.nav-ready) .navpill,
.topbar:not(.nav-ready) .navpill__links,
.topbar:not(.nav-ready) .navpill__burger,
.topbar:not(.nav-ready) .topbar__right { transition: none !important; }

/* Right cluster: socials + theme pill — fixed at the top-right, always visible */
.topbar__right {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.social { display: inline-flex; align-items: center; gap: 2px; }
.social a {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--muted);
  transition: color .15s ease, background-color .15s ease;
}
.social a:hover { color: var(--accent); background: var(--accent-soft); }
.social svg { width: 17px; height: 17px; fill: currentColor; }

/* Sliding sun/moon theme pill */
.themepill {
  position: relative;
  width: 56px; height: 30px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  cursor: pointer;
  padding: 0;
  transition: border-color .15s ease;
}
.themepill:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.themepill__face {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--faint);
}
.themepill__face svg { width: 100%; height: 100%; }
.themepill .t-sun  { left: 8px; }
.themepill .t-moon { right: 8px; }
/* hide the icon currently under the knob */
.t-sun  { opacity: 0; }
.t-moon { opacity: 1; }
[data-theme="dark"] .t-sun  { opacity: 1; }
[data-theme="dark"] .t-moon { opacity: 0; }
.themepill__knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  transition: transform .26s cubic-bezier(.4,.1,.2,1);
}
[data-theme="dark"] .themepill__knob { transform: translateX(26px); }
.themepill__knob svg { width: 13px; height: 13px; color: var(--accent-contrast); display: none; }
.themepill__knob .k-sun  { display: block; }
[data-theme="dark"] .themepill__knob .k-sun  { display: none; }
[data-theme="dark"] .themepill__knob .k-moon { display: block; }

/* Burger / dropdown styles live with the .navpill rules above */

@media (max-width: 880px) {
  .social { display: none; }
}
@media (max-width: 760px) {
  .topbar__inner { padding: 11px 18px; }
  .brand { font-size: 14px; }
  .navpill { top: 11px; }
  /* on phones the icons + toggle live in the burger dropdown */
  .topbar__right { display: none; }
}

/* ---------- Layout ---------- */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 22px 60px;
}
/* Two-column CSS Grid bento.
   Cards sit at their natural height (align-items:start).
   Use .col-2 on any child to span both columns. */
.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.bento > .card { margin: 0; }
.col-2 { grid-column: 1 / -1; }

/* Half-width nested pair (e.g. clock + contact side by side) */
.bento-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.bento-pair > .card { margin: 0; height: 100%; }

/* Vertical stack — two cards stacked in one grid cell (e.g. clock + contact) */
.bento-stack { display: flex; flex-direction: column; gap: 12px; }
.bento-stack > .card { margin: 0; }

/* Full-height column — wraps a bento column's cards into a vertical flex stack */
.bento-col { display: flex; flex-direction: column; gap: 12px; }
.bento-col > .card { margin: 0; }

/* Allow flip-card to fill its cell height inside a bento-pair */
.bento-pair > .flip-card { height: 100%; }

.page--bento { max-width: 900px; }

@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .col-2 { grid-column: 1; }
  .bento-pair { grid-template-columns: 1fr; }
  .bento-stack { flex-direction: column; }
}

/* ---------- Find me: logos only ---------- */
.findme-card { padding: 15px 16px; }
.findme { display: flex; flex-wrap: wrap; gap: 10px; }
.fmbtn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease, color .15s ease;
  text-decoration: none;
}
.fmbtn svg {
  width: 18px; height: 18px;
  fill: currentColor;
  display: block;
}
.fmbtn__badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.01em;
  color: var(--muted);
  transition: color .15s ease;
}
.fmbtn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-2px);
}
.fmbtn:hover .fmbtn__badge { color: var(--accent); }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 17px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card--link:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.card__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__label .tick {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.card__more {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}
.card__more .arr { transition: transform .2s ease; }
a.card__more:hover .arr,
.card--link:hover .card__more .arr { transform: translate(2px,-2px); }

/* ---------- Intro / hero ---------- */
.hero { display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.monogram {
  width: 64px; height: 64px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 25px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  position: relative;
}
.monogram::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.hero__body { min-width: 0; }
.hero__name {
  margin: 0;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.hero__role {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.hero__role b { color: var(--text); font-weight: 600; }
.hero__tagline {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--text);
  max-width: 46ch;
  text-wrap: pretty;
}
.hero__about {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  text-wrap: pretty;
}

/* ---------- About ---------- */
.prose { max-width: 60ch; }
.prose p { margin: 0 0 10px; font-size: 14.5px; color: var(--text); text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }
.prose .muted { color: var(--muted); }

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  white-space: nowrap;
  flex: none;
  transition: all .15s ease;
}
.tag:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

/* ---------- Clock ---------- */
.clock__time {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock__time .sec { color: var(--muted); font-size: 20px; }
.clock__meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex; flex-direction: column; gap: 3px;
}
.clock__meta .tz { color: var(--text); font-weight: 500; }

/* ---------- Lists (pubs / talks) ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: block;
  padding: 11px 0;
  border-top: 1px solid var(--border-2);
}
.item:first-child { border-top: 0; padding-top: 0; }
.item__top { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.item__title {
  font-size: 14px; font-weight: 500; line-height: 1.35;
  text-wrap: pretty;
}
a.item:hover .item__title { color: var(--accent); }
.item__year {
  font-size: 12px; color: var(--faint);
  font-variant-numeric: tabular-nums; flex: none;
}
.item__meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.item__meta em { font-style: italic; }

/* ---------- Feature (climate hub) ---------- */
.feature { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: center; }
.feature__body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.feature__body p { margin: 0; font-size: 14px; color: var(--muted); text-wrap: pretty; }

/* Striped image placeholder */
.ph {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: var(--card-2);
  background-image: repeating-linear-gradient(
    -45deg, var(--stripe) 0 1px, transparent 1px 11px);
  display: grid; place-items: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.ph span {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint);
  background: var(--card);
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--border);
}

/* ---------- Links grid ---------- */
.links { display: grid; gap: 2px; }
.lnk {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 0 -10px;
  border-radius: 10px;
  transition: background-color .15s ease;
}
.lnk:hover { background: var(--accent-soft); }
.lnk__badge {
  width: 28px; height: 28px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--muted);
}
.lnk:hover .lnk__badge { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.lnk__name { font-size: 13.5px; font-weight: 500; }
.lnk__sub { font-size: 12px; color: var(--faint); margin-left: auto; }
.lnk .arr { color: var(--faint); font-size: 13px; }

/* ---------- Featured highlight ---------- */
.feat__kicker { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 7px; }
.feat__title { font-size: 15.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; text-wrap: pretty; }
.feat__meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- Footer ---------- */
.foot {
  margin-top: 26px;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--faint);
}
.foot__leaf { display: inline-flex; align-items: center; gap: 7px; }
.foot__leaf .seed { width: 7px; height: 7px; border-radius: 50% 0 50% 50%; background: var(--accent); transform: rotate(45deg); display: inline-block; }
.foot a:hover { color: var(--accent); }

/* ---------- Deeper page header (one-line title + description) ---------- */
.page-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 2px 0 14px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.page-head p {
  margin: 0;
  font-size: 13.5px; color: var(--muted);
  position: relative; padding-left: 13px;
  text-wrap: pretty;
}
.page-head p::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
@media (max-width: 560px) {
  .page-head p { padding-left: 0; }
  .page-head p::before { display: none; }
}

/* Year group on deeper page */
.yeargroup { margin-bottom: 8px; }
.yeargroup__year {
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em;
  color: var(--faint); text-transform: uppercase;
  padding: 6px 0; margin-top: 10px;
}

/* ===========================================================
   Publications page — searchable / filterable list (single card)
   =========================================================== */
.serif {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

.pubs-card { padding: 20px 22px 6px; }

/* Toolbar: filter pills (left) + search (right) */
.pubs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-2);
}
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.fpill {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.fpill:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.fpill .count { color: var(--faint); font-size: 11px; }
.fpill[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.fpill[aria-pressed="true"] .count { color: color-mix(in srgb, var(--bg) 65%, var(--text)); }

.search {
  position: relative;
  display: flex; align-items: center;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 280px;
}
.search svg { position: absolute; left: 13px; width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* List of publications */
.pub {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 4px 16px;
  align-items: start;
  padding: 17px 0;
  border-bottom: 1px solid var(--border-2);
}
.pub:last-child { border-bottom: 0; }
.pub__rail { padding-top: 2px; }
.pub__year {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px; font-weight: 500; color: var(--accent);
  line-height: 1;
}
.pub__type {
  margin-top: 6px;
  font-size: 9px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint);
  line-height: 1.35;
}
.pub__title {
  margin: 0;
  font-size: 14px; font-weight: 500; line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--text);
  text-wrap: pretty;
}
.pub__authors { margin: 5px 0 0; font-size: 12px; color: var(--muted); text-wrap: pretty; }
.pub__authors b { color: var(--text); font-weight: 600; }
.pub__authors em { font-style: italic; }
.pub__links { display: flex; gap: 6px; padding-top: 3px; }
.pubpill {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 10.5px; letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.pubpill:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }

.no-results {
  padding: 40px 0;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}
.no-results[hidden] { display: none; }

/* Projects page */
.proj__status {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 9px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.dot-live, .dot-arch { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot-arch { background: var(--faint); }
.proj__tags { margin: 12px 0 0; }
.feature__body .card__more { margin-top: 14px; }

/* News & blog page */
.postlist { display: flex; flex-direction: column; }
.post {
  display: block;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-2);
}
.post:last-child { border-bottom: 0; }
.post__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post__cat {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
.post__cat--essay { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }
.post__cat--news { color: var(--text); }
.post__cat--note { color: var(--faint); }
.post__date { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.post__title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25; letter-spacing: -0.012em; color: var(--text); text-wrap: pretty; }
a.post:hover .post__title { color: var(--accent); }
.post__excerpt { margin: 7px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); max-width: 64ch; text-wrap: pretty; }

@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .pub__rail { display: flex; align-items: baseline; gap: 10px; padding-top: 0; }
  .pub__type { margin-top: 0; }
  .pub__links { padding-top: 2px; }
  .search { max-width: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; }
  .feature__media { order: -1; }
  .hero__name { font-size: 24px; }
  .nav a:not(.active) { display: none; }
  .topbar__inner { padding: 11px 18px; }
}

/* ===========================================================
   Contact QR (landing hero)
   =========================================================== */
.qrcard {
  margin: 0; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.qrcard__code {
  width: 96px; height: 96px;
  padding: 7px;
  background: #fff;
  border-radius: 11px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.qrcard__code svg { display: block; width: 100%; height: 100%; }
.contact-card .qrcard { margin-top: 12px; align-items: flex-start; }
.contact-card .qrcard__cap { text-align: left; }
.contact-card .card__more { margin-top: 14px; }

/* Contact page */
.contactpage {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.contactpage__main { flex: 1 1 280px; min-width: 0; }
.contactpage__email {
  display: inline-block;
  margin-top: 14px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
  word-break: break-word;
}
.contactpage__email:hover { text-decoration: underline; }
.contactpage__note {
  margin: 16px 0 0;
  font-size: 14.5px; line-height: 1.6; color: var(--muted);
  max-width: 46ch; text-wrap: pretty;
}
.contactpage__links {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 22px;
}
.contactpage__qr {
  margin: 0; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
}
.contactpage__qr .qrcard__code { width: 150px; height: 150px; }
@media (max-width: 540px) {
  .contactpage { gap: 24px; }
  .contactpage__qr { align-items: flex-start; }
}
.qrcard__code svg rect[fill="#ffffff"],
.qrcard__code svg rect[fill="white"] { fill: #fff; }
.qrcard__cap {
  font-size: 9px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
  text-align: center; white-space: nowrap;
}

/* ===========================================================
   Publications — peer-review colour coding
   =========================================================== */
.review-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin: 12px 0 0; padding: 0;
  font-size: 11.5px; color: var(--muted);
}
.review-legend__item { display: inline-flex; align-items: center; gap: 7px; }
.review-legend__item .swatch {
  width: 11px; height: 11px; border-radius: 4px; border: 1.5px solid;
}
.review-legend__item.is-pr .swatch { border-color: var(--accent); background: var(--accent-soft); }
.review-legend__item.is-np .swatch { border-color: var(--faint); background: var(--border-2); }

/* peer-reviewed pills (green) */
.fpill--pr { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.fpill--pr:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.fpill--pr[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.fpill--pr[aria-pressed="true"] .count { color: color-mix(in srgb, var(--accent-contrast) 70%, var(--accent)); }

/* non-peer-reviewed pills (neutral grey) */
.fpill--np { color: var(--muted); border-color: var(--border); }
.fpill--np:hover { color: var(--text); border-color: var(--faint); background: var(--card-2); }
.fpill--np[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.fpill--np[aria-pressed="true"] .count { color: color-mix(in srgb, var(--bg) 60%, var(--muted)); }

.fpill.is-empty { opacity: 0.4; cursor: default; }
.fpill.is-empty:hover { color: inherit; border-color: var(--border); background: transparent; }

/* per-row type label coloured by review status + small flag */
.pub__type.is-pr { color: var(--accent); }
.pub__type.is-np { color: var(--faint); }
.pub__review {
  margin-top: 5px;
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 999px; white-space: nowrap;
}
.pub__review::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.pub__review.is-pr { color: var(--accent); background: var(--accent-soft); }
.pub__review.is-pr::before { background: var(--accent); }
.pub__review.is-np { color: var(--clay); background: var(--clay-soft); }
.pub__review.is-np::before { background: var(--clay); }

/* ===========================================================
   Projects — single column, background-image cards
   =========================================================== */
.projlist { display: flex; flex-direction: column; gap: 16px; }
.projcard {
  position: relative;
  display: flex;
  min-height: 260px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  isolation: isolate;
  transition: box-shadow .25s ease, transform .25s ease;
}
.projcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.projcard__bg {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  /* placeholder fill until the user drops an image */
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--card)) 0%, var(--card-2) 70%);
}
.projcard--archived .projcard__bg {
  background: linear-gradient(135deg, color-mix(in srgb, var(--faint) 28%, var(--card)) 0%, var(--card-2) 70%);
}
.projcard__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(0deg, rgba(8,12,10,0.82) 0%, rgba(8,12,10,0.45) 42%, rgba(8,12,10,0.12) 100%);
}
.projcard__body {
  position: relative; z-index: 2;
  margin-top: auto;
  padding: 22px 24px;
  color: #fff;
  max-width: 62ch;
}
.projcard__body h3 { margin: 0 0 7px; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; color: #fff; }
.projcard__body > p { margin: 0; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,0.86); text-wrap: pretty; }
.projcard .proj__status { color: rgba(255,255,255,0.9); }
.projcard .dot-arch { background: rgba(255,255,255,0.7); }
.projcard__foot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 14px; margin-top: 14px;
}
.projcard .proj__tags { margin: 0; }
.projcard .tag {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}
.projcard .tag:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); color: #fff; }
.projcard .card__more { margin: 0; color: #fff; }
.projcard .card__more .arr { color: #fff; }

/* ===========================================================
   Updates — boxed feed (date + text)
   =========================================================== */
.feed-card { padding: 8px 22px; }
.feed { display: flex; flex-direction: column; }
.feeditem {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 4px 20px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-2);
}
.feeditem:last-child { border-bottom: 0; }
.feeditem__date {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.feeditem__text {
  margin: 0;
  font-size: 13.5px; line-height: 1.58; color: var(--text);
  text-wrap: pretty; overflow-wrap: anywhere;
}
.feeditem__text a { color: var(--accent); }
.feeditem__text a:hover { text-decoration: underline; }
/* Compact variant for homepage news widget */
.feeditem--compact {
  padding: 9px 0;
  grid-template-columns: 72px 1fr;
  gap: 0 10px;
}
.feeditem--compact .feeditem__date { font-size: 11.5px; }
.feeditem--compact .feeditem__text { font-size: 13.5px; line-height: 1.5; }

@media (max-width: 560px) {
  .feeditem { grid-template-columns: 1fr; gap: 5px; }
  .feeditem--compact { grid-template-columns: 1fr; }
}

/* ===========================================================
   Article (sample blog post) + Table of Contents
   =========================================================== */
.page--article { max-width: 950px; }
.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px 54px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 88px;
  align-self: start;
}
.toc__label {
  margin: 0 0 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--faint);
}
.toc__nav { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.toc__link {
  font-size: 13px; line-height: 1.4; color: var(--muted);
  padding: 7px 0 7px 15px; margin-left: -1px;
  border-left: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
  text-wrap: pretty;
}
.toc__link:hover { color: var(--text); }
.toc__link.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.article__head, .article__body h2 { scroll-margin-top: 92px; }
@media (max-width: 880px) {
  .page--article { max-width: 720px; }
  .article-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}
.backlink {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin-bottom: 18px;
}
.backlink:hover { color: var(--accent); }
.backlink .arr { transition: transform .2s ease; }
.backlink:hover .arr { transform: translateX(-2px); }
.article__head { margin-bottom: 26px; }
.article__meta { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 14px; }
.article__read { font-size: 12px; color: var(--faint); }
.article__title {
  margin: 0; font-size: 26px; font-weight: 600; line-height: 1.2;
  letter-spacing: -0.02em; color: var(--text); text-wrap: balance;
}
.article__standfirst {
  margin: 14px 0 0; font-size: 15px; line-height: 1.55; color: var(--muted);
  text-wrap: pretty; max-width: 60ch;
}
.article__body { font-size: 14.5px; line-height: 1.7; color: var(--text); }
.article__body p { margin: 0 0 18px; text-wrap: pretty; }
.article__body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 28px auto;
  border-radius: 5px;
}
.article__body figure {
  margin: 28px auto;
  text-align: center;
}
.article__body figure img { margin: 0 auto; }
.article__body figcaption {
  font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center;
}

/* Section banner — image header with dark scrim, used in long-form pages */
.section-banner {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  min-height: 96px;
  display: flex;
  align-items: flex-end;
  margin: 32px 0 18px;
  background-size: cover;
  background-position: center;
}
.section-banner__scrim {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(0deg, rgba(8,12,10,0.78) 0%, rgba(8,12,10,0.42) 55%, rgba(8,12,10,0.18) 100%);
}
.section-banner__title {
  position: relative; z-index: 1;
  color: #fff;
  font-size: 17px; font-weight: 600; letter-spacing: -0.005em;
  margin: 0;
  padding: 16px 20px;
  scroll-margin-top: 92px;
}

.article__body h2 {
  margin: 28px 0 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
}
.article__body h3 {
  margin: 20px 0 8px; font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
}
.article__body h4 {
  margin: 16px 0 7px; font-size: 13.5px; font-weight: 600; letter-spacing: 0;
}
.article__body ul { margin: 0 0 18px; padding-left: 22px; }
.article__body li { margin: 0 0 8px; text-wrap: pretty; }
.article__body strong { font-weight: 600; }
.article__body em { font-style: italic; }
.article__body blockquote {
  margin: 24px 0; padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 20px; font-style: italic; line-height: 1.45; color: var(--text);
}
.article__foot {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.article__share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.article__byline { font-size: 13.5px; font-weight: 600; color: var(--text); margin-right: 4px; }
.article__foot .backlink { margin-bottom: 0; }
@media (max-width: 560px) {
  .article__title { font-size: 22px; }
}

/* publist container */
.publist { display: flex; flex-direction: column; }

/* ===========================================================
   Flip contact card — hover reveals "Contact me" CTA
   =========================================================== */
.flip-card {
  perspective: 900px;
}
.flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 130px;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.42, 0, .58, 1);
}
.flip-card:hover .flip-card__inner {
  transform: rotateY(180deg);
}
.flip-card__front,
.flip-card__back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 15px 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}
.flip-card__back {
  transform: rotateY(180deg);
  background: var(--accent);
  border-color: var(--accent);
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: box-shadow .25s ease;
}
.flip-card__back:hover {
  box-shadow: var(--shadow-lg);
}
.flip-card__qr {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flip-card__cta {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-contrast);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.flip-card__cta .arr { transition: transform .2s ease; }
.flip-card__back:hover .flip-card__cta .arr { transform: translate(2px, -2px); }

@media (max-width: 560px) {
  /* On mobile, disable the 3D flip (tap vs hover) */
  .flip-card__inner { transform: none !important; }
  .flip-card__back { display: none; }
  .flip-card__front { position: static; border-radius: 16px; }
}

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