/* The world page is the stage alone: the planet and the night scenes fill the viewport; the pins, the top bar,
   the timeline and the card with a country's projects float over the canvas. world.js draws and drives it all. */
:root {
  --ink: #fdf6e3;
  --muted: #b9b4c8;
  --line: rgba(253, 246, 227, .18);
  --glass: rgba(8, 12, 24, .78);
  --chip: rgba(253, 246, 227, .1);
  --sun: #f08a55;
  --sea: #7fe3ff;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --pixel: "Silkscreen", "Courier New", monospace;
  --mono: "Fira Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #04060d; color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The stage fills the viewport. A one-finger drag turns the view; two fingers still zoom the page. */
.stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; background: #04060d; touch-action: pinch-zoom; cursor: grab; }
.stage.hot { cursor: pointer; }
.stage.dragging { cursor: grabbing; }
.stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap;
  font-family: var(--pixel); font-size: 11px; line-height: 1.3; color: #1d1d2b; background: #fdf6e3;
  border: 2px solid #1d1d2b; box-shadow: 2px 2px 0 #1d1d2b; padding: 3px 7px; display: grid; justify-items: center;
}
.pin small { font-size: 9px; color: #6b5a8c; }
.pin small.done { color: #8a5a00; }
.pin small.now { color: #b4501f; }
.pin.far { background: rgba(8, 12, 24, .78); color: #fdf6e3; border-color: rgba(253, 246, 227, .35); box-shadow: none; font-size: 10px; }
.pin.far small { color: #d9cfff; }
.pin.proj::before { content: "◆ "; color: #c98a00; }
.pin:hover, .pin.hot { background: #ffd27a; color: #1d1d2b; }
.pin.on { background: #ff8a4c; color: #1d1d2b; }

/* Top bar: back to the planet, where we are, and the way home. */
.topbar { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); display: flex; gap: 8px; align-items: center; pointer-events: none; z-index: 3; }
.topbar > * { pointer-events: auto; }
.chipbtn, .place, .home { border-radius: 4px; padding: 5px 9px; }
.chipbtn, .place { font-family: var(--pixel); font-size: 11px; }
.chipbtn { background: #fdf6e3; color: #1d1d2b; border: 2px solid #1d1d2b; box-shadow: 2px 2px 0 #1d1d2b; cursor: pointer; }
.place { color: #fdf6e3; background: var(--glass); pointer-events: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .grow { flex: 1; pointer-events: none; }
.home { font-family: var(--mono); font-size: 13px; color: var(--ink); text-decoration: none; background: var(--glass); border: 1px solid var(--line); white-space: nowrap; }
.home:hover { border-color: var(--sun); }
.home b { color: var(--sun); font-weight: 500; }

/* Timeline of the stops, at the bottom. */
.timeline { position: absolute; left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; list-style: none; margin: 0; padding: 4px; gap: 4px; background: rgba(8, 12, 24, .74); border-radius: 8px; z-index: 3; }
.timeline li { flex: 1; min-width: 0; display: flex; }
.timeline button { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 3px; background: none; border: 0; color: #fdf6e3; font-family: var(--pixel); font-size: 10px; padding: 5px 2px; cursor: pointer; border-radius: 6px; }
.timeline button:hover { background: rgba(255, 255, 255, .08); }
.timeline button[aria-current] { background: rgba(255, 255, 255, .16); }
.timeline .dot { width: 10px; height: 10px; border: 2px solid #fdf6e3; }
.timeline .dot.done { background: #ffd27a; }
.timeline .dot.now { background: #ff8a4c; }
.timeline .dot.next, .timeline .dot.later { background: transparent; border-color: #b9a8ff; }
.timeline small { font-family: var(--body); font-size: 11px; opacity: .72; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 5; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); font-size: 12px; color: #fdf6e3; background: #04060d; text-align: center; padding-inline: 16px; z-index: 6; }
button:focus-visible, .stage:focus-visible, a:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* The card over the scene: a country's projects, or one project's details. */
.panel { position: absolute; top: calc(52px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); width: min(340px, 42%); max-height: calc(100% - 52px - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; z-index: 2; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; display: grid; gap: 10px; align-content: start; }
.panel h2 { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; margin: 0; text-wrap: balance; }
.panel p { margin: 0; }
.panel .when { color: var(--muted); font-size: 14px; }
.panel .when b { font-weight: 600; }
.st-done { color: #ffd27a; } .st-now { color: #ff9a62; } .st-next, .st-later { color: #b9a8ff; }
.panel .note { color: var(--muted); font-size: 14px; }
.panel a { color: var(--sea); }
.linkbtn { justify-self: start; font: 600 14px var(--body); color: var(--sea); background: none; border: 0; padding: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list button { width: 100%; text-align: left; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline; font: 15px var(--body); color: var(--ink); background: var(--chip); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.list button:hover { border-color: var(--sun); }
.list button .tag { grid-row: span 2; align-self: center; }
.list button strong { font-weight: 600; }
.list button span.sub { grid-column: 2; font-size: 13px; color: var(--muted); }
.tags { display: flex; gap: 6px; }
.tag { font-family: var(--pixel); font-size: 10px; letter-spacing: .03em; padding: 2px 6px; border-radius: 3px; background: var(--ink); color: #1d1d2b; white-space: nowrap; }
.tag.ex { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.result { border-left: 3px solid var(--sun); padding-left: 10px; }
.result b { display: block; font-family: var(--pixel); font-size: 10px; font-weight: 400; color: var(--muted); }
.meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.meta dt { font-family: var(--pixel); font-size: 10px; color: var(--muted); padding-top: 3px; }
.meta dd { margin: 0; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 13px; background: var(--chip); border-radius: 999px; padding: 2px 10px; }

/* Phones: the card becomes a sheet over the lower part of the stage, above the timeline. */
@media (max-width: 700px) {
  .panel { top: auto; left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; max-height: 46%; }
  .panel h2 { font-size: 22px; }
  .timeline small { display: none; }
  .pin { font-size: 10px; padding: 2px 5px; }
}

/* Touch screens: 44px tap targets and no text under 12px. The pins and the card's back link get an invisible larger hit area. */
@media (pointer: coarse) {
  .pin, .pin.far, .pin small, .chipbtn, .place, .timeline button, .timeline small, .tag, .result b, .meta dt { font-size: 12px; }
  .chipbtn { min-height: 44px; }
  .home { padding-block: 12px; }
  .timeline button { min-height: 44px; }
  .linkbtn { position: relative; }
  .pin::after, .linkbtn::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
}
@media (pointer: coarse) and (min-width: 701px) {
  .panel { top: calc(64px + env(safe-area-inset-top)); max-height: calc(100% - 64px - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) and (max-width: 700px) {
  .panel { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
