/* Raid 3D viewer — cinematic glass-overlay design (Phase 1 of the
 * standalone-mockup rebuild, 2026-05-25).
 *
 * Scoped to .raid3d-shell so the dark theme + tokens don't leak into
 * the rest of the SPA. The canvas fills the shell; every UI element
 * is an absolute glass panel floating on top. Pointer-events on the
 * .raid3d-ui wrapper is `none` so map drag/zoom passes through; each
 * child re-enables pointer-events where interactive.
 */

.raid3d-shell {
  /* Local design tokens — mockup palette. Scope-local so they
   * shadow the rest of the SPA's --y / --bk on this page only. */
  --r3-y: #ffce00;
  --r3-bk: #0a0b0c;
  --r3-bk2: #14171a;
  --r3-wh: #fafaf8;
  --r3-g3: #b8b5ab;
  --r3-g4: #6e6b62;
  --r3-line: #262a2f;
  --r3-pane: rgba(20, 23, 26, 0.78);
  --r3-pane-solid: #0d0f12;
  --r3-serif: "DM Serif Display", serif;
  --r3-radius-pill: 999px;
  --r3-radius-card: 12px;

  position: relative;
  width: 100%;
  height: calc(100vh - 60px);
  background: var(--r3-bk);
  color: var(--r3-wh);
  overflow: hidden;
}

/* Full-bleed canvas — fills the shell. */
.raid3d-shell .raid3d-canvas {
  position: absolute;
  inset: 0;
  background: var(--r3-bk2);
}

/* UI overlay layer — clicks pass through except where re-enabled. */
.raid3d-shell .raid3d-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.raid3d-shell .raid3d-ui > * {
  pointer-events: auto;
}

/* ── TOP zone: breadcrumb + title block + right cluster ───────── */
.raid3d-shell .raid3d-top {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  right: var(--sp-3);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  pointer-events: none;
}
.raid3d-shell .raid3d-top > * {
  pointer-events: auto;
}

.raid3d-shell .raid3d-top-left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.raid3d-shell .raid3d-top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Breadcrumb pill — glass with a circular "back" affordance on the
 * left edge, hover state lifts to yellow. Acts as the back link. */
.raid3d-shell .raid3d-crumb {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r3-radius-pill);
  padding: 5px 14px 5px 5px;
  font-size: var(--fs-xs);
  color: var(--r3-g3);
  text-decoration: none;
  transition:
    border-color var(--dur-chip),
    color var(--dur-chip);
  align-self: flex-start;
}
.raid3d-shell .raid3d-crumb:hover {
  border-color: var(--r3-y);
  color: var(--r3-wh);
}
.raid3d-shell .raid3d-crumb-back {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--r3-pane-solid);
  display: grid;
  place-items: center;
  color: var(--r3-g3);
  font-size: var(--fs-xs);
}
.raid3d-shell .raid3d-crumb b {
  color: var(--r3-wh);
  font-weight: 600;
}
.raid3d-shell .raid3d-crumb-sep {
  opacity: 0.4;
}
.raid3d-shell .raid3d-crumb-camp {
  /* Truncate long camp names so the breadcrumb doesn't push the title
   * block off-screen on narrow viewports. */
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.raid3d-shell .raid3d-crumb:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Title block — eyebrow + serif H1 + sub-meta. The H1 is large and
 * intentionally floats over the canvas (no panel background) — a
 * subtle text-shadow keeps it legible against any tile colour. */
.raid3d-shell .raid3d-title-block {
  padding: 0 var(--sp-2);
}
.raid3d-shell .raid3d-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--r3-y);
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.raid3d-shell .raid3d-h1 {
  font-family: var(--r3-serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  margin: 0;
  color: var(--r3-wh);
  text-shadow:
    0 2px 18px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(0, 0, 0, 0.35);
  letter-spacing: -0.012em;
}
.raid3d-shell .raid3d-sub {
  font-size: var(--fs-sm);
  color: var(--r3-g3);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.raid3d-shell .raid3d-sub .raid3d-pin {
  color: var(--r3-y);
}
.raid3d-shell .raid3d-sub .raid3d-sep {
  opacity: 0.4;
}

/* Segmented control (Aérien / Topo) — pill-button group on a glass
 * background. Active button gets the yellow accent. */
.raid3d-shell .raid3d-seg {
  display: inline-flex;
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.raid3d-shell .raid3d-seg button {
  border: 0;
  background: transparent;
  color: var(--r3-g3);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition:
    background var(--dur-chip),
    color var(--dur-chip);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.raid3d-shell .raid3d-seg button:hover {
  color: var(--r3-wh);
}
.raid3d-shell .raid3d-seg button.on {
  background: var(--r3-y);
  color: var(--r3-bk);
  font-weight: var(--fw-semibold);
}
.raid3d-shell .raid3d-seg button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Icon button (Orbit) — same glass treatment, neutral by default,
 * yellow when "on". */
.raid3d-shell .raid3d-iconbtn {
  border: 1px solid var(--r3-line);
  background: var(--r3-pane);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--r3-g3);
  font: inherit;
  font-size: var(--fs-sm);
  padding: 6px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    color var(--dur-chip),
    border-color var(--dur-chip);
}
.raid3d-shell .raid3d-iconbtn:hover {
  color: var(--r3-wh);
  border-color: var(--r3-g4);
}
.raid3d-shell .raid3d-iconbtn.on {
  color: var(--r3-y);
  border-color: var(--r3-y);
}
.raid3d-shell .raid3d-iconbtn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.raid3d-shell .raid3d-ic {
  width: 12px;
  height: 12px;
}

/* ── Legend (Phase 2: glass panel with header / body / footer; collapse
 *   to a 44px-wide icon strip via [data-collapsed="true"]; per-row click-
 *   the-dot swatch picker; group rows + "Tout masquer/afficher" stats.) */
.raid3d-shell .raid3d-legend {
  position: absolute;
  top: 180px; /* clear the title block above */
  right: var(--sp-3);
  width: 328px;
  max-height: calc(100vh - 200px - var(--sp-3));
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--r3-radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width var(--dur-normal) ease;
  pointer-events: auto;
  box-shadow: var(--r3-shadow);
}
.raid3d-shell .raid3d-legend[data-collapsed="true"] {
  width: 44px;
}
.raid3d-shell .raid3d-legend[data-collapsed="true"] .r3l-body,
.raid3d-shell .raid3d-legend[data-collapsed="true"] .r3l-foot,
.raid3d-shell .raid3d-legend[data-collapsed="true"] .r3l-title {
  display: none;
}

/* Header (eyebrow + camp name on the left, collapse toggle on the right). */
.raid3d-shell .raid3d-legend .r3l-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2-h, var(--sp-2)) var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--r3-line);
  background: rgba(0, 0, 0, 0.18);
}
.raid3d-shell .raid3d-legend .r3l-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.raid3d-shell .raid3d-legend .r3l-eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--r3-y);
  font-weight: 600;
}
.raid3d-shell .raid3d-legend .r3l-camp {
  font-family: var(--r3-serif);
  font-weight: 400;
  font-size: 19px;
  color: var(--r3-wh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid3d-shell .raid3d-legend .r3l-toggle {
  background: transparent;
  color: var(--r3-g3);
  border: 1px solid var(--r3-line);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color var(--dur-fast),
    border-color var(--dur-fast);
}
.raid3d-shell .raid3d-legend .r3l-toggle:hover {
  color: var(--r3-y);
  border-color: var(--r3-y);
}
.raid3d-shell .raid3d-legend .r3l-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.45);
}
.raid3d-shell .raid3d-legend .r3l-toggle-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
  transition: transform var(--dur-normal) ease;
}
.raid3d-shell .raid3d-legend[data-collapsed="true"] .r3l-toggle-icon {
  transform: rotate(180deg);
}

/* Body — scrollable list of group sections. */
.raid3d-shell .raid3d-legend .r3l-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-2) 0;
}
.raid3d-shell .raid3d-legend .r3l-body::-webkit-scrollbar {
  width: 6px;
}
.raid3d-shell .raid3d-legend .r3l-body::-webkit-scrollbar-thumb {
  background: var(--r3-line);
  border-radius: 999px;
}

/* Group section + row. */
.raid3d-shell .r3l-group {
  margin-bottom: var(--sp-2);
}
.raid3d-shell .r3l-group-hd {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px var(--sp-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--r3-g3);
  font-weight: 600;
}
.raid3d-shell .r3l-group-hd .r3l-group-count {
  font-weight: 400;
  color: var(--r3-g4);
}
.raid3d-shell .r3l-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  color: var(--r3-wh);
  transition: background var(--dur-fast);
}
.raid3d-shell .r3l-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.raid3d-shell .r3l-row[data-hidden="true"] {
  opacity: 0.42;
}
.raid3d-shell .r3l-row[data-hidden="true"] .r3l-nm,
.raid3d-shell .r3l-row[data-hidden="true"] .r3l-meta {
  text-decoration: line-through;
  text-decoration-color: var(--r3-g4);
}
.raid3d-shell .r3l-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: var(--r3-dot, #888);
  padding: 0;
  cursor: pointer;
  display: inline-block;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.4),
    0 0 6px var(--r3-dot, transparent);
  transition: transform var(--dur-fast);
}
.raid3d-shell .r3l-dot:hover {
  transform: scale(1.18);
}
.raid3d-shell .r3l-dot:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 206, 0, 0.55);
}
.raid3d-shell .r3l-nm-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.raid3d-shell .r3l-nm {
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid3d-shell .r3l-meta {
  font-size: 10.5px;
  color: var(--r3-g3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid3d-shell .r3l-fly,
.raid3d-shell .r3l-eye {
  background: transparent;
  border: 0;
  color: var(--r3-g3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  font-size: var(--fs-md);
  line-height: 1;
  transition:
    background var(--dur-fast),
    color var(--dur-fast);
}
.raid3d-shell .r3l-fly {
  color: var(--r3-y);
}
.raid3d-shell .r3l-fly:hover,
.raid3d-shell .r3l-eye:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--r3-wh);
}
.raid3d-shell .r3l-fly:focus-visible,
.raid3d-shell .r3l-eye:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.45);
}
.raid3d-shell .r3l-eye[aria-pressed="true"] {
  opacity: 0.5;
}

/* Footer — visibility stats + Tout masquer + GPX/KML exports. */
.raid3d-shell .raid3d-legend .r3l-foot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--r3-line);
  background: rgba(0, 0, 0, 0.18);
}
.raid3d-shell .raid3d-legend .r3l-foot-stats {
  font-size: 11px;
  color: var(--r3-g3);
  letter-spacing: 0.04em;
}
.raid3d-shell .raid3d-legend .r3l-foot-stats b {
  color: var(--r3-wh);
  font-weight: 600;
}
.raid3d-shell .raid3d-legend .r3l-foot-actions {
  display: flex;
  gap: var(--sp-1);
}
.raid3d-shell .raid3d-legend .r3l-foot-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--r3-line);
  color: var(--r3-g3);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    border-color var(--dur-fast),
    color var(--dur-fast);
}
.raid3d-shell .raid3d-legend .r3l-foot-btn:first-child {
  flex: 1 1 auto; /* "Tout masquer" stretches; GPX/KML stay compact */
}
.raid3d-shell .raid3d-legend .r3l-foot-btn:hover {
  border-color: var(--r3-y);
  color: var(--r3-y);
}
.raid3d-shell .raid3d-legend .r3l-foot-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.45);
}

/* Swatch picker popup — fixed-positioned via JS over the clicked dot.
 * 10-colour grid (PALETTE from raid-3d/palette.js). */
.r3l-swatchpop {
  position: fixed;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(5, 22px);
  gap: 6px;
  padding: 10px;
  background: rgba(20, 23, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}
.r3l-swatchpop[hidden] {
  display: none;
}
.r3l-swatchpop-cell {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  padding: 0;
  background: var(--r3-cell, #888);
  transition:
    transform var(--dur-fast),
    border-color var(--dur-fast);
}
.r3l-swatchpop-cell:hover {
  transform: scale(1.12);
  border-color: rgba(255, 255, 255, 0.55);
}
.r3l-swatchpop-cell[aria-current="true"] {
  border-color: #ffce00;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.45);
}
.r3l-swatchpop-cell:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 206, 0, 0.55);
}

/* ── Stats overlay (Phase 3): bottom-center glass card shown when a
 *   legend row is clicked. Route name + distance + sub-group + the
 *   primary "▶ Survoler" CTA. Fades in via opacity + translate-up. */
.raid3d-shell .r3-stats {
  position: absolute;
  left: 50%;
  bottom: var(--sp-4);
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 340px;
  max-width: min(560px, calc(100vw - 2 * var(--sp-3)));
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: var(--sp-2) var(--sp-3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  transition:
    transform var(--dur-normal) ease,
    opacity var(--dur-normal) ease;
}
.raid3d-shell .r3-stats[data-visible="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.raid3d-shell .r3-stats-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: var(--r3-stat-dot, #888);
  box-shadow: 0 0 8px var(--r3-stat-dot, transparent);
  flex-shrink: 0;
}
.raid3d-shell .r3-stats-block {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.raid3d-shell .r3-stats-nm {
  font-family: var(--r3-serif);
  font-weight: 400;
  font-size: 18px;
  color: var(--r3-wh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid3d-shell .r3-stats-meta {
  font-size: 11px;
  color: var(--r3-g3);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.raid3d-shell .r3-stats-meta b {
  color: var(--r3-wh);
  font-weight: 600;
}
.raid3d-shell .r3-stats-meta .r3-stats-sep {
  opacity: 0.35;
}
.raid3d-shell .r3-stats-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}
.raid3d-shell .r3-stats-btn {
  border: 1px solid var(--r3-line);
  background: transparent;
  color: var(--r3-g3);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition:
    border-color var(--dur-fast),
    color var(--dur-fast),
    background var(--dur-fast);
}
.raid3d-shell .r3-stats-btn:hover {
  border-color: var(--r3-y);
  color: var(--r3-y);
}
.raid3d-shell .r3-stats-btn.r3-stats-btn-primary {
  background: var(--r3-y);
  border-color: var(--r3-y);
  color: var(--r3-bk);
  font-weight: 600;
}
.raid3d-shell .r3-stats-btn.r3-stats-btn-primary:hover {
  background: #ffd633;
  border-color: #ffd633;
  color: var(--r3-bk);
}
.raid3d-shell .r3-stats-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.55);
}
.raid3d-shell .r3-stats-close {
  background: transparent;
  border: 0;
  color: var(--r3-g3);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}
.raid3d-shell .r3-stats-close:hover {
  color: var(--r3-wh);
  background: rgba(255, 255, 255, 0.06);
}

/* Pulse selected row in the legend so it's clear which one is showing
 * in the stats overlay. */
.raid3d-shell .r3l-row[data-selected="true"] {
  background: rgba(255, 206, 0, 0.06);
  box-shadow: inset 3px 0 0 var(--r3-y);
}

/* ── Bottom-left credit pill (Phase 4 will add scalebar + compass). */
.raid3d-shell .raid3d-credit {
  position: absolute;
  left: var(--sp-3);
  bottom: var(--sp-3);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r3-radius-pill);
  padding: 5px 14px 5px 10px;
  font-size: 10.5px;
  color: var(--r3-g3);
  pointer-events: none;
}
.raid3d-shell .raid3d-credit b {
  color: var(--r3-wh);
  font-weight: 600;
}
.raid3d-shell .raid3d-credit-flag {
  width: 14px;
  height: 14px;
  background: #dc2626;
  border-radius: 2px;
  display: inline-grid;
  place-items: center;
  position: relative;
}
.raid3d-shell .raid3d-credit-flag::before,
.raid3d-shell .raid3d-credit-flag::after {
  content: "";
  position: absolute;
  background: #fff;
}
.raid3d-shell .raid3d-credit-flag::before {
  left: 50%;
  top: 25%;
  bottom: 25%;
  width: 2px;
  transform: translateX(-50%);
}
.raid3d-shell .raid3d-credit-flag::after {
  top: 50%;
  left: 25%;
  right: 25%;
  height: 2px;
  transform: translateY(-50%);
}

/* ── Phase 5: orbit banner (top-center pill) + flythrough HUD
 *   (bottom-center with progress bar). Both hidden by default; JS
 *   toggles [hidden] when entering/leaving the respective mode. */
.raid3d-shell .r3-orbit-banner {
  position: absolute;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 14px 6px 12px;
  background: var(--r3-pane);
  border: 1px solid var(--r3-y);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  color: var(--r3-wh);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* user clicks the canvas, not the banner */
  z-index: 12;
}
.raid3d-shell .r3-orbit-banner[hidden] {
  display: none;
}
.raid3d-shell .r3-orbit-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--r3-y);
  box-shadow: 0 0 0 3px rgba(255, 206, 0, 0.18);
  animation: r3OrbitPulse 1.4s ease-in-out infinite;
}
@keyframes r3OrbitPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.7;
  }
}
@media (prefers-reduced-motion: reduce) {
  .raid3d-shell .r3-orbit-banner-dot {
    animation: none;
  }
}

.raid3d-shell .r3-flythrough-hud {
  position: absolute;
  left: 50%;
  bottom: var(--sp-4);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: min(560px, calc(100vw - 2 * var(--sp-3)));
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  padding: var(--sp-2) var(--sp-3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  z-index: 11;
}
.raid3d-shell .r3-flythrough-hud[hidden] {
  display: none;
}
/* While the flythrough HUD is open, hide the stats overlay so the
 * two glass cards don't stack on top of each other. */
.raid3d-shell
  .r3-flythrough-hud:not([hidden])
  ~ .r3-stats[data-visible="true"] {
  opacity: 0;
  pointer-events: none;
}
.raid3d-shell .r3-flythrough-hud-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: var(--r3-fly-dot, var(--r3-y));
  box-shadow: 0 0 8px var(--r3-fly-dot, var(--r3-y));
  flex-shrink: 0;
}
.raid3d-shell .r3-flythrough-hud-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.raid3d-shell .r3-flythrough-hud-nm {
  font-family: var(--r3-serif);
  font-weight: 400;
  font-size: 16px;
  color: var(--r3-wh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid3d-shell .r3-flythrough-hud-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.raid3d-shell .r3-flythrough-hud-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--r3-y), #ffd633);
  border-radius: 2px;
  transition: width 0.08s linear;
}
.raid3d-shell .r3-flythrough-hud-close {
  background: transparent;
  border: 0;
  color: var(--r3-g3);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}
.raid3d-shell .r3-flythrough-hud-close:hover {
  color: var(--r3-wh);
  background: rgba(255, 255, 255, 0.06);
}
.raid3d-shell .r3-flythrough-hud-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.55);
}

/* ── Phase 4: bottom-right meta cluster — compass + scalebar.
 *   Compass needle rotates with the camera heading (Cesium only).
 *   Scalebar shows a "nice" round distance via the JS sampler. */
.raid3d-shell .raid3d-meta-cluster {
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-3);
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  pointer-events: none;
}
.raid3d-shell .raid3d-meta-cluster > * {
  pointer-events: auto;
}
.raid3d-shell .raid3d-compass {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--r3-g3);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition:
    color var(--dur-fast),
    border-color var(--dur-fast);
}
.raid3d-shell .raid3d-compass:hover {
  border-color: var(--r3-y);
  color: var(--r3-wh);
}
.raid3d-shell .raid3d-compass:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 206, 0, 0.55);
}
.raid3d-shell .raid3d-compass-svg {
  width: 32px;
  height: 32px;
  display: block;
}
.raid3d-shell .raid3d-compass-needle {
  /* Pin the rotation origin to the SVG viewBox centre, not the
   * element's bounding box. Without `transform-box: view-box` the
   * browser treats `16px 16px` as offsets from the bounding-box
   * origin — the needle swings around its own corner instead of
   * the compass centre, so the N-tip drifts off the dial as you
   * rotate the camera. (Spotted live 2026-05-25.) */
  transform-box: view-box;
  transform-origin: 16px 16px;
  transition: transform var(--dur-fast) linear;
}
.raid3d-shell .raid3d-compass-needle-n {
  fill: var(--r3-y);
}

.raid3d-shell .raid3d-scale {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 92px;
}
.raid3d-shell .raid3d-scale-bar {
  position: relative;
  height: 4px;
  width: 100px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  transition: width var(--dur-fast) linear;
}
.raid3d-shell .raid3d-scale-bar::before,
.raid3d-shell .raid3d-scale-bar::after {
  content: "";
  position: absolute;
  width: 1.5px;
  height: 9px;
  background: var(--r3-y);
  top: -3px;
}
.raid3d-shell .raid3d-scale-bar::before {
  left: 0;
}
.raid3d-shell .raid3d-scale-bar::after {
  right: 0;
}
.raid3d-shell .raid3d-scale-label {
  font-size: 10.5px;
  color: var(--r3-wh);
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Hide the meta cluster on the Leaflet/2D fallback path — Leaflet
 * is always north-up so a compass is meaningless, and we'd need a
 * separate scale calculation for a different projection. */
.raid3d-fallback-mode .raid3d-meta-cluster {
  display: none;
}

/* ── Mobile / WebGL2 fallback container. Reuses standard Leaflet
 *   sizing but kept inside the same canvas mount so the overlays
 *   still sit on top. */
.raid3d-shell .raid3d-fallback-map {
  width: 100%;
  height: 100%;
}

/* On the fallback path the Présentation/orbit button is meaningless
 * (no 3D camera), so hide it. */
.raid3d-fallback-mode .raid3d-iconbtn#raid3dPresentation {
  display: none;
}

/* Print: hide the 3D viewer entirely — the existing relecture raid
 * sheet handles print rendering. */
@media print {
  #page-raid-3d {
    display: none !important;
  }
}

/* Empty state (#689) — shown in the legend slot when the camp has no
 * resolved raid links. Canvas is blanked via .raid3d-empty class. */
.raid3d-shell .raid3d-empty-state {
  padding: var(--sp-4);
  text-align: center;
  color: var(--r3-g3);
}
.raid3d-shell .raid3d-empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: var(--sp-2);
  opacity: 0.6;
}
.raid3d-shell .raid3d-empty-state h3 {
  margin: 0 0 var(--sp-2);
  font-family: var(--r3-serif);
  font-weight: 400;
  font-size: 22px;
  color: var(--r3-wh);
}
.raid3d-shell .raid3d-empty-state p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.raid3d-shell .raid3d-canvas.raid3d-empty {
  background: var(--r3-bk);
}

/* Responsive: shrink the title-block H1 + hide the breadcrumb's
 * trailing camp-name on narrow viewports so the top zone doesn't
 * crowd into the right-cluster. */
@media (max-width: 840px) {
  .raid3d-shell .raid3d-h1 {
    font-size: 28px;
  }
  .raid3d-shell .raid3d-crumb-camp {
    max-width: 100px;
  }
  .raid3d-shell .raid3d-legend {
    width: calc(100vw - 2 * var(--sp-3));
    top: auto;
    bottom: var(--sp-3);
    max-height: 40vh;
  }
}

/* Overlay popover — additional WMTS + OSM POI layer toggles. Anchored
 * to its button via .raid3d-overlays-wrap relative positioning. Same
 * glass panel treatment as the legend so the cluster reads as one
 * family of controls. */
.raid3d-shell .raid3d-overlays-wrap {
  position: relative;
  display: inline-block;
}
.raid3d-shell .raid3d-overlays-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  background: var(--r3-pane);
  border: 1px solid var(--r3-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 10px 12px 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 12;
  color: var(--r3-wh);
}
.raid3d-shell .raid3d-overlays-menu[hidden] {
  display: none;
}
.raid3d-shell .raid3d-overlays-section + .raid3d-overlays-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--r3-line);
}
.raid3d-shell .raid3d-overlays-section-hd {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--r3-g3);
  margin-bottom: 4px;
}
.raid3d-shell .raid3d-overlay-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.raid3d-shell .raid3d-overlay-row input[type="checkbox"] {
  accent-color: var(--r3-y);
  margin: 0;
}
.raid3d-shell .raid3d-overlay-row input[type="checkbox"]:disabled {
  opacity: 0.6;
}
.raid3d-shell .raid3d-overlay-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}
.raid3d-shell .raid3d-od-wanderwege {
  background: #f5a623;
}
.raid3d-shell .raid3d-od-oev {
  background: #6366f1;
}
.raid3d-shell .raid3d-od-fire {
  background: #ef4444;
}
.raid3d-shell .raid3d-od-fountains {
  background: #3b82f6;
}
.raid3d-shell .raid3d-od-sac {
  background: #dc2626;
}
.raid3d-shell .raid3d-od-refuges {
  background: #a16207;
}
.raid3d-shell .raid3d-od-picnic {
  background: #16a34a;
}
.raid3d-shell .raid3d-overlay-lbl {
  flex: 1;
}
.raid3d-shell .raid3d-overlays-foot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--r3-line);
  font-size: 10px;
  color: var(--r3-g4);
}
