/* Atlas page. Inherits the archive tokens from ../style.css; the map itself is
   painted by map.js from the same tokens. Depth = 1px rules, as everywhere. */

.atlas-body { overflow: hidden; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.atlas-body .site-header { flex: 0 0 auto; background: var(--paper); }
.atlas-crumb { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.atlas-link { font-family: var(--mono); font-size: 12px; color: var(--blue); text-decoration: none; border-bottom: 1px solid var(--rule); }

.atlas { position: relative; flex: 1 1 auto; min-height: 0; }
.atlas-map { position: absolute; inset: 0; background: var(--paper); }
.atlas-map:focus { outline: none; }
.atlas-map canvas { outline: none; }

/* Hide MapLibre's default chrome: no logo, no attribution box; credit lives in the panel. */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { display: none; }

/* --- Control panel -------------------------------------------------------- */
.atlas-panel {
  position: absolute; top: 16px; left: 16px; width: 300px; max-height: calc(100% - 32px);
  overflow-y: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: 3px;
  padding: 14px 16px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5;
  color: var(--ink); box-shadow: var(--overlay-shadow);
}
.atlas-panel section + section { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 10px; }
.atlas-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }

.atlas-year-head { display: flex; align-items: baseline; gap: 10px; }
.atlas-year-value { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; color: var(--vermilion); }
.atlas-year-reign { color: var(--muted); font-size: 11px; }

.atlas-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 6px 0 0; cursor: ew-resize; }
.atlas-slider:focus { outline: none; }
.atlas-slider::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
.atlas-slider::-moz-range-track { height: 1px; background: var(--ink); }
.atlas-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 18px; margin-top: -9px; background: var(--vermilion); border: 1px solid var(--ink); border-radius: 2px; }
.atlas-slider::-moz-range-thumb { width: 8px; height: 16px; background: var(--vermilion); border: 1px solid var(--ink); border-radius: 2px; }
.atlas-slider:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--blue); outline-offset: 2px; }
.atlas-ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin: 0 2px; }
.atlas-chronicle { font-family: var(--serif); font-size: 14px; line-height: 1.5; margin: 10px 0 0; color: var(--ink); min-height: 3em; }
.atlas-chapters { font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--muted); margin: 6px 0 0; }

.atlas-checklist, .atlas-key { list-style: none; margin: 0; padding: 0; }
.atlas-checklist li { margin: 2px 0; }
.atlas-checklist label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.atlas-checklist input { margin: 0; accent-color: var(--vermilion); width: 13px; height: 13px; }

.atlas-key li { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.atlas-key-row { gap: 0 !important; }
.atlas-key-row span { flex: 1 1 50%; display: flex; align-items: center; gap: 8px; }
.k { display: inline-block; width: 22px; height: 12px; border: 1px solid var(--vermilion); box-sizing: border-box; vertical-align: middle; }
.k-core { background: rgba(158, 49, 34, 0.34); }
.k-base { background: repeating-linear-gradient(135deg, rgba(158,49,34,0.75) 0 1px, transparent 1px 4px); }
.k-influence { border-style: dotted; background: rgba(158, 49, 34, 0.08); }
.k-sphere { border: 1px dashed var(--muted); background: repeating-linear-gradient(45deg, rgba(110,106,96,0.7) 0 1px, transparent 1px 4px); }
.k-capital, .k-place, .k-foreign, .k-battle { width: 9px; height: 9px; border-radius: 50%; margin-left: 4px; }
.k-capital { background: var(--vermilion); border-color: var(--ink); border-radius: 1px; }
.k-place { background: var(--vermilion); border-color: var(--vermilion); }
.k-foreign { background: transparent; border-color: var(--ink); }
.k-battle { background: transparent; border: 0; width: 10px; height: 10px; position: relative; }
.k-battle::before, .k-battle::after { content: ''; position: absolute; left: 4px; top: -1px; width: 1.5px; height: 12px; background: var(--ink); transform: rotate(45deg); }
.k-battle::after { transform: rotate(-45deg); }
[data-theme="lamplight"] .k-core { background: rgba(217, 138, 117, 0.34); }
[data-theme="lamplight"] .k-base { background: repeating-linear-gradient(135deg, rgba(217,138,117,0.8) 0 1px, transparent 1px 4px); }
[data-theme="lamplight"] .k-influence { background: rgba(217, 138, 117, 0.1); }

.atlas-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.atlas-buttons button, .atlas-panel-toggle, .atlas-slip-close {
  font-family: var(--mono); font-size: 12px; background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 3px; padding: 3px 9px; cursor: pointer;
}
.atlas-buttons button:hover, .atlas-panel-toggle:hover { border-color: var(--ink); }
.atlas-buttons button.is-active { border-color: var(--vermilion); color: var(--vermilion); }

.atlas-note, .atlas-credit { font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--muted); margin: 12px 0 0; }
.atlas-credit { margin-top: 6px; }

.atlas-panel-toggle { position: absolute; top: 16px; left: 16px; display: none; background: var(--panel); }

/* --- Selection slip -------------------------------------------------------- */
.atlas-slip {
  position: absolute; top: 16px; right: 16px; width: 280px; background: var(--panel);
  border: 1px solid var(--rule); border-radius: 3px; padding: 14px 16px 14px; box-shadow: var(--overlay-shadow);
}
.atlas-slip-close { position: absolute; top: 8px; right: 8px; padding: 0 6px; line-height: 1.4; }
.atlas-slip-kind { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.atlas-slip-name { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 2px 24px 0 0; line-height: 1.25; }
.atlas-slip-zh { font-family: var(--serif); font-size: 15px; color: var(--muted); margin-top: 2px; }
.atlas-slip-note { font-family: var(--serif); font-size: 14px; line-height: 1.5; margin: 8px 0 0; }
.atlas-slip-years { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 6px; }
.atlas-slip-name .ink-v { color: var(--vermilion); }

/* Map popups are not used; hover state uses the cursor only. */
.maplibregl-canvas-container.maplibregl-interactive { cursor: default; }
.maplibregl-canvas-container.maplibregl-interactive.is-hover { cursor: pointer; }

.atlas-loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 12px; color: var(--muted); pointer-events: none;
}

@media (max-width: 768px) {
  .atlas-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 55%; border-radius: 3px 3px 0 0; border-bottom: 0; }
  .atlas-panel.is-collapsed { display: none; }
  .atlas-panel-toggle { display: block; }
  .atlas-slip { top: 12px; left: 12px; right: 12px; width: auto; }
  .atlas-crumb { display: none; }
  .atlas-bearings, .atlas-note, .atlas-credit { display: none; }
}
