/* The map page. Colours, the top bar and chips come from shared/theme.css. */
body { overflow: hidden; }

#app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: 1fr minmax(320px, 400px);
  grid-template-rows: auto 1fr;
  grid-template-areas: "bar bar" "stage panel";
}

/* ---- top bar ---- */
#bar { grid-area: bar; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
#q {
  width: 100%; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--field); color: var(--fg); font: inherit; font-size: 16px; outline: none;
}
#q:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
#results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 30px var(--shadow);
  max-height: 60vh; overflow: auto;
}
#results li { padding: 6px 10px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#results li:hover, #results li.on { background: var(--sel); }
#results .cat { color: var(--muted); font-size: 14px; font-style: italic; }

/* ---- the map ---- */
#stage {
  grid-area: stage; position: relative; overflow: hidden; touch-action: none; cursor: grab;
  background: radial-gradient(ellipse at center, var(--sel), var(--bg) 70%);
}
#stage.dragging { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#mapimg { display: block; user-select: none; filter: var(--map-filter); box-shadow: 0 0 60px var(--shadow); }
#overlay { position: absolute; inset: 0; overflow: visible; }

.pin { fill: transparent; stroke: transparent; stroke-width: 5; cursor: pointer; transition: stroke .2s, fill .2s; }
.pin:hover { stroke: var(--gold); fill: rgba(255, 240, 200, .18); }
.pin.on { stroke: #fff4d6; fill: rgba(255, 236, 190, .25); filter: drop-shadow(0 0 10px #f5d58a); }
.extra { cursor: pointer; }
.extra circle { fill: rgba(250, 240, 220, .7); stroke: #6b4f2e; stroke-width: 3; stroke-dasharray: 6 5; }
.extra text { font: italic 30px "EB Garamond", Georgia, serif; fill: #4a3520; paint-order: stroke; stroke: rgba(245, 232, 205, .9); stroke-width: 7px; }
.extra.on circle { stroke: #fff4d6; filter: drop-shadow(0 0 10px #f5d58a); }

.trail { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.trail.halo { stroke: rgba(255, 250, 235, .75); }
.stopdot { stroke: #fff8ea; stroke-width: 3; cursor: pointer; }
.stopnum { font: 600 20px "EB Garamond", Georgia, serif; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }

#zoom { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
#zoom button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(8px); cursor: pointer; font-size: 20px;
  box-shadow: 0 4px 14px var(--shadow);
}
#zoom button:hover { border-color: var(--accent); }

/* ---- the panel ---- */
#panel {
  grid-area: panel; display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--line);
}
.grab { display: none; }
#journeys { padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
h2 .book { letter-spacing: .04em; text-transform: none; font-style: italic; font-weight: 500; }
#chips { display: flex; flex-wrap: wrap; gap: 6px; }
#chips .chip { padding-left: 8px; }
.chip .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--field), 0 0 0 3px var(--c); opacity: .55; }
.chip.on { border-color: var(--c); background: var(--sel); }
.chip.on .dot { opacity: 1; }
#chips .chip.plain { padding-left: 12px; }

#detail { flex: 1; overflow: auto; padding: 18px 22px 30px; min-height: 0; }
#intro p { margin: 0 0 12px; }
.draft-mark {
  display: inline-block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  padding: 0 7px; border-radius: 6px; border: 1px dashed var(--muted); color: var(--muted); font-style: normal;
}

.back { border: 0; background: none; color: var(--link); cursor: pointer; padding: 0; margin-bottom: 10px; font-size: 15px; }
.entry h1 { font: 600 32px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0 0 4px; }
.entry .aka { color: var(--muted); font-style: italic; margin: 0 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 14px; }
.tag { font-size: 13px; padding: 0 8px; border-radius: 999px; background: var(--sel); color: var(--muted); }
.tag.cat { background: transparent; border: 1px solid var(--line); }
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin: 0 0 16px; }
.pics img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1px solid var(--line); }
.field { margin: 0 0 6px; }
.field .k { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.body p { margin: 0 0 10px; }
.body ul { margin: 0 0 10px; padding-left: 20px; }
.body a, .link { color: var(--link); text-decoration: none; border-bottom: 1px solid var(--glow); cursor: pointer; }
.body a:hover, .link:hover { border-bottom-color: var(--link); }
.body .dead { color: var(--muted); }

.passes { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.passes li { margin-bottom: 4px; }
.passes ul { list-style: none; padding: 0; margin: 0; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--c); }

.trip { list-style: none; padding: 0; margin: 6px 0 0; position: relative; }
.trip li { position: relative; padding: 0 0 14px 34px; cursor: pointer; }
.trip li::before { content: ""; position: absolute; left: 11px; top: 22px; bottom: -2px; width: 2px; background: var(--c); opacity: .35; }
.trip li:last-child::before { display: none; }
.trip .n {
  position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--c); color: #fff; font-size: 13px; display: grid; place-items: center;
}
.trip .where { font-weight: 500; }
.trip .part { color: var(--muted); font-size: 14px; font-style: italic; }
.trip .note { font-size: 15.5px; }
.trip .by { font-size: 13px; color: var(--muted); }
.trip li:hover .where { color: var(--link); }

#foot { padding: 8px 20px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

#lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 6, .85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 100%; max-height: 86vh; border-radius: 10px; box-shadow: 0 20px 60px #000; }
#lightbox p { color: #f0e6d6; font-style: italic; }

/* ---- phone: the panel becomes a sheet under the map ---- */
@media (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "bar" "stage" "panel"; }
  #bar { min-width: 0; }
  .search { flex: 0 1 120px; }
  #bar { position: relative; }
  .search { position: static; }
  #results { left: 16px; right: 16px; top: calc(100% - 2px); }
  .search { min-width: 0; }
  #panel { border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px var(--shadow); }
  #panel.small { max-height: 132px; }
  .grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; cursor: pointer; }
  #journeys { padding: 8px 16px 10px; }
  #detail { padding: 14px 16px 24px; }
  #foot { display: none; }
}
