/* ──────────────────────────────────────────────────────────────
   Francesco Balassone — personal site
   Editorial paper + terminal ink. No build step.
   ────────────────────────────────────────────────────────────── */

:root {
  --paper: #f4f3ee;
  --paper-2: #ebeae3;
  --card: #fbfbf8;
  --ink: #1a1a19;
  --ink-2: #5f605b;
  --ink-3: #8b8c86;
  --line: #d6d5cd;
  --accent: #c2352a;        /* signal red */
  --accent-ink: #ffffff;
  --blue: #2d5fc9;         /* defense */
  --ok: #2f7d4b;
  --term-bg: #151514;
  --term-fg: #d9d8d0;
  --term-dim: #7b7b74;
  --term-red: #ff6b5e;
  --term-blue: #7fb3ff;
  --term-green: #8ad19b;

  --serif: "JetBrains Mono", ui-monospace, Menlo, monospace;   /* display face (headings) */
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 4px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --paper-2: #1b1b19;
    --card: #181816;
    --ink: #ecebe4;
    --ink-2: #a3a39b;
    --ink-3: #74746d;
    --line: #2d2d2a;
    --accent: #ff5f4f;
    --accent-ink: #121211;
    --blue: #6fa6ff;
    --ok: #5cc27e;
    --term-bg: #0b0b0a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121211;
  --paper-2: #1b1b19;
  --card: #181816;
  --ink: #ecebe4;
  --ink-2: #a3a39b;
  --ink-3: #74746d;
  --line: #2d2d2a;
  --accent: #ff5f4f;
  --accent-ink: #121211;
  --blue: #6fa6ff;
  --ok: #5cc27e;
  --term-bg: #0b0b0a;
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }

.mono { font-family: var(--mono); }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.display { font-family: var(--serif); letter-spacing: -0.02em; }
.display em, .section-title em { font-style: normal; color: var(--accent); }

kbd {
  font: 500 0.72em/1 var(--mono);
  display: inline-block;
  padding: 3px 5px 2px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  vertical-align: 0.1em;
}

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; }
.skip:focus { left: 8px; }

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { display: block; width: 30px; height: 30px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .dim { opacity: .5; }
.brand-mark .r { stroke: var(--accent); }
.brand-mark .b { stroke: var(--blue); }
.brand-mark .node { fill: var(--accent); stroke: none; }
.brand-mark .dim, .brand-mark .node { transition: opacity .25s, stroke .25s, transform .35s cubic-bezier(.2,.7,.2,1); }
.brand:hover .brand-mark .dim { opacity: 1; stroke: var(--accent); }
.brand:hover .brand-mark .node { transform: translate(-2px, 2px); }
.brand-name { font: 400 20px/1 var(--serif); letter-spacing: -0.012em; white-space: nowrap; }
.brand-name i { color: var(--ink-2); }
.nav { display: flex; align-items: center; gap: clamp(10px, 2vw, 26px); font: 400 13px/1 var(--mono); }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--ink); }
.nav a kbd, .theme-toggle kbd { margin-right: 1px; }
.theme-toggle {
  font: inherit; color: var(--ink-2); background: none; border: 0; padding: 0; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }

@media (max-width: 720px) {
  .brand-name { display: none; }
  .nav { gap: 12px; }
  .nav a { font-size: 11.5px; }
  .theme-label { display: none; }
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { padding-top: clamp(40px, 7vw, 88px); padding-bottom: 0; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.hero-meta .dot { width: 3px; height: 3px; background: var(--ink-3); border-radius: 50%; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--ok); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok) 60%, transparent); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero-grid {
  display: grid; gap: clamp(24px, 5vw, 72px);
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center; margin-top: clamp(20px, 3vw, 36px);
}
.hero-side { padding-bottom: 0; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }

.eyebrow { font-size: 12.5px; color: var(--ink-2); margin-bottom: 20px; letter-spacing: .01em; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 6.4vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px/1 var(--mono); text-decoration: none;
  padding: 13px 18px; border: 1px solid var(--ink); border-radius: var(--radius);
  transition: background-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn span { transition: transform .15s; }
.btn:hover span { transform: translateX(3px); }

/* Terminal figure */
.terminal {
  margin: 0; background: var(--term-bg); color: var(--term-fg);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 24px 48px -24px rgba(0,0,0,.35);
  border: 1px solid color-mix(in oklab, var(--term-bg) 80%, var(--ink-3));
}
.terminal-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; font-size: 11.5px; color: var(--term-dim);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.lights { display: flex; gap: 6px; }
.lights i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a37; }
.terminal-tag { margin-left: auto; letter-spacing: .08em; }
.terminal-body {
  margin: 0; padding: 18px 16px 8px; height: 270px; overflow: hidden;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.terminal-body .t-dim { color: var(--term-dim); }
.terminal-body .t-red { color: var(--term-red); }
.terminal-body .t-blue { color: var(--term-blue); }
.terminal-body .t-green { color: var(--term-green); }
.terminal-body .cursor { display: inline-block; width: 7px; height: 1.05em; background: var(--term-fg); vertical-align: -0.15em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.terminal figcaption { padding: 10px 16px 12px; font-size: 11px; color: var(--term-dim); border-top: 1px solid rgba(255,255,255,.07); }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(48px, 7vw, 80px) 0 0; border-top: 1px solid var(--line);
}
.stats > div { padding: 18px 16px 0 0; border-right: 1px solid var(--line); }
.stats > div:not(:first-child) { padding-left: 16px; }
.stats > div:last-child { border-right: 0; }
.stats dt { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.stats dd { margin: 6px 0 0; font: 400 clamp(28px, 4vw, 40px)/1.1 var(--serif); letter-spacing: -0.02em; }
.stats .stats-src dd { font: 400 13px/1.6 var(--mono); margin-top: 12px; }
.stats .stats-src a { text-decoration: none; color: var(--ink-2); }
.stats .stats-src a:hover { color: var(--accent); }
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats .stats-src { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-left: 0 !important; margin-top: 16px; padding-bottom: 0; }
  .stats > div:nth-child(3) { border-right: 0; }
}

/* ── Sections ─────────────────────────────────────────────────── */
.section { padding-top: clamp(64px, 9vw, 120px); padding-bottom: 8px; }
.section-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px 20px;
  padding-bottom: 20px; margin-bottom: clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--ink);
}
.section-num { font-size: 12px; color: var(--accent); letter-spacing: .06em; }
.section-title { font: 400 clamp(32px, 4.4vw, 52px)/1 var(--serif); letter-spacing: -0.025em; }
.section-sub { grid-column: 3; margin: 0; color: var(--ink-2); font-size: 15px; text-align: right; }
@media (max-width: 720px) {
  .section-head { grid-template-columns: auto 1fr; }
  .section-sub, .section-head .filter { grid-column: 1 / -1; text-align: left; justify-self: start; }
}

/* Research cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 900px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--paper); padding: clamp(22px, 2.6vw, 32px); display: flex; flex-direction: column; transition: background-color .2s; }
.card:hover { background: var(--card); }
.card-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.card h3 { font: 400 26px/1.15 var(--serif); letter-spacing: -0.015em; margin: 18px 0 12px; }
.card p { color: var(--ink-2); font-size: 15.5px; flex: 1; }
.card-refs { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.card-refs a {
  display: inline-block; text-decoration: none; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
  transition: border-color .15s, color .15s;
}
.card-refs a:hover { border-color: var(--accent); color: var(--accent); }

/* Filter */
.filter { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; font-size: 12px; }
.filter button {
  font: inherit; color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; transition: background-color .15s, color .15s;
}
.filter button.is-active { background: var(--ink); color: var(--paper); }

/* Featured paper */
.featured {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: clamp(22px, 3vw, 36px); margin-bottom: 40px;
}
.featured-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.featured-title { font: 400 clamp(24px, 3vw, 34px)/1.15 var(--serif); letter-spacing: -0.02em; margin: 14px 0 16px; max-width: 26em; }
.featured-title a { text-decoration: none; }
.featured > p { color: var(--ink-2); max-width: 46em; }
.featured-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 24px; font-size: 11.5px; }
@media (max-width: 720px) { .featured-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.featured-figs span { display: block; color: var(--ink-3); margin-bottom: 8px; min-height: 2.6em; }
.featured-figs b {
  display: block; position: relative; font-weight: 500; font-size: 13px; padding-top: 10px;
}
.featured-figs b::before {
  content: ""; position: absolute; top: 0; left: 0; height: 3px; border-radius: 2px;
  width: 100%; background: var(--paper-2);
}
.featured-figs b::after {
  content: ""; position: absolute; top: 0; left: 0; height: 3px; border-radius: 2px;
  width: calc(var(--v) * 1%); background: var(--ink);
  transform-origin: left; transform: scaleX(var(--grow, 1)); transition: transform 1s cubic-bezier(.2,.7,.2,1);
}
.featured-figs div:first-child b::after { background: var(--accent); }

/* Publication list */
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) 112px; gap: 16px 24px; align-items: start;
  padding: 20px 0; border-bottom: 1px solid var(--line);
}
.pubs li[hidden] { display: none; }
.pub-year { font-size: 12px; color: var(--ink-3); padding-top: 5px; }
.pub-title { font: 400 clamp(19px, 2vw, 22px)/1.3 var(--serif); letter-spacing: -0.01em; text-decoration: none; }
.pub-title:hover { text-decoration: underline; }
.pubs li[data-first] .pub-title::after {
  content: "1st"; font: 500 10px/1 var(--mono); letter-spacing: .05em;
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px;
  padding: 3px 6px 2px; margin-left: 10px; vertical-align: 0.25em;
}
.pub-authors { margin: 6px 0 2px; font-size: 14.5px; color: var(--ink-2); }
.pub-authors b { color: var(--ink); font-weight: 600; }
.pub-venue { margin: 0; font-size: 12px; color: var(--ink-3); }
@media (max-width: 600px) {
  .pubs li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pub-year { padding-top: 0; }
}
.more { margin-top: 24px; font-size: 13px; }
.more a { color: var(--ink-2); }

/* About */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
@media (max-width: 900px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }
.about-text p { color: var(--ink-2); max-width: 36em; }
.about-text strong { color: var(--ink); font-weight: 500; }
.about-lead { font: 400 clamp(22px, 2.4vw, 28px)/1.35 var(--serif) !important; color: var(--ink) !important; letter-spacing: -0.01em; }
.pull {
  margin: 32px 0 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--accent);
  font: 400 clamp(20px, 2.2vw, 24px)/1.35 var(--serif); color: var(--ink); max-width: 28em;
}
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tl-when { font-size: 12px; color: var(--ink-3); padding-top: 3px; }

.timeline b { display: block; font-weight: 500; }
.timeline span:not(.tl-when) { display: block; font-size: 14.5px; color: var(--ink-2); }
.interests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 44px; font-size: 12px; }
.interests span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); }

/* Contact */
.contact { padding-bottom: clamp(56px, 8vw, 100px); }
.contact-line { font-size: clamp(34px, 5.5vw, 68px); line-height: 1.05; margin-bottom: 40px; max-width: 14em; }
.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.links a {
  display: flex; align-items: baseline; gap: 20px; padding: 18px 0;
  border-bottom: 1px solid var(--line); text-decoration: none;
  font: 400 clamp(22px, 2.6vw, 30px)/1.2 var(--serif); letter-spacing: -0.01em;
  transition: padding-left .2s ease, color .15s;
}
.links a span { font-size: 12px; color: var(--ink-3); }
.links a i { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 16px; color: var(--ink-3); transition: transform .2s, color .15s; }
.links a:hover { padding-left: 10px; }
.links a:hover i { color: var(--accent); transform: translate(3px, -3px); }

/* Footer */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3);
}
.site-footer a { text-decoration: none; }
@media (max-width: 720px) { .footer-hint { display: none; } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.is-in { opacity: 1; transform: none; }

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

/* Highlights */
.hl { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.hl li {
  display: grid; grid-template-columns: 96px 96px minmax(0, 1fr); gap: 16px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.hl-when { font-size: 12px; color: var(--ink-3); padding-top: 5px; }
.hl-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); padding-top: 6px; }
.hl-body b { display: block; font: 400 clamp(19px, 2vw, 22px)/1.3 var(--serif); letter-spacing: -0.01em; }
.hl-body span { display: block; margin-top: 6px; font-size: 15px; color: var(--ink-2); max-width: 46em; }
@media (max-width: 600px) {
  .hl li { grid-template-columns: auto 1fr; gap: 4px 14px; }
  .hl-body { grid-column: 1 / -1; margin-top: 6px; }
}

/* About side column */
.side-label { font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 0 0 10px; }
.about-side .timeline + .side-label { margin-top: 36px; }
.timeline li:nth-child(-n+3) .tl-when { color: var(--ink-3); }
.timeline .tl-when { white-space: nowrap; }

/* ── Hero scene ───────────────────────────────────────────── */
.scene {
  position: relative; margin: 0 calc(var(--gutter) * -0.5) 0;
  height: clamp(280px, min(44vh, 30vw), 460px);
}
.scene canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.scene canvas.is-dragging { cursor: grabbing; }
.scene-tag, .scene-hint {
  position: absolute; left: 36px; font-size: 11px; color: var(--ink-3); letter-spacing: .06em; pointer-events: none;
}
.scene-tag { top: 14px; text-transform: uppercase; }
.scene-hint { bottom: 14px; }
.hud {
  position: absolute; right: 14px; bottom: 14px; margin: 0;
  display: grid; grid-template-columns: auto auto; gap: 1px 14px;
  font-size: 10.5px; line-height: 1.55; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 2px;
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  pointer-events: none;
}
.hud > div { display: contents; }
.hud dt { color: var(--ink-3); }
.hud dd { margin: 0; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; min-width: 8ch; }
.hud .hud-phase dt, .hud .hud-phase dd { color: var(--accent); padding-top: 3px; border-top: 1px solid var(--line); }
.hud .hud-phase dd { min-width: 24ch; }
@media (max-width: 700px) {
  .scene { height: 380px; margin-inline: calc(var(--gutter) * -1); }
  .scene-tag, .scene-hint { left: 16px; }
  .scene-hint { display: none; }
  .hud { right: 10px; bottom: 10px; font-size: 10px; }
  .hud > div:not(.hud-phase):nth-child(n+3) { display: none; }
  .hud .hud-phase dd { min-width: 0; }
}

/* ── Research figures ─────────────────────────────────────── */
.card-fig { margin: 0 0 20px; }
.card-fig canvas { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--paper); }
.card-fig figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 10.5px; color: var(--ink-3); }
.card-fig figcaption span:last-child { color: var(--ink-2); text-align: right; }

/* ── Featured with terminal ───────────────────────────────── */
.featured { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px clamp(24px, 4vw, 48px); align-items: start; }
.featured .featured-figs { grid-column: 1 / -1; }
.featured .terminal { align-self: stretch; }
@media (max-width: 900px) { .featured { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 701px) and (max-height: 820px) {
  .hud > div:nth-child(-n+4) { display: none; }
}

/* ── Scene controls: stage rail + caption ─────────────────── */
.scene-ctrl {
  display: flex; align-items: stretch; gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-inline: calc(var(--gutter) * -0.5);
}
.scene-play {
  flex: none; font-size: 11px; letter-spacing: .04em; color: var(--ink-2);
  background: none; border: 0; border-right: 1px solid var(--line);
  padding: 0 16px; cursor: pointer; min-width: 92px; text-align: left;
}
.scene-play:hover { color: var(--accent); }
.stages {
  list-style: none; margin: 0; padding: 0; display: flex; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.stages::-webkit-scrollbar { display: none; }
.stages li { flex: 1 0 auto; }
.stages button {
  position: relative; width: 100%; display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  font: inherit; font-size: 11px; text-align: left; white-space: nowrap;
  padding: 10px 12px 12px; background: none; border: 0; border-right: 1px solid var(--line);
  color: var(--ink-3); cursor: pointer; transition: color .2s, background-color .2s;
}
.stages li:last-child button { border-right: 0; }
.stages button:hover { color: var(--ink); background: var(--paper-2); }
.stages .st-n { font-size: 9.5px; opacity: .7; }
.stages button.is-done { color: var(--ink-2); }
.stages button.is-active { color: var(--accent); }
.stages button.is-def.is-active, .stages button.is-def.is-done { color: var(--blue); }
.stages button::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent);
}
.stages button.is-done::after { width: 100%; opacity: .35; }
.stages button.is-active::after { width: calc(var(--k, 0) * 100%); }
.stages button.is-def::after { background: var(--blue); }
.scene-caption {
  margin: 12px 0 clamp(28px, 4vw, 44px); min-height: 1.6em;
  font: 400 clamp(17px, 1.7vw, 20px)/1.4 var(--serif); color: var(--ink-2);
}
.scene-caption::before { content: "▸ "; font-style: normal; color: var(--accent); }
@media (max-width: 700px) {
  .scene-ctrl { margin-inline: calc(var(--gutter) * -1); }
  .scene-play { min-width: 0; padding: 0 12px; }
  .stages li { flex: none; }
}
.scene-caption.is-def::before { color: var(--blue); }
.hud.is-def .hud-phase dt, .hud.is-def .hud-phase dd { color: var(--blue); }


/* ══════════════════════════════════════════════════════════════
   BLOG
   ══════════════════════════════════════════════════════════════ */
.kicker { margin: 0 0 10px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.badge { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 2px 7px 1px; }
.posts-empty { color: var(--ink-3); font: 400 20px/1.4 var(--serif); }
.post-meta { margin: 0; font-size: 11.5px; color: var(--ink-3); }

/* Feed: featured card + rows with thumbnails */
.feature {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px);
  align-items: center; text-decoration: none; padding-bottom: 32px; border-bottom: 1px solid var(--line);
}
.feature-cover canvas, .row-thumb canvas, .nav-thumb canvas, .post-cover canvas, .gen-fig canvas {
  display: block; width: 100%; border: 1px solid var(--line); background: var(--paper);
}
.feature-cover canvas { aspect-ratio: 16 / 10; transition: border-color .2s; }
.feature:hover .feature-cover canvas, .row:hover .row-thumb canvas { border-color: var(--ink-3); }
.feature-title { font: 400 clamp(28px, 3.4vw, 40px)/1.08 var(--serif); letter-spacing: -0.025em; margin: 0 0 12px; }
.feature:hover .feature-title, .row:hover .row-title { color: var(--accent); }
.feature-desc { color: var(--ink-2); font-size: 16.5px; margin: 0 0 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 24px; align-items: center;
  padding: 24px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.row-title { font: 400 clamp(21px, 2.2vw, 25px)/1.2 var(--serif); letter-spacing: -0.012em; margin: 0 0 6px; transition: color .15s; }
.row-desc { color: var(--ink-2); font-size: 15px; margin: 0 0 8px; }
.row-thumb canvas { aspect-ratio: 4 / 3; }
@media (max-width: 760px) {
  .feature { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr) 96px; gap: 16px; }
  .row-desc { display: none; }
}

/* Blog index */
.blog-hero { padding-top: clamp(48px, 8vw, 96px); padding-bottom: clamp(32px, 5vw, 56px); border-bottom: 1px solid var(--ink); margin-bottom: 36px; }
.blog-h1 { font: 400 clamp(56px, 10vw, 128px)/0.95 var(--serif); letter-spacing: -0.04em; margin: 0 0 18px; }
.blog-sub { font: 400 clamp(19px, 2vw, 23px)/1.4 var(--serif); color: var(--ink-2); max-width: 30em; margin: 0 0 24px; }
.blog-feed { padding-bottom: clamp(56px, 8vw, 100px); }

/* ── Article ──────────────────────────────────────────────── */
.narrow { width: 100%; max-width: calc(680px + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.post { padding-bottom: clamp(56px, 8vw, 100px); }
.post-head { padding-top: clamp(32px, 6vw, 72px); }
.back { display: inline-block; font-size: 12px; color: var(--ink-3); text-decoration: none; margin-bottom: 28px; }
.back:hover { color: var(--accent); }
.post-h1 { font: 400 clamp(38px, 6vw, 64px)/1.03 var(--serif); letter-spacing: -0.032em; margin: 0 0 16px; }
.post-lede { font: 400 clamp(20px, 2.2vw, 24px)/1.4 var(--serif); color: var(--ink-2); margin: 0 0 28px; }
.byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.byline-avatar { display: block; flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.byline-who { display: flex; flex-direction: column; line-height: 1.35; }
.byline-who b { font-weight: 500; font-size: 15px; }
.byline-who span { font-size: 11.5px; color: var(--ink-3); }
.share { margin-left: auto; display: flex; gap: 6px; font-size: 11px; }
.share a, .share button {
  font: inherit; color: var(--ink-2); background: none; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px;
}
.share a:hover, .share button:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 600px) { .share { margin-left: 0; width: 100%; } }

.post-cover { max-width: 1080px; margin: 36px auto 44px; padding-inline: var(--gutter); }
.post-cover canvas { aspect-ratio: 21 / 9; }
.post-cover figcaption, .gen-fig figcaption, .img-fig figcaption {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--ink-3);
}
@media (max-width: 600px) { .post-cover canvas { aspect-ratio: 4 / 3; } }

/* ── Prose ────────────────────────────────────────────────── */
.prose { font-size: 18.5px; line-height: 1.75; counter-reset: h2; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose p { margin-bottom: 0; }
.prose a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 600; }
.prose mark { background: color-mix(in oklab, var(--accent) 20%, transparent); color: inherit; padding: 0 .15em; border-radius: 2px; }
.prose del { color: var(--ink-3); }
.prose kbd { font-size: .72em; }
.prose code { font: 0.84em/1 var(--mono); background: var(--paper-2); border: 1px solid var(--line); padding: 2px 5px; border-radius: 3px; }

/* Headings: numbered h2 with a rule, serif h3, mono h4 */
.prose h2, .prose h3, .prose h4 { position: relative; scroll-margin-top: 80px; }
.prose h2 {
  counter-increment: h2; margin-top: 2.2em !important;
  font: 400 clamp(28px, 3.2vw, 34px)/1.15 var(--serif); letter-spacing: -0.02em;
  padding-top: 18px; border-top: 1px solid var(--ink);
}
.prose h2::before {
  content: counter(h2, decimal-leading-zero); display: block; margin-bottom: 8px;
  font: 400 11px/1 var(--mono); letter-spacing: .08em; color: var(--accent);
}
.prose h3 { font: 400 23px/1.25 var(--serif); letter-spacing: -0.012em; margin-top: 1.7em !important; }
.prose h4 { font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-top: 1.8em !important; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .55em; }
.prose .anchor { position: absolute; right: 100%; padding-right: 10px; color: var(--ink-3); text-decoration: none; opacity: 0; font: 400 .6em var(--mono); bottom: .3em; transition: opacity .15s; }
.prose h2 .anchor { bottom: auto; top: 19px; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }

/* Lists */
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose ul > li::marker { content: "▸  "; color: var(--accent); font-size: .8em; }
.prose ol > li::marker { font: .8em var(--mono); color: var(--ink-3); }
.prose ul.tasks { list-style: none; padding-left: 0; }
.prose ul.tasks li { display: flex; gap: 12px; align-items: baseline; }
.prose ul.tasks li::marker { content: none; }
.prose .check {
  flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; transform: translateY(2px);
  border: 1px solid var(--ink-3); border-radius: 3px; font: 11px/1 var(--mono); color: var(--paper);
}
.prose li.done .check { background: var(--ink); border-color: var(--ink); }
.prose li.done { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* Quotes */
.prose blockquote { margin-inline: 0; padding: 2px 0 2px 22px; border-left: 2px solid var(--ink); color: var(--ink); font: 400 21px/1.55 var(--serif); }
.prose blockquote > * + * { margin-top: .8em; }
.pullquote { margin: 2em 0 !important; text-align: center; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; }
.pullquote::before {
  content: "“"; position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  padding: 0 14px; background: var(--paper); color: var(--accent); font: 400 56px/1 var(--serif);
}
.pullquote blockquote { border: 0; padding: 0; margin: 0; font: 400 clamp(25px, 3vw, 32px)/1.3 var(--serif); letter-spacing: -0.015em; color: var(--ink); }
.pullquote figcaption { margin-top: 16px; font-size: 11.5px; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }

/* Callouts — technical-drawing annotation: tag on the border, hatched edge, registration mark */
.callout {
  --c: var(--ink-2);
  --cb: color-mix(in oklab, var(--c) 42%, var(--line));
  position: relative; margin-top: 1.9em !important; margin-bottom: .3em !important;
  padding: 24px 22px 18px 30px;
  border: 1px solid var(--cb); border-radius: 2px;
  background: color-mix(in oklab, var(--c) 5%, var(--paper));
  font-size: 16.5px; line-height: 1.65;
}
.callout::before {                     /* hatched edge strip */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px;
  border-right: 1px solid var(--cb);
  background: repeating-linear-gradient(-45deg, color-mix(in oklab, var(--c) 55%, transparent) 0 1px, transparent 1px 5px);
}
.callout::after {                      /* registration mark, bottom-right */
  content: ""; position: absolute; right: -4px; bottom: -4px; width: 7px; height: 7px;
  border-right: 1px solid var(--c); border-bottom: 1px solid var(--c);
}
.callout-tag {
  position: absolute; top: 0; left: 22px; transform: translateY(-50%); margin: 0 !important;
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px;
  background: var(--paper); border: 1px solid var(--cb); border-radius: 2px;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--c); line-height: 1.4;
}
.callout-tag svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.callout-body > * + * { margin-top: .6em; }
.callout-body p { margin: 0; }
.callout-title { font: 500 19px/1.3 var(--serif) !important; letter-spacing: -0.01em; color: var(--ink); }
.callout-body ul, .callout-body ol { padding-left: 1.2em; }
.callout-tip { --c: var(--ok); }
.callout-info, .callout-defense { --c: var(--blue); }
.callout-idea { --c: #b4862c; }
.callout-warning { --c: #c08a1e; }
.callout-danger, .callout-offense { --c: var(--accent); }
.callout-note { --c: var(--ink-2); }

/* Toggle */
.toggle { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle + .toggle { margin-top: 0 !important; border-top: 0; }
.toggle summary {
  list-style: none; cursor: pointer; padding: 14px 0; display: flex; align-items: center; gap: 12px;
  font: 500 16px/1.4 var(--sans);
}
.toggle summary::-webkit-details-marker { display: none; }
.toggle summary::before {
  content: "+"; flex: none; display: grid; place-items: center; width: 20px; height: 20px;
  border: 1px solid var(--line); border-radius: 3px; font: 13px/1 var(--mono); color: var(--accent); transition: transform .2s;
}
.toggle[open] summary::before { content: "−"; }
.toggle summary:hover { color: var(--accent); }
.toggle-body { padding: 0 0 18px 32px; font-size: 17px; }
.toggle-body > * + * { margin-top: .8em; }

/* Stats */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stat-tiles > div { padding: 16px 16px 16px 0; }
.stat-tiles > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stat-tiles b { display: block; font: 400 clamp(34px, 4vw, 44px)/1 var(--serif); letter-spacing: -0.02em; font-weight: 400; color: var(--accent); }
.stat-tiles span { display: block; margin-top: 8px; font: 12px/1.45 var(--mono); color: var(--ink-2); }

/* Bookmark */
.bookmark {
  display: grid; grid-template-columns: minmax(0, 1fr) 150px; text-decoration: none !important;
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden; transition: border-color .15s;
}
.bookmark:hover { border-color: var(--accent); }
.bookmark-text { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 0; }
.bookmark-text b { font: 500 16px/1.35 var(--sans); color: var(--ink); }
.bookmark-text span { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.bookmark-url { font-size: 11px !important; color: var(--ink-3) !important; margin-top: 4px; }
.bookmark-art { display: block; width: 100%; height: 100%; min-height: 96px; border-left: 1px solid var(--line); background: var(--paper); }
@media (max-width: 600px) { .bookmark { grid-template-columns: minmax(0, 1fr) 90px; } }

/* Figures */
.gen-fig, .img-fig { margin-inline: 0; }
.gen-fig canvas { aspect-ratio: 16 / 9; }
.img-fig img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.gen-fig figcaption span, .img-fig figcaption span, .post-cover figcaption span:first-child { color: var(--accent); flex: none; }
.gen-fig figcaption, .img-fig figcaption { justify-content: flex-start; }
@media (min-width: 900px) { .gen-fig, .img-fig { margin-inline: -60px; } }

/* Code + terminal */
.codeblock, .term { margin-inline: 0; border-radius: 6px; overflow: hidden; background: var(--term-bg); border: 1px solid color-mix(in oklab, var(--term-bg) 80%, var(--ink-3)); }
.codeblock-bar, .term-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; font-size: 11px; color: var(--term-dim);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.codeblock-lang { text-transform: uppercase; letter-spacing: .08em; }
.copy-code { margin-left: auto; font: inherit; color: var(--term-dim); background: none; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; padding: 2px 8px; cursor: pointer; }
.copy-code:hover { color: var(--term-fg); }
.codeblock pre, .term pre { margin: 0; padding: 16px 18px; overflow-x: auto; color: var(--term-fg); font: 13.5px/1.7 var(--mono); }
.codeblock code { background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.term .t-dim { color: var(--term-dim); }
.term .t-red { color: var(--term-red); }
.term .t-blue { color: var(--term-blue); }
.term .t-green { color: var(--term-green); }

/* Tables */
.table-wrap { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th { font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--ink); }
.prose td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Columns */
.columns { display: grid; gap: 28px; }
.columns-2 { grid-template-columns: 1fr 1fr; }
.columns-3 { grid-template-columns: 1fr 1fr 1fr; }
.columns > div > * + * { margin-top: .8em; }
@media (max-width: 700px) { .columns { grid-template-columns: 1fr; } }

/* TOC, dividers */
.toc { border-left: 2px solid var(--line); padding: 2px 0 2px 18px; }
.toc p { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.toc ol { margin: 0; padding-left: 0; list-style: none; counter-reset: t; font-size: 15px; }
.toc li { counter-increment: t; margin: 4px 0; }
.toc li::before { content: counter(t, decimal-leading-zero) "  "; font: 11px var(--mono); color: var(--accent); }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--accent); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }
.ornament { display: flex; align-items: center; gap: 16px; margin: 2.6em 0 !important; color: var(--accent); }
.ornament span { flex: 1; height: 1px; background: var(--line); }
.ornament i { font-style: normal; font-size: 10px; }

/* Post footer */
.post-foot { margin-top: 64px; }
.end-card { text-align: center; padding: 8px 0 36px; border-bottom: 1px solid var(--line); }
.end-card .ornament { margin: 0 0 28px !important; }
.end-title { font: 400 34px/1.1 var(--serif); letter-spacing: -0.02em; margin: 0 0 10px; }
.end-sub { color: var(--ink-2); margin: 0 auto 22px; max-width: 28em; }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.end-actions .share { margin-left: 0; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.nav-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 14px; align-items: start; text-decoration: none; padding: 12px; border: 1px solid var(--line); border-radius: 4px; transition: border-color .15s; }
.nav-card:hover { border-color: var(--accent); }
.nav-thumb { grid-row: 1 / 3; }
.nav-thumb canvas { aspect-ratio: 4 / 3; }
.nav-card span { font-size: 11px; color: var(--ink-3); }
.nav-card b { font: 400 16px/1.3 var(--serif); }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } }

/* Home: writing section uses the same feed */
#writing .feature { padding-top: 4px; }

/* Category chips + kicker */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; font-size: 12px; }
.chips button {
  font: inherit; color: var(--ink-2); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; transition: color .15s, border-color .15s, background-color .15s;
}
.chips button span { color: var(--ink-3); margin-left: 4px; }
.chips button:hover { border-color: var(--ink-3); color: var(--ink); }
.chips button.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chips button.is-active span { color: color-mix(in oklab, var(--paper) 65%, transparent); }
.blog-feed [hidden], #writing [hidden] { display: none !important; }
.kicker .cat { color: var(--accent); }
.kicker { color: var(--ink-3); }
.columns .gen-fig { margin-inline: 0 !important; }

.hero .scene { margin-top: clamp(40px, 6vw, 72px); }
.hero .scene-caption { margin-bottom: 0; }

/* Hero figure (right column) */
.hero-fig { margin: 0 0 28px; }
.hero-fig canvas { aspect-ratio: 16 / 10; }
@media (max-width: 900px) { .hero-fig { display: none; } }

/* Syntax highlighting */
.codeblock code { color: #d9d8d0; }
.tk-com { color: #7b7b74; font-style: italic; }
.tk-kw { color: #ff7b6e; }
.tk-str { color: #9fd6a6; }
.tk-num, .tk-const { color: #f0b36a; }
.tk-fn { color: #82b6ff; }
.tk-def { color: #82b6ff; font-weight: 600; }
.tk-builtin { color: #c6a4ff; }
.tk-type { color: #f6d58e; }
.tk-dec { color: #c6a4ff; }
.tk-self { color: #ff9e93; font-style: italic; }
.tk-var { color: #f0b36a; }
.tk-flag { color: #c6a4ff; }
.tk-key { color: #82b6ff; }

/* Page background: topographic survey map (drawn by graphics.js) */
#bg {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 46% 62% at 50% 46%, rgba(0,0,0,.08) 0%, rgba(0,0,0,.35) 55%, #000 100%);
          mask-image: radial-gradient(ellipse 46% 62% at 50% 46%, rgba(0,0,0,.08) 0%, rgba(0,0,0,.35) 55%, #000 100%);
}
main, .site-footer { position: relative; z-index: 1; }

/* CTF team */
.team { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
@media (max-width: 900px) { .team { grid-template-columns: minmax(0, 1fr); } }
@font-face {
  font-family: "Napoli"; src: url("fonts/Napoli.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
.team-brand { display: inline-flex; align-items: center; gap: 18px; margin-bottom: 14px; text-decoration: none; }
.team-brand img { display: block; width: 88px; height: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.team-name { display: block; font: 400 clamp(56px, 7vw, 92px)/1 "Napoli", var(--sans); letter-spacing: .01em; text-transform: uppercase; color: var(--ink); text-box: trim-both cap alphabetic; margin-top: 10px; }
.team-brand:hover .team-name { color: var(--accent); }
.team-stats b { font-family: "Napoli", var(--serif) !important; letter-spacing: .01em !important; }
.team-lead { font: 400 clamp(21px, 2.2vw, 26px)/1.35 var(--serif) !important; color: var(--ink) !important; margin-bottom: 14px; }
.team-lead strong { font-weight: 500; }
.team-text > p:not(.team-name):not(.team-lead) { color: var(--ink-2); max-width: 36em; }
.team-stats { margin: 26px 0 22px; }
.team-links { margin: 0; }
.team-fig { margin: 0; }
.team-fig canvas { aspect-ratio: 4 / 3.2; }

/* ══════════════════════════════════════════════════════════════
   FX
   ══════════════════════════════════════════════════════════════ */
/* 1. Attack path */
.attack-path { position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; overflow: visible; }
.attack-path.is-hidden { display: none; }
.ap-route { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 6; opacity: .45; }
.ap-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.ap-head { opacity: 0; transition: opacity .3s; }
.attack-path.is-started .ap-head { opacity: 1; }
.attack-path.is-contained .ap-head { opacity: 0; }
.ap-dot { fill: var(--accent); }
.ap-ring { fill: none; stroke: var(--accent); stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: apPulse 1.6s ease-out infinite; }
@keyframes apPulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.ap-node rect { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; transition: fill .25s, stroke .25s; }
.ap-node text { font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; fill: var(--ink-3); opacity: .55; transition: fill .25s, opacity .25s; }
.ap-node.is-on rect { fill: var(--accent); stroke: var(--accent); }
.ap-node.is-on text { fill: var(--accent); opacity: 1; }
.ap-node.is-last rect { display: none; }
.ap-node.is-last.is-on text { fill: var(--blue); }
.attack-path.no-labels .ap-node text { display: none; }
.ap-shield { opacity: 0; transition: opacity .4s; }
.ap-shield path { fill: var(--paper); stroke: var(--blue); stroke-width: 1.3; stroke-linejoin: round; }
.ap-shield .ap-shield-in { fill: none; opacity: .6; }
.attack-path.is-contained .ap-shield { opacity: 1; }
.attack-path.is-contained .ap-line { stroke: color-mix(in oklab, var(--accent) 55%, var(--blue)); transition: stroke .6s; }

/* 3. Reticle */
.fx-cursor canvas[data-fig], .fx-cursor #scene, .fx-cursor .post-cover canvas { cursor: none; }
.reticle { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .15s; }
.reticle.is-on { opacity: 1; }
.reticle i { position: fixed; display: block; }
.reticle .rx { height: 1px; background: var(--accent); opacity: .45; }
.reticle .ry { width: 1px; background: var(--accent); opacity: .45; }
.reticle .rc { width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 1px solid var(--accent); border-radius: 50%; }
.reticle .rr {
  position: fixed; font: 10px/1.4 var(--mono); color: var(--accent); white-space: pre;
  background: color-mix(in oklab, var(--paper) 88%, transparent); border: 1px solid var(--line); padding: 2px 6px;
}

/* 4. Console */
.console {
  position: fixed; left: 50%; bottom: 16px; z-index: 80; width: min(780px, calc(100vw - 24px)); height: min(440px, 62vh);
  display: flex; flex-direction: column; transform: translate(-50%, calc(100% + 40px)); transition: transform .35s cubic-bezier(.2,.7,.2,1);
  background: var(--term-bg); color: var(--term-fg); border: 1px solid color-mix(in oklab, var(--term-bg) 70%, var(--ink-3));
  border-radius: 8px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); overflow: hidden;
}
.console.is-open { transform: translate(-50%, 0); }
.console-bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; font-size: 11.5px; color: var(--term-dim); border-bottom: 1px solid rgba(255,255,255,.07); }
.console-bar .lights i:first-child { background: var(--term-red); }
.console-x { margin-left: auto; font: inherit; color: var(--term-dim); background: none; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; padding: 1px 7px; cursor: pointer; }
.console-x:hover { color: var(--term-fg); }
.console-out { flex: 1; cursor: text; overflow-y: auto; padding: 14px 16px 4px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.console-out a { color: var(--term-blue); }
.cl.cmd { color: var(--term-fg); margin-top: 6px; }
.cl.dim { color: var(--term-dim); }
.cl.red { color: var(--term-red); }
.cl.blue { color: var(--term-blue); }
.cl.green { color: var(--term-green); }
.console-in { display: flex; gap: 8px; align-items: center; padding: 10px 16px 14px; font-size: 13px; }
.console-ps { color: var(--term-green); white-space: nowrap; }
.console-in input { flex: 1; min-width: 0; font: inherit; color: var(--term-fg); background: none; border: 0; outline: none; caret-color: var(--term-red); }

/* 5. Pwned badge */
.pwned { color: var(--accent); border: 1px solid currentColor; border-radius: 2px; padding: 2px 8px; letter-spacing: .06em; }
.shell-hint { cursor: pointer; }

/* Paper thumbnails */
.pub-thumb canvas { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--paper); transition: border-color .2s; }
.pubs li:hover .pub-thumb canvas { border-color: var(--ink-3); }
@media (max-width: 600px) { .pub-thumb { display: none; } }

/* ── View transitions ─────────────────────────────────────── */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
#bg { view-transition-name: bg; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2,.7,.2,1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }
/* Theme switch: circular wipe from the toggle */
html.theme-wipe::view-transition-old(root) { animation: none; }
html.theme-wipe::view-transition-new(root) { animation: wipe .65s cubic-bezier(.2,.7,.2,1); }
@keyframes wipe {
  from { clip-path: circle(0 at var(--wipe-x, 100%) var(--wipe-y, 0)); }
  to   { clip-path: circle(var(--wipe-r, 150vmax) at var(--wipe-x, 100%) var(--wipe-y, 0)); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* 6. Red alert */
html[data-alert] {
  --line: color-mix(in oklab, var(--accent) 40%, var(--paper));
  --ink-3: color-mix(in oklab, var(--accent) 55%, var(--ink-2));
}
html[data-alert] body { background: color-mix(in oklab, var(--accent) 8%, var(--paper)); }
html[data-alert] body::after {
  content: ""; position: fixed; inset: 0; z-index: 70; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 180px color-mix(in oklab, var(--accent) 35%, transparent);
  animation: alertPulse 1s ease-in-out infinite;
}
@keyframes alertPulse { 50% { opacity: .35; } }
html[data-alert] .section-title, html[data-alert] .hero h1 { animation: alertShake .18s steps(2) infinite; }
@keyframes alertShake { 50% { transform: translateX(1px); } }
.alert-banner {
  position: fixed; top: 72px; left: 50%; z-index: 90; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: var(--accent); color: #fff; font-size: 12px; letter-spacing: .06em; border-radius: 2px;
  box-shadow: 0 12px 40px -10px rgba(0,0,0,.5);
  background-image: repeating-linear-gradient(-45deg, rgba(0,0,0,.12) 0 6px, transparent 6px 12px);
  transition: background-color .3s, opacity .4s, transform .4s;
}
.alert-banner b { font-weight: 600; }
.alert-banner span { opacity: .85; }
.alert-banner.is-blue { background-color: var(--blue); color: #0b1220; }
.alert-banner.is-out { opacity: 0; transform: translate(-50%, -10px); }
@media (prefers-reduced-motion: reduce) { html[data-alert] body::after, html[data-alert] .section-title, html[data-alert] .hero h1 { animation: none; } }

/* Hero identity lockup (logo + name) */
.hero-id { display: flex; align-items: center; gap: .32em; margin: 0 0 28px; font: 400 clamp(34px, 3.9vw, 56px)/1 var(--serif); }
.hero-mark { width: 1.36em; height: 1.36em; margin: -0.16em 0 -0.16em calc(-1.36em * 9 / 32 + 0.02em); } /* stem flush with the text edge */
.hero-mark svg { stroke-width: 1.25; }
.hero-name { white-space: nowrap; font: inherit; text-box: trim-both cap alphabetic; letter-spacing: -0.02em; color: var(--ink); }
.hero-name i { color: var(--ink-2); }
.hero-id:hover .brand-mark .dim { opacity: 1; stroke: var(--accent); }
.hero-id:hover .brand-mark .node { transform: translate(-2px, 2px); }   /* same as the header mark */

/* Scene log window */
.logwin {
  position: absolute; left: 18px; bottom: 18px; z-index: 5; width: min(560px, calc(100% - 36px)); max-height: 66%;
  display: flex; flex-direction: column; background: color-mix(in oklab, var(--term-bg) 94%, transparent);
  border: 1px solid color-mix(in oklab, var(--term-bg) 60%, var(--ink-3)); border-radius: 6px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: logIn .25s cubic-bezier(.2,.7,.2,1);
}
.logwin[hidden] { display: none; }
@keyframes logIn { from { opacity: 0; transform: translateY(8px); } }
.logwin.is-off { border-color: color-mix(in oklab, var(--accent) 45%, var(--term-bg)); }
.logwin.is-def { border-color: color-mix(in oklab, var(--blue) 45%, var(--term-bg)); }
.logwin-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 11px; color: var(--term-dim); border-bottom: 1px solid rgba(255,255,255,.07); }
.logwin-title { color: var(--term-fg); }
.logwin.is-off .logwin-title { color: var(--term-red); }
.logwin.is-def .logwin-title { color: var(--term-blue); }
.logwin-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.logwin-x { margin-left: auto; flex: none; font: inherit; color: var(--term-dim); background: none; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; padding: 1px 7px; cursor: pointer; }
.logwin-x:hover { color: var(--term-fg); }
.logwin-body { overflow-y: auto; padding: 10px 12px; font-size: 11.5px; line-height: 1.6; color: var(--term-fg); }
.ll { white-space: pre-wrap; word-break: break-word; padding-left: 7.2em; text-indent: -7.2em; }
.ll-t { color: var(--term-dim); margin-right: 1.2em; }
.ll.red { color: var(--term-red); }
.ll.blue { color: var(--term-blue); }
.ll.dim { color: var(--term-dim); }
.ll.is-new { animation: llIn .5s ease-out; }
@keyframes llIn { from { background: rgba(255,255,255,.08); } }
.logwin-foot { padding: 6px 12px 8px; font-size: 10px; color: var(--term-dim); border-top: 1px solid rgba(255,255,255,.06); }
@media (max-width: 700px) { .logwin { left: 8px; right: 8px; width: auto; bottom: 8px; max-height: 72%; } }
.logwin.is-right { left: auto; right: 18px; }

/* Affiliations strip */
.affil { margin: clamp(40px, 6vw, 64px) 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.logos {
  list-style: none; margin: 0; padding: 24px 0 20px;
  display: flex; align-items: center; justify-content: center; gap: 24px clamp(40px, 6vw, 80px);
}
.logos li { display: flex; align-items: center; justify-content: center; }
.logos-former {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 0; padding: 12px 0 14px; border-top: 1px dashed var(--line);
}
.logos-former span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.logos-former a { opacity: .5; transition: opacity .2s; }
.logos-former a:hover { opacity: .9; }
.logos-former .logo-alias { height: 15px; width: auto; display: block; }
.logos a { display: flex; align-items: center; gap: 10px; text-decoration: none; opacity: .72; transition: opacity .2s; }
.logos a:hover { opacity: 1; }
.logos img { display: block; width: auto; }
.logo-cr { height: 38px; }
.logo-alias { height: 21px; }
.logo-unina { height: 40px; }
.logo-napwnli img { height: 38px; }
.logo-napwnli span { font: 400 30px/1 "Napoli", var(--sans); letter-spacing: .01em; color: #fff; text-box: trim-both cap alphabetic; }
@media (max-width: 760px) {
  .logos { display: grid; grid-template-columns: 1fr 1fr 1fr; justify-items: center; gap: 16px; }
  .logo-cr { height: 24px; } .logo-unina { height: 32px; }
  .logo-napwnli img { height: 30px; } .logo-napwnli span { font-size: 24px; }
}
.hero .affil + .scene { margin-top: clamp(28px, 4vw, 44px); }

/* Research: home lab */
.lab { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 56px); align-items: center; margin-bottom: clamp(36px, 5vw, 56px); }
@media (max-width: 900px) { .lab { grid-template-columns: minmax(0, 1fr); } }
.lab-kicker { margin: 0 0 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.lab-lead { font: 400 clamp(21px, 2.2vw, 26px)/1.35 var(--serif); color: var(--ink); margin-bottom: 14px; }
.lab-lead strong, .lab-text strong { font-weight: 500; color: var(--ink); }
.lab-text > p:not(.lab-lead):not(.lab-kicker) { color: var(--ink-2); max-width: 34em; }
.lab-dark { color: var(--accent) !important; letter-spacing: .04em; }
.lab-fig { margin: 0; }
.lab-fig canvas { aspect-ratio: 16 / 10.5; }

/* About: places map */
.places-fig { margin: clamp(40px, 6vw, 64px) 0 0; }
.places-fig canvas { aspect-ratio: 21 / 8; }
@media (max-width: 700px) { .places-fig canvas { aspect-ratio: 4 / 3; } }

/* Publications: talks sub-list · About: award line */
.sub-head { margin: clamp(48px, 6vw, 72px) 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); font: 700 clamp(22px, 2.4vw, 28px)/1.2 var(--serif); letter-spacing: -0.03em; color: var(--ink); }
.talks { border-top: 0; }
.talks li { grid-template-columns: 72px minmax(0, 1fr) 112px; }   /* same column as the paper glyphs */
.talk-thumb { position: relative; display: block; border: 1px solid var(--line); background: var(--paper); line-height: 0; overflow: hidden; transition: border-color .2s; }
.talk-thumb img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 30% 50%; filter: saturate(.85) brightness(.9); transition: filter .25s, transform .4s cubic-bezier(.2,.7,.2,1); }
.talk-thumb:hover { border-color: var(--accent); }
.talk-thumb:hover img { filter: none; transform: scale(1.03); }
.talk-play {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: color-mix(in oklab, var(--paper) 70%, transparent); border: 1px solid var(--accent);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); transition: background-color .2s;
}
.talk-play::after { content: ""; position: absolute; left: 11px; top: 8.5px; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--accent); }
.talk-thumb:hover .talk-play { background: var(--accent); }
.talk-thumb:hover .talk-play::after { border-left-color: #fff; }
@media (max-width: 600px) { .talks li { grid-template-columns: minmax(0, 1fr); } .talk-thumb { display: none; } }
.timeline .tl-award { margin-top: 4px; color: var(--accent) !important; font-size: 13.5px !important; }

/* Timeline logos */
.timeline li { grid-template-columns: 72px 44px minmax(0, 1fr); gap: 14px; align-items: start; }
.tl-logo { display: grid; place-items: center; width: 40px; height: 40px; align-self: center; }
.tl-logo img { display: block; width: 40px; height: 40px; object-fit: contain; opacity: .85; }
.timeline li:hover .tl-logo img { opacity: 1; }
.tl-badge { border: 1px solid var(--line); border-radius: 50%; font-size: 9.5px; letter-spacing: .04em; color: var(--ink-2); }
.pub-venue a { color: var(--ink-2); }
.pub-venue a:hover { color: var(--accent); }

/* Timeline: current roles read as "live" */
.timeline li.is-now {
  position: relative; margin: 8px -14px; padding: 14px; border: 1px solid color-mix(in oklab, var(--ink) 13%, transparent); border-radius: 3px;
  background: linear-gradient(100deg, color-mix(in oklab, var(--accent) 9%, transparent), color-mix(in oklab, var(--ink) 2%, transparent) 55%, transparent);
}
.timeline li.is-now + li:not(.is-now) { border-top: 0; }
.timeline li.is-now::before, .timeline li.is-now::after { content: ""; position: absolute; width: 10px; height: 10px; border: 0 solid var(--accent); pointer-events: none; }
.timeline li.is-now::before { left: -1px; top: -1px; border-left-width: 2px; border-top-width: 2px; border-top-left-radius: 3px; }
.timeline li.is-now::after { right: -1px; bottom: -1px; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 3px; }
.timeline li.is-now:hover { border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.timeline li.is-now b { color: var(--ink); }
.timeline li:not(.is-now) b { color: color-mix(in oklab, var(--ink) 82%, var(--paper)); }
.tl-now {
  display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 3px; margin-top: 5px;
  font-style: normal; font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.tl-now i { width: 6px; height: 11px; background: var(--accent); animation: tl-blink 1.1s steps(1) infinite; }
@keyframes tl-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tl-now i { animation: none; } }
.timeline li.is-now .tl-when { color: var(--ink-2); }

/* About: neofetch card */
.fetch {
  margin: 32px 0 0; max-width: 34em; background: var(--term-bg); color: var(--term-fg);
  border: 1px solid color-mix(in oklab, var(--term-bg) 70%, var(--ink-3)); border-radius: 6px; overflow: hidden;
  cursor: pointer; transition: border-color .2s, transform .2s;
}
.fetch:hover { border-color: color-mix(in oklab, var(--accent) 55%, var(--term-bg)); }
.fetch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fetch-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: 11px; color: var(--term-dim); border-bottom: 1px solid rgba(255,255,255,.07); }
.fetch-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; padding: 16px 18px 6px; align-items: start; }
.fetch-art { margin: 2px 0 0; font: 11px/1.18 var(--mono); letter-spacing: -0.02em; color: var(--term-fg); }
.fetch-art b { font-weight: 400; color: var(--term-fg); }
.fetch-art i { font-style: normal; color: #55554f; }
.fetch-art em { font-style: normal; color: var(--term-red); }
.fetch-info { margin: 0; font-size: 12px; line-height: 1.62; }
.fetch-info > div { display: flex; gap: 8px; min-width: 0; }
.fetch-info dt { color: var(--term-red); flex: none; }
.fetch-info dt::after { content: ":"; color: var(--term-dim); }
.fetch-info dd { margin: 0; color: var(--term-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fetch-host .u { color: var(--term-red); } .fetch-host .h { color: var(--term-blue); }
.fetch-rule { color: var(--term-dim); letter-spacing: -0.05em; }
.fetch-colors { gap: 0 !important; margin-top: 8px; }
.fetch-colors i { width: 18px; height: 12px; background: var(--c); }
.fetch-prompt { display: flex; align-items: center; gap: 6px; padding: 14px 18px 0; font-size: 12px; color: var(--term-dim); }
.fetch-prompt span:first-child { color: var(--term-fg); }
.fetch-body { padding-bottom: 16px !important; }
.fetch-cursor { width: 7px; height: 14px; background: var(--term-fg); animation: blink 1s steps(1) infinite; }
/* reveal line by line (fx.js adds .is-in) */
.fetch.will-reveal .fetch-info > div, .fetch.will-reveal .fetch-art { opacity: 0; transform: translateX(-4px); }
.fetch.is-in .fetch-info > div, .fetch.is-in .fetch-art { opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; transition-delay: calc(var(--i, 0) * 70ms); }
@media (max-width: 520px) { .fetch-body { grid-template-columns: minmax(0, 1fr); } .fetch-art { display: none; } }

/* ══════════════════════════════════════════════════════════════
   TYPE SYSTEM — JetBrains Mono (display) + Inter Tight (text)
   Mono runs wide, so display sizes step down; no italics anywhere.
   ══════════════════════════════════════════════════════════════ */
body { font-size: 16.5px; }
em, i, .display em, .section-title em { font-style: normal; }

/* Headline: attack/defend as tags */
.hero h1 { font: 700 clamp(32px, 4.6vw, 56px)/1.08 var(--serif); letter-spacing: -0.045em; }
.hero h1 em { color: var(--accent); }
.hero h1 em.def { color: var(--blue); }
.hero h1 em::before { content: "<"; opacity: .45; }
.hero h1 em::after { content: ">"; opacity: .45; }
.hero-id { font: 700 clamp(24px, 2.7vw, 38px)/1 var(--serif); letter-spacing: -0.04em; }
.hero-name i, .brand-name i { color: var(--ink-3); }
.brand-name { font: 700 15px/1 var(--serif); letter-spacing: -0.03em; }

/* Section titles: markdown heading */
.section-title { font: 700 clamp(26px, 3.4vw, 40px)/1 var(--serif); letter-spacing: -0.04em; }
.section-title::before { content: "## "; color: var(--ink-3); font-weight: 400; }
.blog-h1 { font: 700 clamp(48px, 8vw, 96px)/0.95 var(--serif); letter-spacing: -0.05em; }
.blog-h1::before { content: "# "; color: var(--ink-3); font-weight: 400; }

/* Card / list titles */
.card h3 { font: 700 19px/1.25 var(--serif); letter-spacing: -0.03em; }
.featured-title { font: 700 clamp(20px, 2.3vw, 26px)/1.25 var(--serif); letter-spacing: -0.03em; }
.pub-title { font: 500 clamp(15.5px, 1.5vw, 17px)/1.4 var(--serif); letter-spacing: -0.02em; }
.feature-title { font: 700 clamp(22px, 2.6vw, 30px)/1.15 var(--serif); letter-spacing: -0.035em; }
.row-title { font: 700 clamp(17px, 1.8vw, 20px)/1.3 var(--serif); letter-spacing: -0.03em; }
.post-h1 { font: 700 clamp(30px, 4.6vw, 48px)/1.1 var(--serif); letter-spacing: -0.045em; }
.nav-card b { font: 700 14px/1.35 var(--serif); letter-spacing: -0.02em; }
.stat-tiles b, .stats dd { font-family: var(--serif); font-weight: 700; letter-spacing: -0.04em; }
.team-stats b { font-family: "Napoli", var(--serif) !important; font-weight: 400; }
.links a { font: 700 clamp(18px, 2vw, 22px)/1.2 var(--serif); letter-spacing: -0.03em; }
.contact-line { font: 700 clamp(28px, 4.2vw, 50px)/1.1 var(--serif); letter-spacing: -0.045em; }
.contact-line em { color: var(--accent); }

/* Leads and quotes: text face, no italics */
.about-lead, .team-lead, .lab-lead { font: 500 clamp(19px, 1.9vw, 22px)/1.45 var(--sans) !important; letter-spacing: -0.01em; }
.lede, .scene-caption, .post-lede, .blog-sub, .feature-desc { font-style: normal; }
.scene-caption { font: 400 clamp(15px, 1.4vw, 17px)/1.5 var(--sans); }
.post-lede, .blog-sub { font: 400 clamp(17px, 1.7vw, 20px)/1.5 var(--sans); }
.pull { font: 500 clamp(17px, 1.8vw, 20px)/1.45 var(--mono); }
.pull::before { content: "> "; color: var(--accent); }
.pullquote blockquote { font: 700 clamp(20px, 2.4vw, 26px)/1.35 var(--serif); letter-spacing: -0.03em; }
.pullquote::before { font-family: var(--serif); }
.prose { font-size: 17.5px; }
.prose h2 { font: 700 clamp(22px, 2.6vw, 27px)/1.25 var(--serif); letter-spacing: -0.035em; }
.prose h3 { font: 700 19px/1.3 var(--serif); letter-spacing: -0.025em; }
.prose blockquote { font: 400 18px/1.6 var(--sans); }
.callout-title { font: 700 16px/1.35 var(--serif) !important; letter-spacing: -0.02em; }
.end-title { font: 700 26px/1.15 var(--serif); letter-spacing: -0.04em; }
.posts-empty { font: 400 16px/1.5 var(--mono); }
.lab-dark { letter-spacing: 0; }

/* Balance the two-column blocks */
.hero-fig canvas { aspect-ratio: 2 / 1; }
.hero-copy .actions { margin-top: 32px; }
.hero h1 { margin-bottom: 0; }
.lab { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.lab-fig canvas { aspect-ratio: 16 / 8.6; }
.about-lead.lab-lead, .lab-lead { font-size: clamp(19px, 2.1vw, 26px) !important; line-height: 1.4 !important; }
.lab-text > p:not(.lab-lead):not(.lab-kicker) { font-size: 17px; }

/* Bookmark with a real preview image */
.bookmark.has-img { grid-template-columns: minmax(0, 1fr) 220px; }
.bookmark-media { position: relative; display: block; min-height: 116px; border-left: 1px solid var(--line); overflow: hidden; background: var(--paper-2); }
.bookmark-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); transition: filter .2s, transform .4s; }
.bookmark.has-img:hover .bookmark-media img { filter: none; transform: scale(1.03); }
@media (max-width: 600px) { .bookmark.has-img { grid-template-columns: minmax(0, 1fr); } .bookmark-media { order: -1; border-left: 0; border-bottom: 1px solid var(--line); aspect-ratio: 1.91 / 1; } }

/* Headline: blinking block cursor instead of the full stop */
.h1-cursor {
  display: inline-block; width: .52em; height: .82em; margin-left: .12em; vertical-align: -0.06em;
  background: var(--ink); animation: blink 1.06s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) { .h1-cursor { animation: none; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bookmark-text > span:not(.bookmark-url) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl.art { white-space: pre; overflow: visible; line-height: 1.2; }
.console-out { overflow-x: auto; }
.cl.art.block { line-height: 1.02; letter-spacing: 0; margin: 6px 0; }
.console, .term pre, .codeblock pre, .fetch, .logwin-body { font-variant-ligatures: none; }

/* Floating terminal button */
.term-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 75;
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 18px 0 16px;
  background: var(--term-bg); color: var(--term-fg); border: 1px solid color-mix(in oklab, var(--term-bg) 60%, var(--ink-3));
  border-radius: 999px; cursor: pointer; font-size: 12px; box-shadow: 0 14px 34px -12px rgba(0,0,0,.6);
  transition: border-color .2s, transform .2s, opacity .25s, gap .25s;
}
.term-fab:hover { border-color: var(--accent); transform: translateY(-2px); }
.term-fab-ico { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--term-green); font-size: 14px; }
.term-fab-ico i { width: 8px; height: 14px; background: var(--term-fg); animation: blink 1.06s steps(1) infinite; }
.term-fab-label { white-space: nowrap; letter-spacing: .02em; }
body.console-open .term-fab { opacity: 0; pointer-events: none; transform: translateY(8px); }
@media (prefers-reduced-motion: reduce) { .term-fab-ico i { animation: none; } }

/* ── Phone pass ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .lab { grid-template-columns: minmax(0, 1fr); }
  .lab-fig canvas { aspect-ratio: 16 / 10.5; }
}
@media (max-width: 600px) {
  .stat-tiles { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .stat-tiles > div { padding: 12px 8px 12px 0; }
  .stat-tiles > div + div { padding-left: 10px; }
  .stat-tiles b { font-size: clamp(22px, 7vw, 30px) !important; }
  .stat-tiles span { font-size: 10.5px; }
  .team-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .team-stats > div { padding: 12px 8px 12px 0; }
  .team-stats > div + div { padding-left: 10px; }
  .team-stats b { font-size: 30px !important; }
  .team-stats span { font-size: 10.5px; }
  .card-fig figcaption, .gen-fig figcaption, .post-cover figcaption { flex-direction: column; align-items: flex-start; gap: 2px; }
  .card-fig figcaption span:last-child { text-align: left; }
  .places-fig canvas { aspect-ratio: 16 / 10; }
}

/* Blog: interactive compound-growth calculator */
.calc { margin-inline: 0; border: 1px solid var(--line); background: transparent; padding: 18px 18px 14px; }
@media (min-width: 900px) { .calc { margin-inline: -60px; } }
.calc-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 20px; font-size: 11px; color: var(--ink-3); }
.calc-controls label { display: flex; flex-direction: column; gap: 8px; }
.calc-controls label > span { display: flex; justify-content: space-between; letter-spacing: .04em; text-transform: uppercase; }
.calc-controls b { color: var(--ink); font-weight: 500; text-transform: none; }
.calc input[type=range] { width: 100%; accent-color: var(--accent); }
.calc-check { grid-column: 1 / -1; flex-direction: row !important; align-items: center; gap: 8px !important; text-transform: none; color: var(--ink-2); font-size: 12px; }
.calc-check input { accent-color: var(--accent); }
.calc canvas { display: block; width: 100%; aspect-ratio: 16 / 8.5; margin-top: 16px; cursor: pointer; }
.calc-out { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 10px 0 0; border-top: 1px solid var(--line); }
.calc-out > div { padding: 12px 10px 0 0; }
.calc-out dt { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.calc-out dd { margin: 4px 0 0; font: 700 clamp(15px, 1.8vw, 20px)/1.2 var(--serif); letter-spacing: -0.03em; color: var(--ink); }
.calc-out dd.r { color: var(--accent); } .calc-out dd.b { color: var(--blue); }
.calc figcaption { display: flex; gap: 12px; margin-top: 14px; font-size: 11px; color: var(--ink-3); }
.calc figcaption span { color: var(--accent); flex: none; }
@media (max-width: 600px) {
  .calc-controls, .calc-out { grid-template-columns: 1fr 1fr; }
  .calc canvas { aspect-ratio: 4 / 3; }
}

/* @duel0 signature in the footer */
.site-footer .handle { margin-left: 6px; color: var(--term-green); }
.site-footer .handle:hover { color: var(--accent); }

/* napwnli · SSC Napoli palette (azzurro #00A7E1, navy #13294B) */
#team[data-palette="napoli"] { --accent: #00a7e1; --napoli-navy: #13294b; --napoli-panel: #131f31; }
#team .team {
  position: relative; overflow: hidden; padding: clamp(22px, 3vw, 36px);
  background: var(--napoli-panel); border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--napoli-navy)); border-radius: 4px;
}
#team .team::before, #team .team::after {          /* the crest's double ring */
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  border: 2px solid color-mix(in oklab, var(--accent) 22%, transparent);
}
#team .team::before { width: 520px; height: 520px; right: -170px; top: -190px; }
#team .team::after { width: 400px; height: 400px; right: -110px; top: -130px; border-width: 1px; }
#team .team > * { position: relative; z-index: 1; }
#team .team-stats { border-top-color: color-mix(in oklab, var(--accent) 45%, var(--napoli-navy)); border-bottom-color: color-mix(in oklab, var(--accent) 25%, var(--napoli-navy)); }
#team .team-stats > div + div { border-left-color: color-mix(in oklab, var(--accent) 25%, var(--napoli-navy)); }
#team .card-refs a { border-color: color-mix(in oklab, var(--accent) 30%, var(--napoli-navy)); }
#team .card-refs a:hover { border-color: var(--accent); color: var(--accent); }
#team .team-fig canvas { background: var(--napoli-panel); border-color: color-mix(in oklab, var(--accent) 30%, var(--napoli-navy)); }
#team .team-fig figcaption span:first-child { color: var(--accent); }
#team .team-brand:hover .team-name { color: var(--accent); }

/* napwnli: "PROUD TO BE NAPWNLI" under the figure */
#team .team { align-items: stretch; }
.team-side { display: flex; flex-direction: column; gap: 18px; }
.team-proud {
  margin: auto 0 0; display: flex; flex-direction: column; align-items: flex-end; line-height: .86;
  font-family: "Napoli", var(--sans); text-transform: uppercase; text-align: right;
}
.team-proud span { font-size: clamp(24px, 2.5vw, 34px); color: color-mix(in oklab, var(--accent) 70%, #fff); letter-spacing: .02em; }
.team-proud b { font-weight: 400; font-size: clamp(52px, 6vw, 88px); color: transparent; -webkit-text-stroke: 1.5px var(--accent); letter-spacing: .01em; }
@media (max-width: 900px) { .team-proud { align-items: flex-start; text-align: left; } }

/* napwnli honours row: armband · CyberChallenge.IT · CyberCup + PROUD TO BE NAPWNLI */
.team-honours { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.team-honours .team-proud { margin: 0; }
.armband {
  flex: none; display: flex; align-items: center; gap: 16px; height: 66px; padding: 0 22px;
  background: #fff; border-radius: 3px; position: relative;
  box-shadow: inset 0 5px 0 -1px var(--accent), inset 0 -5px 0 -1px var(--accent), 0 8px 20px -8px rgba(0,0,0,.5);
}
.armband::before, .armband::after {                     /* velcro seam at the ends */
  content: ""; position: absolute; top: 9px; bottom: 9px; width: 4px;
  background: repeating-linear-gradient(0deg, color-mix(in oklab, var(--accent) 70%, transparent) 0 2px, transparent 2px 4px);
}
.armband::before { left: 5px; } .armband::after { right: 5px; }
.ab-c { font: 400 50px/1 "Napoli", var(--sans); color: var(--accent); text-box: trim-both cap alphabetic; }
.ab-sep { width: 1.5px; height: 34px; background: color-mix(in oklab, var(--accent) 55%, transparent); }
.armband img { display: block; height: 34px; width: auto; }
/* same visible height (34px) and equal visible gaps: the emblem file has ~9% transparent padding */
.armband img[src*="cyberchallenge"] { height: 37px; margin: 0 -3px; }
.armband img[src*="napwnli"] { height: 34px; width: auto; transform: translateY(-2px); filter: drop-shadow(0 0 0.6px rgba(19,41,75,.6)); }   /* optical centre: the head sits low in the image */
.armband img[src*="cyberchallenge"] { filter: brightness(0) saturate(100%) invert(13%) sepia(36%) saturate(2400%) hue-rotate(196deg); }   /* navy emblem */
@media (max-width: 900px) { .team-honours { flex-direction: column-reverse; align-items: flex-start; } }

/* napwnli heading: | UniNA seal */
.team-head { display: flex; align-items: center; gap: 22px; margin-bottom: 14px; }
.team-head .team-brand { margin-bottom: 0; }
.team-uni { display: flex; align-items: center; gap: 22px; margin-top: 10px; text-decoration: none; opacity: .9; transition: opacity .2s; }   /* same optical offset as .team-name */
.team-uni:hover { opacity: 1; }
.team-uni i { width: 2px; height: clamp(48px, 5.6vw, 72px); background: color-mix(in oklab, var(--accent) 60%, transparent); }
.team-uni img { display: block; height: clamp(46px, 5.4vw, 68px); width: auto; }
@media (max-width: 600px) { .team-head { gap: 14px; } .team-uni { gap: 14px; } }

/* About: organisation links read as highlighted names, underline on hover */
.about-text a { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--accent) 55%, transparent); text-underline-offset: 3px; }
.about-text a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* hero status verbs */
.status-word { white-space: pre; }
.status, .status i { transition: color .4s ease, background-color .4s ease; }
.status[data-tone="red"] { color: var(--accent); } .status[data-tone="red"] i { background: var(--accent); }
.status[data-tone="blue"] { color: var(--blue); } .status[data-tone="blue"] i { background: var(--blue); }
.status[data-tone="dim"] { color: var(--ink-3); } .status[data-tone="dim"] i { background: var(--ink-3); animation-duration: 4.5s; }
.status.has-spin i { font-size: 1.35em; line-height: 1; text-transform: none; width: auto; min-width: 1.1em; height: auto; background: none !important; box-shadow: none; animation: none; font-style: normal; text-align: center; }
.status.has-spin[data-night] i { min-width: 1.9em; text-align: left; }

/* Publications: collapsed list shows only key papers */
.pubs.is-collapsed li:not([data-key]) { display: none; }
.pubs-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 0; padding: 8px 14px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: color .2s, border-color .2s; }
.pubs-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.pubs-toggle[hidden] { display: none; }

/* About: programs & recognition, one horizontal row under both columns */
.about-programs { margin-top: clamp(40px, 5vw, 56px); }
.programs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.programs li { display: grid; grid-template-rows: 44px 1fr auto; gap: 14px; padding: 20px 18px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background-color .2s; }
.programs li:hover { background: color-mix(in oklab, var(--ink) 3%, transparent); }
.prog-logo { display: flex; align-items: center; }
.prog-logo img { display: block; width: 44px; height: 44px; object-fit: contain; opacity: .85; }
.programs li:hover .prog-logo img { opacity: 1; }
.programs b { display: block; font-weight: 500; color: var(--ink); }
.programs span:not(.prog-logo):not(.prog-when) { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.prog-when { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
@media (max-width: 900px) { .programs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .programs { grid-template-columns: minmax(0, 1fr); } .programs li { grid-template-rows: auto; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; } }
.prog-logo { gap: 12px; }
.prog-logo i { width: 1px; height: 26px; background: var(--line); }
