/* ════════════════════════════════════════════════════════════════════
   THE CLAWFILES — PUBLIC EXPLORER (/explore/)
   Loads AFTER style.css + atlas.css. Namespace: .xp-  (+ .claw-pin,
   shared pin language with the gated wall).
   The public, plain-language face of the investigator's map:
   tour chips → tap a pin → follow the strings → read the card.
   One accent (lobster red). Motion: transform/opacity only.
   ════════════════════════════════════════════════════════════════════ */

/* ── Compact hero ──────────────────────────────────────────────────── */
.xp-hero { padding-bottom: clamp(1.4rem, 3vh, 2.2rem); }
.xp-hero .atlas-lede { margin-bottom: 0.2rem; }

/* ── Tour chips — the "start here" layer ───────────────────────────── */
.xp-tours {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem var(--gut) 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.xp-tours-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-right: 0.3rem;
}
.xp-tour {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--paper-2);
  background: var(--paper-card-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.xp-tour:hover { border-color: var(--atlas-accent-dim); color: var(--paper); }
.xp-tour:active { transform: translateY(1px) scale(0.98); }
.xp-tour:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.xp-tour[aria-pressed="true"] {
  color: var(--atlas-ink-0);
  background: var(--atlas-accent);
  border-color: transparent;
}
.xp-tour .xp-tour-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--dot, var(--atlas-accent));
  flex: none;
}
.xp-tour[aria-pressed="true"] .xp-tour-dot { background: var(--atlas-ink-0); }
.xp-tour .xp-tour-dot.is-square { border-radius: 2.5px; }

.xp-note {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.35rem var(--gut) 0.9rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--paper-2);
  min-height: 2.2em;
  text-wrap: pretty;
}

/* ── The stage ─────────────────────────────────────────────────────── */
.xp-wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--gut) 3rem; }
.xp-stage {
  position: relative;
  overflow: hidden;
  min-height: clamp(520px, 72dvh, 920px);
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--atlas-shadow);
}
#xp-map { position: absolute; inset: 0; }
#xp-map .maplibregl-canvas { outline: none; }
#xp-map .maplibregl-ctrl-group {
  background: rgba(10, 37, 41, 0.85);
  border: 1px solid rgba(242, 239, 232, 0.12);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
#xp-map .maplibregl-ctrl-group button { width: 34px; height: 34px; }
#xp-map .maplibregl-ctrl-group button + button { border-top: 1px solid rgba(242, 239, 232, 0.1); }
#xp-map .maplibregl-ctrl-scale {
  background: rgba(10, 37, 41, 0.7); color: var(--paper-2);
  border-color: rgba(242, 239, 232, 0.3); font-family: var(--mono); font-size: 0.62rem;
}
#xp-map .maplibregl-ctrl-attrib { background: rgba(10, 37, 41, 0.66); font-size: 0.6rem; }
#xp-map .maplibregl-ctrl-attrib a { color: var(--paper-mute); }

.xp-basemap {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: flex; gap: 2px; padding: 3px;
  background: rgba(10, 37, 41, 0.85);
  border: 1px solid rgba(242, 239, 232, 0.12); border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.xp-basemap button {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.02em;
  color: var(--paper-mute); background: transparent; border: 0; cursor: pointer;
  min-height: 34px; padding: 4px 11px; border-radius: 7px;
  transition: color 0.15s ease, background 0.15s ease;
}
.xp-basemap button:hover { color: var(--paper-2); }
.xp-basemap button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: -2px; }
.xp-basemap button[aria-pressed="true"] { color: var(--paper); background: rgba(242, 239, 232, 0.1); }

.xp-empty {
  position: absolute; inset: auto 0 40% 0; z-index: 2;
  text-align: center; font-family: var(--mono); font-size: 0.8rem; color: var(--paper-2);
  margin: 0; pointer-events: none;
}

/* Paper-frame vignette — the map sits IN the page, not behind glass */
.xp-stage::after {
  content: "";
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(242, 239, 232, 0.08), inset 0 0 44px rgba(0, 0, 0, 0.39);
}

/* On-map key — always visible, no hunting below the fold */
.xp-key {
  position: absolute; left: 12px; bottom: 34px; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.8rem;
  max-width: calc(100% - 24px);
  background: rgba(10, 37, 41, 0.9);
  border: 1px solid rgba(242, 239, 232, 0.12);
  border-radius: 9px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  padding: 0.4rem 0.75rem;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--paper-2);
}
.xp-key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.xp-key-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.xp-key-dot.xp-key-sq { border-radius: 2.5px; }
.xp-key-swatch {
  width: 14px; height: 9px; display: inline-block; border-radius: 2px;
  background: rgba(127, 178, 204, 0.5); border: 1px dashed #5b8aa6;
}
@media (max-width: 640px) { .xp-key { display: none; } }

/* Pin hover name tag — explicit hex so no cache/extension state can wash it out */
.xp-pin-tip .maplibregl-popup-content {
  font-family: var(--sans); font-weight: 600; font-size: 0.78rem;
  color: #f2efe8 !important; background: #0a2529;
  border: 1px solid rgba(242, 239, 232, 0.14); border-radius: 8px;
  padding: 0.3rem 0.6rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.47);
}
.xp-pin-tip .maplibregl-popup-tip { border-top-color: rgba(10, 37, 41, 0.96); border-bottom-color: rgba(10, 37, 41, 0.96); }

/* ── Pins (shared visual language with the gated wall) ─────────────── */
.claw-pin {
  appearance: none; -webkit-appearance: none;
  border: 0; padding: 0; background: transparent; cursor: pointer; line-height: 0;
}
.claw-pin-shape {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pin, #ef5f52);
  box-shadow: 0 0 0 2px rgba(14, 48, 52, 0.9), 0 0 10px 1px color-mix(in srgb, var(--pin) 65%, transparent);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.claw-pin.shape-company .claw-pin-shape { border-radius: 5px; }
.claw-pin-glyph { width: 12px; height: 12px; color: #06191c; display: block; }
.claw-pin-glyph svg { width: 100%; height: 100%; display: block; }
.claw-pin:hover .claw-pin-shape,
.claw-pin:focus-visible .claw-pin-shape { transform: scale(1.25); }
.claw-pin:focus-visible { outline: none; }
.claw-pin:focus-visible .claw-pin-shape {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--accent-hi), 0 0 14px 2px var(--pin);
}
.claw-pin.is-investigated .claw-pin-shape::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit;
  border: 2px solid var(--pin); pointer-events: none;
  animation: claw-pulse 1.9s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes claw-pulse {
  0%   { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(2.6); opacity: 0; }
}
.xp-stage.is-focused .claw-pin.pin-dim .claw-pin-shape { opacity: 0.22; box-shadow: 0 0 0 2px rgba(14, 48, 52, 0.7); }
.xp-stage.is-focused .claw-pin.pin-dim .claw-pin-shape::after { animation: none; opacity: 0; }
.xp-stage.is-focused .claw-pin.pin-lit .claw-pin-shape { transform: scale(1.28); }
/* RM block removed — owner decision 2026-07-16 */

/* ── The card (desktop rail / mobile bottom sheet) ─────────────────── */
.xp-panel {
  position: absolute;
  top: 0.9rem; right: 0.9rem;
  width: min(380px, calc(100% - 1.8rem));
  max-height: calc(100% - 1.8rem);
  overflow-y: auto;
  z-index: 3;
  background: rgba(10, 37, 41, 0.94);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--atlas-shadow);
  padding: 1.05rem 1.15rem 1.1rem;
}
.xp-panel:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: -2px; }
.xp-panel-handle { display: none; }
.xp-panel-kind {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; margin: 0 0 0.45rem;
}
.xp-roleword.role-hazard  { color: #ec5548; }
.xp-roleword.role-subject { color: #a678e8; }
.xp-roleword.role-water   { color: #4db7dd; }
.xp-badge {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
  border: 1px solid var(--rule); border-radius: var(--radius-pill);
  padding: 0.14rem 0.55rem; color: var(--paper-2);
}
.xp-badge.is-alert { color: #f4685c; border-color: var(--atlas-accent-dim); }
.xp-panel-label {
  font-family: var(--serif); font-size: 1.28rem; line-height: 1.15;
  color: var(--paper); margin: 0 0 0.15rem; text-wrap: balance;
}
.xp-panel-town { font-family: var(--mono); font-size: 0.7rem; color: var(--paper-mute); margin: 0 0 0.7rem; }
.xp-panel-what { font-size: 0.92rem; line-height: 1.55; color: var(--paper-2); margin: 0 0 0.8rem; text-wrap: pretty; }
.xp-why {
  border-left: 2px solid var(--atlas-accent-dim);
  background: var(--atlas-accent-wash);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 0.8rem;
  margin: 0 0 0.9rem;
}
.xp-why-label {
  display: block;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: #f4685c; margin-bottom: 0.25rem;
}
.xp-why p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--paper); text-wrap: pretty; }
.xp-conn-h {
  font-family: var(--sans); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 0.7rem; color: var(--paper-mute);
  margin: 0.9rem 0 0.4rem;
}
.xp-conn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.xp-conn-item {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; text-align: left;
  font-size: 0.86rem; color: var(--paper-2); line-height: 1.35;
  background: transparent; border: 0; border-top: 1px solid var(--rule-soft);
  padding: 0.5rem 0.1rem; cursor: pointer;
  font-family: var(--serif);
  transition: color 0.15s ease;
}
.xp-conn-item:first-child { border-top: 0; }
.xp-conn-item:hover .xp-conn-name,
.xp-conn-item:focus-visible .xp-conn-name { color: var(--accent-hi); }
.xp-conn-item:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: -2px; border-radius: 6px; }
.xp-conn-name { color: var(--paper); font-weight: 600; font-family: var(--sans); font-size: 0.82rem; flex: none; }
.xp-conn-rel { color: var(--paper-mute); font-style: italic; }
.xp-conn-item .xp-conn-arrow { margin-left: auto; color: var(--atlas-accent); flex: none; }
.conn-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block;
}
.conn-dot.r-hazard { background: #ef5f52; }
.conn-dot.r-subject { background: #8a55d4; border-radius: 3px; }
.conn-dot.r-water { background: #2f7fb8; }

.xp-go {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin-top: 1rem; min-height: 44px;
  font-family: var(--sans); font-weight: 600; font-size: 0.88rem;
  color: var(--atlas-ink-0); background: var(--atlas-accent);
  border-radius: var(--radius-pill); padding: 0.55rem 1.2rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.xp-go:hover { background: #f4685c; }
.xp-go:active { transform: translateY(1px); }
.xp-close-row { margin: 0.7rem 0 0; text-align: right; }
.xp-btn-link {
  background: none; border: 0; cursor: pointer; min-height: 44px;
  font-family: var(--mono); font-size: 0.74rem; color: var(--paper-mute);
  text-decoration: underline; text-underline-offset: 3px; padding: 0.4rem 0.2rem;
}
.xp-btn-link:hover { color: var(--paper); }
.xp-btn-link:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* ── Controls under the stage ──────────────────────────────────────── */
.xp-under {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem;
  padding: 0.9rem 0.2rem 0;
}
.xp-under .conn-btn { min-height: 44px; }
.xp-fine { width: 100%; }
.xp-fine > summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--paper-mute); padding: 0.4rem 0.2rem;
}
.xp-fine > summary::-webkit-details-marker { display: none; }
.xp-fine > summary:hover { color: var(--paper-2); }
.xp-fine > summary::after { content: "+"; font-size: 0.9rem; color: var(--atlas-accent); }
.xp-fine[open] > summary::after { content: "–"; }
.xp-fine .conn-controls { margin-top: 0.6rem; }

/* ── First-visit coach ─────────────────────────────────────────────── */
.xp-coach {
  position: absolute; left: 50%; bottom: 1.1rem; z-index: 4;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 1.8rem));
  background: rgba(10, 37, 41, 0.95);
  border: 1px solid var(--atlas-accent-dim);
  border-radius: var(--radius-md);
  box-shadow: var(--atlas-shadow);
  padding: 0.85rem 1rem;
  display: flex; align-items: center; gap: 0.9rem;
}
/* author display:flex beats the UA [hidden] rule — restate it or "Got it" can't dismiss */
.xp-coach[hidden] { display: none; }
.xp-coach p { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--paper-2); flex: 1; }
.xp-coach p strong { color: var(--paper); font-family: var(--sans); font-size: 0.85rem; }
.xp-coach-ok {
  flex: none; min-height: 44px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 0.82rem;
  color: var(--atlas-ink-0); background: var(--atlas-accent);
  border: 0; border-radius: var(--radius-pill); padding: 0.5rem 1rem;
}
.xp-coach-ok:hover { background: #f4685c; }
.xp-coach-ok:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* ── Legend / how-to ───────────────────────────────────────────────── */
.xp-legend-details { margin-top: 1.2rem; }
.xp-legend-details summary {
  cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 0.95rem; color: var(--paper);
  min-height: 44px; display: flex; align-items: center;
}
.xp-legend-details summary h2 { font-size: inherit; font-family: inherit; margin: 0; display: inline; }
.xp-legend { list-style: none; margin: 0.8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.xp-legend li { display: flex; align-items: baseline; gap: 0.6rem; font-size: 0.9rem; color: var(--paper-2); line-height: 1.5; }
.xp-legend .conn-dot { position: relative; top: 1px; }
.xp-legend strong { color: var(--paper); }
.xp-caveat { margin-top: 0.9rem; font-size: 0.8rem; line-height: 1.55; color: var(--paper-mute); }

.xp-foot {
  margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.72rem; color: var(--paper-mute); line-height: 1.6;
}

/* ── Mobile: card becomes a bottom sheet ───────────────────────────── */
@media (max-width: 899px) {
  .xp-stage { border-radius: var(--radius-md); min-height: 68dvh; }
  .xp-panel {
    position: fixed;
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 58dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: calc(1rem + var(--safe-bottom, 0px));
    z-index: 96; /* above the mobile bottom-nav (90) while a pin is open */
  }
  .xp-panel-handle {
    display: block; width: 42px; height: 4px; border-radius: 999px;
    background: var(--rule); margin: 0 auto 0.75rem;
  }
  /* RM block removed — owner decision 2026-07-16 */
  .xp-coach { position: fixed; bottom: calc(4.6rem + var(--safe-bottom, 0px)); z-index: 95; }
}
