/* Scroll-driven explainer film. Scrolling through #film moves the timeline;
   the play button advances it and scrolls the page in step. Site tokens only. */
.film {
  --film-ink: var(--ink);
  --film-ink2: var(--muted);
  --film-ink3: var(--faded);
  --film-line: var(--line);
  --film-card: var(--paper);
  --film-accent: hsla(24, 78%, 52%, 1);
  --film-accent-soft: hsla(24, 78%, 52%, 0.14);
  --k-water: hsla(204, 58%, 46%, 1);
  --k-land: hsla(142, 36%, 38%, 1);
  --k-people: hsla(282, 32%, 50%, 1);
  --k-built: hsla(var(--hue-primary), 9%, 52%, 1);
  --band: 48px;
  position: relative;
  /* The film fills the first screen: it slides up under the site header, which floats above it. */
  margin-top: calc(-1 * var(--film-head, 90px));
}

body .topbar { position: relative; z-index: 3; margin-bottom: 0; }

:root[data-theme="dark"] .film {
  --film-accent: hsla(26, 86%, 62%, 1);
  --film-accent-soft: hsla(26, 86%, 62%, 0.16);
  --k-water: hsla(204, 62%, 66%, 1);
  --k-land: hsla(142, 38%, 60%, 1);
  --k-people: hsla(282, 40%, 72%, 1);
  --k-built: hsla(var(--hue-primary), 12%, 64%, 1);
}

.film-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto var(--band);
  padding: calc(var(--film-top, var(--film-head, 90px)) + 4px) var(--gutter) 10px;
}

@supports (height: 100dvh) {
  .film-sticky { height: 100dvh; }
}

.film-screen {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}

/* the stage fills the screen box exactly: its size must never follow the viewBox, or the camera's
   framing would feed back into the shape it measures */
#stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
}

.cap {
  min-height: 3.2em;
  max-width: 60ch;
  margin: 0 auto;
  padding: 6px 0 4px;
  text-align: center;
  color: var(--film-ink2);
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.5;
  text-wrap: balance;
  transition: opacity 0.28s ease;
}

.cap.fade { opacity: 0; }
.cap .k-water { color: var(--k-water); font-weight: 800; }
.cap .k-land { color: var(--k-land); font-weight: 800; }
.cap .k-people { color: var(--k-people); font-weight: 800; }
.cap .k-built { color: var(--k-built); font-weight: 800; }
.cap .k-acc { color: var(--film-accent); font-weight: 800; }
.cap .k-ink { color: var(--film-ink); font-weight: 800; }

.film-band {
  display: flex;
  align-items: center;
  gap: 12px;
}

.film-band > button {
  height: 38px;
  min-width: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--film-ink);
  box-shadow: 0 8px 22px var(--shadow-soft);
  cursor: pointer;
  transition: color 160ms ease;
}

.film-band > button svg { width: 14px; height: 14px; fill: currentColor; }

.film-band .skip {
  padding: 0 16px;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--film-ink2);
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
}

.film-band .skip:hover { color: var(--film-ink); }

.bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  cursor: pointer;
  touch-action: none;
}

.bar i {
  position: relative;
  height: 3px;
  border-radius: 3px;
  background: var(--panel-strong);
  overflow: hidden;
  transition: height 0.2s ease;
}

.bar:hover i, .bar:focus-visible i { height: 6px; }
.bar i b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--film-ink); }

.bartip {
  position: absolute;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--film-ink2);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 24px var(--shadow-medium);
}

.bartip i { font-style: normal; color: var(--film-ink3); margin-right: 6px; }

.film-time {
  color: var(--film-ink3);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--film-ink3);
  font-size: 0.86rem;
  font-weight: 700;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.scroll-hint i { animation: hint-bob 1.8s ease-in-out infinite; }
@keyframes hint-bob { 50% { transform: translateY(4px); } }

.film-tip, .film-pin {
  position: absolute;
  z-index: 5;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 18px 42px var(--shadow-medium);
  color: var(--film-ink2);
  font-size: 0.92rem;
  line-height: 1.45;
}

.film-tip { max-width: 300px; padding: 10px 14px; pointer-events: none; }
.film-tip small { display: block; margin-top: 6px; color: var(--film-ink3); font-size: 0.78rem; font-weight: 700; }

.film-cite {
  margin: 0 auto;
  min-height: 1.6em;
  color: var(--film-ink3);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  transition: opacity 0.3s ease;
}

.film-cite.is-empty { opacity: 0; }
.film-cite a { color: var(--film-ink2); transition: color 160ms ease; }
.film-cite a:hover { color: var(--film-ink); }

.pin-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--film-ink2);
  font-weight: 800;
  font-size: 0.86rem;
  transition: color 160ms ease;
}

.pin-link:hover { color: var(--film-accent); }
.film-tip b, .film-pin h3 {
  display: block;
  margin: 0 0 2px;
  color: var(--film-ink);
  font-family: "Raleway", ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.film-pin { top: 8px; right: 0; width: min(340px, 100%); padding: 16px 18px; }
.film-pin h3 { font-size: 1.1rem; padding-right: 30px; }
.film-pin p { margin: 10px 0 0; padding-left: 12px; border-left: 2px solid var(--film-accent); }
.film-pin button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--film-ink3);
  font-size: 18px;
  cursor: pointer;
}

/* svg type */
.t-d { font-family: "Raleway", ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.02em; }
.t-b { font-family: "Nunito", ui-sans-serif, system-ui, sans-serif; }
.mid { dominant-baseline: central; }
/* Hover: dots grow, words take the accent, outlined nodes take an accent edge.
   Group labels (.keep) keep their colour; hovering them focuses their group instead. */
#stage .hot { cursor: pointer; }
#stage circle.hot { transform-box: fill-box; transform-origin: center; transition: transform 180ms cubic-bezier(.2,.7,.1,1); }
#stage circle.hot.is-hover { transform: scale(1.7); }
#stage text.hot, #stage .hot text { transition: fill 160ms ease; }
#stage text.hot.is-hover, #stage .hot.is-hover:not(.keep) text { fill: var(--film-accent) !important; }
#stage g.hot.is-hover circle { stroke: var(--film-accent) !important; }
.fbtn { cursor: pointer; }
.fbtn rect { fill: var(--film-card); stroke: var(--film-line); stroke-width: 1.6px; transition: stroke 160ms ease; }
.fbtn text { fill: var(--film-ink2); font-family: "Nunito", ui-sans-serif, system-ui, sans-serif; font-weight: 800; }
.fbtn:hover rect { stroke: var(--film-accent); }
.fbtn.on rect { fill: var(--film-accent-soft); stroke: var(--film-accent); }
.fbtn.on text { fill: var(--film-accent); }
#stage > g.leaving { transition: opacity 0.22s ease; }
#stage > g { transition: opacity 0.35s ease; }

@media (max-width: 620px) {
  .film-time { display: none; }
  .film-band .skip span { display: none; }
  .film-band { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint i { animation: none; }
  .cap, .leaving { transition: none; }
}

/* the first screen is a search field: type a place and jump to it, or scroll and the film takes over */
.front-search {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(720px, 88%);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--film-card, hsla(0, 0%, 100%, 1));
  box-shadow: 0 18px 48px hsla(220, 20%, 20%, 0.12);
  transition: opacity 0.4s ease, box-shadow 0.16s ease;
}
.front-search label { color: var(--film-ink3); font-size: 1.4rem; cursor: text; }
.front-search input { flex: 1; min-width: 0; height: 76px; border: 0; padding: 0; background: none; color: var(--film-ink); font: inherit; font-size: clamp(1.15rem, 2.4vw, 1.7rem); font-weight: 600; letter-spacing: -0.01em; }
.front-search input::placeholder { color: var(--film-ink3); font-weight: 500; }
.front-search input:focus, .front-search input:focus-visible { outline: none; }
.front-search:focus-within { box-shadow: 0 22px 56px hsla(220, 20%, 20%, 0.18); }
.front-search:focus-within label { color: var(--film-accent); }
#stage { transition: opacity 0.4s ease; }
.film.is-front #stage { opacity: 0; }
.film:not(.is-front) .front-search { opacity: 0; pointer-events: none; }
@media (max-width: 600px) {
  .front-search { min-height: 60px; padding: 0 20px; gap: 12px; }
  .front-search input { height: 60px; }
}
