/* ==========================================================================
   Stephane van der Aa — personal site
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #e0e7ff 0%, transparent 60%),
             radial-gradient(900px 500px at 95% 0%, #cffafe 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --ink: #0d1424;
  --ink-soft: #2c3548;
  --muted: #5c6679;
  --faint: #8b95a8;
  --border: #e5e8f0;
  --border-strong: #d3d8e6;
  --accent: #4338ca;
  --accent-soft: #eef1ff;
  --accent-2: #0891b2;
  --shadow-sm: 0 1px 2px rgba(13, 20, 36, .05), 0 1px 3px rgba(13, 20, 36, .04);
  --shadow-md: 0 4px 6px -1px rgba(13, 20, 36, .06), 0 10px 24px -6px rgba(13, 20, 36, .09);
  --shadow-lg: 0 18px 40px -12px rgba(13, 20, 36, .16);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1320px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080c17;
    --bg-grad: radial-gradient(1100px 600px at 12% -10%, #1b2450 0%, transparent 60%),
               radial-gradient(900px 500px at 95% 0%, #093c4a 0%, transparent 55%);
    --surface: #101728;
    --surface-2: #0d1322;
    --ink: #eef1f8;
    --ink-soft: #d3d9e8;
    --muted: #98a2ba;
    --faint: #6f7a93;
    --border: #1e2740;
    --border-strong: #2b3654;
    --accent: #8b93ff;
    --accent-soft: #171f3c;
    --accent-2: #38bdf8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 18px -6px rgba(0, 0, 0, .6);
    --shadow-lg: 0 20px 44px -14px rgba(0, 0, 0, .75);
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
/* Safety net: any icon dropped into UI chrome is constrained unless explicitly sized. */
svg { flex: none; }
.card svg, .disclosure svg, .topbar svg, .footer svg, .crumbs svg, .hero svg {
  max-width: 20px; max-height: 20px;
}
.btn svg, .acard__more svg, .chev svg { max-width: none; max-height: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 650; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.15em; }
li { margin-bottom: .4em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- chrome ---------------------------------------------------- */

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}

.brand {
  font-weight: 700; letter-spacing: -.03em; color: var(--ink);
  display: flex; align-items: center; gap: .6rem; font-size: .98rem;
  padding: .3rem 0;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center;
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
}

.topbar__links { margin-left: auto; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.topbar__links a {
  color: var(--muted); font-size: .875rem; font-weight: 550;
  padding: .45rem .7rem; border-radius: 8px;
}
.topbar__links a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- breadcrumbs ---------------------------------------------- */

.crumbs {
  max-width: var(--maxw); margin: 0 auto; padding: 1.1rem 1.5rem 0;
  font-size: .82rem; color: var(--faint);
}
.crumbs ol { display: flex; flex-wrap: wrap; gap: .15rem .45rem; list-style: none; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; gap: .45rem; margin: 0; }
.crumbs li + li::before { content: "/"; color: var(--border-strong); }
.crumbs a { color: var(--muted); font-weight: 550; padding: .3rem 0; display: inline-block; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- layout ---------------------------------------------------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem 4rem; }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 2rem;
  align-items: start; margin-top: 1.25rem;
}

.stack > * + * { margin-top: 1.5rem; }

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

.hero {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 2.25rem 2.25rem 2rem;
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #a855f7);
}
.hero::after {
  content: ""; position: absolute; right: -110px; top: -130px; width: 340px; height: 340px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

/* Name and role own the full card width; the portrait sits lower, beside the
   contact details, so the role line never has to wrap around it. */
.hero__top { min-width: 0; }
.hero__grid { display: flex; gap: 1.75rem; align-items: flex-start; margin-top: 1.1rem; }
.hero__intro { flex: 1 1 auto; min-width: 0; }
.hero__photo { flex: none; margin: 0; width: 152px; }
.hero__photo img {
  width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 22px; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}

.hero__name { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 750; letter-spacing: -.035em; }
.hero__role {
  margin-top: .55rem; font-size: .97rem; font-weight: 560; color: var(--accent);
  display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .55rem;
}
/* Separator hangs off the following item, so a wrapped line never ends in a dot. */
.hero__role .role + .role::before {
  content: "·"; color: var(--border-strong); margin-right: .55rem; font-weight: 700;
}

.hero__meta {
  display: flex; flex-wrap: wrap; gap: .4rem .5rem;
  list-style: none; padding: 0; margin: 0; font-size: .87rem;
}
.hero__meta li { margin: 0; }
.hero__meta a, .hero__meta span {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .34rem .7rem; border-radius: 999px; color: var(--muted); font-weight: 550;
}
.hero__meta a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.hero__actions { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: .65rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .62rem 1.05rem; border-radius: 10px; font-size: .9rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: var(--shadow-md);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: .45rem .8rem; font-size: .84rem; }
.btn svg { width: 15px; height: 15px; flex: none; }

/* ---------- cards & sections ------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.6rem 1.75rem;
}

.section__head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1.15rem; }
.section__title {
  font-size: .78rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent);
}
.section__rule { flex: 1; height: 1px; background: var(--border); }

/* ---------- collapsible boxes ---------------------------------------- */

.disclosure {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.disclosure[open] { box-shadow: var(--shadow-md); }

.disclosure > summary {
  cursor: pointer; list-style: none; padding: 1.25rem 1.75rem;
  display: flex; align-items: center; gap: .85rem; user-select: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--surface-2); }
.disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.disclosure__title {
  font-weight: 650; font-size: 1.02rem; letter-spacing: -.015em;
  display: inline-flex; align-items: center; gap: .5rem; min-width: 0;
}
/* Inline icons must never inherit an unbounded size from the SVG viewBox. */
.disclosure__title svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.disclosure__hint { font-size: .82rem; color: var(--faint); margin-left: auto; padding-right: .25rem; }

.chev {
  width: 22px; height: 22px; flex: none; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; transition: transform .22s ease;
}
.chev svg { width: 12px; height: 12px; }
.disclosure[open] .chev { transform: rotate(90deg); }
.disclosure[open] .disclosure__hint { opacity: 0; }

.disclosure__body { padding: 0 1.75rem 1.6rem; border-top: 1px solid var(--border); }
.disclosure__body > :first-child { margin-top: 1.25rem; }

/* ---------- profile / prose ------------------------------------------ */

.prose { color: var(--ink-soft); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 620; }
.prose--lead { font-size: 1.02rem; line-height: 1.72; }

.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .55rem 1.5rem; }
.focus-grid ul { margin: 0; }

/* ---------- timeline -------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: .55rem; bottom: .55rem;
  width: 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2), transparent);
  opacity: .35; border-radius: 2px;
}
.timeline > li { position: relative; padding-left: 2rem; margin: 0 0 1.6rem; }
.timeline > li:last-child { margin-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: 0; top: .52rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.job__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.job__role { font-weight: 650; font-size: 1.03rem; color: var(--ink); }
.job__org { color: var(--muted); font-size: .93rem; }
.job__when {
  margin-left: auto; font-size: .78rem; font-weight: 650; color: var(--accent);
  background: var(--accent-soft); padding: .18rem .6rem; border-radius: 999px; white-space: nowrap;
}
.job__meta { font-size: .86rem; color: var(--faint); margin-top: .15rem; }
.job ul { margin: .55rem 0 0; padding-left: 1.1em; color: var(--ink-soft); font-size: .95rem; }

/* ---------- publications --------------------------------------------- */

.pub { display: flex; gap: 1rem; align-items: flex-start; }
.pub + .pub { margin-top: 1.35rem; padding-top: 1.35rem; border-top: 1px solid var(--border); }
.pub__badge {
  flex: none; width: 42px; height: 54px; border-radius: 6px 10px 10px 6px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center; font-size: .68rem; font-weight: 800;
  letter-spacing: .06em; box-shadow: var(--shadow-sm);
}
.pub__title { font-weight: 650; color: var(--ink); }
.pub__meta { font-size: .82rem; color: var(--accent); font-weight: 600; margin: .1rem 0 .35rem; }
.pub__desc { font-size: .93rem; color: var(--ink-soft); margin: 0; }
.pub__links { margin-top: .4rem; font-size: .86rem; display: flex; gap: .3rem 1rem; flex-wrap: wrap; }
.pub__links a { padding: .3rem 0; display: inline-block; }

/* ---------- skills & chips -------------------------------------------- */

.skills { display: grid; gap: 1.05rem; }
.skill__label {
  font-size: .74rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin-bottom: .3rem;
}
.skill__text { font-size: .95rem; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .3rem .72rem; border-radius: 999px; font-size: .85rem; color: var(--ink-soft);
}
.chip b { font-weight: 650; color: var(--ink); }

/* ---------- articles column ------------------------------------------ */

/* The article column flows with the page: no sticky panel, no inner scrollbar. */
.rail { min-width: 0; }

.rail__head {
  display: flex; align-items: baseline; gap: .6rem; margin-bottom: .9rem; padding: 0 .25rem;
}
.rail__head h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
.rail__head span { font-size: .8rem; color: var(--faint); margin-left: auto; }

.rail__list {
  display: grid; gap: .75rem; list-style: none; margin: 0; padding: 0 0 .5rem;
}

.acard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.acard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.acard a { color: inherit; display: block; }
.acard a:hover { text-decoration: none; }

.acard__visual {
  position: relative; aspect-ratio: 2 / 1; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.acard__visual img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.acard:hover .acard__visual img { transform: scale(1.045); }
.acard__visual--fallback {
  display: grid; place-items: center; color: rgba(255,255,255,.95);
  font-size: 1.05rem; font-weight: 700; text-align: center; padding: 1rem; letter-spacing: -.02em;
}
.acard__date {
  position: absolute; left: .6rem; bottom: .6rem;
  background: rgba(8, 12, 23, .72); color: #fff; backdrop-filter: blur(6px);
  font-size: .71rem; font-weight: 650; letter-spacing: .02em;
  padding: .22rem .58rem; border-radius: 999px;
}
.acard__badge {
  position: absolute; right: .6rem; top: .6rem;
  background: rgba(255,255,255,.92); color: var(--accent);
  font-size: .68rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: 999px;
}

.acard__body { padding: .85rem 1rem .9rem; }
.acard__title {
  font-size: .97rem; font-weight: 650; letter-spacing: -.015em; color: var(--ink);
  margin-bottom: .5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.summary { list-style: none; margin: 0; padding: 0; }
.summary li {
  position: relative; padding-left: .95rem; font-size: .845rem; line-height: 1.5;
  color: var(--muted); margin-bottom: .12rem;
}
.summary li::before {
  content: ""; position: absolute; left: 0; top: .58em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .55;
}
.acard__more {
  margin-top: .7rem; font-size: .8rem; font-weight: 650; color: var(--accent);
  display: inline-flex; align-items: center; gap: .3rem;
}
.acard:hover .acard__more svg { transform: translateX(3px); }
.acard__more svg { width: 12px; height: 12px; transition: transform .18s ease; }

/* ---------- PDF embeds ------------------------------------------------ */

.pdf-frame {
  width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 1.25rem;
}
.pdf-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- article page --------------------------------------------- */

.article { max-width: 780px; }
.article__head { margin-bottom: 1.75rem; }
.article__title { font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 720; letter-spacing: -.03em; }
.article__sub {
  margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  font-size: .87rem; color: var(--muted); align-items: center;
}
.article__cover {
  margin: 1.6rem 0 0; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.article__cover img { width: 100%; }

.summary-box {
  margin-top: 1.6rem; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius); padding: 1.15rem 1.35rem;
}
.summary-box h2 {
  font-size: .74rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .6rem;
}
.summary-box .summary li { color: var(--ink-soft); }

.article__body { font-size: 1.045rem; line-height: 1.78; color: var(--ink-soft); }
.article__body > :first-child { margin-top: 0; }
.article__body h2, .article__body h3, .article__body h4 {
  color: var(--ink); margin: 2.2rem 0 .75rem; letter-spacing: -.02em;
}
.article__body h2 { font-size: 1.42rem; }
.article__body h3 { font-size: 1.2rem; }
.article__body h4 { font-size: 1.05rem; }
.article__body p { margin: 0 0 1.15rem; }
.article__body ul, .article__body ol { margin: 0 0 1.3rem; padding-left: 1.35em; }
.article__body li { margin-bottom: .5rem; }
.article__body figure { margin: 1.9rem 0; }
.article__body figure img {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.article__body figcaption {
  font-size: .84rem; color: var(--faint); text-align: center; margin-top: .6rem;
}
.article__body blockquote {
  margin: 1.6rem 0; padding: .9rem 1.3rem; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft); font-style: italic;
}
.article__body a { font-weight: 550; text-decoration: underline; text-underline-offset: 2px; }
.article__body code {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  border: 1px solid var(--border); padding: .1em .35em; border-radius: 5px;
}
.article__body hr { margin: 2.4rem 0; }

.source-note {
  margin-top: 2.5rem; padding-top: 1.35rem; border-top: 1px solid var(--border);
  font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap;
  gap: .6rem 1.2rem; align-items: center;
}

.pager { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.pager a {
  flex: 1 1 240px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .85rem 1.05rem; background: var(--surface); box-shadow: var(--shadow-sm);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: .2rem; }
.pager b { font-weight: 600; color: var(--ink); font-size: .93rem; }

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

.footer {
  border-top: 1px solid var(--border); margin-top: 3rem; padding: 2rem 0 3rem;
  color: var(--faint); font-size: .85rem;
}
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center;
}
.footer__inner nav { margin-left: auto; display: flex; gap: .5rem 1rem; flex-wrap: wrap; }
.footer__inner nav a { padding: .35rem 0; display: inline-block; }

/* ---------- responsive ------------------------------------------------ */

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; }
}

/* Single column: media queries must run widest-first so the narrower
   grid-template-columns below reliably wins over the 1180px override. */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail__list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

@media (max-width: 860px) {
  .topbar__inner { flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem; row-gap: .35rem; }
  .brand { order: 1; }
  .icon-btn { order: 2; margin-left: auto; }
  .topbar__links {
    order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap;
    overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-right: -.5rem; padding-right: .5rem;
  }
  .topbar__links::-webkit-scrollbar { display: none; }
  .topbar__links a { white-space: nowrap; padding: .35rem .6rem; font-size: .84rem; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 116px; }
  body { font-size: 15.5px; }
  .wrap { padding: 0 1rem 3rem; }
  .crumbs { padding: .85rem 1rem 0; font-size: .78rem; }
  .layout { margin-top: .9rem; gap: 1.15rem; }
  .stack > * + * { margin-top: 1.15rem; }

  .hero { padding: 1.4rem 1.25rem 1.35rem; }
  /* Portrait drops below the role line, above the contact details. */
  .hero__grid { flex-direction: column; gap: 1.1rem; margin-top: .9rem; }
  .hero__photo { order: -1; width: 124px; }
  .hero__photo img { border-radius: 18px; }
  .hero__name { font-size: 1.75rem; letter-spacing: -.03em; }
  .hero__role { font-size: .95rem; row-gap: .25rem; }
  .hero__role .dot { display: none; }
  .hero__meta { font-size: .82rem; }
  .hero__meta a, .hero__meta span { padding: .3rem .6rem; }
  .hero__actions { margin-top: 1.15rem; }
  .hero__actions .btn { flex: 1 1 auto; justify-content: center; }

  .card { padding: 1.2rem 1.15rem; border-radius: 14px; }
  .disclosure { border-radius: 14px; }
  .disclosure > summary { padding: 1rem 1.15rem; gap: .6rem; }
  .disclosure__title { font-size: .95rem; }
  .disclosure__hint { display: none; }
  .disclosure__body { padding: 0 1.15rem 1.25rem; }

  .focus-grid { grid-template-columns: 1fr; gap: .25rem; }
  .focus-grid ul:last-child { margin-bottom: 0; }

  .timeline > li { padding-left: 1.6rem; margin-bottom: 1.35rem; }
  .timeline > li::before { width: 13px; height: 13px; border-width: 3px; }
  .timeline::before { left: 5.5px; }
  .job__role { font-size: .98rem; }
  .job__org { font-size: .89rem; }
  .job__when { margin-left: 0; }
  .job__top { gap: .35rem; }
  .job ul { font-size: .92rem; padding-left: 1em; }

  .pub { gap: .8rem; }
  .pub__badge { width: 34px; height: 46px; font-size: .6rem; }

  .rail__list { grid-template-columns: 1fr; padding-right: 0; }
  .acard__title { font-size: .95rem; }
  .summary li { font-size: .86rem; }

  .pdf-frame { height: 62vh; min-height: 380px; margin-top: 1rem; }
  .pdf-actions { gap: .5rem; }
  .pdf-actions .btn { flex: 1 1 auto; justify-content: center; }

  .article__head { margin-bottom: 1.35rem; }
  .article__title { font-size: 1.5rem; }
  .article__sub { font-size: .82rem; gap: .4rem .7rem; }
  .article__cover { margin-top: 1.15rem; border-radius: 14px; }
  .summary-box { margin-top: 1.15rem; padding: 1rem 1.1rem; border-radius: 14px; }
  .article__body { font-size: 1rem; line-height: 1.72; }
  .article__body h2 { font-size: 1.24rem; }
  .article__body h3 { font-size: 1.1rem; }
  .article__body figure { margin: 1.5rem 0; }
  .article__body blockquote { padding: .8rem 1rem; }
  /* Wide tables scroll instead of breaking the layout. */
  .article__body table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .pager a { flex: 1 1 100%; }
  .source-note { gap: .5rem; }
  .source-note .btn { flex: 1 1 100%; justify-content: center; }

  .footer__inner { padding: 0 1rem; }
  .footer__inner nav { margin-left: 0; gap: .75rem; font-size: .82rem; }
}

@media (max-width: 420px) {
  .hero__name { font-size: 1.55rem; }
  .brand span:last-child { font-size: .92rem; }
  .brand__mark { width: 27px; height: 27px; border-radius: 8px; }
  .hero__actions .btn { flex: 1 1 100%; }
  .chips .chip { font-size: .82rem; }
}

/* Keep long words and URLs from forcing horizontal scroll.
   Note: do NOT use word-break/overflow-wrap:anywhere on flex children such as the
   hero chips — it collapses their min-content width and wraps them one char per line. */
.hero, .card, .disclosure, .acard, .article__body, .job, .summary, .rail {
  overflow-wrap: break-word;
}
.article__body a, .source-note a, .pub__links a { overflow-wrap: anywhere; }

@media print {
  .topbar, .rail, .hero__actions, .footer, .crumbs { display: none; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; }
  .card, .hero { box-shadow: none; border-color: #ddd; }
}
