/* The read-only map page. */
/* Must not: style anything but the read-only map page
   Layer: ui */
:root {
  --bg: #24211d; --bg-2: #2e2a25; --line: #4a443b; --text: #ece5d6; --dim: #a89f8e; --accent: #e0a94f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --shadow: 0 6px 22px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--backdrop); color: var(--text); font: var(--font-m)/1.35 var(--sans); }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#map.dragging { cursor: grabbing; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#bar {
  position: fixed; left: 12px; top: 10px; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
#name { margin: 0; font: 600 var(--font-l) var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
#search { width: 170px; min-width: 60px; padding: 5px 9px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-m); }
#bar button { padding: 5px 10px; border-radius: var(--radius-m); white-space: nowrap; }
#bar button:hover { background: var(--bg-2); }
/* Eras: Previous, the era menu, Next and Play. */
#eras { display: inline-flex; align-items: center; gap: 2px; }
#eras[hidden] { display: none; }
#eras select { padding: 4px 6px; border-radius: var(--radius-m); max-width: 180px; font: inherit; }
#eras button:disabled { opacity: .4; }

.panel {
  position: fixed; left: 12px; top: 62px; width: 240px; max-height: calc(100vh - 120px); overflow-y: auto; padding: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
.panel label { display: flex; gap: 8px; align-items: center; padding: 3px 2px; cursor: pointer; }
.panel input { accent-color: var(--accent); margin: 0; }
.panel button { display: block; width: 100%; text-align: left; padding: 6px 8px; border-radius: var(--radius-m); }
.panel button:hover { background: var(--bg-2); }

#tip {
  position: fixed; z-index: var(--z-chrome); padding: 4px 9px; pointer-events: none; max-width: 240px; font: var(--font-l) var(--serif);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow);
}
#tip small { display: block; color: var(--dim); font: var(--font-s) var(--sans); font-variant-numeric: tabular-nums; }

#zoom {
  position: fixed; right: 12px; bottom: 12px; display: flex; padding: 3px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
#zoom button { height: 32px; min-width: 34px; border-radius: var(--radius-m); font-size: var(--font-l); }
#zoom #z-fit { font-size: var(--font-s); padding: 0 8px; }
#zoom button:hover { background: var(--bg-2); }
#coords { position: fixed; right: 12px; bottom: 56px; padding: 3px 8px; font-size: var(--font-s); white-space: pre; pointer-events: none; background: color-mix(in srgb, var(--bg) 88%, transparent); border-radius: var(--radius-m); }
#credit { position: fixed; left: 12px; bottom: 12px; padding: 3px 8px; font-size: var(--font-s); color: var(--dim); text-decoration: none; background: color-mix(in srgb, var(--bg) 88%, transparent); border-radius: var(--radius-m); }
#credit:hover { color: var(--text); }
#message { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font: var(--font-xl) var(--serif); background: var(--backdrop); }

/* A phone: the title takes the bar's first row (two lines at most), and the search
   box shares the second with the buttons, wide enough for its placeholder. */
@media (max-width: 620px) {
  #bar { right: 12px; flex-wrap: wrap; row-gap: 6px; padding: 8px 8px 8px 12px; }
  #name { flex: 1 0 100%; max-width: none; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.25; }
  #search { flex: 1 1 120px; width: auto; min-width: 120px; }
}

/* A place's note (placenotes.js), opened by clicking the place or its little page. */
#map.on-note { cursor: pointer; }
#note-card {
  position: fixed; z-index: var(--z-bar); width: min(340px, calc(100vw - 16px)); max-height: min(60vh, 460px); overflow-y: auto; padding: 12px 14px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
#note-card h2 { margin: 0 24px 6px 0; font: 600 var(--font-l) var(--serif); }
.note-etym { margin: -2px 0 8px; color: var(--dim); font-style: italic; }
#note-card .note-body p { margin: 0 0 8px; white-space: pre-line; overflow-wrap: anywhere; }
#note-card .note-x { position: absolute; right: 6px; top: 4px; width: 28px; height: 28px; border-radius: var(--radius-m); font-size: var(--font-xl); color: var(--dim); }
#note-card .note-x:hover { color: var(--text); background: var(--bg-2); }
#note-card .note-link { color: var(--accent); }
