/* Explore in 3D — UI shell. Tokens from styles.css. All text ≥4.5:1:
   --fg/--fg-soft on --bg/--bg-2 (≈10–17:1), #06111d on --accent (≈8:1). */

.attraction-footer .explore3d-btn { min-height: 44px; min-width: 44px; height: auto; }

html.e3d-open { overflow: hidden; }

.e3d {
  position: fixed; inset: 0; z-index: 2500;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--bg); color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.e3d[hidden] { display: none; }

.e3d-top {
  display: flex; align-items: center; gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.e3d-title {
  margin: 0; font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 22px; letter-spacing: -0.01em; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.e3d-btn {
  min-height: 44px; min-width: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--fg);
  font: 600 14px/1 inherit; font-family: inherit; cursor: pointer;
}
.e3d-btn:hover { background: var(--bg-2); }
.e3d-btn:focus-visible, .explore3d-btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.e3d-primary { background: var(--accent); color: #06111d; border-color: transparent; }
.e3d-primary:hover { background: var(--accent); filter: brightness(1.08); }

.e3d-stage { position: relative; overflow: hidden; background: var(--bg-2); }
.e3d-backdrop { position: absolute; inset: 0; display: none; }
.e3d-photo { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.45); }
.e3d-story {
  position: absolute; left: 16px; right: 16px; top: 16px; margin: 0 auto; max-width: 640px;
  padding: 12px 14px; border-radius: 12px; background: rgba(10, 16, 25, 0.85);
  color: var(--fg-soft); font-size: 14px; line-height: 1.5;
}
.e3d-skeleton {
  position: absolute; inset: 0; display: none;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 200% 100%; animation: e3d-shimmer 1.6s ease-in-out infinite;
}
@keyframes e3d-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.e3d-viewer {
  position: absolute; inset: 0; display: none; place-items: center;
  background: radial-gradient(ellipse at 50% 70%, #23405a 0%, #12202f 55%, var(--bg) 100%);
  color: var(--fg-soft); font-family: 'Geist Mono', monospace; font-size: 12px; letter-spacing: 0.08em;
}

.e3d-panel {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  padding: 18px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--line-2);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.7);
}
.e3d-step {
  margin: 0 0 6px; color: var(--fg-soft);
  font-family: 'Geist Mono', monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.e3d-step:empty { display: none; }
.e3d-status { margin: 0; font-size: 16px; line-height: 1.45; color: var(--fg); }
.e3d-status strong { display: block; font-size: 18px; margin-bottom: 4px; }
.e3d-status span { color: var(--fg-soft); }
.e3d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.e3d-actions:empty { display: none; }

.e3d[data-state="loading"] .e3d-skeleton,
.e3d[data-state="loading-2"] .e3d-skeleton { display: block; }
.e3d[data-state="loading-2"] .e3d-viewer,
.e3d[data-state="view"] .e3d-viewer { display: block; }
.e3d[data-state="loading-2"] .e3d-skeleton { opacity: 0.85; }
/* Cesium's own credit bar / ion logo are never shown (we render attribution). */
.e3d-viewer .cesium-widget-credits, .e3d-viewer .cesium-credit-logoContainer { display: none !important; }
.e3d-viewer .cesium-widget, .e3d-viewer .cesium-widget canvas { width: 100%; height: 100%; display: block; }

/* Google Maps attribution on the canvas, bottom-left (Map Tiles policy):
   official outlined logo + live per-tile credits on a semi-opaque backing.
   #fff on rgba(6,17,29,.82) over any imagery ≥ 12:1. */
.e3d-gattr {
  position: absolute; left: 10px; bottom: 10px; z-index: 1; max-width: calc(100% - 20px);
  display: none; align-items: center; gap: 10px;
  padding: 5px 10px; border-radius: 8px;
  background: rgba(6, 17, 29, 0.82); color: #fff;
  font-size: 12px; line-height: 1.3;
}
.e3d[data-state="loading-2"] .e3d-gattr,
.e3d[data-state="view"] .e3d-gattr { display: flex; }
.e3d-gattr { align-items: flex-end; }
.e3d-glogo { flex-shrink: 0; height: 18px; width: auto; margin-bottom: 3px; }
/* Credits wrap to 2 lines (no ellipsis-cut words); full list on expand. */
.e3d-credits-btn {
  min-width: 0; min-height: 44px; margin: -5px 0; padding: 6px 4px;
  display: flex; align-items: center; text-align: left;
  background: none; border: 0; border-radius: 6px; color: #fff; font: inherit; cursor: pointer;
}
.e3d-credits-btn:disabled { cursor: default; }
.e3d-credits-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.e3d-credits-btn:not(:disabled) .e3d-credits { text-decoration: underline dotted; text-underline-offset: 2px; }
.e3d-gattr .e3d-credits {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; color: #fff;
}
.e3d-gattr.is-expanded { max-height: calc(100% - 20px); }
.e3d-gattr.is-expanded .e3d-credits-btn { max-height: 60vh; overflow-y: auto; align-items: flex-start; }
.e3d-gattr.is-expanded .e3d-credits { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
.e3d-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Loading progress: indeterminate (Cesium can't report bytes), step text in .e3d-status. */
.e3d-progress { position: relative; height: 4px; margin-top: 12px; border-radius: 2px; background: var(--bg-3); overflow: hidden; }
.e3d-progress-bar { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 2px; background: var(--accent); animation: e3d-indeterminate 1.4s ease-in-out infinite; }
@keyframes e3d-indeterminate { 0% { left: -35%; } 100% { left: 100%; } }
.e3d-progress-text { margin: 6px 0 0; color: var(--fg-soft); font-size: 12px; }
.e3d-progress-text:empty { display: none; }
.e3d:not([data-state="loading"]):not([data-state="loading-2"]) .e3d-progress,
.e3d:not([data-state="loading"]):not([data-state="loading-2"]) .e3d-progress-text { display: none; }
.e3d[data-state="timeout"] .e3d-backdrop,
.e3d[data-state="error"] .e3d-backdrop,
.e3d[data-state="nocov"] .e3d-backdrop,
.e3d[data-state="cap"] .e3d-backdrop { display: block; }
/* view state still announces "ready" via the hidden-panel status: keep it for SR */
.e3d[data-state="view"] .e3d-panel { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; border: 0; }

.e3d-attr {
  display: flex; align-items: center; gap: 16px; min-height: 44px;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: var(--bg); border-top: 1px solid var(--line);
  font-size: 12px; color: var(--fg-soft);
}
/* Data sources (Google attribution) is visible at every width and state. */
.e3d-sources-btn { display: inline-flex; align-items: center; margin-left: auto; flex-shrink: 0; }

.e3d-sources {
  position: absolute; left: 12px; right: 12px; bottom: 64px; z-index: 2;
  padding: 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2);
}
.e3d-sources[hidden] { display: none; }
.e3d-sources-title { margin: 0 0 6px; font-weight: 600; }
.e3d-credits-full { margin: 0 0 12px; color: var(--fg-soft); font-size: 14px; }

@media (max-width: 720px) {
  .e3d-title { font-size: 18px; }
  .e3d-actions .e3d-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .e3d-skeleton { animation: none; background: var(--bg-3); }
  .e3d-progress-bar { animation: none; left: 0; width: 100%; opacity: 0.5; }
  .e3d, .e3d *, .e3d *::before, .e3d *::after, .explore3d-btn {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}

/* Phones: 4 pills don't fit one row at 390px — give Explore in 3D its own full-width row. */
@media (max-width: 720px) {
  .attractions-grid-hero .attraction-footer:has(.explore3d-btn) { flex-wrap: wrap; }
  .attraction-footer .explore3d-btn { flex: 1 1 100%; order: 10; }
}
