/* ═══════════════════════════════════════════════════════════════════════
   scene-viewer.css — styles for the VVScene reusable image component.

   ONE component, four image backends (flat / 180 / 360 / spherical), five
   layered behaviours (nav · poi · note · compass · popup). Each sales page
   wraps it with its own chrome; this file styles only the component's own
   surface: the markers, the compass, the popup lightbox, the authoring UI.

   Brand-agnostic by design — it consumes PROJECT tokens with fallbacks so it
   themes itself to whatever `[data-project]` it is mounted under:
     --proj-accent          marker ink / pale stone
     --font-project         label type (the client-uploaded UI font)
     --font-project-display caption / title display type
   When mounted bare (no project), the fallbacks keep it legible.

   Requires: pannellum.css (pano backends) + _brand-aa6.js (POI dot fields).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Host ─────────────────────────────────────────────────────────────── */
.vv-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0c1a10;                 /* deep fallback while media loads */
  --vv-ink: var(--proj-accent, #f5f0e8);
  --vv-font: var(--font-project, system-ui, sans-serif);
  --vv-font-display: var(--font-project-display, Georgia, serif);
}
.vv-scene__stage { position: absolute; inset: 0; z-index: 0; }

/* THREE.js canvas + the DOM overlay that holds projected markers.
   UI is never drawn in WebGL — markers live here and are positioned each
   frame by projecting their spherical direction to screen coords. */
.vv-three__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; }
.vv-scene__stage.is-grabbing .vv-three__canvas { cursor: grabbing; }
.vv-three__overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.vv-three-mk { position: absolute; top: 0; left: 0; will-change: transform; }
.vv-three__overlay .vv-mk { pointer-events: auto; }

/* ── Flat backend (regular images) ─────────────────────────────────────
   .vv-flat fills the host; .vv-flat__inner is sized by JS to the CONTAINED
   picture rect (letterbox-corrected) and holds both the image and the marker
   layer, so percent-positioned markers track the picture, not the viewport.
   Pan/zoom (v0.2) will transform .vv-flat__inner — img + markers move as one. */
.vv-flat { position: absolute; inset: 0; overflow: hidden; }
.vv-flat.is-pannable { cursor: grab; touch-action: none; }   /* 180 wide strip — drag to pan */
.vv-flat.is-pannable.is-grabbing { cursor: grabbing; }
.vv-flat__inner { position: absolute; will-change: transform; }
.vv-flat__img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.vv-flat__layer { position: absolute; inset: 0; pointer-events: none; }
.vv-flat__layer .vv-mk { position: absolute; pointer-events: auto; }

/* ═══ MARKERS ═════════════════════════════════════════════════════════════
   Shared base. On pano backends the marker is the child of a Pannellum
   hotspot div (positioned for us). On flat it is absolutely positioned in
   .vv-flat__layer. Either way the marker's own transform anchors it. */
.vv-mk {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-family: var(--vv-font);
  -webkit-user-select: none; user-select: none;
}
/* Text always sits ABOVE the icon (Roman's POI rule). */
.vv-mk__label,
.vv-mk__name {
  font-size: 10px; font-weight: 600; line-height: 1;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--vv-ink);
  text-shadow: 0 1px 6px rgba(0,0,0,.85);
  white-space: nowrap; text-align: center;
}
.vv-mk__name small { display: block; font-weight: 400; opacity: .82; margin-top: 2px; }

/* ── ① nav — travel to another image ──────────────────────────────────── */
.vv-mk--nav { transform: translate(-50%, -50%); cursor: pointer; }
.vv-nav-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px 5px 8px;
  background: rgba(245,240,232,.16);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid rgba(245,240,232,.30);
  border-radius: 20px;
  font: 500 11px/1 var(--vv-font);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--vv-ink); white-space: nowrap;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.55));
  transition: background .2s, transform .2s;
}
.vv-nav-chip::before {                 /* chevron disc */
  content: ''; width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: rgba(245,240,232,.28)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4l4 4-4 4' stroke='%23f5f0e8' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center/14px no-repeat;
  border: 1px solid rgba(245,240,232,.55);
}
.vv-mk--nav:hover .vv-nav-chip { background: rgba(245,240,232,.30); transform: translateY(-1px); }

/* ── ② poi — point of interest (pin-housed brand ring) ────────────────── */
.vv-mk--poi { transform: translate(-50%, -100%); cursor: pointer; }
.vv-poi { filter: drop-shadow(0 3px 8px rgba(0,0,0,.45)); display: block; transition: transform .18s ease; }
.vv-poi__house { fill: rgba(245,240,232,.14); stroke: var(--vv-ink); stroke-width: 1.3; transition: fill .18s, stroke-width .18s; }
.vv-poi g circle { fill: var(--vv-ink); }
.vv-mk--poi:hover .vv-poi__house { fill: rgba(245,240,232,.24); }
/* cross-highlight: when the matching map pin is hovered/clicked */
.vv-mk--poi.is-active .vv-poi { transform: scale(1.14); }
.vv-mk--poi.is-active .vv-poi__house { fill: rgba(245,240,232,.40); stroke-width: 2.2; }
.vv-mk--poi.is-active .vv-mk__name { opacity: 1; }

/* ── ③ note — material / description callout ──────────────────────────── */
.vv-mk--note { transform: translate(-50%, -50%); cursor: pointer; align-items: flex-start; }
.vv-note__dot {
  width: 20px; height: 20px; padding: 0; border-radius: 50%; cursor: pointer;
  background: rgba(245,240,232,.20);
  border: 1.5px solid var(--vv-ink);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  transition: background .18s, transform .18s;
}
.vv-note__dot::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--vv-ink); }
.vv-note__dot:hover { background: rgba(245,240,232,.34); transform: scale(1.12); }
.vv-note__card {
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  min-width: 168px; max-width: 240px; padding: 12px 15px;
  background: rgba(18,30,24,.62);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(245,240,232,.18); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.vv-mk--note.is-open .vv-note__card,
.vv-mk--note:hover .vv-note__card { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.vv-note__card h4 { margin: 0 0 4px; font: italic 15px/1.2 var(--vv-font-display); color: #fafaf8; }
.vv-note__card p  { margin: 0; font: 400 11px/1.55 var(--vv-font); color: rgba(250,250,248,.74); }

/* ── ⑤ popup — peek another image (no scene transition) ───────────────── */
.vv-mk--popup { transform: translate(-50%, -50%); cursor: pointer; }
.vv-popup__btn {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; cursor: pointer;
  background: rgba(245,240,232,.18);
  border: 1px solid rgba(245,240,232,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; color: var(--vv-ink);
  transition: background .18s, transform .18s;
}
.vv-popup__btn svg { width: 15px; height: 15px; }
.vv-mk--popup:hover .vv-popup__btn { background: rgba(245,240,232,.32); transform: scale(1.08); }

/* ── ④ compass — cardinal directions drawn IN-SCENE on the horizon ─────
   Each N/E/S/W is a Pannellum hotspot at pitch 0 / its true bearing, so it
   pans naturally with the panorama. The label sits above a short tick that
   meets the horizon point. North is emphasised. */
.vv-cardinal {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transform: translate(-50%, -100%); pointer-events: none; user-select: none;
}
.vv-cardinal__char {
  font: 600 14px/1 var(--vv-font); letter-spacing: .18em; color: var(--vv-ink);
  opacity: .5; text-shadow: 0 1px 6px rgba(0,0,0,.85);
}
.vv-cardinal__tick {
  width: 1px; height: 16px;
  background: linear-gradient(to bottom, var(--vv-ink), transparent); opacity: .45;
}
.vv-cardinal--N .vv-cardinal__char { opacity: 1; font-size: 17px; font-weight: 700; }
.vv-cardinal--N .vv-cardinal__tick { opacity: .7; }

/* ── popup lightbox (one per instance) ────────────────────────────────── */
.vv-lightbox {
  position: absolute; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; padding: 5vmin;
  background: rgba(8,14,10,.78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.vv-lightbox.is-open { display: flex; animation: vv-fade .25s ease; }
.vv-lightbox__frame { position: relative; max-width: 92%; max-height: 88%; }
.vv-lightbox__img { display: block; max-width: 100%; max-height: 82vh; border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.vv-lightbox__cap { margin: 12px 2px 0; font: italic 16px/1.3 var(--vv-font-display); color: #fafaf8; text-align: center; }
.vv-lightbox__close {
  position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; background: rgba(245,240,232,.92); border: none; color: #163029;
  font-size: 20px; line-height: 1; display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
@keyframes vv-fade { from { opacity: 0; } to { opacity: 1; } }

/* ── authoring overlay (place-the-dots tool) ──────────────────────────── */
.vv-scene.is-authoring { cursor: crosshair; }
.vv-author-readout {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  display: none; padding: 7px 14px; border-radius: 18px;
  background: rgba(18,30,24,.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245,240,232,.2);
  font: 500 11px/1 var(--vv-font); letter-spacing: .04em; color: var(--vv-ink);
}
.vv-scene.is-authoring .vv-author-readout { display: block; }

/* ── pan affordance — shown when the scene can be panned/explored ─────── */
.vv-panhint {
  position: absolute; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  z-index: 24; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px 8px 12px; border-radius: 22px;
  background: rgba(18,30,24,.5);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(245,240,232,.18);
  font: 500 10.5px/1 var(--vv-font); letter-spacing: .08em; text-transform: uppercase;
  color: var(--vv-ink); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .45s ease, transform .45s ease;
}
.vv-panhint.is-on { opacity: .92; transform: translate(-50%, 0); }
.vv-panhint__icon { width: 17px; height: 17px; display: block; flex-shrink: 0; }
@keyframes vv-pan-nudge   { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
@keyframes vv-pan-breathe { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.14); opacity: 1; } }
.vv-panhint--h.is-on      .vv-panhint__icon { animation: vv-pan-nudge 1.7s ease-in-out infinite; }
.vv-panhint--around.is-on .vv-panhint__icon { animation: vv-pan-breathe 2s ease-in-out infinite; }

/* Respect reduced motion — kill marker hover lifts + compass tween + hint pulse. */
@media (prefers-reduced-motion: reduce) {
  .vv-mk--nav:hover .vv-nav-chip,
  .vv-note__dot:hover,
  .vv-mk--popup:hover .vv-popup__btn { transform: none; }
  .vv-compass__rose { transition: none; }
  .vv-panhint__icon { animation: none !important; }
}
