/* The three typefaces are served from here (Latin only), so the page asks no other site for anything.
   Barlow and JetBrains Mono are under the SIL Open Font License: the licences sit beside the files. */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/barlow-condensed-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/barlow-condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/barlow-condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 800; font-display: swap; src: url('../assets/fonts/barlow-condensed-800.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../assets/fonts/jetbrains-mono.woff2') format('woff2'); }

/* Ground Up. Every colour in the UI comes from these tokens. */
:root {
  --ink: #04051a;
  --ink-2: #0d1130;
  --paper: #f5f0e6;
  --paper-dim: rgba(245, 240, 230, 0.7);
  --paper-faint: rgba(245, 240, 230, 0.42);
  --line: rgba(245, 240, 230, 0.16);
  --glass: rgba(8, 10, 30, 0.66);
  --glass-strong: rgba(8, 10, 30, 0.86);
  --amber: #ffb92e;
  --amber-ink: #241a02;
  --cyan: #5ee0ff;
  --coral: #ff6f5e;
  --green: #5fd39a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', Impact, sans-serif;
  --text: 'Barlow', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --pad: clamp(14px, 2.2vw, 30px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
svg { width: 1.15em; height: 1.15em; fill: currentColor; stroke: currentColor; stroke-width: 0; flex: none; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; display: block; touch-action: none; }

.ui { position: fixed; inset: 0; pointer-events: none; }
.ui > * { pointer-events: auto; }

/* ── top bar ─────────────────────────────────────────────────────────── */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--safe-t) + 14px) var(--pad) 14px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 44px; }
/* His photograph, in a ring of the brand colour. The amber shows if the picture cannot load. */
.brand__mark {
  display: block; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--amber); box-shadow: 0 0 0 2px var(--amber), 0 6px 16px rgba(4, 6, 24, 0.4);
}
.brand__mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand__text { display: grid; line-height: 1.05; }
.brand__text b { font: 700 20px/1.05 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.brand__text i { font: 400 11px/1.3 var(--mono); font-style: normal; color: var(--paper-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.tools { display: flex; align-items: center; gap: 8px; }
.tool, .skillcount {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font: 600 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.tool:hover { border-color: var(--paper-faint); transform: translateY(-1px); }
.tool[aria-pressed='true'] { color: var(--cyan); border-color: rgba(94, 224, 255, 0.5); }
.tool--accent { color: var(--amber); border-color: rgba(255, 185, 46, 0.45); }
#btn-sound[aria-pressed='false'] .wave { display: none; }
#btn-sound[aria-pressed='false'] { color: var(--paper-faint); }
.skillcount { color: var(--paper-dim); font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }
.skillcount b { color: var(--amber); font-weight: 600; }
.skillcount svg { color: var(--amber); }
.skillcount.is-bump { animation: bump 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes bump { 40% { transform: scale(1.16); } }

/* ── title ───────────────────────────────────────────────────────────── */
.title, .finale {
  position: absolute; left: var(--pad); top: 50%; transform: translateY(-50%);
  width: min(46vw, 640px);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.7s;
}
.ui:not(.is-title) .title { opacity: 0; visibility: hidden; transform: translateY(-50%) translateX(-40px); pointer-events: none; }
.ui:not(.is-finale) .finale { opacity: 0; visibility: hidden; transform: translateY(-50%) translateX(-40px); pointer-events: none; }

.title__kicker {
  margin: 0 0 10px; font: 600 13px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber);
}
.title__name {
  margin: 0; font: 800 clamp(64px, 10.4vw, 176px)/0.86 var(--display); letter-spacing: -0.01em; text-transform: uppercase;
  text-shadow: 0 6px 40px rgba(4, 5, 26, 0.55);
}
.title__name span { display: block; }
.title__name span:last-child { color: transparent; -webkit-text-stroke: 2px var(--paper); }
.title__roles {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 22px 0 0;
  font: 600 clamp(18px, 2vw, 28px)/1.1 var(--display); letter-spacing: 0.1em; text-transform: uppercase;
}
.title__roles i { font-style: normal; color: var(--amber); }
.title__lede { max-width: 30em; margin: 16px 0 0; font-size: clamp(15px, 1.25vw, 18px); line-height: 1.55; color: var(--paper-dim); }
.title__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.title__hint { margin: 26px 0 0; font: 400 12px/1.8 var(--mono); color: var(--paper-faint); letter-spacing: 0.04em; }
.title__hint span { margin: 0 6px; }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; margin-right: 3px;
  border: 1px solid var(--line); border-radius: 5px; background: rgba(245, 240, 230, 0.06); font: inherit; color: var(--paper-dim);
}

.title > *, .finale > * { animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.title > :nth-child(2), .finale > :nth-child(2) { animation-delay: 0.08s; }
.title > :nth-child(3), .finale > :nth-child(3) { animation-delay: 0.18s; }
.title > :nth-child(4), .finale > :nth-child(4) { animation-delay: 0.26s; }
.title > :nth-child(5), .finale > :nth-child(5) { animation-delay: 0.34s; }
.title > :nth-child(6), .finale > :nth-child(6) { animation-delay: 0.44s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px;
  border-radius: 999px; font: 700 18px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn--primary { background: var(--amber); color: var(--amber-ink); box-shadow: 0 10px 34px rgba(255, 185, 46, 0.34); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 44px rgba(255, 185, 46, 0.5); }
.btn--ghost { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn--ghost:hover { border-color: var(--paper-faint); transform: translateY(-2px); }

/* ── chapter announcement ────────────────────────────────────────────── */
.chapter-card {
  /* centred in the room left of the station card, so the two never sit on top of each other */
  position: absolute; left: calc((100% - min(430px, 36vw) - var(--pad)) / 2); top: 16%; transform: translate(-50%, 0);
  width: max-content; max-width: calc(100% - min(430px, 36vw) - var(--pad) * 3);
  text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 0.5s ease;
}
.chapter-card.is-on { opacity: 1; }
.chapter-card__n { display: block; font: 600 13px/1 var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--amber); }
.chapter-card h2 {
  margin: 8px 0 0; font: 800 clamp(54px, 7vw, 120px)/0.9 var(--display); text-transform: uppercase; letter-spacing: 0.01em;
  text-shadow: 0 6px 36px rgba(4, 5, 26, 0.6);
}
.chapter-card p { margin: 10px 0 0; font: 500 clamp(16px, 1.6vw, 22px)/1.2 var(--display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--paper-dim); text-shadow: 0 2px 14px rgba(4, 5, 26, 0.7); }
.chapter-card.is-on h2 { animation: stamp 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
.chapter-card.is-on p { animation: rise 0.7s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes stamp { from { opacity: 0; letter-spacing: 0.3em; transform: scale(1.08); } }

/* ── station card ────────────────────────────────────────────────────── */
.card {
  position: absolute; right: var(--pad); top: calc(var(--safe-t) + 84px);
  width: min(430px, 36vw); max-height: calc(100vh - 230px); overflow: auto;
  padding: 22px 24px 20px; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0; transform: translateX(28px); pointer-events: none;
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.card.is-on { opacity: 1; transform: none; pointer-events: auto; }
.card::before {
  content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 3px; border-radius: 3px; background: var(--accent, var(--amber));
}
.card[data-kind='education'] { --accent: var(--cyan); }
.card[data-kind='project'] { --accent: var(--cyan); }
.card[data-kind='award'] { --accent: var(--coral); }
.card[data-kind='volunteer'] { --accent: var(--green); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
/* The organisations' marks: one colour, the card's own ink, so they sit in the page like a letterhead. */
.card__logos { display: flex; flex: none; align-items: center; gap: 12px; margin-top: -3px; color: var(--paper-dim); }
.card__logos svg { display: block; width: auto; height: 26px; max-width: 58px; fill: currentColor; opacity: 0.85; }
.card__when { margin: 0; font: 600 12px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent, var(--amber)); }
.card__title { margin: 8px 0 0; font: 700 clamp(26px, 2.5vw, 36px)/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.card__org { margin: 6px 0 0; font: 600 16px/1.3 var(--text); }
.card__where { margin: 2px 0 0; font-size: 13px; color: var(--paper-faint); }
.card__points { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.card__points li { position: relative; padding-left: 16px; font-size: 14.5px; line-height: 1.5; color: var(--paper-dim); }
.card__points li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent, var(--amber)); transform: rotate(45deg); }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.card__tags span { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font: 400 11px/1.4 var(--mono); color: var(--paper-dim); }
.card__group { margin: 12px 0 0; }
.card__group h4 { margin: 0 0 6px; font: 600 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-faint); }
.card__tags span.is-got { color: var(--amber); border-color: rgba(255, 185, 46, 0.5); }
.card__link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px;
  font: 700 15px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent, var(--amber)); text-decoration: none;
}
.card__link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── toast ───────────────────────────────────────────────────────────── */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translate(-50%, 12px);
  padding: 10px 18px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line);
  font: 500 13px/1.3 var(--mono); letter-spacing: 0.04em; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--amber); font-weight: 600; }

/* ── timeline ────────────────────────────────────────────────────────── */
.timeline {
  position: absolute; left: var(--pad); right: var(--pad); bottom: calc(var(--safe-b) + 16px);
  display: flex; align-items: stretch; height: 52px; padding: 0 6px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.6s, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ui.is-title .timeline, .ui.is-title .card, .ui.is-title .pad, .ui.is-title .skillcount, .ui.is-title #btn-auto,
.ui.is-finale .card, .ui.is-finale .pad { opacity: 0; pointer-events: none; }
.ui.is-title .timeline { transform: translateY(30px); }
.timeline__track { position: absolute; left: 14px; right: 14px; bottom: 9px; height: 3px; border-radius: 3px; background: var(--line); }
.timeline__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--amber), var(--coral)); }
.timeline__dot { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 4px rgba(255, 185, 46, 0.35), 0 0 16px var(--amber); }
.timeline button {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 4px 10px;
  font: 600 14px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper-faint); white-space: nowrap;
  transition: color 0.2s;
}
.timeline button b { font: 600 10px/1 var(--mono); letter-spacing: 0.04em; color: inherit; opacity: 0.7; }
.timeline button span { overflow: hidden; text-overflow: ellipsis; }
.timeline button:hover { color: var(--paper); }
.timeline button.is-done { color: var(--paper-dim); }
.timeline button.is-here { color: var(--amber); }

/* ── touch pad ───────────────────────────────────────────────────────── */
.pad {
  position: absolute; left: var(--pad); right: var(--pad); bottom: calc(var(--safe-b) + 82px);
  display: none; justify-content: space-between; align-items: flex-end; pointer-events: none;
  transition: opacity 0.4s;
}
.pad__move { display: flex; gap: 12px; }
.pad button {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; pointer-events: auto;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.pad button svg { width: 28px; height: 28px; fill: none; }
.pad button.is-held, .pad button:active { transform: scale(0.92); background: rgba(255, 185, 46, 0.3); border-color: var(--amber); }
@media (pointer: coarse), (max-width: 760px) { .pad { display: flex; } }

/* ── finale ──────────────────────────────────────────────────────────── */
.finale__title { margin: 0; font: 800 clamp(52px, 7.4vw, 124px)/0.9 var(--display); text-transform: uppercase; text-shadow: 0 6px 40px rgba(4, 5, 26, 0.55); }
.finale__stats { margin: 16px 0 0; font: 400 13px/1.7 var(--mono); color: var(--paper-dim); letter-spacing: 0.03em; }
.finale__stats b { color: var(--amber); font-weight: 600; }
.finale__stats span { white-space: nowrap; }
.finale__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.finale__links .tile {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; border-radius: 16px; text-decoration: none; color: var(--paper);
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.finale__links button.tile { width: 100%; text-align: left; }
.finale__links .tile:hover { transform: translateY(-2px); border-color: var(--amber); }
.finale__links .tile svg { width: 22px; height: 22px; color: var(--amber); }
.finale__links .tile b { display: block; font: 700 17px/1.1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.finale__links .tile i { display: block; font: 400 11px/1.4 var(--mono); font-style: normal; color: var(--paper-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finale__links .tile > span { min-width: 0; }
.finale__links .tile.is-primary { grid-column: 1 / -1; background: var(--amber); color: var(--amber-ink); border-color: transparent; }
.finale__links .tile.is-primary svg, .finale__links .tile.is-primary i { color: var(--amber-ink); }
/* The game this one replaced: one faint line under the buttons. The padding makes the small type a full-size touch target. */
.finale__old { margin: 2px 0 0; font: 400 11px/1.4 var(--mono); letter-spacing: 0.04em; }
.finale__old a { display: inline-block; padding: 15px 0; color: var(--paper-faint); text-decoration: none; text-shadow: 0 1px 8px rgba(4, 5, 26, 0.8); transition: color 0.2s; }
.finale__old a:hover, .finale__old a:focus-visible { color: var(--paper-dim); text-decoration: underline; }

/* ── plain CV ────────────────────────────────────────────────────────── */
.cv { position: absolute; inset: 0; overflow: auto; background: rgba(4, 5, 26, 0.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: fade 0.3s ease both; }
@keyframes fade { from { opacity: 0; } }
.cv__bar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: calc(var(--safe-t) + 12px) var(--pad) 12px; background: linear-gradient(var(--ink), rgba(4, 5, 26, 0)); }
.cv__bar .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
.cv__sheet {
  width: min(880px, calc(100vw - 2 * var(--pad))); margin: 6px auto 60px; padding: clamp(22px, 5vw, 56px);
  background: var(--paper); color: #1c1d2b; border-radius: 6px; box-shadow: var(--shadow); font-size: 15px; line-height: 1.55;
}
.cv__sheet h1 { margin: 0; font: 800 clamp(40px, 7vw, 64px)/0.95 var(--display); text-transform: uppercase; letter-spacing: 0.01em; }
.cv__sheet .cv-headline { margin: 8px 0 0; font: 600 18px/1.3 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: #8a5a00; }
.cv__sheet .cv-contact { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 0; font: 400 13px/1.5 var(--mono); }
.cv__sheet a { color: #0b4f8a; }
.cv__sheet h2 { margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 2px solid #1c1d2b; font: 700 20px/1 var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.cv__sheet .cv-item { margin: 0 0 16px; break-inside: avoid; }
.cv__sheet .cv-item h3 { margin: 0; font: 600 17px/1.3 var(--text); }
.cv__sheet .cv-item h3 span { font-weight: 400; color: #54566a; }
.cv__sheet .cv-meta { margin: 1px 0 0; font: 400 12px/1.5 var(--mono); color: #6a6c80; }
.cv__sheet ul { margin: 6px 0 0; padding-left: 18px; }
.cv__sheet li { margin: 2px 0; }
.cv__sheet .cv-skills { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; margin: 0; }
.cv__sheet .cv-skills dt { font: 600 13px/1.6 var(--mono); color: #54566a; }
.cv__sheet .cv-skills dd { margin: 0; }

/* Without scripts the page is this short CV. It scrolls, and "safe" keeps its top in reach on a small screen. */
.noscript { position: fixed; inset: 0; display: grid; place-content: safe center; padding: 24px; overflow-y: auto; text-align: center; background: var(--ink); }
.noscript h1 { margin: 0 0 6px; font: 800 clamp(40px, 8vw, 72px)/0.95 var(--display); text-transform: uppercase; }
.noscript p { max-width: 46em; margin: 12px auto 0; line-height: 1.55; color: var(--paper-dim); }
.noscript b { color: var(--paper); }
.noscript a { color: var(--amber); }

/* ── phones held upright ─────────────────────────────────────────────── */
@media (max-width: 760px), (orientation: portrait) {
  .tool span, .brand__text i { display: none; }
  .tool { padding: 0; width: 44px; justify-content: center; }
  .brand__text b { font-size: 17px; }
  .skillcount { padding: 0 10px; }
  .title, .finale { left: var(--pad); right: var(--pad); width: auto; top: calc(var(--safe-t) + 78px); transform: none; }
  .ui:not(.is-title) .title, .ui:not(.is-finale) .finale { transform: translateY(-24px); }
  .title__name { font-size: clamp(60px, 19vw, 120px); }
  .title__lede { font-size: 15px; }
  .title__hint { display: none; }
  .title__actions { margin-top: 20px; }
  .btn { min-height: 50px; padding: 0 20px; font-size: 16px; }
  .card { left: 10px; right: 10px; top: calc(var(--safe-t) + 70px); width: auto; max-height: 44vh; padding: 16px 18px 14px; transform: translateY(-16px); border-radius: 16px; }
  .card__title { font-size: 25px; }
  .card__points li { font-size: 13.5px; }
  .chapter-card { left: 50%; top: 22%; width: 94vw; max-width: none; }
  .timeline { left: 8px; right: 8px; bottom: calc(var(--safe-b) + 8px); height: 46px; }
  .timeline button span { display: none; }
  .timeline button b { font-size: 12px; opacity: 1; }
  .pad { bottom: calc(var(--safe-b) + 66px); left: 14px; right: 14px; }
  .toast { bottom: calc(var(--safe-b) + 142px); width: max-content; white-space: normal; text-align: center; border-radius: 18px; }
  .finale__title { font-size: clamp(44px, 14vw, 84px); }
  .finale__links { grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
  .finale__links .tile { min-height: 52px; padding: 8px 14px; }
  .cv__sheet .cv-skills { grid-template-columns: 1fr; gap: 0; }
  .cv__sheet .cv-skills dd { margin-bottom: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  /* a phone on its side: pin the words under the top bar and keep only what fits */
  .title, .finale { top: calc(var(--safe-t) + 70px); transform: none; }
  .ui:not(.is-title) .title, .ui:not(.is-finale) .finale { transform: translateX(-40px); }
  .title__lede, .title__hint, .finale__stats { display: none; }
  .title__kicker { margin-bottom: 6px; }
  .title__name { font-size: clamp(48px, 15vh, 96px); }
  .title__roles { margin-top: 12px; font-size: 17px; }
  .title__actions { margin-top: 14px; }
  .btn { min-height: 44px; }
  .finale { width: min(60vw, 640px); }
  .finale__title { font-size: clamp(30px, 10vh, 52px); }
  .finale__links { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .finale__links .tile { min-height: 46px; padding: 6px 12px; gap: 8px; }
  .finale__links .tile.is-primary { grid-column: auto; }
  .finale__links .tile i { display: none; }
  .finale__links .tile b { font-size: 14px; }
  .ui.is-finale .timeline { opacity: 0; pointer-events: none; }
  .card { max-height: calc(100vh - 150px); top: calc(var(--safe-t) + 68px); }
  .pad { display: flex; bottom: calc(var(--safe-b) + 70px); }
}

@media (prefers-reduced-motion: reduce) {
  .title > *, .finale > *, .chapter-card.is-on h2, .chapter-card.is-on p { animation: none; }
}

/* ── print: the plain CV is the document ─────────────────────────────── */
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  #stage, .hud, .title, .finale, .card, .timeline, .pad, .toast, .chapter-card, .cv__bar { display: none !important; }
  @page { margin: 14mm; }
  /* No fade-in on paper: an element that first appears for printing would be caught at opacity 0. */
  .ui, .cv { position: static; background: none; backdrop-filter: none; overflow: visible; animation: none !important; opacity: 1 !important; }
  .cv[hidden] { display: block !important; }
  .cv__sheet { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; background: #fff; font-size: 11pt; }
  .cv__sheet h2 { break-after: avoid; }
  .cv__sheet a { color: inherit; text-decoration: none; }
}
