/* ---------- fonts (self-hosted, latin subset, OFL) ---------- */
@font-face {
  font-family: 'IM Fell English';
  src: url(../fonts/im-fell-english-latin.woff2) format('woff2');
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'IM Fell English';
  src: url(../fonts/im-fell-english-italic-latin.woff2) format('woff2');
  font-style: italic; font-weight: 400; font-display: swap;
}
/* IM Fell only has old-style figures (1 looks like I): digits come from a lining serif */
@font-face {
  font-family: 'Fell Digits';
  src: local('Times New Roman'), local('TimesNewRomanPSMT'), local('Liberation Serif'),
       local('Tinos'), local('Noto Serif'), local('DejaVu Serif');
  unicode-range: U+0030-0039;
}
@font-face {
  font-family: 'Caveat';
  src: url(../fonts/caveat-latin.woff2) format('woff2');
  font-style: normal; font-weight: 400 700; font-display: swap;
}

:root {
  --paper: #f4ecd6;
  --paper-light: #fbf6e8;
  --table: #14213d;          /* the chart table around the map: night blue */
  --ink: #1d2b4a;
  --pencil: #3d3d3d;
  --red: #b3261e;            /* the route and the stop markers only */
  --sea: #2a6c78;
  --sea-light: #94c4c8;
  --postit: #fbe77c;
  --tape: rgba(236, 229, 205, 0.78);
  --fell: 'Fell Digits', 'IM Fell English', Georgia, 'Times New Roman', serif;
  --hand: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;
  --world-font: 28px;
  --halo: 0 0 3px var(--paper), 0 0 6px var(--paper), 0 0 10px var(--paper), 0 0 14px var(--paper);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--table);
  color: var(--ink);
  font-family: var(--fell);
  -webkit-text-size-adjust: 100%;
}

/* ---------- camera ---------- */
.viewport {
  position: fixed;
  inset: 0;
  overflow: clip;            /* focus never scrolls the map behind the camera */
  touch-action: pinch-zoom;  /* swipes (and rubbing the fog) come to us, pinch zoom stays */
  background-color: var(--table);
  background-image: url(../assets/paper-grain.png);
  background-size: 180px;
}
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 4800px;
  height: 4500px;
  transform-origin: 0 0;
  background-color: var(--paper);
  background-image: url(../assets/paper-grain.png);
  background-size: 256px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.world.moving { will-change: transform; }
.world.fade { transition: opacity 220ms ease; }
.world.faded { opacity: 0; }

.chart {
  position: absolute;
  left: 0;
  top: 0;
  width: 4800px;
  height: 4500px;
  display: block;
}

/* Mindelo: the wind moves a little, only while you're there */
.wind { position: absolute; pointer-events: none; }
/* tools left on the chart table, outside the map */
.desk-obj { position: absolute; overflow: visible; pointer-events: none; transform-origin: center; }
.desk-obj:not(.desk-coffee) { filter: drop-shadow(0 24px 18px rgba(0, 0, 0, .5)); }
/* only around the whole map: hidden, they don't widen the map's layer during flights */
body:not(.overview) .desk-obj { opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
.desk-obj { transition: opacity .4s; }
@media (prefers-reduced-motion: reduce) { .desk-obj, body:not(.overview) .desk-obj { transition: none; } }
/* the dividers need the right-hand margin of wide screens; elsewhere only a leg would show */
@media (max-width: 1279px) { .desk-dividers { display: none; } }
.wind svg { position: absolute; overflow: visible; }
body[data-step="mindelo"] .gust { animation: gust 2.6s ease-in-out infinite alternate; }
body[data-step="mindelo"] .gust-1 { animation-delay: -0.8s; }
body[data-step="mindelo"] .gust-2 { animation-delay: -1.5s; }
body[data-step="mindelo"] .gust-3 { animation-delay: -2.1s; }
@keyframes gust { from { transform: translateX(-18px); } to { transform: translateX(22px); } }

#route { transition: stroke-dasharray 0.6s; }
/* the sea layer (opacity set per stop in app.js) */
.sea { mix-blend-mode: multiply; opacity: 0; }
body.route-done #route { stroke-dasharray: none; }

/* ---------- world content (sizes in world units) ---------- */
.stop {
  position: absolute;
  font-size: var(--world-font);
  line-height: 1.38;
}
.stop p { margin: 0 0 12px; }
.stop p:last-child { margin-bottom: 0; }

/* headings are written straight on the chart, with a paper halo over the lines */
.stop h2 {
  margin: 0 0 34px;
  font-weight: 400;
  font-size: 46px;
  line-height: 1.1;
  text-shadow: var(--halo);
}
.num {
  display: inline-grid;
  place-items: center;
  width: 1.3em;
  height: 1.3em;
  margin-right: 10px;
  border: 3px solid var(--red);
  border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%;
  color: var(--red);
  font-size: 0.75em;
  vertical-align: 0.1em;
  text-shadow: none;
  background: var(--paper);
}

/* stop 5: the Kriolu note fades between its states */
.kriolu { transition: opacity .25s; }
.kriolu.swap { opacity: 0; }

/* pencil notes in the margin */
.pencil {
  font-family: var(--hand);
  font-size: 40px;
  line-height: 1.15;
  color: var(--pencil);
  transform: rotate(-2deg);
  text-shadow: var(--halo);
  padding-left: 18px;
  margin-top: 36px !important;
}

/* post-it */
.postit {
  position: relative;
  background: var(--postit);
  background-image: linear-gradient(170deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%, rgba(0,0,0,.05));
  padding: 26px 28px 30px;
  font-family: var(--hand);
  font-size: 37px;
  line-height: 1.18;
  transform: rotate(-1.2deg);
  box-shadow: 0 14px 18px -10px rgba(60, 40, 0, .45), 0 2px 3px rgba(60, 40, 0, .2);
  border-bottom-right-radius: 30px 8px;
}
.postit p { margin-bottom: 10px; }
.postit-small { font-size: 34px; transform: rotate(1.6deg); margin-top: 46px; }
.postit-title { font-weight: 700; }

/* index card: ruled, with a red top line */
.index-card {
  position: relative;
  background-color: var(--paper-light);
  background-image:
    linear-gradient(var(--sea), var(--sea)),
    repeating-linear-gradient(transparent 0 37px, rgba(80, 120, 170, .28) 37px 39px);
  background-size: 100% 2px, 100% 100%;
  background-position: 0 40px, 0 56px;
  background-repeat: no-repeat, repeat;
  padding: 58px 30px 26px;
  transform: rotate(0.8deg);
  box-shadow: 0 10px 16px -8px rgba(60, 40, 0, .45), 0 1px 2px rgba(60, 40, 0, .25);
}

/* field notebook page with spiral holes */
.notebook {
  position: relative;
  background-color: var(--paper-light);
  background-image:
    radial-gradient(circle at 50% 50%, #3a3226 0 7px, transparent 8px),
    linear-gradient(90deg, transparent 54px, rgba(47, 111, 126, .5) 54px 57px, transparent 57px),
    repeating-linear-gradient(transparent 0 37px, rgba(80, 120, 170, .3) 37px 39px);
  background-size: 44px 34px, 100% 100%, 100% 100%;
  background-repeat: repeat-x, no-repeat, repeat;
  background-position: 6px 6px, 0 0, 0 22px;
  padding: 48px 28px 24px 76px;
  font-family: var(--hand);
  font-size: 37px;
  line-height: 1.05;
  transform: rotate(-0.8deg);
  box-shadow: 0 10px 18px -8px rgba(60, 40, 0, .5);
}
.notebook p { margin-bottom: 12px; }

/* a scrap of paper for ink text that sits on the chart */
.scrap {
  background: rgba(251, 246, 232, .93);
  padding: 22px 28px;
  box-shadow: 0 6px 12px -6px rgba(60, 40, 0, .4);
  clip-path: polygon(0 2%, 4% 0, 30% 1.5%, 62% 0, 100% 1%, 99% 40%, 100% 98%, 70% 100%, 35% 98.5%, 0 100%, 1% 60%);
}
.ink .big {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 50px;
  line-height: 1.15;
  display: inline;
  text-decoration: underline double var(--sea);
  text-decoration-thickness: 3px;
  text-underline-offset: 8px;
}
.ink .big + p { margin-top: 22px; }
.last-line {
  margin-top: 26px !important;
  font-size: 36px;
  text-shadow: var(--halo);
}

/* tape and pins */
.taped::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  width: 150px;
  height: 40px;
  margin-left: -75px;
  background: var(--tape);
  transform: rotate(-3deg);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  z-index: 1;
}
.pinned::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #94c4c8 0 18%, var(--sea) 22%);
  box-shadow: 4px 6px 4px rgba(0,0,0,.25);
  z-index: 1;
}

/* notes shortened to pictograms (stops 2, 4, 7): the short line stays in plain text;
   the full text opens in a tooltip that covers the pictograms only, inside the note,
   so it never reaches the bars, another note, or the short line */
.picto-note { position: relative; }
.note-main { position: relative; margin-top: 18px; }
.note-main:first-child { margin-top: 0; }
.note-btn {
  display: block; width: 100%; margin: 0; padding: 0;
  border: 0; background: none; color: inherit;
  font: inherit; line-height: inherit; text-align: left;
  cursor: help;
}
.note-btn:focus-visible { outline: 4px dashed var(--ink); outline-offset: 10px; }
.note-short { display: block; }
.stop p.note-short { margin: 0; }
.stop p.note-honest { margin: 14px 0 0; }
.ink p.note-short.big { display: inline; }
.pictos { display: flex; flex-wrap: nowrap; gap: 6px 18px; align-items: flex-start; }
.pictos + .note-short { margin-top: 16px; }
.picto { display: flex; flex-direction: column; align-items: center; flex: 0 1 160px; min-width: 0; text-align: center; }
.picto svg { display: block; overflow: visible; width: 100%; max-width: 120px; height: auto; }
.picto svg[data-picto="files"] { max-width: 150px; }
.picto-arrow { align-self: center; margin-top: -30px; font: 700 52px/1 var(--hand); color: var(--ink); }
.picto > span { font-family: var(--hand); font-size: 34px; line-height: 1.05; margin-top: 4px; }
.more {
  position: absolute; top: -8px; right: -6px;
  width: 38px; height: 38px;
  border: 2.5px solid var(--pencil);
  border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%;
  font: 700 28px/33px var(--hand); color: var(--pencil); text-align: center;
  background: var(--paper-light);
}
.note-link { margin-top: 14px !important; }
.note-full {
  position: absolute; z-index: 3;
  left: -10px; right: -10px; top: -10px; min-height: calc(100% + 20px);
  box-sizing: border-box;
  padding: 12px 18px;
  background: var(--paper-light);
  box-shadow: 0 10px 18px -8px rgba(60, 40, 0, .5), 0 0 0 2px rgba(29, 43, 74, .15);
  line-height: 1.25; color: var(--ink);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.note-full p { margin: 0 0 8px; }
.notebook .note-full { font-size: .86em; line-height: 1.12; }
.note-full p:last-child { margin-bottom: 0; }
.picto-note.open .note-full,
.note-btn:focus-visible ~ .note-full { opacity: 1; pointer-events: auto; }
@media (hover: hover) { .note-main:hover .note-full { opacity: 1; pointer-events: auto; } }
.picto-note.hush .note-full { opacity: 0 !important; pointer-events: none !important; }
.picto-note:is(.open, :hover, :focus-within) { clip-path: none; z-index: 4; }
@media (prefers-reduced-motion: reduce) { .note-full { transition: none; } }

/* stop 2 */
.stop-site .site-grid {
  display: grid;
  grid-template-columns: 560px 1fr;
  grid-template-areas: "a b" "c b";
  gap: 34px 46px;
  align-items: start;
}
#h-site { width: fit-content; }   /* the camera frames the words, not the whole row */
#site-a { grid-area: a; }
#site-b { grid-area: b; margin: 0; }
#site-c { grid-area: c; }

.screen {
  position: relative;
  border: 4px solid var(--ink);
  border-radius: 14px 10px 16px 9px;
  background: #fbf7ea;
  padding: 16px;
  transform: rotate(1deg);
  box-shadow: 0 12px 20px -8px rgba(30, 20, 5, .5);
}
.screen-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 2px solid var(--ink);
  border-radius: 6px;
}
.screen-stage { overflow: hidden; background: #fbf7ea; }
/* before the drawing arrives (camera not yet at stop 2): pencil hatching, not a blank box */
.screen-stage:empty { background: repeating-linear-gradient(-45deg, #fbf7ea 0 14px, #ebe1c4 14px 16px); }
.pipeline-svg { display: block; width: 100%; height: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.screen figcaption { margin: 14px 0; font-size: 28px; line-height: 1.3; }
.screen-actions { display: flex; gap: 14px; }
.screen .btn { font-size: 26px; }

/* stop 6 */
.old-title {
  font-size: 92px !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1 !important;
}
.old-title .num { font-size: 0.42em; vertical-align: 0.6em; }
/* the band where the lost things float (positions are inline, in world units) */
.fog-band { position: relative; height: 300px; margin: 6px 0 16px; }
.fog-objects { list-style: none; margin: 0; padding: 0; }
.fog-obj { position: absolute; }
.fog-obj svg { display: block; overflow: visible; margin: 0 auto; }
body[data-step="fog"] .fog-obj { animation: bob 3.6s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
@keyframes bob {
  from { transform: translateY(-9px) rotate(-4deg); }
  to { transform: translateY(9px) rotate(3deg); }
}
.fog-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: help;
  font: inherit;
}
.fog-btn:focus-visible { outline: 5px dashed var(--ink); outline-offset: 8px; border-radius: 6px; }
.file-name {
  display: block;
  margin-top: 4px;
  font-family: var(--hand);
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  text-shadow: var(--halo);
}
.tip {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(100% + 14px);
  width: max-content;
  max-width: 480px;
  padding: 10px 16px;
  background: var(--paper-light);
  box-shadow: 0 6px 14px -6px rgba(60, 40, 0, .5);
  font-family: var(--hand);
  font-size: 34px;
  line-height: 1.1;
  transform: translateX(-50%) rotate(-1.5deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.tip-start .tip { left: 0; transform: rotate(-1.5deg); }
.tip-end .tip { left: auto; right: 0; transform: rotate(1.5deg); }
.fog-obj.open .tip,
.fog-btn:focus-visible + .tip { opacity: 1; }
@media (hover: hover) { .fog-obj:hover .tip { opacity: 1; } }
.fog-obj:hover, .fog-obj.open, .fog-obj:focus-within { z-index: 4; }
.fog-hint { margin: 0 0 18px !important; text-align: right; font-size: 34px; }
/* pencil straight on the sea or the fog: a darker lead keeps 4.5:1 */
.fog-hint, #mindelo-note { color: #3d3d3d; }

/* the objects act out their labels */
.platter { transform-box: fill-box; transform-origin: center; }
.fog-obj.open .platter { animation: spin .7s linear infinite; }
@media (hover: hover) { .fog-obj:hover .platter { animation: spin .7s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
#fog-drive { transition: opacity .35s; }
#fog-drive.vanish { opacity: 0; }

.stamp {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 46px;
  padding: 2px 10px;
  border: 4px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--fell);
  font-size: 26px;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(251, 246, 232, .7);
  transform: translateX(-50%) rotate(-14deg) scale(1.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s cubic-bezier(.3, 1.6, .5, 1);
}
.fog-obj.open .stamp { opacity: 1; transform: translateX(-50%) rotate(-14deg) scale(1); }
.fog-obj.open .fog-btn svg[data-obj="padlock"] { animation: rattle .45s ease-in-out; }
@media (hover: hover) {
  .fog-obj:hover .stamp { opacity: 1; transform: translateX(-50%) rotate(-14deg) scale(1); }
  .fog-obj:hover .fog-btn svg[data-obj="padlock"] { animation: rattle .45s ease-in-out; }
}
@keyframes rattle {
  20% { transform: rotate(-9deg); } 40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); }
}
.garble {
  display: block;
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  color: var(--pencil);
  white-space: nowrap;
}

/* the fog rolls back in */
.hole { animation: refog 5s ease-in 12s forwards; }
@keyframes refog { to { opacity: 0; } }

/* finale: part of the fog has lifted along the route */
.holes-finale { opacity: 0; transition: opacity 1.6s ease; }
body.route-done .holes-finale { opacity: 1; }


.hand-link {
  color: var(--ink);
  font-family: var(--hand);
  font-size: 42px;
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.note-link { display: flex; flex-wrap: wrap; gap: 6px 32px; }
.exits { margin-top: 22px !important; }
.stop p.origin { margin-top: 18px; font-size: 26px; }

/* polaroids: 6 personal photos, stops 4 and 5 only */
.polaroids {
  display: grid;
  grid-template-columns: 230px 230px;
  gap: 30px 24px;
  justify-content: center;
  margin-top: 40px;
}
.polaroid {
  position: relative;
  width: 230px;
  margin: 0;
  padding: 12px 12px 0;
  background: #fbf8ef;
  box-shadow: 0 10px 16px -6px rgba(40, 25, 5, .45), 0 1px 2px rgba(40, 25, 5, .25);
  transform: rotate(var(--tilt, 0deg));
}
.polaroid.wide { grid-column: 1 / -1; justify-self: center; width: 420px; }
.polaroids-right .polaroid:last-child { grid-column: 1 / -1; justify-self: center; }
.polaroid .photo {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #d8d0bf;
}
.polaroid.wide .photo { aspect-ratio: 16 / 9; }
.polaroid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.72) sepia(.14) contrast(.96);
  opacity: 0;
  transition: opacity .6s ease;
}
.polaroid img.loaded { opacity: 1; }
/* a touch of paper grain over the photo */
.polaroid .photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url(../assets/paper-grain.png) 0 0 / 128px;
  opacity: .7;
  pointer-events: none;
}
.polaroid figcaption {
  min-height: 64px;
  padding: 10px 6px 12px;
  font-family: var(--hand);
  font-size: 29px;
  line-height: 1.05;
  text-align: center;
  color: var(--ink);
}
/* photos sit beside the card; on phones the camera visits them in a step of their own */
.polaroids-right { position: absolute; left: calc(100% + 50px); top: 10px; margin: 0; }
.polaroids-left { position: absolute; right: calc(100% + 40px); top: -250px; margin: 0; }

/* map pins (number badges) */
.pin {
  position: absolute;
  width: 66px;
  height: 66px;
  margin: -33px 0 0 -33px;
  border: 4px solid var(--paper-light);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a5d86 0 12%, var(--ink) 45%);
  color: #fff;
  font: 400 36px/1 var(--fell);
  cursor: pointer;
  z-index: 2;
  box-shadow: 3px 6px 6px rgba(0,0,0,.3);
}
.pin-red { background: radial-gradient(circle at 35% 30%, #e4625a 0 12%, var(--red) 45%); }

/* ---------- screen-space UI ---------- */
.btn {
  font: inherit;
  font-size: 17px;
  min-height: 44px;
  padding: 8px 18px;
  border: 2px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: var(--paper-light);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 3px 0 rgba(29, 43, 74, .35);
}
.btn:hover { background: #fff3cf; }
.btn:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 rgba(29, 43, 74, .35); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2c3e66; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 7px var(--paper-light); }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.controls {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.controls > * { pointer-events: auto; }
.where {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 6px 14px;
  background: var(--paper-light);
  border-radius: 4px;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
/* Previous / Next, with the step label (and the first-screen hint) between them */
.btn-nav { white-space: nowrap; flex: none; }
.controls .mid { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* first screen only: a quiet hint, gone at the first scroll */
.scroll-hint {
  margin: 0;
  padding: 4px 10px;
  font: 22px/1 var(--hand);
  color: var(--ink);
  background: rgba(251, 246, 232, .9);
  border-radius: 4px;
  white-space: nowrap;
}
body:not([data-step="start"]) .scroll-hint, body.scrolled .scroll-hint { display: none; }
.hint-touch { display: none; }
@media (pointer: coarse) { .hint-fine { display: none; } .hint-touch { display: inline; } }
.scroll-arrow { display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .scroll-arrow { animation: none; } }
.where-short { display: none; }
@media (max-width: 759px) {
  .where { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .where-long { display: none; }
  .where-short { display: inline; }
}

/* safe zones: another step's note, cut by an edge or under the bars, fades out at rest */
#world .off-frame { opacity: 0 !important; pointer-events: none; transition: opacity .3s; }
#world .aside { opacity: .4 !important; transition: opacity .3s; }
#art-compass { opacity: .35; }   /* map furniture: kept in the background */
@media (prefers-reduced-motion: reduce) { #world .off-frame, #world .aside { transition: none; } }

/* the opening: the laptop screen at Lomé, filling the viewport (see bootFor in app.js) */
.boot {
  position: fixed; inset: 0; z-index: 8;
  display: grid; place-items: center;
  padding: 24px 20px 96px;
  background: #dbe6ec;
  color: var(--ink);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.boot.gone { visibility: hidden; }
.boot-inner { max-width: 640px; width: 100%; }
.boot-url {
  display: inline-block; margin: 0 0 28px; padding: 4px 14px;
  font: 15px/1.4 ui-monospace, 'SFMono-Regular', Menlo, monospace; color: #3a4a66;
  border: 1.5px solid #9fb2c2; border-radius: 999px; background: #eef3f6;
}
.boot h1 { margin: 0; font: 400 clamp(44px, 9vw, 84px)/1 var(--fell); }
.boot .subtitle { margin: 8px 0 26px; font: italic clamp(18px, 3vw, 24px)/1.3 var(--fell); color: #3d3d3d; }
.boot-line { margin: 0 0 30px; font-size: clamp(18px, 2.6vw, 22px); line-height: 1.45; }
.caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 4px;
  vertical-align: -0.15em; background: var(--ink);
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } .boot { transition: opacity .3s; } }
/* on the opening, no hint that this is a map: the top bar waits (still reachable by keyboard) */
body.booting .topbar { opacity: 0; }
body.booting .topbar:focus-within { opacity: 1; }
body.booting .where { display: none; }

.card {
  position: fixed;
  z-index: 9;
  background-color: var(--paper-light);
  background-image: url(../assets/paper-grain.png);
  background-size: 256px;
  padding: 22px 22px 20px;
  left: 12px;
  right: 12px;
  bottom: 74px;
  max-height: 55vh;
  overflow: auto;
  box-shadow: 0 14px 28px rgba(0,0,0,.4);
  transform: rotate(-0.6deg);
}
.card[hidden] { display: none; }
.card h1, .card h2 { margin: 0; font-weight: 400; font-size: 32px; line-height: 1.05; }
.card .subtitle { margin: 4px 0 12px; font-style: italic; color: var(--pencil); }
.card p { margin: 0 0 14px; font-size: 17px; line-height: 1.4; }
.card a { color: var(--ink); }
.signature { font-size: 16px !important; }

.legend ol {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  counter-reset: stop;
}
.legend li { counter-increment: stop; }
.legend button {
  font: inherit;
  font-size: 15px;
  min-height: 36px;
  padding: 4px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.legend button:hover { background: #fff3cf; }
.legend button::before { content: counter(stop) " · "; color: var(--red); }


/* Narrow phones: arrows only, the label stays for screen readers */
@media (max-width: 479px) {
  .btn-nav { min-width: 52px; font-size: 20px; padding: 6px 12px; }
  .btn-nav .lbl {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 760px) {
  .card {
    left: 22px;
    right: auto;
    top: 72px;
    bottom: auto;
    width: 350px;
    max-height: calc(100vh - 160px);
  }
  .card h1 { font-size: 44px; }
}

/* Short windows (laptops, landscape phones, small panes): a tighter card */
@media (max-height: 760px) {
  .card { padding: 14px 16px 12px; }
  .card h1, .card h2 { font-size: 28px !important; }
  .card .subtitle { margin-bottom: 6px; font-size: 15px; }
  .card p { font-size: 15px; margin-bottom: 10px; }
  .card .btn { min-height: 40px; padding: 6px 14px; font-size: 16px; }
  .legend ol { margin-top: 10px; gap: 5px; }
  .legend button { font-size: 13px; min-height: 30px; padding: 2px 9px; }
}
@media (max-height: 760px) and (max-width: 759px) {
  .card { bottom: 66px; max-height: 50vh; }
}
/* Narrow and short (small panes, split screens): stops on one scrollable row */
@media (max-height: 600px) and (max-width: 759px) {
  .card { max-height: 46vh; }
  .card .subtitle { display: none; }
  .legend ol { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .legend li { flex: none; }
}
@media (max-height: 520px) {
  .card .subtitle { display: none; }
  .card h1, .card h2 { font-size: 24px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-step="mindelo"] .gust { animation: none; }
  body[data-step="fog"] .fog-obj,
  .fog-obj .platter, .fog-obj .fog-btn svg { animation: none !important; }
  .tip, .stamp, .holes-finale, #fog-drive { transition: none; }
  #route { transition: none; }
}

/* Phones: the stop 2 heading wraps to the width of the post-it it sits above */
@media (max-width: 759px) {
  #h-site { max-width: 560px; }
}

/* stop 6: clear the fog (button, Skip, reduced motion) */
.fog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 14px; margin: 0 0 18px; }
.fog-actions .fog-hint { flex: 1 1 100%; margin: 0 !important; }
.fog-actions .btn { font-size: 44px; min-height: 92px; padding: 12px 34px; }
/* once lifted, the buttons have done their job (space kept, so nothing jumps) */
body.fog-cleared .fog-actions .btn { visibility: hidden; }
body.fog-cleared .fog-hint { visibility: hidden; }
.fog-clear { opacity: 0; transition: opacity 1.6s ease; }
body.fog-cleared .fog-clear { opacity: 1; }
body.fog-instant .fog-clear { transition: none; }

/* stop 7: the empty spot is a button; the visitor's pin and word */
.reserved { position: absolute; z-index: 2; }
.reserved-btn {
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: crosshair;
}
@media (hover: hover) { .reserved-btn:hover { background: rgba(179, 38, 30, .07); } }
.reserved-btn:focus-visible { outline: 5px dashed var(--ink); outline-offset: 6px; }
.reserved-word {
  position: absolute; width: 380px; height: 64px; margin-left: -190px;
  padding: 0 12px; z-index: 3;
  font: 700 46px/1 var(--hand); color: var(--ink); text-align: center;
  background: rgba(251, 246, 232, .96);
  border: 2px dashed var(--ink); border-radius: 6px;
}
.reserved-word[hidden] { display: none; }
#planted.drop { animation: pin-drop .45s cubic-bezier(.3, 1.5, .6, 1) both; }
@keyframes pin-drop { from { opacity: 0; transform: translateY(-60px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .fog-clear { transition: none; }
  #planted.drop { animation: none; }
}

/* the ship's log: one pencil line per stop, top left */
.log {
  margin: 0;
  padding: 4px 10px;
  max-width: 340px;
  font: 22px/1.1 var(--hand);
  color: var(--pencil);
  background: rgba(251, 246, 232, .82);
  border-radius: 4px;
  transform: rotate(-1.5deg);
  transition: opacity .2s;
}
.log:empty { visibility: hidden; }
.log.swap { opacity: 0; }
@media (max-width: 759px) { .log { font-size: 18px; max-width: calc(100vw - 210px); } }
@media (prefers-reduced-motion: reduce) { .log { transition: none; } }

/* the boat: its wake shows only while it sails; reduced motion: no boat */
.boat-wake { opacity: 0; transition: opacity .3s; }
.boat.sailing .boat-wake { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #boat { display: none; } }

/* stop 6: the construction-site note, a vault beside the text */
.fog-card { display: flex; gap: 22px; align-items: center; }
.fog-card > svg { flex: none; overflow: visible; }
/* stop 6: what it takes to lift the fog */
.fog-needs { margin-top: 10px !important; font-style: italic; }
/* finale card: the conclusion of the whole route */
.card .finale-line { margin: 10px 0 14px; font-size: 19px; line-height: 1.35; }

/* "Lost in ..." stamp under each stop title: the thread from stop to stop */
.lost-tag {
  display: block;
  width: fit-content;
  margin-top: 10px;
  padding: 2px 12px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-size: 24px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: none;
  transform: rotate(-3deg);
}
.fog-choice { margin-top: 12px; }

/* ---------- no JavaScript: the route as plain text, above the inert map ---------- */
.nojs {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: auto;
  padding: 24px 16px 32px;
  background: var(--paper-light) url(../assets/paper-grain.png);
  background-size: 256px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}
.nojs > * { max-width: 40rem; margin-left: auto; margin-right: auto; }
.nojs h1 { margin-top: 0; margin-bottom: 0; font-weight: 400; font-size: 36px; }
.nojs .subtitle { margin-top: 4px; font-style: italic; color: var(--pencil); }
.nojs ol { padding-left: 1.4em; }
.nojs li { margin-bottom: 10px; }
.nojs a { color: var(--ink); }
/* stop 2: the route crosses the title; a patch of paper keeps it clear */
#h-site { width: fit-content; background: var(--paper); box-shadow: 0 0 14px 10px var(--paper); border-radius: 12px; }
/* stop 2: "Run the pipeline" is the call to action, "Skip" a quiet link */
.screen .btn-ghost { padding-left: 6px; padding-right: 6px; color: var(--pencil); text-decoration: underline; text-underline-offset: 4px; }
/* stop 6: the note is the answer under the fog; hidden (also from screen readers) until it lifts */
#fog-card { margin-top: 24px; font-size: 32px; transition: opacity .6s ease, visibility .6s; }
body[data-step="fog"]:not(.fog-cleared) #fog-card { opacity: 0; visibility: hidden; }
@media (min-width: 700px) { #fog-card { width: 780px; } }   /* wide screens: fewer lines, larger on screen */
@media (prefers-reduced-motion: reduce) { #fog-card { transition: none; } }
/* stop 1: a slightly larger post-it fills the frame */
#lome-card { font-size: 31px; }
#lome-card .note-short { text-wrap: balance; }
/* stop 7: the empty field says what it wants */
.reserved-word::placeholder { color: var(--pencil); opacity: 1; }

/* already on the whole map: nothing to skip to */
body[data-step="finale"] #btn-overview { visibility: hidden; }

/* the chart inks itself along the route (inkFor in app.js) */
#chart [data-ink] { opacity: 0; transition: opacity .9s ease-out; }
#chart [data-ink].inked { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #chart [data-ink] { transition: none; } }
