/* ═══════════════════════════════════════════════════════════════════
   Atlas modal (FEAT-009) — maps of the lands of Scripture.
   Approved mock: artifact b7d49dfe. Era design language: serif title
   with the purple tick, gold uppercase eyebrows, quiet surfaces.
   Built on the app tokens so dark mode arrives free.
   ═══════════════════════════════════════════════════════════════════ */

.atlas-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 25, 45, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10200;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.atlas-backdrop.visible { display: flex; }

.atlas-modal {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    /* corners: .modal-shell (css/modal-header.css) */
    box-shadow: var(--shadow-lg);
    width: min(1120px, 100%);
    height: min(760px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── TEMP "New" flags (owner 2026-09-02: pleasant blue, remove later).
      One rail badge (clones into the mobile More sheet free — it lives
      inside .icon-nav-icon-wrap) + one pill beside the modal title.
      Delete this block + the two spans when the Atlas is no longer new. */
.icon-nav-new {
    position: absolute;
    top: -6px;
    right: -12px;
    background: var(--accent-isbe);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 8px;
    line-height: 1.5;
    pointer-events: none;
}
/* TEMP pill rides in the shared title (.modal-title) beside the name */
.modal-title .atlas-new-pill {
    margin-left: 8px;
    vertical-align: middle;
    background: var(--accent-isbe);
    color: #fff;
    font-size: 0.6rem;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 9px;
}

/* Header bar: the one header bar (css/modal-header.css) — nothing of its own. */
.atlas-title-short { display: none; }

/* ── Body: rail | topics | viewer ───────────────────────────────── */
.atlas-body {
    display: grid;
    grid-template-columns: 185px 250px 1fr;
    flex: 1;
    min-height: 0;
}

.atlas-rail {
    border-right: 1px solid var(--border);
    background: var(--background);
    padding: 12px 0;
    overflow-y: auto;
}
.atlas-rail-label {
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 600;
    padding: 0 16px 8px;
}
.atlas-era {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 9px 16px;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    min-height: var(--touch-target-min);
}
.atlas-era:hover { background: var(--highlight); }
/* Active era is GOLD (owner ruling: gold = place, purple = choice —
   the selected topic keeps the purple bar; FEAT-031 Atlas slice). */
.atlas-era.active {
    background: var(--gold-bg);
    color: var(--gold-text);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--gold);
}
.atlas-era-n { color: var(--text-secondary); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

.atlas-topics {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 10px 0;
}
.atlas-topic {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}
.atlas-topic:hover { background: var(--highlight); }
.atlas-topic.active {
    background: rgba(var(--primary-rgb), 0.10);
    box-shadow: inset 3px 0 0 var(--primary);
}
.atlas-topic-t { display: block; font-size: 0.86rem; font-weight: 600; color: var(--text-primary); }
.atlas-topic.active .atlas-topic-t { color: var(--primary); }
.atlas-topic-m { display: block; font-size: 0.72rem; color: var(--text-secondary); margin-top: 1px; }
.atlas-topic-n { display: block; font-size: 0.68rem; color: var(--text-secondary); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ── Viewer ─────────────────────────────────────────────────────── */
.atlas-viewer {
    padding: 16px 20px 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}
.atlas-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 3rem 1rem;
}
.atlas-viewer-head { margin-bottom: 8px; }
.atlas-viewer-title {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    font-size: 1.25rem;
    margin-right: 10px;
}
.atlas-viewer-blurb { font-size: 0.78rem; color: var(--text-secondary); }

.atlas-pager {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.atlas-pager-btn {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1;
    padding: 5px 14px;
    cursor: pointer;
    min-height: 32px;
}
.atlas-pager-btn:hover:not(:disabled) { background: var(--highlight); }
.atlas-pager-btn:disabled { opacity: 0.35; cursor: default; }
.atlas-pager-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 600;
}
/* Plate dots — one engraved thumb per plate in the topic (replaced the
   native <select>, FEAT-031 Atlas slice / mock 0ed8ef1a). Names carry
   in title/aria-label; the pager label + credit name the current one. */
.atlas-plate-dots {
    display: inline-flex;
    gap: 6px;
    margin-left: 4px;
    flex-wrap: wrap;
}
.atlas-plate-dot {
    width: 44px;
    height: 32px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    padding: 0;
    background: repeating-linear-gradient(45deg,
        #efe9dd, #efe9dd 4px, #e6dfd0 4px, #e6dfd0 8px);
}
.atlas-plate-dot:hover { border-color: var(--gold); }
.atlas-plate-dot.active {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-bg);
}

.atlas-plate-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #F2E9D8; /* parchment ground behind loading plates, both themes */
    overflow: auto;
    flex-shrink: 0;
    max-height: 62%;
    cursor: zoom-in;
}
.atlas-plate-img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}
.atlas-plate-wrap.zoomed { cursor: grab; }
.atlas-plate-wrap.zoomed.atlas-panning { cursor: grabbing; }
.atlas-plate-wrap.zoomed .atlas-plate-img { width: 250%; max-width: none; }

/* Send-to-study pill in the pager row + the owner-ruled choice menu */
.atlas-send-btn { flex-shrink: 0; }
.atlas-send-btn.in-study { color: var(--primary); border-color: var(--primary); }
.atlas-send-menu {
    position: fixed;
    z-index: 10300;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: min(340px, calc(100vw - 16px));
}
.atlas-send-menu button {
    border: none;
    background: none;
    text-align: left;
    padding: 11px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1px;
    color: var(--text-primary);
    min-height: var(--touch-target-min);
}
.atlas-send-menu button + button { border-top: 1px solid var(--border); }
.atlas-send-menu button:hover { background: var(--highlight); }
.atlas-send-menu b { font-size: 0.88rem; }
.atlas-send-menu span { font-size: 0.74rem; color: var(--text-secondary); }

/* Map study card (7th content type — reference-only window into the catalog) */
.study-map-badge {
    background: var(--accent-isbe);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 7px;
    flex-shrink: 0;
}
.study-map-body { padding: 0 0 2px; }
.study-map-img {
    display: block;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #F2E9D8;
}
.study-map-credit { font-size: 0.74rem; color: var(--text-secondary); margin-top: 7px; }
.study-map-credit b { color: var(--text-primary); }
.study-map-missing {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.9rem 0.5rem;
    text-align: center;
}
.study-map-open-btn {
    font-size: 0.78rem;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    border-radius: 999px;
    padding: 4px 13px;
    cursor: pointer;
    min-height: 30px;
}
.study-map-open-btn:hover { background: rgba(var(--primary-rgb), 0.16); }

/* Map figure injected into study text: its dress moved to css/study-cards.css
   (ONE card sheet for the desk, the community and the preview — 2026-09-26). */

.atlas-credit {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.5;
}
.atlas-credit b { color: var(--text-primary); font-weight: 600; }

.atlas-related {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.atlas-related-label {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 600;
}
.atlas-chip {
    font-size: 0.78rem;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    border-radius: 999px;
    padding: 4px 13px;
    cursor: pointer;
    min-height: 30px;
}
.atlas-chip:hover { background: rgba(var(--primary-rgb), 0.16); }

/* ── Mobile: stacked, everything reachable ──────────────────────── */
@media (max-width: 768px) {
    .atlas-backdrop { padding: 0; }
    .atlas-modal { width: 100%; height: 100%; border-radius: 0; border: none; }
    .atlas-body {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    .atlas-rail {
        display: flex;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 6px 10px;
        gap: 4px;
        flex-shrink: 0;
    }
    .atlas-rail-label { padding: 0 6px; white-space: nowrap; }
    .atlas-era { width: auto; white-space: nowrap; border-radius: 999px; padding: 7px 13px; gap: 6px; }
    .atlas-era.active { box-shadow: none; }
    .atlas-topics {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 10px;
        gap: 8px;
        flex-shrink: 0;
    }
    .atlas-topic {
        width: auto;
        min-width: 180px;
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 9px 12px;
        flex-shrink: 0;
    }
    .atlas-topic.active { box-shadow: inset 0 0 0 2px var(--primary); }
    .atlas-topic-m { display: none; }
    .atlas-viewer { padding: 12px 14px; overflow: visible; }
    .atlas-plate-wrap { max-height: none; }
    .atlas-title-full { display: none; }
    .atlas-title-short { display: inline; }
    .atlas-plate-dot { width: 38px; height: 27px; }
    /* Chevrons are redundant on touch: swipe steps plates, dots jump.
       (Owner 2026-09-03: they crowded the phone pager row.) */
    .atlas-pager-btn { display: none; }
    /* Owner 2026-09-03: gold plate label ALWAYS its own line; dots +
       send pill ALWAYS together on the next — never length-dependent. */
    .atlas-pager-label { flex-basis: 100%; }
    .atlas-plate-dots { margin-left: 0; }
}
