/* SIMON SKI: page, game window and the "Read it all" trail map. */

@font-face {
  font-family: "Press Start 2P";
  src: url("/ski/fonts/press-start-2p-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("/ski/fonts/pixelify-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("/ski/fonts/pixelify-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1e2233;
  --text: #16181f;
  --muted: #565f75;
  --sky: #dceefb;
  --snow: #eef4fa;
  --paper: #ffffff;
  --frame: #c9d4e2;
  --red: #e23b2e;
  --yellow: #ffc93c;
  --link: #1f4fbf;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --pix: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --body: Arial, Helvetica, sans-serif;
  --gate: #1e2233;
}

[data-chapter="casian"] { --gate: #1f4fbf; }
[data-chapter="protocols"] { --gate: #6a32c9; }
[data-chapter="writing"] { --gate: #b85c00; }
[data-chapter="experience"] { --gate: #0b7d45; }
[data-chapter="education"] { --gate: #c2185b; }
[data-chapter="ski"] { --gate: #c62f25; }
[data-chapter="travel"] { --gate: #007a94; }
[data-chapter="contact"] { --gate: #2e3b5e; }
[data-chapter="hood"] { --gate: #7a5a00; }
[data-chapter="screen"] { --gate: #1f4fbf; }
[data-chapter="carry"] { --gate: #0b7d45; }
[data-chapter="umip"] { --gate: #2a6f8f; }
[data-chapter="secrets"] { --gate: #2e3b5e; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--sky);
  background-image: radial-gradient(#ffffff 1.2px, transparent 1.6px), radial-gradient(#ffffff 1px, transparent 1.4px);
  background-size: 34px 34px, 34px 34px;
  background-position: 0 0, 17px 17px;
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, .stage:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

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

/* ---------- Top of the page ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 1032px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

.secrets-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font: 400 14px/1 var(--pix);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  border: 2px dashed #9fb3cf;
  cursor: pointer;
}
.secrets-badge:hover { color: var(--ink); background: #ffffff; border-style: solid; }
.secrets-badge.all { color: #5a4300; background: #fff6d8; border: 2px solid #c99a1e; }
.sb-flake, .pt-flake { width: 14px; height: 14px; flex: none; }
#secrets-count { font: 400 10px/1 var(--pixel); color: var(--ink); }

.skiplink {
  display: inline-block;
  margin: 0;
  padding: 8px 12px;
  font: 11px/1.4 var(--pixel);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none;
}
.skiplink:hover { background: var(--yellow); }

.masthead {
  max-width: 1032px;
  margin: 0 auto;
  padding: 18px 16px 20px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 12px 40px;
  align-items: end;
}

h1 {
  margin: 0 0 10px;
  font: 400 clamp(19px, 3.1vw, 30px)/1.3 var(--pixel);
  color: var(--ink);
  text-shadow: 3px 3px 0 #ffffff;
}

.role { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 16px; }
.lede {
  margin: 0;
  max-width: 62ch;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border-left: 4px solid var(--red);
  padding: 10px 14px;
}

/* ---------- Game window ---------- */

.arcade {
  max-width: 1032px;
  margin: 0 auto;
  padding: 0 16px 44px;
}

.window {
  background: var(--frame);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  scroll-margin-top: 8px;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 4px 6px 4px 10px;
  background-color: var(--red);
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 5px);
  border-bottom: 3px solid var(--ink);
}
.tb-icon { width: 30px; height: 21px; flex: none; }
.tb-title {
  margin: 0;
  font: 400 13px/1 var(--pixel);
  color: #ffffff;
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}
.tb-sub {
  min-width: 0;
  padding: 2px 4px;
  font: 400 14px/1 var(--pix);
  color: #ffe1dc;
  background: transparent;
  border: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.tb-sub { cursor: pointer; }
button.tb-sub:hover { color: #ffffff; text-decoration: underline; }
.tb-title { flex: none; }
.tb-buttons { display: flex; gap: 6px; margin-left: auto; }
.tb-btn, .card-x {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  font: 400 10px/1 var(--pixel);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.tb-btn:hover, .card-x:hover { background: var(--yellow); }
.tb-btn:disabled { opacity: 0.55; cursor: default; background: var(--paper); }

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  padding: 8px 12px;
  background: var(--ink);
  color: #ffffff;
}
.hud-cell { margin: 0; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.hud-k { font: 400 14px/1 var(--pix); color: #a9bbe0; }
.hud-v { font: 400 12px/1 var(--pixel); color: var(--yellow); }
.hud-chapters { margin-left: auto; }
.hud-flags { display: inline-flex; gap: 3px; }
.hud-flags i {
  display: block;
  width: 9px;
  height: 12px;
  border: 2px solid #5a6582;
}
.hud-flags i.on { background: var(--gate); border-color: #ffffff; }

.stage {
  position: relative;
  height: clamp(300px, calc(100vh - 290px), 600px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--snow);
}
.stage:focus { outline: none; }
.stage canvas {
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  touch-action: manipulation;
}
.window.is-playing .stage canvas { touch-action: none; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  padding: 14px;
  overflow: auto;
  background: rgba(238, 244, 250, 0.84);
}
.panel {
  margin: auto;
  width: 100%;
  max-width: 470px;
  padding: 18px 20px 20px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}
.kicker {
  margin: 0 0 8px;
  font: 400 15px/1 var(--pix);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.logo {
  margin: 0;
  font: 400 34px/1.2 var(--pixel);
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
}
.logo span { display: block; }
.logo span + span { color: var(--link); }
.title-skier-btn {
  display: block;
  margin: 12px auto 6px;
  padding: 2px;
  background: none;
  border: 0;
  cursor: pointer;
}
.title-skier-btn.hop { animation: hop 0.26s steps(2, jump-none); }
.title-skier-btn.flip { animation: flip 0.8s steps(8); }
@keyframes hop { 50% { transform: translateY(-10px); } }
@keyframes flip { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.title-skier {
  display: block;
  width: 36px;
  height: 54px;
  animation: bob 0.9s steps(2, jump-none) infinite alternate;
}
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
.premise { margin: 6px 0 12px; font-size: 16px; line-height: 1.5; color: var(--text); }
.controls {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  font: 400 15px/1.6 var(--pix);
  color: var(--ink);
}
p.controls { display: block; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 0 5px;
  font: 400 13px/1.5 var(--pix);
  text-align: center;
  color: var(--ink);
  background: #f3f6fa;
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 3px;
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.best { margin: 12px 0 0; font: 400 15px/1.4 var(--pix); color: var(--muted); }

.btn {
  display: inline-block;
  padding: 11px 14px;
  font: 400 11px/1.4 var(--pixel);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.btn:hover { background: #f1f5fa; }
.btn:active, .pad-btn.is-down, .pad-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-go { background: var(--yellow); }
.btn-go:hover { background: #ffd866; }

.menu-title { margin: 0 0 12px; font: 400 18px/1.3 var(--pixel); color: var(--ink); }
.menu-label { margin: 16px 0 8px; font: 700 15px/1 var(--pix); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.menu-keys { margin: 14px 0 0; font: 400 14px/1.4 var(--pix); color: var(--muted); }
.end-stats { margin: 0 0 4px; font: 400 16px/1.5 var(--pix); color: var(--ink); }
.end-yeti { display: block; width: 60px; height: 75px; margin: 0 auto 8px; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-block;
  padding: 6px 10px;
  font: 400 15px/1.2 var(--pix);
  color: #ffffff;
  background: var(--gate);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.chip.locked {
  color: var(--muted);
  background: #f3f5f9;
  border-style: dashed;
  box-shadow: none;
  cursor: default;
}

.toast {
  position: absolute;
  top: 10px;
  left: 50%;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 6px 12px;
  font: 400 16px/1.3 var(--pix);
  color: #ffffff;
  text-align: center;
  background: var(--ink);
  border: 2px solid #ffffff;
  box-shadow: 3px 3px 0 rgba(30, 34, 51, 0.35);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.18s linear;
  pointer-events: none;
}
.toast.on { opacity: 1; }
.window.chasing .toast { top: auto; bottom: 30px; }

.nojs {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--snow);
}
.nojs p { margin: 0; max-width: 34ch; }

.pad {
  display: none;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-top: 3px solid var(--ink);
  background: var(--frame);
  user-select: none;
  -webkit-user-select: none;
}
.pad-group { display: flex; gap: 8px; }
.pad-btn {
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 54px;
  padding: 0 10px;
  font: 400 11px/1 var(--pixel);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.pad-jump { min-width: 78px; background: var(--yellow); }
.arrow { display: block; width: 0; height: 0; border-style: solid; }
.arrow-left { border-width: 9px 13px 9px 0; border-color: transparent var(--ink) transparent transparent; }
.arrow-right { border-width: 9px 0 9px 13px; border-color: transparent transparent transparent var(--ink); }
.arrow-down { border-width: 13px 9px 0 9px; border-color: var(--ink) transparent transparent transparent; }

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin: 0;
  padding: 6px 10px;
  font: 400 14px/1.4 var(--pix);
  color: var(--ink);
  background: #e6ecf4;
  border-top: 3px solid var(--ink);
}

.touch-only { display: none; }
p.touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
  .pad { display: flex; }
  .keys-only { display: none; }
  .touch-only, p.touch-only { display: block; }
}
.window.touch .pad { display: flex; }
.window.touch .keys-only { display: none; }
.window.touch .touch-only, .window.touch p.touch-only { display: block; }

/* ---------- Read it all ---------- */

.trail {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 28px 30px 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  scroll-margin-top: 12px;
}
.trail-head h2 { margin: 0 0 8px; font: 400 20px/1.3 var(--pixel); color: var(--ink); }
.trail-head p { margin: 0 0 14px; color: var(--muted); }
.trail-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.trail-toc a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 8px;
  font: 400 15px/1.2 var(--pix);
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--ink);
  background: #ffffff;
}
.trail-toc a::before { content: ""; width: 10px; height: 10px; background: var(--gate); }
.trail-toc a:hover { background: #f1f5fa; }

.chapter {
  padding: 26px 0 12px;
  border-top: 3px dashed #d3dce8;
  margin-top: 18px;
  scroll-margin-top: 12px;
}
.chapter h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font: 400 17px/1.4 var(--pixel);
  color: var(--ink);
}
.chapter h2::before {
  content: "";
  flex: none;
  width: 16px;
  height: 20px;
  background: linear-gradient(var(--gate), var(--gate)) 3px 0 / 13px 11px no-repeat, linear-gradient(var(--ink), var(--ink)) 0 0 / 3px 20px no-repeat;
}
.chapter h2:focus { outline: none; }
.chapter p { margin: 0 0 12px; }
.chapter h3 { margin: 0 0 4px; font-size: 17.5px; line-height: 1.4; color: #111111; }
.meta { color: var(--muted); font-size: 15px; }
.item { margin-top: 20px; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #e6ebf2;
}
.timeline li:last-child { border-bottom: 0; }
.timeline .when { margin: 2px 0 0; font: 400 15px/1.4 var(--pix); color: var(--gate); }
.timeline .title { display: block; font-weight: 400; font-size: 15px; color: var(--muted); }
.timeline p:last-child { margin-bottom: 0; }

.trophy {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 10px 16px 10px 12px;
  background: #fff6d8;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.trophy-art { width: 48px; height: 48px; flex: none; }
.trophy p { margin: 0; }
.trophy strong { display: block; font: 400 14px/1.5 var(--pixel); color: var(--ink); }
.trophy span { display: block; font: 400 15px/1.3 var(--pix); color: var(--muted); }

.photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
  margin: 16px 0 6px;
  padding: 0;
  list-style: none;
}
.photos a { display: block; }
.photos img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #e3e9f1;
  border: 2px solid var(--ink);
}
.photos p { margin: 6px 0 0; font-size: 14px; line-height: 1.35; color: var(--text); }
.photos p span { color: var(--muted); }

.more-photos { margin: 4px 0 6px; }
.more-photos summary {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 9px 12px;
  font: 400 11px/1.4 var(--pixel);
  color: var(--ink);
  list-style: none;
  cursor: pointer;
  background: #ffffff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.more-photos summary::-webkit-details-marker { display: none; }
.more-photos summary:hover { background: #f1f5fa; }
.more-photos .less, .more-photos[open] .more { display: none; }
.more-photos[open] .less { display: inline; }
.more-photos > .photos { margin-top: 6px; }

.photo-strip {
  display: flex;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 0 0 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.photo-strip li { flex: 0 0 132px; scroll-snap-align: start; }
.photo-strip p { font-size: 13px; }

.contact .emails { font-size: 18px; line-height: 1.8; }

.foot {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 44px;
  text-align: center;
  font: 400 15px/1.5 var(--pix);
  color: var(--muted);
}
.foot p { margin: 0 0 6px; }

/* ---------- Chapter cards ---------- */

.card {
  width: min(780px, calc(100vw - 24px));
  max-width: none;
  max-height: min(88vh, 920px);
  padding: 0;
  color: var(--text);
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
.card[open] { display: flex; flex-direction: column; }
.card::backdrop { background: rgba(20, 26, 46, 0.6); }
.card-band {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #ffffff;
  background: var(--gate);
  border-bottom: 3px solid var(--ink);
}
.card-flag {
  flex: none;
  width: 16px;
  height: 20px;
  background: linear-gradient(#ffffff, #ffffff) 3px 0 / 13px 11px no-repeat, linear-gradient(var(--ink), var(--ink)) 0 0 / 3px 20px no-repeat;
}
.card-gate { margin: 0; font: 400 11px/1.4 var(--pixel); }
.card-x { margin-left: auto; flex: none; }
.card-body {
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 26px 10px;
}
.card-body .chapter { margin-top: 0; padding-top: 18px; border-top: 0; }
.card-lead {
  margin: 20px 0 6px;
  font: 400 16px/1.6 var(--pixel);
  color: var(--ink);
}
.card-lead:focus { outline: none; }
.card-stats { margin: 0 0 4px; font: 400 16px/1.5 var(--pix); color: var(--muted); }
.card-body .photos { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
.card-body .photos p { font-size: 13px; }
.card-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #f1f5fa;
  border-top: 3px solid var(--ink);
}

/* ---------- Extra cards and the secrets panel ---------- */

.card-sub { margin: 0 0 14px; font-size: 15.5px; color: var(--muted); }
.card-note { margin: 16px 0 6px; font: 400 15px/1.5 var(--pix); color: var(--muted); }
.card-quote { margin: 14px 0 6px; padding: 8px 12px; font-weight: 700; background: #f4f7fb; border-left: 4px solid var(--gate); }
.hood { margin: 4px 0 0; }
.hood dt { margin: 14px 0 4px; font: 400 12px/1.4 var(--pixel); color: var(--gate); }
.hood dd { margin: 0; }
.verdict { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; font: 400 16px/1.4 var(--pix); }
.verdict-pill {
  padding: 6px 12px;
  font: 400 12px/1 var(--pixel);
  color: #ffffff;
  background: #0b7d45;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.evidence { margin: 0; padding: 0; list-style: none; }
.evidence li { padding: 10px 0; border-top: 1px solid #e6ebf2; }
.ev-claim { display: block; font-weight: 700; color: #111111; }
.ev-meta { display: block; margin-top: 4px; font-size: 14.5px; color: var(--muted); }
.ev-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 6px;
  font: 400 9px/1.4 var(--pixel);
  color: #0b5d34;
  background: #e2f5e9;
  border: 2px solid #0b7d45;
}
.secrets-reward { margin: 0 0 12px; padding: 10px 12px; font: 400 15px/1.4 var(--pix); color: #5a4300; background: #fff6d8; border: 3px solid #c99a1e; }
.secrets-list { margin: 0 0 6px; padding: 0; list-style: none; counter-reset: secret; }
.secrets-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 9px 0;
  border-top: 1px solid #e6ebf2;
  counter-increment: secret;
}
.secrets-list li::before { content: counter(secret); grid-row: span 2; font: 400 11px/1.6 var(--pixel); color: #9aa3b5; }
.secrets-list .found::before { color: #b07b00; }
.secrets-list strong { font: 400 12px/1.5 var(--pixel); color: var(--ink); }
.secrets-list span { font-size: 15px; color: var(--text); }
.secrets-list .unfound strong { color: #9aa3b5; }
.secrets-list .unfound span { font-style: italic; color: var(--muted); }

[data-chapter="passport"] { --gate: #7d1f2c; }
[data-chapter="shanghai"] { --gate: #3b4157; }
[data-chapter="postcard"] { --gate: #007a94; }
[data-chapter="sneakers"] { --gate: #c4561c; }
[data-chapter="alpine"] { --gate: #8a6400; }
[data-chapter="forerunner"] { --gate: #c62f25; }
[data-chapter="apres"] { --gate: #6a32c9; }
[data-chapter="pikachu"] { --gate: #8a6400; }
.stamp-note { margin: 8px 0 0; font: 400 14px/1.4 var(--pix); color: var(--muted); }
.stamp-group { margin: 16px 0 8px; font: 400 11px/1.4 var(--pixel); color: var(--gate); }
.stamps { display: flex; flex-wrap: wrap; gap: 8px 8px; margin: 0; padding: 0; list-style: none; }
.stamp {
  display: inline-block;
  padding: 4px 8px;
  font: 400 13px/1.2 var(--pix);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--stamp, #2e3b5e);
  background: #ffffff;
  border: 2px dashed var(--stamp, #2e3b5e);
  text-decoration: none;
}
.stamp[data-c="0"] { --stamp: #b85c00; }
.stamp[data-c="1"] { --stamp: #c2185b; }
.stamp[data-c="2"] { --stamp: #1f4fbf; }
.stamp[data-c="3"] { --stamp: #0b7d45; }
.stamp[data-c="4"] { --stamp: #6a32c9; }
.stamps li:nth-child(3n + 1) .stamp { transform: rotate(-2deg); }
.stamps li:nth-child(3n + 2) .stamp { transform: rotate(1.5deg); }
.stamp.photo { color: #5a4300; background: #fff6d8; border: 2px solid #c99a1e; box-shadow: 2px 2px 0 #c99a1e; }
.stamp.photo::before { content: ""; display: inline-block; width: 8px; height: 6px; margin-right: 6px; background: #5a4300; box-shadow: 2px -2px 0 -1px #5a4300; vertical-align: 1px; }
.stamp.photo:hover { background: #ffe9a8; }

[data-chapter="map"] { --gate: #1f4fbf; }
[data-chapter="sidequests"] { --gate: #3b4157; }
[data-chapter="closed"] { --gate: #c62f25; }
[data-chapter="investing"] { --gate: #0b7d45; }
[data-chapter="teach"] { --gate: #2f6fd6; }
[data-chapter="chatgpt"] { --gate: #3b4157; }
.closed-list { margin: 8px 0 0; padding: 0; list-style: none; }
.closed-list li { padding: 10px 0 2px 12px; border-left: 4px solid #c62f25; margin-bottom: 10px; }
.closed-name { margin: 0 0 4px; font-weight: 700; color: #111111; }
.closed-name .meta { font-weight: 400; margin-left: 6px; }
.map-zoom { position: absolute; top: 8px; right: 8px; z-index: 3; padding: 7px 9px; font-size: 10px; }
.next-run {
  position: absolute;
  z-index: 1;
  border: 2px dashed #c62f25;
  border-radius: 50%;
  pointer-events: none;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(0.92); opacity: 0.6; } 50% { transform: scale(1.08); opacity: 1; } }
.next-caption { margin: 4px 0 10px; padding-left: 16px; font: 400 15px/1.4 var(--pix); color: #8a1f17; background: linear-gradient(#c62f25, #c62f25) 0 50% / 10px 2px no-repeat; }
.trips-label { margin: 12px 0 6px; font: 700 14px/1 var(--pix); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.trips { display: flex; flex-wrap: wrap; gap: 8px; }
.trip-btn {
  padding: 6px 10px;
  font: 400 14px/1.2 var(--pix);
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.trip-btn[aria-pressed="true"] { color: #ffffff; background: var(--ink); }
.trip-caption { margin: 10px 0 0; font-size: 15px; line-height: 1.5; color: var(--text); }
.trip-caption:empty { display: none; }
[data-chapter="radar"] { --gate: #c62f25; }
.map-open { margin: 4px 0 14px; }
.map-stats { margin: 0 0 10px; font: 400 15px/1.4 var(--pix); color: var(--ink); }
.map-wrap { position: relative; }
.map-canvas { display: block; width: 100%; height: auto; background: #eef4fa; border: 2px solid var(--ink); touch-action: manipulation; }
.map-canvas.on-pin { cursor: pointer; }
.map-tip {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 3px 7px;
  font: 400 13px/1.3 var(--pix);
  color: #ffffff;
  white-space: nowrap;
  background: var(--ink);
  transform: translate(-50%, -150%);
  pointer-events: none;
}
.map-panel .photos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.map-place { margin: 14px 0 0; font: 400 12px/1.4 var(--pixel); color: var(--ink); }
.fine { margin: 6px 0 10px; padding: 10px 12px; font: 400 16px/1.4 var(--pix); background: #fff6d8; border: 3px dashed #c62f25; }

/* ---------- Page toast and visitors from the edges ---------- */

.ptoast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 8px 12px;
  font: 400 15px/1.3 var(--pix);
  color: var(--ink);
  background: #ffffff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  opacity: 0;
  transform: translate(-50%, 160%);
  transition: transform 0.25s steps(4), opacity 0.2s linear;
  pointer-events: none;
}
.ptoast.on { opacity: 1; transform: translate(-50%, 0); }

.peek {
  position: fixed;
  z-index: 55;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  transition: transform 0.45s steps(5);
}
.peek canvas { display: block; image-rendering: pixelated; }
.peek-right { right: 0; bottom: 22vh; align-items: flex-start; transform: translateX(110%); }
.peek-right.on { transform: translateX(28%); }
.peek-left { left: 12px; bottom: 0; align-items: flex-start; transform: translateY(110%); }
.peek-left.on { transform: translateY(10%); }
.peek-bubble {
  margin: 0 0 6px;
  padding: 6px 9px;
  font: 400 11px/1.4 var(--pixel);
  color: var(--ink);
  white-space: nowrap;
  background: #ffffff;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.peek-right .peek-bubble { transform: translateX(-30%); }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .hud {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 7px 10px 8px;
  }
  .hud-cell { flex-direction: column; align-items: flex-start; gap: 3px; }
  .hud-k { font-size: 13px; }
  .hud-v { font-size: 11px; }
  .hud-chapters { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 7px; margin-left: 0; }
}

@media (max-width: 760px) {
  .masthead { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
  .tb-sub { font-size: 12px; padding: 2px 2px; }
  .stage { height: clamp(300px, calc(100vh - 250px), 560px); }
  .trail { padding: 20px 16px 6px; box-shadow: 4px 4px 0 var(--ink); }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-body { padding: 2px 16px 8px; }
  .card-body .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-panel .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logo { font-size: 28px; }
}

@supports (height: 100svh) {
  .stage { height: clamp(300px, calc(100svh - 290px), 600px); }
  @media (max-width: 760px) {
    .stage { height: clamp(300px, calc(100svh - 250px), 560px); }
  }
}

@media (max-width: 420px) {
  .arcade { padding-left: 10px; padding-right: 12px; }
  .window { box-shadow: 4px 4px 0 var(--ink); }
  .panel { padding: 14px 14px 16px; }
  .btn { padding: 10px 10px; font-size: 9.5px; }
  .pad-btn { min-width: 50px; }
  .pad-jump { min-width: 66px; }
  h1 { font-size: 18px; }
  .skiplink { font-size: 9.5px; padding: 7px 9px; }
  .sb-label { display: none; }
  .titlebar { gap: 7px; }
}

/* ---------- Print: a clean CV straight off the slope ---------- */

.print-only { display: none; }

@media print {
  @page { margin: 14mm 16mm; }
  html { scroll-behavior: auto; }
  body { color: #000000; background: #ffffff none; font-size: 10.5pt; line-height: 1.45; }
  .topbar, .arcade, .trail-head, .photos, .more-photos, .map-open, .trophy, .screen-only, .ptoast, .peek, dialog, .sr-only { display: none !important; }
  .masthead { display: block; max-width: none; margin: 0 0 6pt; padding: 0 0 8pt; border-bottom: 2px solid #000000; }
  h1 { margin: 0 0 4pt; font: 700 22pt/1.2 Arial, Helvetica, sans-serif; color: #000000; text-shadow: none; }
  .role, .links { font-size: 10.5pt; }
  .links { gap: 0 12pt; }
  .lede { max-width: none; margin-top: 6pt; padding: 0; font-size: 10.5pt; background: none; border: 0; }
  .trail { max-width: none; margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
  .chapter { margin-top: 10pt; padding: 8pt 0 0; border-top: 1px solid #999999; }
  .chapter h2 { margin-bottom: 4pt; font: 700 13pt/1.3 Arial, Helvetica, sans-serif; color: #000000; }
  .chapter h2::before { display: none; }
  .chapter h3 { font-size: 11pt; }
  .item, .timeline li { break-inside: avoid; }
  .timeline li { grid-template-columns: 110pt minmax(0, 1fr); gap: 8pt; padding: 4pt 0; border-bottom: 0; }
  .timeline .when { font: 400 10pt/1.4 Arial, Helvetica, sans-serif; color: #333333; }
  a { color: #000000; text-decoration: none; }
  .chapter a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444444; }
  .chapter a[href^="/files/"]::after { content: " (simoncastelain.com" attr(href) ")"; font-size: 9pt; color: #444444; }
  .meta { font-size: 9.5pt; color: #333333; }
  .foot { max-width: none; padding: 14pt 0 0; font: 400 9pt Arial, Helvetica, sans-serif; color: #444444; }
  .print-only { display: block; }
}

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

/* ---------- Off-piste (404) ---------- */

.lost-main { max-width: 640px; margin: 0 auto; padding: 40px 16px; }
.lost-stage { padding: 26px 22px 28px; text-align: center; background: var(--snow); }
.lost-art { display: block; width: 100%; max-width: 384px; height: auto; margin: 0 auto 18px; }
.lost h1 { margin: 0 0 12px; }
.nowrap { white-space: nowrap; }
.lost-stage p { margin: 0 0 12px; }
.lost-secret { font: 400 15px/1.4 var(--pix); color: #5a4300; }
.lost-actions { margin-top: 18px; }

/* ---------- Version switcher (/shared/switch.css), in the top bar next to the secrets badge ---------- */

:root {
  --vs-ink: #1e2233;
  --vs-paper: #ffffff;
  --vs-muted: #565f75;
  --vs-accent: #1f4fbf;
  --vs-here-bg: #ffc93c;
  --vs-hover: #eef4fa;
  --vs-name-font: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --vs-btn-font: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --vs-radius: 0;
  --vs-border: 2px;
  --vs-shadow: 4px 4px 0 #1e2233;
  --vs-btn-shadow: 2px 2px 0 #1e2233;
}
.topbar .secrets-badge { margin-left: auto; }
.topbar .vs-btn { gap: 6px; padding: 5px 9px; font-size: 14px; line-height: 1; }
.topbar .vs-btn:hover { background: var(--yellow); }
.topbar .vs-icon { width: 14px; height: 14px; }
@media (max-width: 600px) {
  .topbar { justify-content: flex-start; }
  .topbar .secrets-badge { margin-left: 0; }
}
/* 404 page: room for the switcher in the top right corner on small screens. */
@media (max-width: 700px) { .lost-main { padding-top: 62px; } }
