/*
 * The map page. Three colours (paper, ink, red) from tokens.css, Ysabeau for
 * the instrument, Cardo for the church names. Corners are 2px. Nothing glows.
 * Layout: masthead, then a full-bleed map with the panel on the left and the
 * drawer on the right, both over the map. Phone rules are in atlas-mobile.css.
 */

.atlas-page { overflow: hidden; height: 100dvh; background: var(--lac-bg); }
.atlas-page [hidden] { display: none !important; }
.atlas-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.atlas-page .skip-map { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--lac-ink); color: var(--lac-bg); padding: 8px 12px; border-radius: 2px; font: 14px var(--lac-ui); text-decoration: none; }
.atlas-page .skip-map:focus { top: 8px; }
.atlas-page .top-nav { position: relative; z-index: 30; }
/* overflow: clip, not hidden: a hidden frame can still be scrolled by script or by focus, and a
   transformed sheet below the fold made the frame scroll 388px on a phone the first time a card was chosen. */
.atlas { position: fixed; inset: var(--atlas-top, 60px) 0 0 0; overflow: clip; font-family: var(--lac-ui); font-size: 14px; line-height: 1.4; color: var(--lac-ink); }
/* Every word on the map reads in full ink: the paler tints were too faint to read. */
.atlas-page { --lac-ink-2: var(--lac-ink); --lac-ink-3: var(--lac-ink); }
#atlasMap { position: absolute; inset: 0; background: var(--lac-bg-warm); }
#atlasMap canvas { outline: none; }
.maplibregl-ctrl-attrib { font: 11px/1.4 var(--lac-ui); background: rgba(253, 246, 237, 0.85); color: var(--lac-ink-2); border-radius: 2px; }
.maplibregl-ctrl-attrib a { color: var(--lac-ink-2); }
.maplibregl-ctrl-bottom-right { right: 8px; bottom: 6px; }

/* ── status and notices ────────────────────────────────────────────────── */
.atlas-status { position: absolute; z-index: 5; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--lac-bg); border: 1px solid var(--lac-rule); padding: 10px 14px; border-radius: 2px; font-size: 13px; color: var(--lac-ink-2); }
.atlas-status.is-error { color: var(--lac-red); border-color: var(--lac-red); }
.atlas-notice { position: absolute; z-index: 6; top: 12px; left: 50%; transform: translateX(-50%); max-width: 460px; background: var(--lac-ink); color: var(--lac-bg); padding: 8px 12px; border-radius: 2px; font-size: 13px; }
.atlas-tip { position: absolute; z-index: 7; top: 0; left: 0; pointer-events: none; background: var(--lac-ink); color: var(--lac-bg); padding: 4px 8px; border-radius: 2px; font-size: 12.5px; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* ── the panel ─────────────────────────────────────────────────────────── */
.atlas-panel { position: absolute; z-index: 10; top: 12px; left: 12px; bottom: 12px; width: 356px; display: flex; flex-direction: column; background: var(--lac-bg); border: 1px solid var(--lac-rule); border-radius: 2px; box-shadow: 0 1px 2px rgba(29, 28, 28, 0.08); transition: transform 200ms ease, opacity 200ms ease; }
.atlas-panel-closed .atlas-panel { transform: translateX(-380px); opacity: 0; pointer-events: none; }
.atlas-sheet-handle { display: none; }
.atlas-panel-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--lac-rule); }
.atlas-brand { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; }
.atlas-brand h1 { font: 700 17px/1.2 var(--lac-display); letter-spacing: 0; margin: 0; color: var(--lac-ink); }
.atlas-brand h1 small { font: 400 12px/1 var(--lac-ui); color: var(--lac-ink-2); margin-left: 6px; letter-spacing: 0.02em; }
.atlas-stats { font-size: 12px; color: var(--lac-ink-2); font-variant-numeric: tabular-nums; }
.atlas-search { position: relative; }
.atlas-search input { width: 100%; box-sizing: border-box; height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--lac-ink); border-radius: 2px; background: var(--lac-bg); font: 14px var(--lac-ui); color: var(--lac-ink); }
.atlas-search input::placeholder { color: var(--lac-ink-3); }
.atlas-search input:focus { outline: 2px solid var(--lac-red); outline-offset: 1px; }
.atlas-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 11px var(--lac-ui); color: var(--lac-ink-3); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 1px 5px; pointer-events: none; }
.atlas-results { position: absolute; z-index: 12; top: 44px; left: 0; right: 0; max-height: 360px; overflow: auto; background: var(--lac-bg); border: 1px solid var(--lac-ink); border-radius: 2px; box-shadow: 0 6px 18px rgba(29, 28, 28, 0.12); }
.atlas-rgroup h3 { margin: 0; padding: 8px 12px 2px; font: 600 10.5px/1 var(--lac-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--lac-ink-3); }
.atlas-result { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; font: 14px var(--lac-ui); color: var(--lac-ink); cursor: pointer; }
.atlas-result small { margin-left: auto; color: var(--lac-ink-3); font-size: 12px; white-space: nowrap; }
.atlas-result:hover, .atlas-result.is-active { background: var(--lac-bg-warm); }
.atlas-result:focus-visible { outline: 2px solid var(--lac-red); outline-offset: -2px; }

.atlas-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.atlas-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; border: 1px solid var(--lac-red); border-radius: 2px; background: var(--lac-red); color: var(--lac-bg); font: 500 12.5px var(--lac-ui); cursor: pointer; }
.atlas-chip i { font-style: normal; font-size: 15px; line-height: 1; opacity: 0.85; }
.atlas-chip:hover { background: var(--lac-ink); border-color: var(--lac-ink); }
.atlas-chip-clear { background: none; color: var(--lac-red); }
.atlas-chip-clear:hover { color: var(--lac-bg); }

.atlas-facets { padding: 8px 14px 10px; border-bottom: 1px solid var(--lac-rule); }
.atlas-facet-row { display: flex; flex-wrap: wrap; gap: 6px; }
.atlas-facet { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid var(--lac-rule); border-radius: 2px; background: var(--lac-bg); font: 500 12.5px var(--lac-ui); color: var(--lac-ink); cursor: pointer; }
.atlas-facet b { font-weight: 400; color: var(--lac-ink-3); font-variant-numeric: tabular-nums; }
.atlas-facet:hover { border-color: var(--lac-ink); }
.atlas-facet.is-on { background: var(--lac-ink); color: var(--lac-bg); border-color: var(--lac-ink); }
.atlas-facet.is-on b { color: var(--lac-bg); opacity: 0.7; }
.atlas-facet:disabled { opacity: 0.4; cursor: default; }
.atlas-facet-selects { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.atlas-facet-selects label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--lac-ink-3); letter-spacing: 0.04em; text-transform: uppercase; }
.atlas-facet-selects select { height: 30px; border: 1px solid var(--lac-rule); border-radius: 2px; background: var(--lac-bg); font: 13px var(--lac-ui); color: var(--lac-ink); padding: 0 6px; }
.atlas-facet-selects select:disabled { opacity: 0.5; }
.atlas-facet-near { grid-column: 1 / -1; }
.atlas-near-controls { display: flex; gap: 6px; }
.atlas-near-controls .atlas-btn { flex: 1; }
.atlas-near-controls select { width: 84px; }

.atlas-context { padding: 8px 14px; border-bottom: 1px solid var(--lac-rule); }
.atlas-countline { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.atlas-countline em { font-style: normal; color: var(--lac-ink-3); }
.atlas-countline small { color: var(--lac-ink-3); }
.atlas-empty p { margin: 0 0 6px; font-size: 13.5px; }
.atlas-empty ul { list-style: none; margin: 0; padding: 0; }
.atlas-empty li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--lac-rule); font-size: 13px; }
.atlas-empty li span { color: var(--lac-ink-3); font-variant-numeric: tabular-nums; }
.atlas-muted { color: var(--lac-ink-3); }

.atlas-place { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--lac-rule); }
.atlas-place h2 { margin: 0 0 6px; font: 700 16px/1.25 var(--lac-display); }
.atlas-place h2 small { font: 400 12px var(--lac-ui); color: var(--lac-ink-3); margin-left: 6px; }
.atlas-place dl { margin: 0; display: grid; grid-template-columns: 84px 1fr; gap: 4px 8px; font-size: 12.5px; }
.atlas-place dt { color: var(--lac-ink-3); }
.atlas-place dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.atlas-place dd i { font-style: normal; border: 1px solid var(--lac-rule); border-radius: 2px; padding: 1px 6px; }
.atlas-place dd i b { font-weight: 400; color: var(--lac-ink-3); }
.atlas-place dd i.is-gap { border-style: dashed; color: var(--lac-ink-3); }
.atlas-place .atlas-btn { margin-top: 8px; }

.atlas-list { list-style: none; margin: 0; padding: 4px 6px; overflow: auto; flex: 1; scrollbar-width: thin; }
.atlas-card { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 8px; border: 1px solid transparent; border-radius: 2px; background: none; color: var(--lac-ink); cursor: pointer; font: 14px var(--lac-ui); }
.atlas-card:hover { background: var(--lac-bg-warm); }
.atlas-card.is-selected { border-color: var(--lac-red); background: var(--lac-bg-warm); }
.atlas-card:focus-visible { outline: 2px solid var(--lac-red); outline-offset: -1px; }
.atlas-card-mark { flex: none; width: 18px; padding-top: 3px; }
.atlas-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.atlas-card-name { font: 600 15px/1.25 var(--lac-display); }
.atlas-card-meta { font-size: 12.5px; color: var(--lac-ink-2); }
.atlas-card-next { font-size: 12.5px; }
.atlas-card-next b { font-weight: 600; color: var(--lac-red); }
.atlas-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.atlas-card-tags i { font-style: normal; font-size: 11px; color: var(--lac-ink-2); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 0 5px; }
.atlas-more { margin: 4px 14px 12px; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.atlas-btn, .atlas a.atlas-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--lac-ink); border-radius: 2px; background: var(--lac-bg); color: var(--lac-ink); font: 500 13px var(--lac-ui); cursor: pointer; text-decoration: none; }
.atlas-btn:hover, .atlas a.atlas-btn:hover { background: var(--lac-ink); color: var(--lac-bg); }
.atlas-btn-primary, .atlas a.atlas-btn-primary { background: var(--lac-red); border-color: var(--lac-red); color: var(--lac-bg); }
.atlas-btn-primary:hover, .atlas a.atlas-btn-primary:hover { background: var(--lac-ink); border-color: var(--lac-ink); color: var(--lac-bg); }
.atlas-btn:focus-visible, .atlas-link:focus-visible, .atlas-chip:focus-visible, .atlas-facet:focus-visible, .atlas-ctl:focus-visible { outline: 2px solid var(--lac-red); outline-offset: 2px; }
.atlas-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0; font: inherit; color: var(--lac-red); cursor: pointer; text-decoration: underline; text-decoration-color: var(--lac-rule); text-underline-offset: 2px; }
.atlas-link:hover { text-decoration-color: var(--lac-red); }
.atlas-link small { color: var(--lac-ink-3); text-decoration: none; }

/* ── controls on the map ───────────────────────────────────────────────── */
.atlas-controls { position: absolute; z-index: 9; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.atlas-controls-group { display: flex; flex-direction: column; border: 1px solid var(--lac-rule); border-radius: 2px; background: var(--lac-bg); box-shadow: 0 1px 2px rgba(29, 28, 28, 0.08); }
.atlas-ctl { width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--lac-ink); cursor: pointer; font: 600 16px var(--lac-ui); }
.atlas-ctl + .atlas-ctl { border-top: 1px solid var(--lac-rule); }
.atlas-ctl:hover { background: var(--lac-bg-warm); }
.atlas-ctl[aria-pressed="true"], .atlas-ctl.is-done { background: var(--lac-ink); color: var(--lac-bg); }
.atlas-ctl svg { width: 18px; height: 18px; display: block; }
.atlas-drawer-open .atlas-controls { right: 436px; }
.atlas-layers { position: absolute; z-index: 9; right: 56px; top: 92px; background: var(--lac-bg); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.atlas-drawer-open .atlas-layers { right: 480px; }
.atlas-layers button { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 8px; border: 0; border-radius: 2px; background: none; font: 13px var(--lac-ui); color: var(--lac-ink); cursor: pointer; }
.atlas-layers button::after { content: ''; width: 10px; height: 10px; border: 1px solid var(--lac-ink); border-radius: 2px; }
.atlas-layers button[aria-pressed="true"]::after { background: var(--lac-red); border-color: var(--lac-red); }
.atlas-layers button:hover { background: var(--lac-bg-warm); }
.atlas-heat-note { position: absolute; z-index: 8; left: 50%; bottom: 44px; transform: translateX(-50%); background: var(--lac-bg); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 4px 10px; font-size: 12px; color: var(--lac-ink-2); }
.atlas-legend { position: absolute; z-index: 8; left: 384px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; background: rgba(253, 246, 237, 0.92); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 6px 10px; font-size: 12px; color: var(--lac-ink-2); }
.atlas-panel-closed .atlas-legend { left: 12px; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 5px; }
.atlas-legend-dim i { width: 10px; height: 10px; border-radius: 50%; background: var(--lac-red); opacity: 0.28; }

/* ── cluster card ──────────────────────────────────────────────────────── */
.atlas-cluster { position: absolute; z-index: 11; top: 0; left: 0; width: 236px; background: var(--lac-bg); border: 1px solid var(--lac-ink); border-radius: 2px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(29, 28, 28, 0.12); font-size: 13px; }
.atlas-cluster-n { margin: 0 0 4px; font: 700 15px var(--lac-display); }
.atlas-cluster ul { list-style: none; margin: 0; padding: 0; color: var(--lac-ink-2); font-variant-numeric: tabular-nums; }
.atlas-cluster-notable { margin: 6px 0 0; display: flex; flex-direction: column; gap: 3px; }
.atlas-cluster-actions { margin: 8px 0 0; display: flex; gap: 6px; }
.atlas-cluster-actions .atlas-btn { min-height: 28px; padding: 0 9px; font-size: 12.5px; }

/* ── drawer ────────────────────────────────────────────────────────────── */
.atlas-drawer { position: absolute; z-index: 10; top: 12px; right: 12px; bottom: 12px; width: 412px; background: var(--lac-bg); border: 1px solid var(--lac-rule); border-radius: 2px; box-shadow: 0 1px 2px rgba(29, 28, 28, 0.08); overflow: auto; scrollbar-width: thin; }
.atlas-drawer-close { position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; z-index: 2; width: 32px; height: 32px; border: 1px solid var(--lac-rule); border-radius: 2px; background: var(--lac-bg); color: var(--lac-ink); font: 18px/1 var(--lac-ui); cursor: pointer; }
.atlas-drawer-close:hover { background: var(--lac-ink); color: var(--lac-bg); }
.atlas-drawer-body { padding: 14px 16px 24px; }
.atlas-dhead h2 { margin: 2px 40px 4px 0; font: 700 22px/1.15 var(--lac-display); }
.atlas-dkind { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--lac-ink-3); }
.atlas-daddr, .atlas-dregion { margin: 0; font-size: 13px; color: var(--lac-ink-2); }
.atlas-dphoto { margin: 12px 0 0; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 2px; background: var(--lac-red); }
.atlas-dphoto img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.05) brightness(0.95); mix-blend-mode: screen; }
.atlas-dphoto::after { content: ''; position: absolute; inset: 0; background: var(--lac-ink); mix-blend-mode: multiply; opacity: 0.18; pointer-events: none; }
.atlas-dactions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.atlas-dsec { padding: 10px 0; border-top: 1px solid var(--lac-rule); }
.atlas-dsec h3 { margin: 0 0 6px; font: 600 11px/1 var(--lac-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--lac-ink-3); display: flex; align-items: center; gap: 8px; }
.atlas-dsec p { margin: 0 0 4px; font-size: 13.5px; }
.atlas-dnext p b { font: 700 17px var(--lac-display); color: var(--lac-red); }
.atlas-now { font-style: normal; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--lac-bg); background: var(--lac-red); border-radius: 2px; padding: 1px 6px; }
.atlas-week { margin: 0; display: grid; grid-template-columns: 36px 1fr; gap: 3px 8px; font-size: 13px; }
.atlas-week > div { display: contents; }
.atlas-week dt { color: var(--lac-ink-3); font-variant-numeric: tabular-nums; }
.atlas-week dd { margin: 0; display: flex; flex-wrap: wrap; gap: 3px 8px; font-variant-numeric: tabular-nums; }
.atlas-week dd small { color: var(--lac-ink-3); margin-left: 3px; font-size: 11px; }
.atlas-dtext { white-space: pre-line; color: var(--lac-ink-2); font-size: 13px; }
.atlas-dfacts p { color: var(--lac-ink-2); }
.atlas-dprov { font-size: 12.5px; color: var(--lac-ink-2); }
.atlas-dprov a { color: var(--lac-red); }
.atlas-dlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.atlas-dlist .atlas-link { text-decoration: none; color: var(--lac-ink); }
.atlas-dlist .atlas-link:hover span { text-decoration: underline; }
.atlas-dlist small { margin-left: auto; }

/* ── palette and keys ──────────────────────────────────────────────────── */
.atlas-palette { position: fixed; inset: 0; z-index: 40; background: rgba(29, 28, 28, 0.35); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.atlas-palette-box { width: min(560px, 92vw); background: var(--lac-bg); border: 1px solid var(--lac-ink); border-radius: 2px; box-shadow: 0 12px 40px rgba(29, 28, 28, 0.25); }
.atlas-palette input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--lac-rule); background: none; font: 16px var(--lac-ui); color: var(--lac-ink); outline: none; }
.atlas-palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.atlas-palette li button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 2px; background: none; font: 14px var(--lac-ui); color: var(--lac-ink); text-align: left; cursor: pointer; }
.atlas-palette li button small { color: var(--lac-ink-3); }
.atlas-palette li button kbd { margin-left: auto; font: 11px var(--lac-ui); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 1px 6px; color: var(--lac-ink-3); }
.atlas-palette li button.is-active, .atlas-palette li button:hover { background: var(--lac-bg-warm); }
.atlas-palette-none { padding: 10px; color: var(--lac-ink-3); }
.atlas-keys { position: absolute; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--lac-bg); border: 1px solid var(--lac-ink); border-radius: 2px; padding: 14px 18px; min-width: 260px; }
.atlas-keys h2 { margin: 0 0 8px; font: 700 15px var(--lac-display); }
.atlas-keys dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.atlas-keys dt kbd { font: 12px var(--lac-ui); border: 1px solid var(--lac-rule); border-radius: 2px; padding: 1px 6px; }
.atlas-keys dd { margin: 0; color: var(--lac-ink-2); }
.atlas-keys .atlas-btn { margin-top: 10px; }
.atlas-mark { flex: none; vertical-align: -2px; }

@media (prefers-reduced-motion: reduce) { .atlas-panel, .atlas-drawer { transition: none; } }
