/* ==========================================================================
   Paulo Condado — personal site
   Pure CSS. No external requests. Target: WCAG 2.2 AA (AAA where practical).
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ----------
   Atkinson Hyperlegible was designed by the Braille Institute to
   maximise character recognition for readers with low vision. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --text: #191c2c;
  --muted: #474c60;
  --accent: #0a6660;          /* 6.6:1 on --bg */
  --accent-strong: #074d48;
  --accent-ink: #ffffff;
  --accent-soft: #dcefec;
  --sun: #f4b942;             /* brand highlight, used behind dark text only */
  --sun-ink: #191c2c;
  --border: #d4d0c6;
  --shadow: 0 1px 2px rgb(25 28 44 / .06), 0 8px 24px rgb(25 28 44 / .06);
  --focus-inner: #191c2c;
  --focus-outer: #f4b942;

  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: .75rem;
  --radius-lg: 1.25rem;
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --space: clamp(3.5rem, 8vw, 6.5rem);
  --tap: 2.75rem;              /* 44px minimum target, generous for motor impairments */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #10121b; --surface: #181b28; --surface-2: #212537;
    --text: #f1f0ea; --muted: #b8bbcb;
    --accent: #6dd5ca; --accent-strong: #9be6dd; --accent-ink: #08201d; --accent-soft: #133430;
    --border: #33394f; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
    --focus-inner: #f1f0ea; --focus-outer: #f4b942;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10121b; --surface: #181b28; --surface-2: #212537;
  --text: #f1f0ea; --muted: #b8bbcb;
  --accent: #6dd5ca; --accent-strong: #9be6dd; --accent-ink: #08201d; --accent-soft: #133430;
  --border: #33394f; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  --focus-inner: #f1f0ea; --focus-outer: #f4b942;
}
:root[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000; --surface: #000; --surface-2: #000;
  --text: #fff; --muted: #fff;
  --accent: #ffeb3b; --accent-strong: #ffeb3b; --accent-ink: #000; --accent-soft: #000;
  --sun: #ffeb3b; --sun-ink: #000;
  --border: #fff; --shadow: none;
  --focus-inner: #000; --focus-outer: #ffeb3b;
}
:root[data-theme="contrast"] .card,
:root[data-theme="contrast"] .tile,
:root[data-theme="contrast"] .panel { border-width: 2px; }

/* Text size preference (set by the Display panel) */
:root[data-text="lg"] { font-size: 115%; }
:root[data-text="xl"] { font-size: 130%; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.125rem;          /* 18px base */
  line-height: 1.65;
  letter-spacing: .005em;
  word-spacing: .02em;
  overflow-wrap: break-word;
}
img, svg, video, iframe { max-width: 100%; display: block; }
img { height: auto; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.3rem; }
p, ul, ol, dl, figure, blockquote { margin: 0 0 1.1em; }
p { max-width: 68ch; text-wrap: pretty; }
ul, ol { padding-left: 1.25em; }
strong { font-weight: 700; }

a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .2em; }
a:hover { color: var(--accent-strong); text-decoration-thickness: .14em; }

:focus-visible {
  outline: 3px solid var(--focus-inner);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-outer);
  border-radius: 4px;
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; box-shadow: none; }
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -10rem; z-index: 100;
  background: var(--sun); color: var(--sun-ink); font-weight: 700;
  padding: .75rem 1.25rem; border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.section { padding-block: var(--space); }
.section--tint { background: var(--surface-2); }
.section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 2rem; }
.section__head h2 { margin: 0; }
.section__head p { margin: .5rem 0 0; color: var(--muted); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .9rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .75rem;
}
.eyebrow::before { content: ""; width: 1.5rem; height: 3px; background: currentColor; border-radius: 2px; }
.lead { font-size: clamp(1.2rem, 2.2vw, 1.4rem); line-height: 1.55; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: var(--tap); padding: .7rem 1.35rem;
  border: 2px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); color: var(--text); border-color: var(--text); }
.btn--sun { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); }
.btn--sun:hover { background: var(--sun); border-color: var(--text); color: var(--sun-ink); }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
@media (prefers-reduced-motion: no-preference) { .btn:active { transform: translateY(1px); } }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; display: inline-block; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: 4.5rem; flex-wrap: wrap; padding-block: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; margin-right: auto; min-height: var(--tap); }
.brand__mark {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .8rem;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem; letter-spacing: .02em;
}
.brand:hover { color: var(--text); }
.brand__text small { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); line-height: 1.2; }

.nav-toggle, .prefs-toggle {
  display: inline-flex; align-items: center; gap: .5rem; min-height: var(--tap); min-width: var(--tap);
  padding: .5rem .9rem; border: 2px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.nav-toggle:hover, .prefs-toggle:hover { border-color: var(--text); }
.nav-toggle svg, .prefs-toggle svg { width: 1.25rem; height: 1.25rem; }
.nav-toggle { display: none; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: .4rem .85rem;
  border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 700;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: underline; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 -3px 0 var(--accent); }
:root[data-theme="contrast"] .site-nav a[aria-current="page"] { outline: 2px solid var(--accent); }

.header-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
@media (max-width: 34rem) {
  .header-tools { width: 100%; justify-content: flex-start; }
  .prefs { position: static; }
  .site-header__inner { position: relative; }
  .prefs-panel { left: 0; right: 0; width: auto; }
}
.lang-link {
  display: inline-flex; align-items: center; gap: .35rem; min-height: var(--tap); padding: .4rem .8rem;
  border-radius: 999px; font-weight: 700; color: var(--text); text-decoration: none; border: 2px solid transparent;
}
.lang-link:hover { border-color: var(--border); color: var(--text); }

/* Collapsible nav only when JS is available (progressive enhancement) */
@media (max-width: 60rem) {
  .js .nav-toggle { display: inline-flex; }
  .site-nav { flex-basis: 100%; order: 5; }
  .js .site-nav[data-open="false"] { display: none; }
  .site-nav ul { flex-direction: column; gap: .15rem; padding-bottom: .75rem; }
  .site-nav a { width: 100%; border-radius: var(--radius); padding-inline: 1rem; }
}

/* ---------- Display preferences panel ---------- */
.prefs { position: relative; }
.prefs-panel {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50;
  width: min(22rem, calc(100vw - 2rem));
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.25rem;
}
.prefs-panel[hidden] { display: none; }
.prefs-panel h2 { font-size: 1.15rem; margin-bottom: .75rem; }
.prefs-panel fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.prefs-panel legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.choice-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.choice-group--3 { grid-template-columns: repeat(3, 1fr); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: var(--tap); padding: .35rem .5rem; border: 2px solid var(--border); border-radius: var(--radius);
  font-weight: 700; font-size: .95rem; line-height: 1.2;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:checked + span::before { content: "✓ "; white-space: pre; }
.choice input:focus-visible + span { outline: 3px solid var(--focus-inner); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-outer); }
.prefs-panel .note { font-size: .9rem; color: var(--muted); margin: 0; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 7vw, 6rem) var(--space); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: auto -10% -40% auto; width: 38rem; height: 38rem; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); z-index: -1; pointer-events: none;
}
.hero__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1.4fr 1fr; align-items: center; }
.hero h1 { margin-bottom: .25em; }
.hero h1 .accent { color: var(--accent); }
.hero__role { font-size: clamp(1.15rem, 2vw, 1.35rem); font-weight: 700; margin-bottom: 1.25rem; }
.hero__lead { font-size: clamp(1.2rem, 2.2vw, 1.4rem); line-height: 1.55; margin-bottom: 2rem; max-width: 38ch; }
.hero__lead mark { background: linear-gradient(transparent 58%, var(--sun) 58%); color: inherit; padding-inline: .1em; }
:root[data-theme="contrast"] .hero__lead mark { background: none; text-decoration: underline 3px var(--sun); }
.hero__portrait { position: relative; justify-self: center; width: min(100%, 24rem); margin: 0; }
.hero__portrait img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2rem 2rem 2rem .5rem;
  background: var(--surface-2); box-shadow: var(--shadow);
}
.hero__portrait::after {
  content: ""; position: absolute; inset: 1.25rem -1.25rem -1.25rem 1.25rem; z-index: -1;
  border: 3px solid var(--sun); border-radius: 2rem 2rem 2rem .5rem;
}
.hero__badge {
  position: absolute; left: -1rem; bottom: 1.5rem; max-width: 15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .7rem 1rem; font-size: .95rem; line-height: 1.35;
}
.hero__badge strong { display: block; color: var(--accent); }
@media (max-width: 52rem) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; width: min(70%, 18rem); justify-self: start; }
  .hero__badge { display: none; }
}

/* ---------- Page header (inner pages) ---------- */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.page-head .lead { max-width: 60ch; margin-bottom: 0; }

.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .95rem; }
.breadcrumb li + li::before { content: "/"; margin-right: .35rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--muted); }
.card__icon {
  display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .9rem;
  background: var(--accent-soft); color: var(--accent); margin-bottom: .5rem;
}
.card__icon svg { width: 1.6rem; height: 1.6rem; }
.card__meta { font-size: .95rem; font-weight: 700; color: var(--accent); }
.card__more { margin-top: auto; padding-top: .75rem; font-weight: 700; }
/* Whole-card click target that keeps a single, meaningful link name */
.card--link .card__title a { color: inherit; text-decoration: none; }
.card--link .card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.card--link:hover { border-color: var(--accent); }
.card--link:hover .card__title a { text-decoration: underline; }
.card--link:focus-within { outline: 3px solid var(--focus-inner); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-outer); }
.card--link .card__title a:focus-visible { outline: none; box-shadow: none; }

.tag { display: inline-block; font-size: .85rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.tile__num { display: block; font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 700; line-height: 1; color: var(--accent); margin-bottom: .35rem; }
.tile__label { color: var(--muted); font-weight: 700; }

/* ---------- Feature (highlight) ---------- */
.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
  background: #161a2b; color: #f6f4ee; border: 1px solid var(--border);
  border-radius: 2rem; padding: clamp(1.5rem, 4vw, 3rem);
}
.feature a:not(.btn) { color: #f4b942; }
.feature .eyebrow { color: #f4b942; }
.feature p { color: inherit; }
.feature .btn--sun { background: #f4b942; border-color: #f4b942; color: #161a2b; }
.feature .btn--sun:hover { border-color: #f6f4ee; }
.feature .btn--ghost { color: #f6f4ee; border-color: #f6f4ee; }
.feature .btn--ghost:hover { background: transparent; color: #f4b942; border-color: #f4b942; }
.feature :focus-visible { outline-color: #f6f4ee; }
:root[data-theme="contrast"] .feature { background: #000; color: #fff; border: 2px solid #fff; }
@media (max-width: 52rem) { .feature { grid-template-columns: 1fr; } }

/* ---------- Video (privacy facade) ---------- */
.video { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.video__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); overflow: hidden; background: #0e1a24; }
.video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__poster {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 1rem 1.15rem; color: #fff; text-decoration: none;
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(244 185 66 / .35), transparent 55%),
    linear-gradient(135deg, var(--poster-a, #0a6660), var(--poster-b, #13213a));
}
.video__poster:hover, .video__poster:focus-visible { color: #fff; }
.video__poster-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; max-width: 28ch; text-shadow: 0 1px 2px rgb(0 0 0 / .4); }
.video__poster-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.video__play {
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: #fff; color: #0e1a24; box-shadow: 0 4px 16px rgb(0 0 0 / .35); flex: none;
}
.video__play svg { width: 1.4rem; height: 1.4rem; margin-left: .2rem; }
.video__poster:hover .video__play { background: var(--sun); }
.video__dur { background: rgb(0 0 0 / .7); color: #fff; font-size: .85rem; font-weight: 700; padding: .15rem .5rem; border-radius: .4rem; }
.video__poster:focus-visible { outline: 4px solid var(--focus-outer); outline-offset: -4px; box-shadow: inset 0 0 0 8px #000; border-radius: var(--radius-lg); }
.video figcaption { font-size: 1rem; line-height: 1.45; }
.video figcaption .muted { font-size: .92rem; }
.video__note { font-size: .9rem; color: var(--muted); display: flex; gap: .4rem; align-items: start; }
.video__note svg { margin-top: .2rem; }
.video[data-hue="2"] { --poster-a: #6b3fa0; --poster-b: #1d1640; }
.video[data-hue="3"] { --poster-a: #b2452e; --poster-b: #2b1410; }
.video[data-hue="4"] { --poster-a: #1f5fa8; --poster-b: #0f1b33; }
.video[data-hue="5"] { --poster-a: #2f7d3b; --poster-b: #0f2414; }
:root[data-theme="contrast"] .video__poster { background: #000; border: 2px solid #fff; border-radius: var(--radius-lg); }

/* ---------- Award ---------- */
.award { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.award img { border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); width: 100%; }
@media (max-width: 52rem) { .award { grid-template-columns: 1fr; } }

/* ---------- CTA ---------- */
.cta {
  background: var(--accent); color: var(--accent-ink); border-radius: 2rem;
  padding: clamp(2rem, 5vw, 3.5rem); display: grid; gap: 1.5rem; grid-template-columns: 1.4fr 1fr; align-items: center;
}
.cta h2 { color: inherit; }
.cta p { color: inherit; opacity: .95; margin-bottom: 0; }
.cta ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.cta li { display: flex; gap: .6rem; align-items: start; font-weight: 700; }
.cta li svg { margin-top: .3rem; }
.cta .btn { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.cta .btn:hover { background: transparent; color: var(--accent-ink); }
.cta a:not(.btn) { color: inherit; }
:root[data-theme="contrast"] .cta { background: #000; color: #fff; border: 2px solid #ffeb3b; }
:root[data-theme="contrast"] .cta .btn { background: #ffeb3b; color: #000; }
@media (max-width: 52rem) { .cta { grid-template-columns: 1fr; } }

/* ---------- Projects ---------- */
.project { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; padding-block: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--border); }
.project:first-of-type { border-top: 0; }
.project h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .3em; }
.project__years { font-weight: 700; color: var(--accent); margin-bottom: .75rem; }
.project dl { display: grid; gap: .9rem; margin-top: 1.25rem; }
.project dt { font-weight: 700; }
.project dd { margin: 0; color: var(--muted); }
@media (max-width: 52rem) { .project { grid-template-columns: 1fr; } }

.toc { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.toc a { display: inline-flex; align-items: center; min-height: var(--tap); padding: .35rem 1rem; border: 2px solid var(--border); border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--text); background: var(--surface); }
.toc a:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Publications ---------- */
.filters { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) auto; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.filters[hidden] { display: none; }
.filters fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.filters legend, .field label { font-weight: 700; padding: 0; margin-bottom: .4rem; display: block; }
.filters .choice-group { display: flex; flex-wrap: wrap; }
.filters .choice span { padding-inline: .9rem; }
.field input[type="search"] {
  width: 100%; min-height: var(--tap); padding: .55rem .9rem; font: inherit; color: var(--text);
  background: var(--bg); border: 2px solid var(--muted); border-radius: var(--radius);
}
.field input[type="search"]:focus-visible { border-color: var(--accent); }
.field { min-width: min(100%, 18rem); }
@media (max-width: 52rem) { .filters { grid-template-columns: 1fr; } }
.result-count { font-weight: 700; margin: 0 0 1.5rem; }

.pub-group { margin-bottom: 2.5rem; }
.pub-group[hidden] { display: none; }
.pub-group > h2 { font-size: 1.5rem; padding-bottom: .5rem; border-bottom: 2px solid var(--border); }
.pub-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.pub { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; }
.pub[hidden] { display: none; }
/* APA hanging indent */
.apa { margin: 0; max-width: none; padding-left: 2em; text-indent: -2em; line-height: 1.7; }
.apa a { word-break: break-all; text-indent: 0; }
.pub__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; padding-left: 2em; }
.pub__actions .btn { min-height: 2.75rem; padding: .45rem 1rem; font-size: .95rem; }
.pub__actions:empty { display: none; }
.project__refs { list-style: none; padding: 0; font-size: 1rem; display: grid; gap: .75rem; }
.project__refs .apa { color: var(--muted); }

/* ---------- Press ---------- */
.press-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; }
.press { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; align-items: start; }
.press--noimg { grid-template-columns: 1fr; }
.press img { border-radius: var(--radius); border: 1px solid var(--border); width: 100%; }
.press__meta { font-size: .95rem; font-weight: 700; color: var(--accent); margin-bottom: .35rem; }
.press h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.press p { margin: 0; color: var(--muted); }
@media (max-width: 40rem) { .press { grid-template-columns: 1fr; } .press img { max-width: 18rem; } }

.outlets { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 1.25rem 0 0; }
.outlets li { font-weight: 700; padding: .35rem .9rem; border: 2px solid var(--border); border-radius: 999px; background: var(--surface); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: .7rem; top: .5rem; bottom: .5rem; width: 3px; background: var(--border); border-radius: 2px; }
.timeline > li { position: relative; padding-left: 2.75rem; padding-bottom: 2.25rem; }
.timeline > li::before { content: ""; position: absolute; left: 0; top: .35rem; width: 1.45rem; height: 1.45rem; border-radius: 50%; background: var(--bg); border: 4px solid var(--accent); }
.timeline > li.is-current::before { background: var(--sun); border-color: var(--text); }
.timeline__date { font-weight: 700; color: var(--accent); margin-bottom: .2rem; display: block; }
.timeline h2, .timeline h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.timeline p { margin-bottom: .4rem; color: var(--muted); }

/* ---------- Prose pages ---------- */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.6rem; margin-top: 2.25rem; }
.prose h3 { margin-top: 1.5rem; }
.prose li { margin-bottom: .4rem; }
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1.25rem; font-size: 1rem; }
.prose th, .prose td { text-align: left; border: 1px solid var(--border); padding: .6rem .75rem; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose code { font-size: .95em; background: var(--surface-2); padding: .1em .35em; border-radius: .3em; }
.table-wrap { overflow-x: auto; }
.callout { background: var(--accent-soft); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding-block: 3rem 2rem; margin-top: var(--space); font-size: 1rem; }
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: 1.5fr 1fr 1fr; }
.site-footer h2 { font-size: 1.05rem; margin-bottom: .75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.site-footer li a { display: inline-flex; align-items: center; gap: .45rem; min-height: var(--tap); }
.site-footer address { font-style: normal; color: var(--muted); }
.site-footer__bottom { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; color: var(--muted); }
.site-footer__bottom p { margin: 0; }
@media (max-width: 52rem) { .site-footer__grid { grid-template-columns: 1fr; } }

.to-top { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); font-weight: 700; }

/* Toast / live status */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 90;
  background: var(--text); color: var(--bg); padding: .75rem 1.25rem; border-radius: 999px; font-weight: 700;
  box-shadow: var(--shadow);
}
.toast:empty { display: none; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
:root[data-motion="reduce"] .reveal { opacity: 1 !important; transform: none !important; }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .skip-link, .video__frame, .pub__actions, .filters, .cta .btn, .header-tools { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .card, .pub, .press, .tile { box-shadow: none; border-color: #999; break-inside: avoid; }
  .feature, .cta { background: #fff; color: #000; border: 1px solid #999; }
}

/* ---------- Utilities (no inline styles: CSP forbids them) ---------- */
.pt-0 { padding-top: 0 !important; }
.pt-2 { padding-top: 2.5rem !important; }
.mt-1 { margin-top: 1rem; }
.mt-15 { margin-top: 1.5rem; }
.m-0 { margin: 0; }
.list-reset { list-style: none; padding: 0; margin: 0; }
.btn-col { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; }
.cta__email { text-align: center; font-weight: 700; margin: 0; }
.grid--split { align-items: start; gap: 3rem; }
.h-sm { font-size: 1.4rem; }
.btn--sm { min-height: var(--tap); padding: .3rem .9rem; margin-top: .5rem; }
.divider { margin: 3rem 0; border: 0; border-top: 1px solid var(--border); }

/* ---------- Header layout refinements (kept last to win the cascade) ---------- */
@media (min-width: 60.01rem) {
  .site-nav { flex-basis: 100%; }
}
@media (max-width: 34rem) {
  .prefs { position: static; }
  .site-header__inner { position: relative; }
  .prefs-panel { left: 0; right: 0; width: auto; }
  .award img { max-height: 28rem; object-fit: contain; }
}
@media (max-width: 36rem) {
  .apa { padding-left: 1.25em; text-indent: -1.25em; }
  .pub__actions { padding-left: 0; }
}

/* ---------- Error pages (404, 500, 505) ---------- */
.error-hero { padding-block: clamp(3rem, 8vw, 6rem) var(--space); position: relative; overflow: hidden; }
.error-hero::before {
  content: ""; position: absolute; inset: auto -10% -40% auto; width: 34rem; height: 34rem; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%); z-index: -1; pointer-events: none;
}
.error-hero__grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2rem; align-items: center; }
.error-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.error-code {
  margin: 0; justify-self: center; font-size: clamp(6rem, 18vw, 12rem); font-weight: 700; line-height: 1;
  letter-spacing: -.04em; color: var(--accent);
  text-shadow: .06em .06em 0 var(--sun);
}
:root[data-theme="contrast"] .error-code { text-shadow: none; }
.h-card { font-size: 1.3rem; }
@media (max-width: 52rem) {
  .error-hero__grid { grid-template-columns: 1fr; }
  .error-code { order: -1; justify-self: start; font-size: clamp(5rem, 24vw, 8rem); }
}

/* ---------- Round portrait ---------- */
.hero__portrait img { aspect-ratio: 1 / 1; border-radius: 50%; object-position: 50% 20%; }
.hero__portrait::after { inset: -.9rem; border-radius: 50%; border-width: 4px; }
.hero__badge { left: -1.5rem; bottom: .5rem; }
@media (max-width: 52rem) { .hero__portrait { width: min(60%, 15rem); margin: .9rem; } }

/* ---------- Spotlight (new project), tags, KPIs ---------- */
.spotlight {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center;
  background: var(--surface); border: 2px solid var(--accent); border-radius: 2rem;
  padding: clamp(1.5rem, 4vw, 3rem); box-shadow: var(--shadow);
}
.spotlight h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.spotlight__note { font-size: .95rem; color: var(--muted); }
@media (max-width: 52rem) { .spotlight { grid-template-columns: 1fr; } }
.kpis { display: flex; flex-wrap: wrap; gap: .75rem 2.5rem; margin: 1.25rem 0 .5rem; }
.kpis dt { font-size: .95rem; font-weight: 700; color: var(--muted); }
.kpis dd { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; line-height: 1.2; color: var(--accent); white-space: nowrap; }
.tag--accent { background: var(--accent-soft); border-color: var(--accent); }
.pub__tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .6rem; max-width: none; }
.pub-group > h2 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.pub-group > h2 .tag { letter-spacing: 0; }
.section__head p a { color: var(--accent); }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; max-width: none; }
