:root {
  --bg: #0a0e13;
  --panel: rgba(12, 17, 23, 0.9);
  --line: #243040;
  --ink: #e6e9ee;
  --ink-soft: #a3adba;
  --ink-faint: #6b7787;
  --accent: #c4b5fd;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: clamp(13px, min(1.08vw, 1.78vh), 18.5px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #fff; }
.mono { font-family: var(--mono); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.6rem; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: 1.6rem; }
p { margin: 0 0 0.9rem; }
.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--ink); color: var(--bg); padding: 0.5rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }

/* The map is the scene: it takes hover and the cart's drag, and the page still scrolls over it.
   The curtain overlay and the pigeons sit above it and take no clicks. */
#map { position: fixed; inset: 0; z-index: 0; opacity: 0; transition: opacity 1.2s ease; }
#map.ready { opacity: 1; }
#map .maplibregl-canvas { touch-action: pan-y; }
#gpr-overlay { display: none; pointer-events: none; }
#pigeons { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; image-rendering: pixelated; }

.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: linear-gradient(var(--bg) 35%, transparent); display: flex; justify-content: space-between; align-items: center; padding: 0.9rem 1.4rem; pointer-events: none; }
.bar a { pointer-events: auto; text-decoration: none; color: var(--ink-soft); font-size: 0.9rem; }
.bar a:hover { color: var(--ink); }
.bar nav { display: flex; gap: 0.9rem; align-items: center; }
.icon-link { display: inline-flex; align-items: center; justify-content: center; width: 1.85rem; height: 1.85rem; border-radius: 6px; color: var(--ink-soft); transition: color 0.18s, background 0.18s; }
.icon-link:hover, .icon-link:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.08); }
.icon-link svg { width: 1.25rem; height: 1.25rem; display: block; }
.brand { font-weight: 700; color: var(--ink) !important; letter-spacing: 0.08em; }

/* Story */
main { position: relative; z-index: 10; pointer-events: none; }
.step { min-height: 100vh; display: flex; align-items: center; padding: 6rem 1.4rem; pointer-events: none; }
.step + .step { min-height: 130vh; }
.step.globe-zoom { min-height: 70vh; padding: 0; }
.card { pointer-events: auto; width: min(30rem, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.6rem 1.7rem 1.2rem; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); transition: opacity 0.4s ease; }
.kicker { font-size: 0.78rem; color: var(--ink-faint); letter-spacing: 0.04em; margin-bottom: 0.7rem; text-transform: uppercase; }
.lead { font-size: 1.12rem; color: var(--ink); }
.card p { color: var(--ink-soft); }
.card .lead { color: var(--ink); }
.note { font-size: 0.75rem; color: var(--ink-faint) !important; }
.cite { font-size: 0.92rem; }
.cite .mono { color: var(--ink-faint); font-size: 0.8rem; }
.hint { font-size: 0.78rem; color: var(--ink-faint) !important; margin: 1.2rem 0 0; }
.hint .sep { margin: 0 0.4rem; }
.more { font-size: 0.92rem; }
.links a { margin-right: 1rem; }

.tag { font: 600 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.1rem 0.4rem; border-radius: 4px; color: var(--ink-faint); border: 1px solid var(--line); vertical-align: 1px; margin-right: 0.3rem; }
.legend { display: grid; grid-template-columns: repeat(3, auto); gap: 0.3rem 1rem; list-style: none; padding: 0; margin: 0.4rem 0 0.6rem; font-size: 0.75rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: 1.2rem; height: 3px; background: var(--c); vertical-align: middle; margin-right: 0.45rem; }

/* Section 1: the dig site. The intro is a caption over the scene, top-left. */
.dig { align-items: flex-start; padding-top: 4.4rem; }
.intro { max-width: 30rem; pointer-events: none; transition: opacity 0.4s; text-shadow: 0 1px 12px rgba(5, 8, 12, 0.9); }
.intro h1 { font-size: clamp(2rem, 4.2vw, 3rem); margin-bottom: 0.4rem; }
.intro .lead { color: var(--ink-soft); font-size: 1.05rem; }
.beat { align-items: flex-start; padding-top: 68vh; }
.beat .card { width: min(26rem, 100%); padding: 1.2rem 1.4rem 0.9rem; background: rgba(10, 14, 19, 0.88); }
.beat .card p { font-size: 0.96rem; }
.rows { width: 100%; border-collapse: collapse; font-size: 0.74rem; color: var(--ink-soft); margin: 0.2rem 0 0.6rem; }
.rows th { text-align: left; font-weight: 500; color: var(--ink-faint); padding: 0.15rem 0; border-bottom: 1px solid var(--line); }
.rows td { padding: 0.2rem 0; }
.rows td:last-child, .rows th:last-child { text-align: right; }
.rows i, .traffic i { display: inline-block; width: 0.9rem; height: 3px; background: var(--c); vertical-align: middle; margin-right: 0.45rem; }
.traffic { list-style: none; padding: 0; margin: 0 0 0.7rem; font-size: 0.78rem; color: var(--ink-soft); display: grid; gap: 0.25rem; }
.traffic i { height: 4px; width: 1.4rem; }
.traffic b { color: var(--ink); font-weight: 600; margin-right: 0.35rem; }
.more-engd { color: var(--ink-faint) !important; font-size: 0.85rem !important; margin: 0; }

/* The rail: the two tools, top centre over the scene (between the intro and the trail), scrolling
   upward together with the intro header on the first screen. */
.rail { position: absolute; top: 4.3rem; left: clamp(48.6rem, 50vw, calc(100vw - 35rem)); transform: translateX(-50%); z-index: 15; width: 33rem; pointer-events: auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.8rem; align-items: stretch; transition: opacity 0.4s; }
.rail .rail-title { grid-column: 1 / -1; text-align: center; }
body.past-dig .rail, body.past-site .rd { opacity: 0; pointer-events: none; }
.rail-tool { display: block; padding: 1rem 1.15rem 0.9rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 14, 19, 0.82); color: inherit; text-decoration: none; outline: none; transition: border-color 0.2s, background 0.2s; }
.rail-tool:hover, .rail-tool:focus-visible { border-color: #4b5a6e; background: rgba(16, 22, 30, 0.92); color: inherit; }
.rail-tool[data-tool=klic]:hover, .rail-tool[data-tool=klic]:focus-visible { border-color: #ea580c; }
.rail-tool[data-tool=gpr]:hover, .rail-tool[data-tool=gpr]:focus-visible { border-color: #f6a635; }
.rail-tool p { margin: 0.6rem 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--ink-soft); }
.klic-mark { width: 2.6rem; height: 2.6rem; vertical-align: middle; }
.klic-word { font-size: 1.75rem; margin-left: 0.55rem; vertical-align: middle; color: var(--ink); }
.klic-word b { color: #ea580c; }
.rail .gpro-logo { display: block; width: 10rem; height: auto; }
.rail .go { color: #f6a635; white-space: nowrap; }
.rail .klic-go { color: #ea580c; }
.rd { position: fixed; left: 1.4rem; bottom: 1.1rem; z-index: 15; margin: 0; font-size: 0.72rem; color: var(--ink-faint); white-space: pre; transition: opacity 0.4s; }

/* On the map: the cart, the IMKL card, and labels lying on the ground. */
.gpr-cart { cursor: grab; touch-action: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
.gpr-cart svg { display: block; width: 60px; height: auto; transition: filter 0.2s; }
.gpr-cart.held { cursor: grabbing; }
.gpr-cart.glow svg { filter: drop-shadow(0 0 10px rgba(246, 166, 53, 0.9)); }
.gpr-hint { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -6px); font-size: 0.72rem; font-weight: 600; color: #f6a635; background: rgba(10, 14, 19, 0.86); border: 1px solid rgba(246, 166, 53, 0.55); border-radius: 999px; padding: 0.12rem 0.5rem; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.75); text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; animation: hint 2.4s ease-in-out infinite; pointer-events: none; }
.gpr-cart.held .gpr-hint { display: none; }
@keyframes hint { 50% { transform: translate(-50%, -11px); opacity: 0.85; } }
@media (prefers-reduced-motion: reduce) { .gpr-hint { animation: none; } }
.imkl-card { position: fixed; left: 0; top: 0; z-index: 40; width: 23rem; background: rgba(10, 14, 19, 0.96); border: 1px solid #334155; border-radius: 8px; padding: 0.7rem 0.8rem 0.6rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); pointer-events: none; font-size: 0.72rem; }
.imkl-card header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.imkl-card header i { width: 1rem; height: 4px; background: var(--c); }
.imkl-card header b { font-size: 0.85rem; }
.imkl-card header span { margin-left: auto; font: 0.68rem var(--mono); color: var(--ink-faint); }
.imkl-card table { width: 100%; border-collapse: collapse; font-family: var(--mono); }
.imkl-card th { text-align: left; font-weight: 400; color: var(--ink-faint); padding: 0.12rem 0.6rem 0.12rem 0; white-space: nowrap; vertical-align: top; }
.imkl-card td { color: var(--ink-soft); word-break: normal; overflow-wrap: break-word; padding: 0.12rem 0; }
.imkl-card .unknown th, .imkl-card .unknown td { color: #fbbf24; border-top: 1px dashed #4b3a12; padding-top: 0.3rem; }
.imkl-card .unknown em { font-style: normal; font-weight: 700; padding: 0 0.3rem; border: 1px solid #fbbf24; border-radius: 3px; margin-right: 0.3rem; }
.imkl-card .pred th, .imkl-card .pred td { color: var(--p, #fbbf24); border-top: 1px dashed #334155; padding-top: 0.35rem; }
.imkl-card .pred td { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.45rem; }
.imkl-card .pred em { font-style: normal; font-weight: 700; white-space: nowrap; padding: 0.05rem 0.38rem; border: 1px solid var(--p, #fbbf24); border-radius: 4px; background: color-mix(in srgb, var(--p, #fbbf24) 14%, transparent); }
.imkl-card p { margin: 0.5rem 0 0; color: var(--ink-faint); font-size: 0.68rem; }
.ground-label { font: 600 11px var(--mono); white-space: nowrap; pointer-events: none; }
/* Upright labels on a leader. MapLibre sets an inline opacity on markers, so they hide by visibility. */
.pin { display: flex; flex-direction: column; align-items: center; pointer-events: none; font: 600 11px var(--mono); }
.pin:not(.on) { visibility: hidden; }
.pin i { width: 1px; height: 26px; background: currentColor; opacity: 0.8; }
.pin-text { padding: 2px 7px; border-radius: 4px; white-space: nowrap; background: rgba(10, 14, 19, 0.88); border: 1px solid currentColor; }
.pin.ask { color: #fbbf24; }
.pin.ask span { color: var(--ink-faint); margin-right: 0.4rem; font-weight: 400; }
.pin.dim { color: var(--c, #fff); }
.pin.dim .pin-text { background: rgba(10, 14, 19, 0.94); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.55); font-weight: 700; }
.pin.dim i { height: 18px; width: 1.5px; opacity: 0.9; }
body.past-dig .rd { opacity: 0; }

/* Segmented controls and metric bars */
.seg { display: flex; margin: 0.7rem 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; background: none; border: 0; color: var(--ink-faint); font: inherit; font-size: 0.75rem; padding: 0.45rem; cursor: pointer; }
.seg button[aria-checked=true] { background: rgba(196, 181, 253, 0.14); color: var(--ink); }
.bars { display: grid; gap: 0.35rem; margin-bottom: 0.7rem; }
.bar-row { display: grid; grid-template-columns: 10.5rem 1fr 2.4rem; align-items: center; gap: 0.6rem; font: 0.72rem var(--mono); color: var(--ink-soft); }
.bar-track { position: relative; height: 8px; background: #141b24; border-radius: 2px; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 2px; transition: width 0.3s ease; }
.bar-target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.bar-row .short { color: #fca5a5; }

/* Brittany Master's thesis interactive controls */
.brittany-card { width: min(27.5rem, 100%); padding: 1.35rem 1.45rem 1.05rem; }
.brittany-card p { font-size: 0.92rem; margin-bottom: 0.7rem; }
.brittany-card .kicker { margin-bottom: 0.45rem; }
.seg-lens { margin: 0 0 0.75rem; }
.seg-lens button { font-size: 0.78rem; padding: 0.44rem 0.4rem; }
.brittany-card .bars { margin-bottom: 0.5rem; }
.brittany-summary { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; font-size: 0.74rem; color: var(--ink-soft); margin-bottom: 0.65rem; }
.brittany-summary b { color: var(--ink); font-weight: 600; }
.mfd-badge { padding: 0.14rem 0.48rem; border-radius: 4px; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.32); color: #fcd34d; }
.mfd-badge b { color: #fde68a; }
.brittany-takeaway { font-size: 0.84rem !important; line-height: 1.45; color: var(--ink-soft); margin-bottom: 0.6rem !important; }
.parcel-readout { margin-bottom: 0.55rem !important; min-height: 1.4em; font-size: 0.72rem !important; line-height: 1.4; color: var(--ink-faint); }
.brittany-card .cite { margin-bottom: 0; font-size: 0.84rem; }

/* Philippines Red Cross 510 interactive controls */
.ph-card { width: min(27.5rem, 100%); padding: 1.35rem 1.45rem 1.05rem; }
.ph-card p { font-size: 0.92rem; margin-bottom: 0.7rem; }
.ph-card .kicker { margin-bottom: 0.45rem; }
.ph-controls { display: grid; gap: 0.5rem; margin-bottom: 0.65rem; }
.ph-group { display: grid; gap: 0.22rem; }
.ph-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }
.seg-ph { margin: 0; }
.seg-ph button { font-size: 0.76rem; padding: 0.4rem 0.35rem; }
.ph-summary { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; font-size: 0.74rem; color: var(--ink-soft); margin-bottom: 0.55rem; }
.ph-badge { padding: 0.14rem 0.48rem; border-radius: 4px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); color: #fcd34d; }
.ph-badge b { color: #fde68a; font-weight: 600; }
.ph-readout { margin-bottom: 0.55rem !important; min-height: 1.4em; font-size: 0.72rem !important; line-height: 1.4; color: var(--ink-faint); }
.ph-takeaway { font-size: 0.84rem !important; line-height: 1.45; color: var(--ink-soft); margin-bottom: 0.6rem !important; }
.ph-card .cite { margin-bottom: 0; font-size: 0.84rem; }


/* CV */
.cv { position: relative; z-index: 10; background: var(--bg); border-top: 1px solid var(--line); padding: 3.6rem 1.4rem 4.2rem; }
.cv-inner { max-width: 47rem; margin: 0 auto; }
.cv-running { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); opacity: 0.68; text-align: right; padding-bottom: 0.55rem; margin: 0 0 1.8rem; border-bottom: 1px solid rgba(36, 48, 64, 0.55); }
.cv h2 { font-size: 2.2rem; letter-spacing: -0.02em; margin-bottom: 0.7rem; }
.cv .lead { font-size: 1.02rem; line-height: 1.65; color: #c7d0dc; }
.cv h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-faint); font-family: var(--mono); font-weight: 600; margin: 2.6rem 0 1.1rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--line); }
.entries { margin: 0; }
.entries dt { display: flex; justify-content: space-between; align-items: baseline; gap: 1.2rem; font-weight: 600; font-size: 1.02rem; color: var(--ink); margin-top: 1.55rem; }
.entries dt:first-child { margin-top: 0; }
.entries dt .mono { font-weight: 400; font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap; flex-shrink: 0; }
.entries dd { margin: 0.32rem 0 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.58; }
.entries dd.entry-sub { margin: 0.14rem 0 0.28rem; font-size: 0.86rem; font-weight: 500; color: #9fb0c4; letter-spacing: 0.005em; }
.pubs { padding-left: 1.25rem; margin: 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.6; }
.pubs li { margin-bottom: 0.9rem; padding-left: 0.25rem; }
.pubs li:last-child { margin-bottom: 0; }
.plain { padding-left: 1.25rem; margin: 0; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.6; }
.cv-tools li { margin-bottom: 0.45rem; }
.cv-tools li:last-child { margin-bottom: 0; }
.lang-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.lang-list li { padding: 0.24rem 0.75rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); color: #cfd8e3; font-size: 0.86rem; }
.cv-updated { margin: 2.8rem 0 0; padding-top: 1rem; border-top: 1px solid rgba(36, 48, 64, 0.55); font-size: 0.72rem; color: var(--ink-faint); opacity: 0.78; }
.foot { margin-top: 3rem; font-size: 0.72rem; color: var(--ink-faint); border-top: 1px solid var(--line); padding-top: 1rem; }
.foot a { color: var(--ink-soft); }

@media (max-width: 760px) {
  .step { align-items: flex-end; padding: 4rem 0.8rem 3.8rem; }
  .card { padding: 1.2rem 1.2rem 0.8rem; }
  .dig { padding-top: 3.6rem; }
  .intro .lead { font-size: 0.95rem; }
  .rail { top: auto; bottom: 3.4rem; right: 0.8rem; left: 0.8rem; transform: none; width: auto; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .rail-tool { padding: 0.6rem 0.7rem; }
  .rail-tool p { display: none; }
  .klic-word { font-size: 1rem; }
  .rail .gpro-logo { width: 5.5rem; }
  .rd { display: none; }
  .imkl-card { width: min(21rem, calc(100vw - 1.6rem)); }
  .bar nav { gap: 0.8rem; }
  .bar nav a:nth-child(n+3) { display: none; }
}
@media (max-width: 760px) {
  .step.dig { align-items: flex-start; }
  .step.beat { padding-top: 70vh; align-items: flex-start; }
  .beat .card p { font-size: 0.9rem; }
  body.past-dig .rail { opacity: 0; pointer-events: none; }
}
.beat .card .note { font-size: 0.72rem; }

/* ---- Scene flock, figure, cues, and tool focus ---- */
#flock { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; image-rendering: pixelated; transition: opacity 0.25s; }

/* The intro reads over a dark corner of the scene. */
.dig { position: relative; }
.dig::before { content: ""; position: absolute; left: 0; top: 0; width: min(46rem, 100%); height: 26rem; pointer-events: none;
  background: radial-gradient(ellipse at 0 0, rgba(6, 9, 13, 0.86), rgba(6, 9, 13, 0.55) 45%, transparent 72%); }
.intro { position: relative; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
.intro .kicker { color: #b4bfcc; }
.intro .lead { color: #d3d9e1; }
.intro .hint { color: #c2cad5 !important; font-size: 0.8rem; letter-spacing: 0.01em; }

/* The rail's heading and tags. */
.rail-title { margin: 0; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: #c2cad5; }
.rail-title span { text-transform: none; letter-spacing: 0; color: var(--ink-faint); }
.tag.live { color: #86efac; border-color: #1f5136; }

/* Top-centre section title for each part of the page, rising smoothly from below. */
.section-title { position: fixed; top: 4.2rem; left: 50%; transform: translate(-50%, 28px); z-index: 15; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.4s, transform 0.4s; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9); }
.section-title h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin: 0; }
.section-title .kicker { color: #c2cad5; margin-bottom: 0.3rem; }
.section-title.on { opacity: 1; transform: translate(-50%, 0); }
.section-title.rising { transition: none; opacity: var(--title-alpha, 0); transform: translate(-50%, var(--title-rise, 70vh)); }
body.in-cv .section-title { opacity: 0 !important; }
body.in-engd .intro, body.past-dig .intro { opacity: 0; }

/* EngD dialogue bubbles: floating above Ilya's head with a downward speech-bubble tail so the dig site stays unobstructed. */
.engd-beat .dialogue {
  position: fixed;
  left: clamp(1.2rem, calc(var(--ilya-x, 220px) - 7.5rem), calc(100vw - 45rem));
  bottom: clamp(12rem, calc(100vh - var(--ilya-y, 56vh) + 3.6rem), calc(100vh - 21rem));
  z-index: 16;
  width: min(25.5rem, calc(100vw - 22rem));
  border-radius: 16px;
  border: 1.5px solid #cbd5e1;
  background: rgba(11, 16, 23, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: 7.5rem bottom;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.engd-beat.on .dialogue {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.engd-beat .dialogue::before,
.engd-beat .dialogue::after {
  content: "";
  position: absolute;
  top: 100%;
  left: clamp(2rem, calc(var(--ilya-x, 220px) - 1.2rem - 11px), 10rem);
  width: 0;
  height: 0;
  border-style: solid;
}
.engd-beat .dialogue::before {
  border-width: 16px 11px 0 11px;
  border-color: #cbd5e1 transparent transparent transparent;
}
.engd-beat .dialogue::after {
  margin-top: -2px;
  margin-left: 2px;
  border-width: 13px 9px 0 9px;
  border-color: rgba(11, 16, 23, 0.96) transparent transparent transparent;
}
.engd-beat .dialogue .speaker {
  color: #fbbf24;
  font-weight: 700;
}
@media (max-width: 760px) {
  .engd-beat .dialogue {
    left: 0.8rem;
    right: 0.8rem;
    top: auto;
    bottom: 3.4rem;
    width: auto;
    transform-origin: bottom left;
  }
  .engd-beat .dialogue::before,
  .engd-beat .dialogue::after { display: none; }
}

/* What comes next, and the way back. */
.next { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 20; background: rgba(10, 14, 19, 0.82); color: #c2cad5; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.95rem; font-size: 0.76rem; cursor: pointer; }
.next b { color: var(--ink); font-weight: 600; }
.next:hover { border-color: var(--ink-faint); color: var(--ink); }
.next[hidden] { display: none; }
.back { position: fixed; left: 50%; bottom: 3.6rem; transform: translateX(-50%); z-index: 20; background: #e6e9ee; color: #0a0e13; border: 0; border-radius: 999px; padding: 0.45rem 1rem; font: 600 0.82rem var(--sans); cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.arrow { position: fixed; left: 0; top: 0; z-index: 20; margin: -22px 0 0 -22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #e6e9ee; background: rgba(10, 14, 19, 0.85); color: #e6e9ee; cursor: pointer; display: grid; place-items: center; }
.arrow i { font-style: normal; font-size: 1.1rem; display: block; }
.arrow[hidden], .back[hidden], .ctx-menu[hidden] { display: none; }
.ctx-menu { position: fixed; left: 0; top: 0; z-index: 50; min-width: 9.5rem; padding: 0.28rem; background: rgba(11, 16, 23, 0.96); border: 1px solid #334155; border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); }
.ctx-menu button { display: flex; align-items: center; gap: 0.45rem; width: 100%; background: none; border: 0; border-radius: 5px; padding: 0.44rem 0.65rem; color: var(--ink); font: 500 0.8rem var(--sans); text-align: left; cursor: pointer; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: rgba(196, 181, 253, 0.16); outline: none; }

/* The figure beside the site, and the introduction it opens. */
.person { background: none; border: 0; padding: 0; cursor: pointer; display: grid; justify-items: center; }
.person-hit { display: block; }
.person-tip { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); white-space: nowrap; font-size: 0.68rem; color: #fbbf24; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.person:hover .person-tip, .person:focus-visible .person-tip { opacity: 1; }
.person:focus-visible { outline: 2px solid #fbbf24; outline-offset: 4px; border-radius: 4px; }
body.past-dig .person { pointer-events: none; cursor: default; }
body.past-dig .person-tip { display: none; }
.about { position: fixed; left: clamp(1.2rem, calc(var(--ilya-x, 220px) - 7.5rem), calc(100vw - 26rem)); bottom: clamp(12rem, calc(100vh - var(--ilya-y, 56vh) + 3.6rem), calc(100vh - 21rem)); z-index: 35; width: min(25rem, calc(100vw - 2.8rem)); background: rgba(11, 16, 23, 0.96); border: 1.5px solid #cbd5e1; border-radius: 16px; padding: 1.15rem 1.35rem 0.8rem; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.about::before, .about::after { content: ""; position: absolute; top: 100%; left: clamp(2rem, calc(var(--ilya-x, 220px) - 1.2rem - 11px), 10rem); width: 0; height: 0; border-style: solid; }
.about::before { border-width: 16px 11px 0 11px; border-color: #cbd5e1 transparent transparent transparent; }
.about::after { margin-top: -2px; margin-left: 2px; border-width: 13px 9px 0 9px; border-color: rgba(11, 16, 23, 0.96) transparent transparent transparent; }
.about p { color: var(--ink-soft); font-size: 0.92rem; }
.about .kicker { color: var(--ink-faint); }
.about .speaker { color: #fbbf24; font-weight: 700; }
.about .links { display: flex; gap: 0.5rem; align-items: center; margin: 0.2rem 0 0.2rem; }
.about .links a { margin-right: 0; }
.about .close { position: absolute; right: 0.65rem; top: 0.45rem; background: none; border: 0; color: var(--ink-faint); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.about .close:hover { color: var(--ink); }
.beat .edu-card { width: min(34rem, 100%); padding: 1.7rem 1.9rem 1.35rem; }
.beat .edu-card p { font-size: 1.04rem; line-height: 1.62; }

/* Upright tags on the map: the education pins. */
.pin.edu { color: #e6e9ee; }
.pin.edu .pin-text { display: grid; text-align: center; padding: 4px 9px; }
.pin.edu span { color: var(--ink-faint); font-weight: 400; }
.pin.edu i { height: 40px; }

/* The rail's focus: everything that is not the hovered tool fades. */
body[data-focus=klic] #flock, body[data-focus=klic] #gpr-overlay, body[data-focus=klic] .gpr-cart,
body[data-focus=gpr] #flock { opacity: 0.18 !important; }
body[data-focus=klic] .intro, body[data-focus=gpr] .intro { opacity: 0.35; }
.gpr-cart, .person, .intro { transition: opacity 0.25s; }

@media (max-width: 760px) {
  .section-title { top: 3.2rem; width: 92vw; }
  .section-title h2 { font-size: 1.4rem; }
  .next { bottom: 0.6rem; font-size: 0.7rem; }
  .about { top: auto; bottom: 4rem; transform: none; left: 0.8rem; }
}
.next { white-space: nowrap; }
@media (max-width: 760px) {
  .rail-title { grid-column: 1 / -1; }
  .rail { bottom: 3.6rem; }
}

/* ---- Section trail beside the scrollbar ---- */
/* Everything on the page in scroll order. The line fills up to where you are; the entry you are at
   says so; the cue for what comes next sits at its foot. */
.trail { position: fixed; right: 0.9rem; top: 50%; transform: translateY(-50%); z-index: 15; width: 13rem; padding: 0.8rem 0.9rem 0.8rem 1rem;
  background: rgba(8, 11, 16, 0.72); border: 1px solid rgba(36, 48, 64, 0.7); border-radius: 12px; backdrop-filter: blur(3px); transition: opacity 0.4s; }
.trail-title { margin: 0 1.5rem 0.5rem 0; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); text-align: right; }
.trail ol { list-style: none; margin: 0; padding: 0 1.5rem 0 0; position: relative; }
.trail ol::before, .trail ol::after { content: ""; position: absolute; right: 0.42rem; width: 1px; top: var(--y0, 0); }
.trail ol::before { height: calc(var(--y1, 0px) - var(--y0, 0px)); background: var(--line); }
.trail ol::after { height: var(--fill, 0px); width: 2px; right: calc(0.42rem - 0.5px); background: var(--accent); transition: height 0.15s linear; }
.trail li { position: relative; text-align: right; padding: 0.32rem 0; }
.trail li::after { content: ""; position: absolute; right: calc(-1.5rem + 0.42rem - 4px); top: 0.62rem; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box;
  background: var(--bg); border: 1px solid #4b5a6e; z-index: 1; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s; }
.trail li.past::after { background: #4b5a6e; }
.trail li.on::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.18); }
.trail a { display: block; text-decoration: none; color: var(--ink-soft); outline: none; border-radius: 6px; }
.trail a:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.trail b { font-size: 0.8rem; font-weight: 600; color: #c2cad5; transition: color 0.2s; }
.trail .when { font-size: 0.64rem; color: var(--ink-faint); margin-left: 0.4rem; }
.trail .what { display: none; font-size: 0.72rem; line-height: 1.38; color: var(--ink-faint); margin-top: 0.15rem; }
.trail li.on .what, .trail li:hover .what, .trail li:focus-within .what { display: block; }
.trail li.on .what { color: var(--ink-soft); }
.trail li.on b, .trail a:hover b { color: var(--ink); }
.trail li.on > a::before { content: "you are here"; display: block; font: 600 0.6rem var(--mono); letter-spacing: 0.07em; text-transform: uppercase; color: #fbbf24; margin-bottom: 0.05rem; }
.trail .beats { display: flex; flex-direction: column; align-items: flex-end; gap: 0.24rem; margin-top: 0.3rem; }
.trail .beats i { font-style: normal; font-size: 0.6rem; padding: 0.02rem 0.38rem; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-faint); cursor: pointer; }
.trail .beats i:hover { color: var(--ink); }
.trail .beats i.past { color: var(--ink-soft); }
.trail .beats i.on { color: var(--ink); border-color: var(--accent); }
@media (min-width: 761px) {
  .trail .next[hidden] { display: none; }
  .trail .next { position: static; transform: none; display: block; width: 100%; margin-top: 0.7rem; text-align: center; white-space: normal; }
}
@media (min-width: 1340px) and (min-height: 800px) { .trail .what { display: block; } }

/* Medium screens: the tools stay top centre, more compact, beside a narrower intro; on small
   tablets they sit at the bottom, centred under the scene. */
@media (min-width: 761px) and (max-width: 1339px) {
  .intro { max-width: 26rem; }
  .rail { left: calc(13rem + 50vw); width: 28.6rem; gap: 0.4rem 0.6rem; }
  .trail { top: auto; bottom: 2.7rem; transform: none; }
  .rail-tool { padding: 0.75rem 0.9rem 0.7rem; }
  .rail-tool p { font-size: 0.76rem; }
  .klic-word { font-size: 1.35rem; } .klic-mark { width: 2.1rem; height: 2.1rem; }
  .rail .gpro-logo { width: 7.5rem; }
  .rd { display: none; }
  body.in-cv .trail { opacity: 0; pointer-events: none; }
}
@media (min-width: 761px) and (max-width: 999px) {
  .rail { top: auto; bottom: 1rem; left: calc(50vw - 8.7rem); width: min(24rem, calc(100vw - 20rem)); }
  .trail { top: 50%; bottom: auto; transform: translateY(-50%); }
  .rail-tool p { display: none; }
}
/* Phones: no trail, the cue stays at the bottom. */
@media (max-width: 760px) {
  .trail { display: contents; }
  .trail-title, .trail ol { display: none; }
}
