/* Shared by every page: reset, type, header, footer, buttons, chips, tags and the publication entry markup.
   Colours come only from tokens.css. Values are the approved homepage prototype's (design build 16). */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 1rem; line-height: 1.58; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }   /* components set display, which would otherwise override the hidden attribute */

.wrap {
  width: min(100%, 1240px);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.kicker { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--ink-2); }
.h2 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.4vw, 3.2rem); line-height: 1; letter-spacing: -0.035em; }
.eyebrow { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); letter-spacing: 0.04em; }
/* Links to other sites (marked "ext" at build time; they open in a new tab): a small box-and-arrow after the text,
   drawn in the link's own colour. The SVG is only a mask, so its stroke colour does not matter. */
a.ext::after {
  content: ""; display: inline-block; flex: none; width: 0.68em; height: 0.68em; margin-left: 0.3em; vertical-align: -0.02em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 9.5v3.75c0 .41-.34.75-.75.75h-9.5a.75.75 0 0 1-.75-.75v-9.5c0-.41.34-.75.75-.75H6.5'/%3E%3Cpath d='M9.5 2H14v4.5M14 2 7.5 8.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 9.5v3.75c0 .41-.34.75-.75.75h-9.5a.75.75 0 0 1-.75-.75v-9.5c0-.41.34-.75.75-.75H6.5'/%3E%3Cpath d='M9.5 2H14v4.5M14 2 7.5 8.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; padding-block: 22px; position: relative; z-index: 1; }
.mark { font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.04em; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; font-family: var(--mono); font-size: 0.72rem; }
.nav a { text-decoration: none; color: var(--ink-2); padding-block: 4px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.theme-btn { display: inline-flex; align-items: center; gap: 7px; font: 500 0.68rem var(--mono); color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 5px 11px 5px 8px; cursor: pointer; }
.theme-btn:hover { border-color: var(--ink-2); }
.ti { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--ink); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
html:not(.js) .theme-btn { display: none; }   /* the toggle needs JavaScript; without it the page follows the system */

/* ---------- Buttons, email chip, chips, segmented toggles, tags ---------- */
.btn { display: inline-flex; align-items: center; font: 600 0.92rem/1 var(--body); padding: 13px 18px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; background: color-mix(in srgb, var(--ground) 80%, transparent); cursor: pointer; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.email { display: inline-flex; align-items: stretch; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--ground) 80%, transparent); }
.email span { font-family: var(--mono); font-size: 0.74rem; padding: 0 14px; display: flex; align-items: center; user-select: all; }
.email button { font: 500 0.72rem var(--mono); color: var(--accent); background: none; border: 0; border-left: 1px solid var(--rule); padding: 12px 14px; cursor: pointer; min-width: 74px; }

.chip { font: 500 0.66rem var(--mono); color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 11px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.seg button { font: 500 0.72rem var(--mono); background: none; color: var(--ink-2); border: 0; padding: 9px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.tag { display: inline-block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.tag-first, .tag-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tag-cites { color: var(--cold); border-color: color-mix(in srgb, var(--cold) 50%, transparent); }   /* secondary highlight: the hero's cold colour */

/* ---------- Bands and section heads ---------- */
.band { border-top: 1px solid var(--rule); }
.band .wrap { padding-block: clamp(56px, 8vw, 96px); display: flex; flex-direction: column; gap: 32px; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }

/* Inner pages (Research, Publications, CV): a page title in the hero name's voice, one step down */
.page-head { padding-block: clamp(28px, 5vw, 56px) clamp(32px, 5vw, 48px); display: flex; flex-direction: column; gap: 18px; }
.page-title { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 0.92; letter-spacing: -0.045em; margin-left: -0.03em; }
.page-intro { font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.5; max-width: 52ch; color: var(--ink-2); }

/* ---------- Publication entries (Home, Publications, CV) ---------- */
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.year { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 0 28px; border-top: 1px solid var(--rule); padding-top: 22px; }
.year + .year { margin-top: 20px; }
.year-label { font-family: var(--display); font-weight: 700; font-size: 2.4rem; letter-spacing: -0.04em; line-height: 0.9; color: var(--ink-2); position: sticky; top: calc(env(safe-area-inset-top, 0px) + 18px); align-self: start; font-variant-numeric: lining-nums; }
.pubs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; }
.pub { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0 12px; scroll-margin-top: 18px; }
.pub-n { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-2); padding-top: 6px; font-variant-numeric: tabular-nums; }
.pub-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pub-title { font-family: var(--display); font-weight: 600; font-size: 1.2rem; line-height: 1.22; letter-spacing: -0.015em; }
.pub-authors { font-size: 0.88rem; color: var(--ink-2); }
.pub-authors strong { color: var(--accent); font-weight: 600; }   /* Jake, in the highlight colour */
.pub-cite { font-size: 0.9rem; }
.pub-cite a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.pub-cite a:hover { border-bottom-color: var(--accent); }
.pub-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.pub-note { font-size: 0.85rem; color: var(--ink-2); font-style: italic; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--rule); }
footer .wrap { padding-block: 44px 56px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 40px; font-size: 0.92rem; color: var(--ink-2); }
footer h2 { font-family: var(--mono); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-bottom: 8px; }
footer .name { font-family: var(--display); font-weight: 800; font-size: 1.8rem; letter-spacing: -0.04em; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.footer-email { font-family: var(--mono); font-size: 0.8rem; user-select: all; }
.footer-address { margin-top: 4px; }
.footer-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.footer-copy { margin-top: 12px; }

@media (max-width: 640px) {
  .year { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .year-label { position: static; }
  footer .wrap { grid-template-columns: minmax(0, 1fr); }
  .pub { grid-template-columns: minmax(0, 1fr); }
  .pub-n { padding-top: 0; }
}

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