/*
 * The header's atlas (static/js/modules/atlas/atlas_modal.js): its button in the header, and the map it opens,
 * one line per page, each station a lamp with its name. The office's designs/ready-shelf/header-atlas/PACK.md, S1.
 * Every colour is a theme token; the lamps are neutral until the family inks come (the pack's call 2).
 */

/* The button: at the header's right end, where the glass on SIM covers nothing (measured 2026-10-06: the glass's
   kebab, EXIT and shot log stand over the header's left 330 px, its conditions over x 950-1090). The status bar
   runs between ↻ and it (ui_notifier.js bannerSpan). */
.atlas-open {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12em;
  min-height: 28px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.atlas-open:hover,
.atlas-open[aria-expanded='true'] {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* The map: over everything the page draws, the glass's overlay and an open Tesseract box too (bento.css: .bento-modal
   fixed at z 10120). A box open covers TRACKS as the glass does (measured 2026-10-06: its backdrop at TRACKS' centre,
   and the header's #uiWrap is a stacking context, so no z-index lifts the button over it); the map opened while a box
   is up shows over it and lights the box (S2). */
.atlas-modal {
  position: fixed;
  inset: 0;
  z-index: 10130;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--text-inverse-rgb), 0.76);
}

.atlas-modal[hidden] {
  display: none;
}

.atlas-modal__box {
  display: flex;
  flex-direction: column;
  width: min(1400px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  box-sizing: border-box;
  background: var(--surface-panel);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
  color: var(--text-primary);
  font-family: var(--font-mono);
  overflow: hidden;
}

.atlas-modal__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-default);
}

.atlas-modal__titles {
  flex: 1;
  min-width: 0;
}

.atlas-modal__title {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
}

.atlas-modal__sub {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.atlas-modal__close {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
}

.atlas-modal__close:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.atlas-modal__lines {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 24px 24px;
  overflow-y: auto;
}

/* A line: its page's name and count, then its stations along a track. */
.atlas-line__name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}

.atlas-line__count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.atlas-line__track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  margin: 0;
  padding: 6px 0 0;
  list-style: none;
  border-top: 3px solid rgba(var(--accent-primary-rgb), 0.45);
}

.atlas-station {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.atlas-station__lamp {
  width: 10px;
  height: 10px;
  flex: none;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: var(--surface-panel);
}

/* A lamp that carries its face's two letters (LD, DB) grows to hold them. */
.atlas-station__lamp:not(:empty) {
  width: auto;
  min-width: 10px;
  height: auto;
  padding: 0 4px;
  border-radius: 999px;
  border-width: 1px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* YOU ARE HERE (S2): the stations where he stands are lit, his page's line is marked, and the map says it in words. */
.atlas-modal__here {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.atlas-modal__here:empty {
  display: none;
}

.atlas-line[data-here="true"] .atlas-line__name {
  color: var(--accent-primary);
}

.atlas-line[data-here="true"] .atlas-line__track {
  border-top-color: var(--accent-primary);
}

.atlas-station--here {
  background: rgba(var(--accent-primary-rgb), 0.18);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.atlas-station--here .atlas-station__lamp {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: var(--surface-panel);
}

/* THE TRACK YOU TOOK (S3): each station he passed is traced, and the map says the newest in order. */
.atlas-modal__track {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.atlas-modal__track:empty {
  display: none;
}

.atlas-station--passed {
  outline: 1px dashed var(--accent-primary);
  outline-offset: 1px;
}

.atlas-station--passed .atlas-station__lamp {
  border-color: var(--accent-primary);
}

/* THE WALKS (S4). The atlas's "you are here" in small, while a walk is under way: one line in the header's flow after
   TRACKS (PRD-158 R8: folded to one line, never covering what a step presses), its words cut to the line; pressed, it
   opens the map, where they are whole. */
.atlas-walk-line {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 34vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}

.atlas-walk-line[hidden] {
  display: none;
}

.atlas-walk-line__head,
.atlas-walk-line__station {
  color: var(--accent-primary);
  font-weight: 700;
}

.atlas-modal__walk {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.atlas-modal__walk:empty {
  display: none;
}

.atlas-station--walk {
  box-shadow: 0 0 0 2px rgba(var(--status-success-rgb), 0.9);
}

/* Her book's walks, under WALKS: a written one to watch her take, a planned one greyed and Coming. */
.atlas-walks {
  padding: 0 24px;
  border-bottom: 1px solid var(--border-default);
}

.atlas-walks__title {
  padding: 10px 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  cursor: pointer;
}

.atlas-walks__said {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--status-warning);
}

.atlas-walks__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 12px;
  max-height: 32vh;
  overflow-y: auto;
  padding-bottom: 12px;
}

.atlas-walks__campaign {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.atlas-walks__entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.atlas-walks__entry--planned {
  opacity: 0.55;
}

.atlas-walks__entry-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.atlas-walks__entry-summary {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.atlas-walks__coming {
  margin: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.atlas-walks__watch {
  align-self: flex-start;
  min-height: 28px;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.atlas-walks__watch:disabled {
  opacity: 0.5;
  cursor: default;
}
