/* ==========================================================================
   THE HOLLOW ATLAS — styles for the interactive map on world.html
   Uses the site's design tokens from styles.css.
   ========================================================================== */
.atlas {
  --gold: #C8AD80;
  --gold-soft: rgba(200, 173, 128, 0.35);
  --crimson: #8A3A44;
  --atlas-h: 700px;
  position: relative;
}
.atlas-intro { max-width: 720px; margin-bottom: 2rem; }
.atlas-tagline { font-family: var(--font-serif); font-style: italic; font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: var(--text-soft); margin: 0.9rem 0 0; }

/* ---------- toolbar: filters + search ---------- */
.atlas__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-bottom: 1.1rem; }
.atlas__filters { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1 1 560px; min-width: 0; padding: 3px; margin: -3px; }
.atlas__filters::-webkit-scrollbar { display: none; }
.atlas .filter-btn { flex: none; white-space: nowrap; }
.atlas .filter-btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--near-black); }
.atlas .atlas-filter--soon { color: var(--text-muted); border-style: dashed; cursor: not-allowed; }
.atlas .atlas-filter--soon:hover { color: var(--text-muted); border-color: var(--line); }
.atlas-soon { display: inline-block; margin-left: 0.35rem; font-size: 0.56rem; letter-spacing: 0.16em; opacity: 0.8; }

.atlas__search { position: relative; flex: 0 1 320px; }
.atlas__search input { padding-left: 2.6rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' fill='none' stroke='%239BA5AA' stroke-width='1.2'/%3E%3Cpath d='M10.4 10.4L14 14' stroke='%239BA5AA' stroke-width='1.2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 16px; background-position: 1rem 50%; }
.atlas__search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 173, 128, 0.18); }
.atlas__search input::-webkit-search-cancel-button { filter: invert(0.7); }
.atlas-results {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; list-style: none; margin: 0; padding: 0.35rem;
  background: rgba(14, 21, 27, 0.97); border: 1px solid var(--line-strong); border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); max-height: 320px; overflow-y: auto;
}
.atlas-results [role="option"] { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.8rem; border-radius: 4px; cursor: pointer; }
.atlas-results [role="option"]:hover, .atlas-results [aria-selected="true"] { background: rgba(200, 173, 128, 0.12); }
.atlas-results__name { color: var(--ivory); font-size: 0.95rem; }
.atlas-results__meta { color: var(--text-muted); font-size: 0.72rem; letter-spacing: 0.06em; }
.atlas-results__empty { padding: 0.7rem 0.8rem; color: var(--text-muted); font-size: 0.85rem; }

/* ---------- stage ---------- */
.atlas__stage {
  position: relative; height: var(--atlas-h); overflow: hidden;
  border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 45%, #13231f 0%, #0a1418 75%);
  isolation: isolate;
}
.atlas .atlas__map { position: absolute; inset: 0; } /* beats .maplibregl-map { position: relative } */
.atlas__map:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.atlas__vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(6, 10, 13, 0.55) 100%),
    linear-gradient(to bottom, rgba(6, 10, 13, 0.35), transparent 14%, transparent 86%, rgba(6, 10, 13, 0.45));
}
.atlas__vignette::after { /* faint parchment grain */
  content: ""; position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.atlas__loading {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none;
  font-family: var(--font-serif); font-style: italic; color: var(--text-muted); font-size: 1.1rem;
  transition: opacity 0.8s var(--ease);
}
.atlas__stage.is-ready .atlas__loading, .atlas__stage.is-failed .atlas__loading { opacity: 0; }

.atlas__reset {
  position: absolute; z-index: 5; left: 10px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; padding: 0.45rem 0.9rem;
  background: rgba(10, 16, 20, 0.86); color: var(--parchment); border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase; cursor: pointer;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.atlas__reset svg { width: 15px; height: 15px; }
.atlas__reset:hover { border-color: var(--gold); color: var(--ivory); }
.atlas__stage.is-failed .atlas__reset { display: none; }
.atlas__hint {
  position: absolute; z-index: 4; left: 50%; top: 12px; transform: translateX(-50%); margin: 0;
  padding: 0.3rem 0.8rem; border-radius: 999px; background: rgba(10, 16, 20, 0.7);
  font-size: 0.66rem; letter-spacing: 0.08em; color: var(--text-muted); white-space: nowrap; pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.atlas__stage.has-panel .atlas__hint, .atlas__stage.is-failed .atlas__hint { opacity: 0; }
.atlas__fallback {
  position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; text-align: center; padding: 2rem;
  background: radial-gradient(ellipse at 50% 50%, #13231f, #0a1418 80%); color: var(--text-soft);
}
.atlas__fallback[hidden] { display: none; }
.atlas__fallback p:last-child { max-width: 46ch; margin: 0.6rem auto 0; }

/* ---------- MapLibre controls, themed ---------- */
.atlas .maplibregl-ctrl-group { background: rgba(10, 16, 20, 0.86); border: 1px solid var(--line-strong); box-shadow: none; border-radius: 4px; }
.atlas .maplibregl-ctrl-group button { width: 36px; height: 36px; }
.atlas .maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.atlas .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.82) sepia(0.25); }
.atlas .maplibregl-ctrl-group button:focus-visible { box-shadow: 0 0 0 2px var(--gold); }
.atlas .maplibregl-ctrl-attrib { background: rgba(10, 16, 20, 0.75); color: var(--text-muted); font-size: 0.66rem; }
.atlas .maplibregl-ctrl-attrib a { color: var(--text-soft); }
.atlas .maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(10, 16, 20, 0.85); }
.atlas .maplibregl-ctrl-attrib-button { filter: invert(0.85); }
.atlas .maplibregl-cooperative-gesture-screen { background: rgba(6, 10, 13, 0.72); color: var(--ivory); font-family: var(--font-sans); font-size: 1rem; letter-spacing: 0.04em; }
.atlas .maplibregl-canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* ---------- markers ---------- */
.atlas-marker {
  position: relative; width: 40px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--gold); -webkit-tap-highlight-color: transparent;
}
.atlas-marker svg { width: 40px; height: 40px; overflow: visible; }
.atlas-marker__glow { fill: rgba(200, 173, 128, 0.14); transform-origin: 20px 20px; transition: fill 0.3s var(--ease); }
.atlas-marker__ring { fill: rgba(10, 16, 20, 0.55); stroke: var(--gold); stroke-width: 1.4; transition: stroke 0.3s var(--ease), stroke-width 0.3s var(--ease); }
.atlas-marker__core { fill: var(--gold); transition: fill 0.3s var(--ease); }
.atlas-marker.is-region .atlas-marker__ring { stroke-dasharray: 2.6 2.2; }
.atlas-marker.is-major .atlas-marker__glow { fill: rgba(138, 58, 68, 0.38); }
.atlas-marker.is-major .atlas-marker__core { fill: #E2C9A0; }
@media (prefers-reduced-motion: no-preference) {
  .atlas-marker.is-major .atlas-marker__glow { animation: atlas-breathe 4.8s ease-in-out infinite; }
}
@keyframes atlas-breathe { 0%, 100% { transform: scale(0.85); opacity: 0.75; } 50% { transform: scale(1.05); opacity: 1; } }
.atlas-marker:hover .atlas-marker__ring, .atlas-marker:focus-visible .atlas-marker__ring, .atlas-marker.is-active .atlas-marker__ring { stroke: #EBD9B6; stroke-width: 2; }
.atlas-marker:hover .atlas-marker__core, .atlas-marker:focus-visible .atlas-marker__core, .atlas-marker.is-active .atlas-marker__core { fill: var(--ivory); }
.atlas-marker:hover .atlas-marker__glow, .atlas-marker.is-active .atlas-marker__glow { fill: rgba(200, 173, 128, 0.28); }
.atlas-marker.is-major.is-active .atlas-marker__glow { fill: rgba(138, 58, 68, 0.6); }
.atlas-marker:focus { outline: none; }
.atlas-marker:focus-visible svg { filter: drop-shadow(0 0 4px rgba(242, 238, 231, 0.6)); }
.atlas-marker.is-hidden { display: none; }
.atlas-marker__label {
  position: absolute; left: 50%; bottom: calc(100% - 4px); transform: translate(-50%, 4px);
  padding: 0.25rem 0.6rem; border-radius: 3px; white-space: nowrap; pointer-events: none;
  background: rgba(10, 16, 20, 0.9); border: 1px solid var(--gold-soft); color: var(--ivory);
  font-family: var(--font-sans); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.atlas-marker:hover .atlas-marker__label, .atlas-marker:focus-visible .atlas-marker__label, .atlas-marker.is-active .atlas-marker__label { opacity: 1; transform: translate(-50%, 0); }
.atlas-marker:hover, .atlas-marker:focus-visible, .atlas-marker.is-active { z-index: 2; }

/* ---------- detail panel (desktop: right side) ---------- */
.atlas-panel {
  position: absolute; z-index: 8; top: 12px; right: 12px; bottom: 12px; width: min(400px, calc(100% - 24px));
  background: linear-gradient(180deg, rgba(16, 24, 32, 0.97), rgba(10, 16, 20, 0.98));
  border: 1px solid var(--line-strong); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  transform: translateX(calc(100% + 24px)); opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
}
.atlas-panel.is-open { transform: none; opacity: 1; }
.atlas-panel[hidden] { display: none; }
.atlas-panel__inner { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.atlas-panel__close {
  position: absolute; z-index: 2; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center;
  background: rgba(10, 16, 20, 0.8); color: var(--ivory); border: 1px solid var(--line-strong); border-radius: 50%; cursor: pointer;
}
.atlas-panel__close svg { width: 14px; height: 14px; }
.atlas-panel__close:hover { border-color: var(--gold); }
.atlas-panel__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0c1519; }
.atlas-panel__media img { width: 100%; height: 100%; object-fit: cover; }
.atlas-panel__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, rgba(16, 24, 32, 0.95)); }
.atlas-panel__ph-name {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 14%; text-align: center;
  font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.28em; text-transform: uppercase; color: rgba(216, 203, 180, 0.55);
}
.atlas-panel__body { padding: 0.4rem 1.6rem 1.8rem; }
.atlas-panel__eyebrow { margin: 0 0 0.4rem; font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); }
.atlas-panel__title { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.9rem); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ivory); }
.atlas-panel__title:focus { outline: none; }
.atlas-panel__title:focus-visible { outline: none; }
.atlas-panel__folklore { margin: 0.5rem 0 0; font-family: var(--font-serif); font-style: italic; font-size: 1.25rem; color: var(--parchment); }
.atlas-panel__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0; }
.atlas-tag { display: inline-block; padding: 0.15rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 999px; font-family: var(--font-sans); font-size: 0.56rem; font-style: normal; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); vertical-align: middle; }
.atlas-tag--fiction { border-color: rgba(138, 58, 68, 0.7); color: #D9A9AE; }
.atlas-panel__quote { margin: 1.1rem 0 0; padding-left: 1rem; border-left: 1px solid var(--oxblood); font-family: var(--font-serif); font-size: 1.12rem; line-height: 1.55; color: var(--text-soft); }
.atlas-panel__atmos { margin: 0.9rem 0 0; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.atlas-panel__facts { margin: 1.3rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); display: grid; gap: 0.8rem; }
.atlas-panel__facts dt { font-size: 0.6rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-muted); }
.atlas-panel__facts dd { margin: 0.2rem 0 0; color: var(--ivory); font-size: 0.95rem; }
.atlas-panel__facts ul { list-style: none; }
.atlas-panel__facts a { color: var(--parchment); }
.atlas-panel__note { margin: 1rem 0 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; }
.atlas-panel__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.atlas .btn--solid { --btn-bg: var(--gold); --btn-border: var(--gold); }
.atlas-panel__fine { margin: 1rem 0 0; font-size: 0.72rem; color: var(--text-muted); }

/* ---------- list view ---------- */
.atlas-list { margin-top: 1rem; border: 1px solid var(--line); background: var(--bg-raised); }
.atlas-list summary {
  cursor: pointer; padding: 1rem 1.25rem; list-style: none; display: flex; justify-content: space-between; align-items: center;
  font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-soft);
}
.atlas-list summary::-webkit-details-marker { display: none; }
.atlas-list summary::after { content: "+"; font-size: 1.1rem; color: var(--gold); }
.atlas-list[open] summary::after { content: "–"; }
.atlas-list summary:hover { color: var(--ivory); }
.atlas-list__body { padding: 0 1.25rem 1.25rem; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.atlas-list__group h4 { margin-bottom: 0.6rem; font-size: 0.64rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); line-height: 1.5; }
.atlas-list__group h4 em { display: block; font-family: var(--font-serif); font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--parchment); }
.atlas-list__group ul { list-style: none; display: grid; gap: 0.25rem; }
.atlas-list__item {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.7rem;
  background: transparent; border: 1px solid transparent; border-radius: 3px; cursor: pointer; min-height: 44px;
}
.atlas-list__item:hover { border-color: var(--line); background: rgba(200, 173, 128, 0.06); }
.atlas-list__name { color: var(--ivory); }
.atlas-list__meta { color: var(--text-muted); font-size: 0.78rem; }
.atlas-list__empty { color: var(--text-muted); margin: 0; }
.atlas__note { margin: 1rem 0 0; font-size: 0.78rem; color: var(--text-muted); }

/* ---------- tablet & phone ---------- */
@media (max-width: 1099px) { .atlas { --atlas-h: 620px; } }
@media (max-width: 819px) {
  .atlas { --atlas-h: clamp(440px, 62vh, 500px); }
  .atlas__toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .atlas__filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -3px; }
  .atlas__search { min-width: 0; }
  .atlas__stage { margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); border-left: 0; border-right: 0; }
  /* bottom sheet */
  .atlas-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 66%;
    border-left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 14px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.55);
    transform: translateY(105%);
  }
  .atlas-panel.is-open { transform: none; }
  .atlas-panel__inner { max-height: 100%; }
  .atlas-panel__inner::before { content: ""; display: block; width: 42px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--line-strong); }
  .atlas-panel__media { aspect-ratio: 16 / 7; }
  .atlas-panel__body { padding: 0.3rem 1.25rem 1.5rem; }
  .atlas__reset { left: auto; right: 10px; top: 10px; bottom: auto; }
  .atlas__hint { top: auto; bottom: 14px; font-size: 0.62rem; }
  .atlas-marker__label { font-size: 0.6rem; }
}
@media (max-width: 380px) {
  .atlas__hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-panel { transition: none; }
  .atlas-marker__label { transition: none; }
}
