/* ============================================================
   THE WIZARDING ATLAS — Harry Potter filming-location globe
   A Victorian gazeteer's atlas, gilded: oxblood leather, gold
   leaf, parchment, and an orrery of rings around a real Earth.
   ============================================================ */

/* Cinzel and EB Garamond are served as variable fonts, so one face covers the
   whole weight range. Files are local, so the atlas works with no network. */
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 900; src: url('../assets/fonts/cinzel-400.woff2') format('woff2-variations'), url('../assets/fonts/cinzel-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 700; src: url('../assets/fonts/ebgaramond-400.woff2') format('woff2-variations'), url('../assets/fonts/ebgaramond-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400 700; src: url('../assets/fonts/ebgaramond-400i.woff2') format('woff2-variations'), url('../assets/fonts/ebgaramond-400i.woff2') format('woff2'); font-display: swap; }

:root {
  --ink:        #07070a;
  --ink-2:      #0e0d0c;
  --panel:      rgba(20, 17, 13, 0.82);
  --panel-solid:#15120e;
  --gold:       #d8b25f;
  --gold-lit:   #f0d79a;
  --gold-dim:   #8a6a2c;
  --gold-hair:  rgba(216, 178, 95, 0.30);
  --parch:      #ece0c8;
  --parch-dim:  #a99a86;
  --muted:      #a2988a;
  --muted-2:    #7d7466;
  --spell:      #57d99a;
  --oxblood:    #6d2222;

  --serif: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --display: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;

  --rail: 336px;
  --card: 420px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background:
    radial-gradient(120% 90% at 50% 12%, #17130f 0%, #0a0908 46%, #050405 100%);
  color: var(--parch);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.62;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

canvas#globe { position: fixed; inset: 0; display: block; z-index: 0; }

/* a faint damask / cartographer's grid over the whole page, like paper tooth */
#grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .30; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='.5'/></svg>");
}

/* vignette so the panels sit on darkness */
#vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(125% 100% at 50% 45%, transparent 42%, rgba(0,0,0,.55) 100%);
}

.hud { position: fixed; z-index: 5; }

/* ------------------------------------------------------ the title cartouche */
#title {
  top: 0; left: var(--rail); padding: 22px 26px 20px;
  max-width: 420px; pointer-events: none;
}
#title::before {
  content: ''; position: absolute; z-index: -1;
  left: -60px; top: -40px; right: -90px; bottom: -46px;
  background: radial-gradient(115% 100% at 0% 0%,
    rgba(5,4,4,.90) 0%, rgba(5,4,4,.62) 42%, rgba(5,4,4,.22) 68%, transparent 84%);
  pointer-events: none;
}
#title .eyebrow {
  font-family: var(--display); font-size: 10px; font-weight: 600;
  letter-spacing: .42em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: 9px;
  display: flex; align-items: center; gap: 10px;
}
#title .eyebrow::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--gold-hair), transparent);
}
#title h1 {
  font-family: var(--display); font-weight: 600;
  font-size: 30px; line-height: 1.06; letter-spacing: .045em;
  margin: 0 0 4px; color: var(--gold-lit);
  text-shadow: 0 0 26px rgba(216,178,95,.22);
}
#title h1 .of { color: var(--parch); opacity: .5; font-style: italic; font-weight: 400; }
#title p {
  margin: 8px 0 0; font-size: 14.5px; color: var(--muted);
  max-width: 33ch; line-height: 1.5;
}
#title .stat {
  margin-top: 12px; display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--display); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted-2);
}
#title .stat b { color: var(--gold); font-weight: 600; font-size: 12px; }

/* --------------------------------------------------- production filter tabs */
#productions {
  position: static; margin-top: 14px; padding-top: 13px;
  transform: none; border-top: 1px solid rgba(216,178,95,.16);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  max-width: none; padding: 0; pointer-events: auto;
}
.prodlabel {
  flex: 0 0 100%; margin-bottom: 2px;
  font-family: var(--display); font-size: 9px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: var(--gold-dim);
}
.chip {
  font-family: var(--display); font-size: 10.5px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--gold-hair); border-radius: 2px;
  padding: 6px 10px 5px; cursor: pointer;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s;
  white-space: nowrap; line-height: 1.25;
}
.chip:hover { color: var(--gold-lit); border-color: var(--gold); }
.chip[aria-pressed="true"] {
  color: #17120a; background: linear-gradient(180deg, var(--gold-lit), var(--gold));
  border-color: var(--gold-lit); font-weight: 700;
  box-shadow: 0 0 18px rgba(216,178,95,.34);
}
.chip .yr { opacity: .62; margin-left: 5px; font-size: 9.5px; }
.chip[aria-pressed="true"] .yr { opacity: .72; }
.chip.series { border-style: dashed; }

/* --------------------------------------------------------- the left index */
#index {
  top: 0; left: 0; bottom: 0; width: var(--rail);
  display: flex; flex-direction: column;
  background: linear-gradient(100deg, rgba(12,10,8,.94) 62%, rgba(12,10,8,.62) 100%);
  border-right: 1px solid var(--gold-hair);
  backdrop-filter: blur(3px);
}
#index header { padding: 20px 20px 12px; border-bottom: 1px solid rgba(216,178,95,.16); }
#index h2 {
  font-family: var(--display); font-size: 11px; font-weight: 600;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 12px;
}
.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--gold-hair); border-radius: 2px;
  background: rgba(0,0,0,.34); padding: 7px 10px;
}
.search span { color: var(--gold-dim); font-size: 13px; line-height: 1; }
.search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--parch); font-family: var(--serif); font-size: 14.5px;
}
.search input::placeholder { color: var(--muted-2); font-style: italic; }
.search:focus-within { border-color: var(--gold); }

#list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 26px; }
#list::-webkit-scrollbar { width: 9px; }
#list::-webkit-scrollbar-track { background: rgba(0,0,0,.3); }
#list::-webkit-scrollbar-thumb { background: rgba(216,178,95,.26); border: 2px solid transparent; background-clip: content-box; }
#list::-webkit-scrollbar-thumb:hover { background: rgba(216,178,95,.45); background-clip: content-box; }

.group-label {
  font-family: var(--display); font-size: 9.5px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: var(--gold-dim);
  padding: 16px 20px 6px; position: sticky; top: 0;
  background: linear-gradient(180deg, rgba(12,10,8,.98), rgba(12,10,8,.88));
  backdrop-filter: blur(3px); z-index: 1;
}
.row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; border-left: 2px solid transparent;
  padding: 8px 20px 9px; color: var(--parch);
  font-family: var(--serif); font-size: 15px; line-height: 1.35;
  transition: background .16s, border-color .16s, color .16s;
}
.row:hover { background: rgba(216,178,95,.07); border-left-color: var(--gold-dim); }
.row[aria-selected="true"] {
  background: linear-gradient(90deg, rgba(216,178,95,.16), rgba(216,178,95,.02));
  border-left-color: var(--gold-lit); color: var(--gold-lit);
}
.row .nm { display: block; }
.row .sub {
  display: flex; align-items: center; gap: 8px; margin-top: 2px;
  font-family: var(--display); font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted-2);
}
.row .glyph { color: var(--gold); font-size: 9px; }
.row .n-film { margin-left: auto; color: var(--gold-dim); }
.row.dim { opacity: .3; }
.empty { padding: 24px 20px; color: var(--muted-2); font-style: italic; }

/* --------------------------------------------------------- the dossier */
#dossier {
  top: 0; right: 0; bottom: 0; width: var(--card);
  overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(260deg, rgba(13,11,9,.95) 60%, rgba(13,11,9,.66) 100%);
  border-left: 1px solid var(--gold-hair);
  transform: translateX(102%); opacity: 0;
  transition: transform .46s cubic-bezier(.22,.8,.24,1), opacity .34s;
}
#dossier.open { transform: none; opacity: 1; }
#dossier::-webkit-scrollbar { width: 9px; }
#dossier::-webkit-scrollbar-thumb { background: rgba(216,178,95,.26); border: 2px solid transparent; background-clip: content-box; }

.doc {
  position: relative;
  background:
    linear-gradient(180deg, rgba(38,31,23,.62), rgba(24,20,15,.62)),
    var(--panel-solid);
  margin: 14px; padding: 0 0 20px;
  border: 1px solid var(--gold-hair);
  box-shadow: 0 24px 60px rgba(0,0,0,.6), inset 0 0 0 1px rgba(216,178,95,.06);
}
.doc::after {  /* paper tooth inside the card */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23p)' opacity='.55'/></svg>");
}
.doc > * { position: relative; z-index: 1; }

.doc .plate { position: relative; margin: 0 0 2px; background: #0a0806; }
.doc .plate img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.doc .plate .fallback {
  aspect-ratio: 16/9; display: grid; place-items: center;
  color: var(--gold-dim); font-family: var(--display);
  letter-spacing: .2em; font-size: 11px;
  background: repeating-linear-gradient(45deg, #16120c, #16120c 9px, #1b1610 9px, #1b1610 18px);
}
.doc .plate::after {  /* gilded rule under the photograph */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-lit) 22%, var(--gold) 60%, var(--gold-dim));
}
.doc .credit {
  position: absolute; right: 8px; bottom: 7px; z-index: 2;
  font-size: 10px; color: rgba(236,224,200,.72);
  background: rgba(0,0,0,.62); padding: 1px 6px; border: 1px solid rgba(216,178,95,.2);
  font-family: var(--display); letter-spacing: .06em;
}

.doc .head { padding: 16px 20px 0; }
.doc .kicker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--display); font-size: 9.5px; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase; color: var(--gold-dim);
  margin-bottom: 8px;
}
.doc h3 {
  font-family: var(--display); font-weight: 600; font-size: 21px; line-height: 1.16;
  letter-spacing: .015em; margin: 0 0 5px; color: var(--gold-lit);
}
.doc .where { color: var(--muted); font-size: 14.5px; font-style: italic; margin: 0 0 12px; }
.doc .coords {
  font-family: var(--display); font-size: 10px; letter-spacing: .12em;
  color: var(--muted-2); margin: 0 0 4px;
}

.tag {
  display: inline-block; font-family: var(--display); font-size: 9px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  padding: 2.5px 7px 2px; border: 1px solid currentColor; border-radius: 1px;
}
.tag.set     { color: var(--gold); }
.tag.studio  { color: #9ec9e8; }
.tag.gateway { color: var(--muted); }
.tag.premiere{ color: #c9a0d8; }
.tag.express { color: var(--spell); }

.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; }
.badge {
  font-family: var(--display); font-size: 9.5px; font-weight: 600; letter-spacing: .1em;
  padding: 3px 7px 2px; border-radius: 1px; cursor: pointer;
  border: 1px solid rgba(216,178,95,.34); color: var(--gold);
  background: rgba(216,178,95,.07); line-height: 1.3;
  transition: background .15s, color .15s;
}
.badge:hover { background: var(--gold); color: #17120a; }
.badge.fb { border-style: dashed; color: #9ec9e8; background: rgba(158,201,232,.08); }
.badge.fb:hover { background: #9ec9e8; color: #0d1116; }
.badge.hbo { border-style: dotted; color: #c9a0d8; background: rgba(201,160,216,.08); }
.badge.hbo:hover { background: #c9a0d8; color: #1a1020; }
.badge i { font-style: normal; opacity: .62; font-weight: 400; margin-left: 4px; }

.sect { padding: 16px 20px 0; }
.sect h4 {
  font-family: var(--display); font-size: 9.5px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 8px; display: flex; align-items: center; gap: 9px;
}
.sect h4::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(216,178,95,.4), transparent);
}
.sect p { margin: 0 0 4px; color: #ddd2bc; }
.sect .quote { color: var(--parch); }
.sect dl { margin: 0; }
.sect dt {
  font-family: var(--display); font-size: 9px; font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold-dim); margin-top: 11px;
}
.sect dd { margin: 3px 0 0; color: #ddd2bc; }
.sect dd.tip { color: var(--spell); opacity: .92; }
.sect dd.tip::before { content: '\2726  '; opacity: .7; }

.clusterhint {
  flex-basis: 100%; margin-top: 4px;
  font-family: var(--serif); font-size: 12.5px; font-style: italic;
  letter-spacing: 0; text-transform: none; color: var(--spell); opacity: .85;
}
.sources { margin: 20px 20px 0; padding-top: 13px; border-top: 1px solid rgba(216,178,95,.18); }
.sources h5 {
  font-family: var(--display); font-size: 9px; font-weight: 600; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold-dim); margin: 0 0 8px;
}
.sources a {
  display: block; color: var(--muted); text-decoration: none;
  font-size: 13px; line-height: 1.4; padding: 3px 0 3px 13px; position: relative;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sources a::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 6px; height: 1px; background: var(--gold-dim);
}
.sources a:hover { color: var(--gold-lit); }

#docClose {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(216,178,95,.4); background: rgba(10,8,6,.7);
  color: var(--gold); cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center; font-family: var(--serif);
  transition: background .15s, color .15s;
}
#docClose:hover { background: var(--gold); color: #17120a; }

/* ------------------------------------------------------------- legend */
#legend {
  left: calc(var(--rail) + 22px); bottom: 20px;
  background: var(--panel); border: 1px solid var(--gold-hair);
  padding: 13px 16px; max-width: 268px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#legend h4 {
  font-family: var(--display); font-size: 9px; font-weight: 600; letter-spacing: .26em;
  text-transform: uppercase; color: var(--gold-dim); margin: 0 0 9px;
}
#legend .row2 { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 7px; font-size: 13.5px; color: var(--muted); }
#legend .row2:last-child { margin-bottom: 0; }
#legend .dot { width: 9px; height: 9px; margin-top: 6px; flex: none; transform: rotate(45deg); border: 1px solid var(--gold); }
#legend .dot.solid { background: var(--gold); }
#legend .dot.studio { border-color: #9ec9e8; }
#legend .dot.studio.solid { background: #9ec9e8; }
#legend .dot.dim { border-style: dashed; }
#legend .line { width: 22px; height: 1px; margin-top: 10px; flex: none; background: linear-gradient(90deg, transparent, #8fd8ff); }

/* ------------------------------------------------------------ controls */
#controls {
  right: 22px; bottom: 20px; display: flex; gap: 7px; align-items: center;
}
#controls button, #controls label {
  font-family: var(--display); font-size: 10px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); cursor: pointer;
  background: var(--panel); border: 1px solid var(--gold-hair); border-radius: 2px;
  padding: 8px 12px 7px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 7px; line-height: 1;
  transition: color .16s, border-color .16s, background .16s;
}
#controls button:hover, #controls label:hover { color: var(--gold-lit); border-color: var(--gold); }
#controls button[aria-pressed="true"] { color: #17120a; background: var(--gold); border-color: var(--gold-lit); }
#controls input { accent-color: var(--gold); margin: 0; }
#controls .sep { width: 1px; height: 22px; background: var(--gold-hair); }

/* ------------------------------------------------------------- loader */
#loader {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: radial-gradient(60% 50% at 50% 45%, #17130f, #050405);
  transition: opacity .8s; text-align: center;
}
#loader.gone { opacity: 0; pointer-events: none; }
#loader .sigil {
  width: 74px; height: 74px; margin: 0 auto 22px; position: relative;
  animation: spin 9s linear infinite;
}
#loader .sigil::before, #loader .sigil::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--gold-hair);
}
#loader .sigil::after { inset: 12px; border-color: var(--gold-dim); border-style: dashed; }
#loader .sigil span {
  position: absolute; inset: 26px; border-radius: 50%;
  border: 1px solid var(--gold); border-top-color: transparent; border-bottom-color: transparent;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loader h2 {
  font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .42em;
  text-transform: uppercase; color: var(--gold); margin: 0 0 10px;
}
#loader p { color: var(--muted-2); font-style: italic; font-size: 14px; margin: 0; }
#loader .err { color: #e08a8a; max-width: 46ch; margin: 12px auto 0; font-style: normal; font-size: 13px; }

/* --------------------------------------------------------------- mobile */
#controls .drawerBtn { display: none; }

@media (max-width: 1180px) {
  :root { --rail: 292px; --card: 372px; }
  #title h1 { font-size: 25px; }
  #title p { font-size: 13.5px; }
}

@media (max-width: 940px) {
  :root { --rail: 0px; --card: 100vw; }
  #index {
    transform: translateX(-100%); transition: transform .4s cubic-bezier(.22,.8,.24,1);
    width: 300px; z-index: 8;
  }
  #index.open { transform: none; }
  #dossier { width: min(420px, 100vw); }
  #title { padding: 14px 16px; max-width: 62vw; }
  #title h1 { font-size: 20px; }
  #title p, #title .stat { display: none; }
  #productions {
    top: auto; bottom: 68px; left: 50%;
    max-width: calc(100vw - 24px);
    padding: 0 12px; flex-wrap: nowrap; pointer-events: auto;
  }
  .prod-select { max-width: 70vw; }
  #legend { display: none; }
  #controls { right: 12px; bottom: 12px; left: 12px; justify-content: center; flex-wrap: wrap; }
  .drawerBtn { display: flex !important; }
}

/* load-time diagnostics, only shown when something actually fails */
#errbox {
  position: fixed; z-index: 99; left: 12px; top: 12px; max-width: 78vw;
  background: #2a0d0d; border: 1px solid #e08a8a; color: #ffd7d7;
  font: 12px/1.45 ui-monospace, Consolas, monospace; padding: 10px 12px;
  white-space: pre-wrap; border-radius: 3px;
}

/* the controls step aside for the dossier */
body.doc-open #controls { right: calc(var(--card) + 22px); }

body.doc-open #legend { opacity: 0; pointer-events: none; }



/* ============================================================
   STREET MAP — deep zoom on Britain, individual pins, popups
   ============================================================ */

#map {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0;
  pointer-events: none;
  background: #0e1116;   /* sea ink — no cream board around the tiles */
}
body.view-map #map { opacity: 1; pointer-events: auto; }
body.view-globe #map { opacity: 0; pointer-events: none; }
/* keep both layers mounted during the dissolve so Leaflet keeps its size */
body.view-blend #map,
body.view-blend canvas#globe { opacity: 1; }
body.view-map #grain { opacity: .12; }
body.view-map #vignette {
  background: radial-gradient(130% 110% at 50% 45%, transparent 55%, rgba(8,10,14,.38) 100%);
}

/* age the tiles toward parchment / gazetteer */
#map .leaflet-tile-pane {
  filter: sepia(.42) saturate(.72) brightness(.92) contrast(1.05);
}
#map .leaflet-control-attribution {
  background: rgba(14,12,9,.78) !important;
  color: var(--muted-2) !important;
  font-family: var(--serif);
  font-size: 11px;
  border-top-left-radius: 6px;
  padding: 3px 8px !important;
}
#map .leaflet-control-attribution a { color: var(--gold-dim) !important; }
#map .leaflet-control-zoom {
  border: 1px solid var(--gold-hair) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
#map .leaflet-control-zoom a {
  background: rgba(18,15,11,.92) !important;
  color: var(--gold) !important;
  border-bottom: 1px solid var(--gold-hair) !important;
  width: 34px; height: 34px; line-height: 34px;
  font-size: 18px;
}
#map .leaflet-control-zoom a:hover {
  background: rgba(216,178,95,.22) !important;
  color: var(--gold-lit) !important;
}

/* ------------------------------------------------------------- pins */
.pin-wrap { background: transparent; border: 0; }
.pin {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 1.5px solid var(--gold-lit);
  background: radial-gradient(circle at 35% 30%, #f0d79a, #b8893a 62%, #6a4a18);
  color: #241806;
  box-shadow: 0 0 0 2px rgba(10,8,5,.55), 0 4px 14px rgba(0,0,0,.45), 0 0 18px rgba(216,178,95,.35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pin .pin-glyph { font-size: 13px; line-height: 1; transform: translateY(1px); }
.pin-studio {
  border-color: #9ec8e8;
  background: radial-gradient(circle at 35% 30%, #d7ecff, #6f9ec4 62%, #2c4a66);
  color: #0d2236;
  box-shadow: 0 0 0 2px rgba(10,8,5,.55), 0 4px 14px rgba(0,0,0,.45), 0 0 18px rgba(120,180,220,.35);
}
.pin-gateway, .pin-express, .pin-premiere {
  border-style: dashed;
  opacity: .92;
}
.pin:hover, .pin.hot, .pin-sel {
  transform: scale(1.22);
  box-shadow: 0 0 0 3px rgba(240,215,154,.55), 0 6px 18px rgba(0,0,0,.5), 0 0 28px rgba(240,215,154,.65);
  z-index: 2;
}
.pin-sel { background: radial-gradient(circle at 35% 30%, #fff3cf, #e0b45e 55%, #8a5c1c); }

/* ------------------------------------------------------------- popup */
.pop-shell .leaflet-popup-content-wrapper {
  background: linear-gradient(165deg, #1b1712 0%, #12100c 100%);
  color: var(--parch);
  border: 1px solid var(--gold-hair);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(216,178,95,.12);
  padding: 0;
  overflow: hidden;
}
.pop-shell .leaflet-popup-content {
  margin: 0; width: 300px !important;
  font-family: var(--serif);
  line-height: 1.55;
}
.pop-shell .leaflet-popup-tip {
  background: #1b1712;
  border: 1px solid var(--gold-hair);
}
.pop-shell .leaflet-popup-close-button {
  color: var(--gold-lit) !important;
  font: 20px/28px var(--serif) !important;
  width: 30px; height: 30px;
  top: 6px; right: 6px;
  background: rgba(10,8,5,.55);
  border-radius: 50%;
  text-align: center;
}
.pop-shell .leaflet-popup-close-button:hover { background: rgba(216,178,95,.28); }

.pop-plate {
  width: 100%; aspect-ratio: 16/9;
  background: #0a0806;
  overflow: hidden;
}
.pop-plate img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.pop-body { padding: 12px 16px 16px; }
.pop-kicker {
  display: flex; gap: 8px; align-items: center;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 6px;
}
.pop-role {
  color: var(--gold-lit);
  border: 1px solid var(--gold-hair);
  padding: 1px 7px; border-radius: 3px;
}
.pop-body h4 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 19px; font-weight: 600;
  color: var(--gold-lit);
  letter-spacing: .02em;
  line-height: 1.25;
}
.pop-where {
  margin: 0 0 8px;
  color: var(--muted);
  font-style: italic;
  font-size: 13.5px;
}
.pop-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.pop-badge {
  font-family: var(--display);
  font-size: 11px; letter-spacing: .06em;
  color: #17120a;
  background: linear-gradient(180deg, var(--gold-lit), var(--gold));
  border-radius: 3px;
  padding: 2px 7px;
}
.pop-lore, .pop-fact {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--parch-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pop-fact { color: var(--muted); font-style: italic; }
.pop-more {
  display: block; width: 100%;
  margin-top: 4px;
  background: transparent;
  color: var(--gold-lit);
  border: 1px solid var(--gold-hair);
  border-radius: 7px;
  padding: 8px 12px;
  font-family: var(--display);
  font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer;
}
.pop-more:hover {
  background: rgba(216,178,95,.16);
  border-color: var(--gold);
}

.express-line {
  filter: drop-shadow(0 0 6px rgba(240,215,154,.85));
}

/* --------------------------------------------------- globe ↔ map crossfade */
/* Both layers stay mounted; opacity does the handoff so the ground
   never hard-cuts. .view-blend means "still dissolving". */
body.view-globe canvas#globe { opacity: 1; pointer-events: auto; }
body.view-map canvas#globe { opacity: 0; pointer-events: none; }

/* During the dissolve both layers paint; only the *outgoing* one is inert.
   Controls and popups must never lose pointer-events. */
body.view-blend.view-map canvas#globe { pointer-events: none; }
body.view-blend.view-globe #map { pointer-events: none; }
body.view-blend #controls,
body.view-blend #index,
body.view-blend #dossier,
body.view-blend .leaflet-container { pointer-events: auto !important; }

canvas#globe, #map { transition: opacity 460ms ease; }

/* while dissolving, the outgoing layer sits under the incoming one */
body.view-blend.view-map #map { z-index: 1; }
body.view-blend.view-globe canvas#globe { z-index: 1; }

#handoff {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  z-index: 8; pointer-events: none;
  opacity: 0;
  font-family: var(--display);
  letter-spacing: .22em; text-transform: uppercase;
  font-size: 11px; color: var(--gold-lit);
  text-shadow: 0 2px 18px rgba(0,0,0,.8);
  transition: opacity 280ms ease, transform 280ms ease;
}
#handoff.show { opacity: .92; transform: translate(-50%, -50%) scale(1); }

/* parchment under the tiles so a slow load never shows void-black */
#map { background: #0e1116; }
body.view-map #map .leaflet-tile-pane {
  filter: sepia(.28) saturate(.78) brightness(.97) contrast(1.02);
}
#map .leaflet-container { background: #0e1116; }

/* Popups and tiles must sit above the grain/vignette wash, or the
   parchment overlays flatten the card and hide its text. */
body.view-map #map { z-index: 3; }
body.view-map #grain,
body.view-map #vignette { z-index: 2; }
body.view-map #title { z-index: 6; }
body.view-map #index,
body.view-map #dossier,
body.view-map #controls,
body.view-map #legend { z-index: 7; }
body.view-map #handoff { z-index: 9; }

/* Leaflet popups inherit a dark content colour from us; pin it explicitly. */
.pop-shell .leaflet-popup-content { color: var(--parch); }
.pop-shell .leaflet-popup-content h4,
.pop-shell .leaflet-popup-content p,
.pop-shell .leaflet-popup-content div { color: inherit; }
.pop-shell .leaflet-popup-content h4 { color: var(--gold-lit); }
.pop-shell .pop-where { color: var(--muted); }
.pop-shell .pop-lore { color: var(--parch-dim); }
.pop-shell .pop-fact { color: var(--muted); font-style: italic; }

/* ---- production dropdown (replaces the chip wall) ---- */
#productions {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
}
.prod-label {
  font-family: var(--display);
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-dim); white-space: nowrap;
}
.prod-select {
  flex: 1; min-width: 0;
  appearance: none; -webkit-appearance: none;
  background: rgba(12, 10, 8, 0.72)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23d8b25f' stroke-width='1.5'/></svg>")
    no-repeat right 12px center;
  color: var(--parch);
  border: 1px solid var(--gold-hair);
  border-radius: 8px;
  padding: 8px 34px 8px 12px;
  font-family: var(--serif); font-size: 14px;
  cursor: pointer;
}
.prod-select:hover, .prod-select:focus {
  border-color: var(--gold); color: var(--gold-lit); outline: none;
}
.prod-select option {
  background: #15120e; color: var(--parch);
  font-family: var(--serif); font-size: 14px;
}

/* one Index button — always available */
#controls #btnIndex { display: flex; }
#controls .drawerBtn { display: flex; }

/* popup text must paint on top of the plate and the grain wash */
.pop-shell .leaflet-popup-content h4,
.pop-shell .leaflet-popup-content p,
.pop-shell .leaflet-popup-content .pop-where,
.pop-shell .leaflet-popup-content .pop-lore,
.pop-shell .leaflet-popup-content .pop-fact,
.pop-shell .pop-body h4,
.pop-shell .pop-where,
.pop-shell .pop-lore,
.pop-shell .pop-fact {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-line-clamp: none !important;
  line-clamp: none !important;
  position: relative;
  z-index: 1;
}
.pop-shell .pop-body h4,
.pop-shell .leaflet-popup-content h4 { color: #f0d79a !important; font-size: 19px !important; }
.pop-shell .pop-where { color: #a2988a !important; }
.pop-shell .pop-lore { color: #ece0c8 !important; }
.pop-shell .pop-fact { color: #a2988a !important; font-style: italic; }
.pop-shell .pop-body { position: relative; z-index: 1; background: #12100c; }
.pop-shell .pop-plate { position: relative; z-index: 0; }

/* UI must sit above the map and never be covered by the dissolve */
#controls, #index, #dossier {
  pointer-events: auto;
  z-index: 8;
}
#controls button, #controls .prod-select, #index, #dossier {
  pointer-events: auto;
}
body.view-map #controls, body.view-globe #controls { z-index: 8; }
body.view-blend #controls { z-index: 9; }
#map .leaflet-container { cursor: grab; }
#map .leaflet-popup-pane { pointer-events: auto; }


/* no cream board — the map is edge-to-edge ink */
html, body { background: #0e1116; }
#map, #map .leaflet-container, #map .leaflet-map-pane,
#map .leaflet-tile-pane, #map .leaflet-overlay-pane {
  background: #0e1116;
}
body.view-map #map { background: #0e1116; }
#map .leaflet-tile {
  mix-blend-mode: normal;
}
