:root {
  --ink: #f3f5f8;
  --ink-dim: #b9c0cc;
  --glass: rgba(18, 22, 30, 0.72);
  --glass-strong: rgba(18, 22, 30, 0.9);
  --accent: #3b8cff;
  --accent-ink: #fff;
  --radius: 10px;
  --gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #14171c; color: var(--ink); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.landing { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 16px;
           background: #f4f5f7; color: #1d2330; }
.landing a { color: #1f5fbf; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* Panorama */
.pano, .pano canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pano canvas { display: block; cursor: grab; touch-action: none; outline: none; }
.pano canvas.dragging { cursor: grabbing; }
.pano-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
               padding: 8px 14px; border-radius: var(--radius); background: var(--glass); pointer-events: none; }

/* Hotspots: positioned by transform from hotspots.js, centred on the point */
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; padding: 0; border: 0;
           background: none; pointer-events: auto; cursor: pointer; }
.hotspot-ring { position: absolute; inset: 0; border-radius: 50%;
                border: 3px solid #fff; background: rgba(59, 140, 255, 0.55);
                box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); transition: transform 0.15s; }
.hotspot-ring svg { width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 3;
                    stroke-linecap: round; stroke-linejoin: round; }
.hotspot-oneoff .hotspot-ring { inset: 11px; background: rgba(255, 179, 0, 0.85); }
.hotspot:hover .hotspot-ring, .hotspot:focus-visible .hotspot-ring { transform: scale(1.15); }
.hotspot-label { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); white-space: nowrap;
                 padding: 3px 8px; border-radius: 6px; background: var(--glass); font-size: 13px;
                 opacity: 0; transition: opacity 0.15s; }
.hotspot:hover .hotspot-label, .hotspot:focus-visible .hotspot-label { opacity: 1; }

/* Item markers (panels, controls, POIs, close-ups, documents) */
.hotspot-item { left: -17px; top: -17px; width: 34px; height: 34px; }
.hotspot-item .hotspot-ring { border-width: 2px; padding: 6px; }
.hotspot-item .hotspot-label { top: 40px; }
.hotspot-item .hotspot-ring svg { stroke-width: 2; }
.item-panel .hotspot-ring { background: rgba(229, 72, 77, 0.85); }
.item-controls .hotspot-ring { background: rgba(132, 94, 247, 0.85); }
.item-poi .hotspot-ring { background: rgba(18, 184, 134, 0.85); }
.item-closeup .hotspot-ring { background: rgba(30, 30, 36, 0.8); }
.item-document .hotspot-ring { background: rgba(250, 82, 160, 0.85); }

/* Item card */
.item-card { position: absolute; top: max(var(--gap), env(safe-area-inset-top)); right: var(--gap);
             bottom: calc(max(var(--gap), env(safe-area-inset-bottom)) + 64px); width: min(380px, calc(100% - 2 * var(--gap)));
             overflow-y: auto; z-index: 6; border-radius: var(--radius); background: #1b1f27;
             box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); font-size: 14px; }
.card-head { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
             padding: 12px 14px; background: #1b1f27; border-bottom: 1px solid #2c323e; }
.card-kind { grid-column: 1; font-size: 12px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.card-title { grid-column: 1; margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.card-close { grid-column: 2; grid-row: 1 / 3; align-self: start; width: 32px; height: 32px; border: 0;
              border-radius: 6px; background: #262b35; cursor: pointer; }
.card-body { padding: 12px 14px; }
.card-section { margin-top: 14px; }
.card-section h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-dim);
                   text-transform: uppercase; letter-spacing: 0.04em; }
.card-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.card-photo-large { grid-template-columns: 1fr; }
.card-thumb { padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #11141a; cursor: zoom-in;
              aspect-ratio: 4 / 3; }
.card-photo-large .card-thumb, .card-arcflash .card-thumb { aspect-ratio: auto; }
.card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-photo-large .card-thumb img, .card-arcflash .card-thumb img { height: auto; object-fit: contain; }
.card-thumb.missing { cursor: default; min-height: 60px; outline: 1px dashed #4a5160; }
.card-thumb.missing img { visibility: hidden; }
.card-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0 0; }
.card-facts dt { color: var(--ink-dim); }
.card-facts dd { margin: 0; }
.card-text { margin: 0; white-space: pre-wrap; }
.card-list, .card-docs { margin: 0; padding-left: 18px; }
.card-docs a, .card-open { color: #8ab8ff; overflow-wrap: anywhere; }
.card-open { display: inline-block; margin-top: 10px; padding: 8px 14px; border-radius: 6px; background: var(--accent);
             color: var(--accent-ink); text-decoration: none; }
.card-empty { margin: 0; color: var(--ink-dim); }
.card-schedule { width: 100%; border-collapse: collapse; font-size: 13px; }
.card-schedule th, .card-schedule td { padding: 3px 6px; border-bottom: 1px solid #2c323e; text-align: left; }
.card-schedule th { color: var(--ink-dim); font-weight: 600; }

/* Photo lightbox */
.lightbox { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0, 0, 0, 0.9); }
.lightbox img { max-width: 94vw; max-height: 88vh; }
.lightbox button { position: absolute; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 26px;
                   line-height: 1; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; }
.lightbox-close { top: 14px; right: 14px; font-size: 20px !important; }
.lightbox-prev { left: 14px; top: 50%; }
.lightbox-next { right: 14px; top: 50%; }
.lightbox.single .lightbox-prev, .lightbox.single .lightbox-next { display: none; }
.lightbox-caption { position: absolute; bottom: 14px; color: #ccc; font-size: 13px; }

/* Top bar */
.topbar { position: absolute; top: max(var(--gap), env(safe-area-inset-top)); left: var(--gap);
          max-width: calc(100% - 2 * var(--gap)); padding: 8px 14px; border-radius: var(--radius);
          background: var(--glass); pointer-events: none; }
.project-logo { display: block; max-height: 36px; max-width: 160px; margin-bottom: 6px; border-radius: 4px;
                background: #fff; padding: 2px 4px; }
.project-name { font-size: 12px; color: var(--ink-dim); letter-spacing: 0.02em; }
.spot-title { margin: 2px 0 0; font-size: 17px; font-weight: 600; }

/* Bottom nav */
.navbar { position: absolute; left: 50%; bottom: max(var(--gap), env(safe-area-inset-bottom)); transform: translateX(-50%);
          display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 999px;
          background: var(--glass); max-width: calc(100% - 2 * var(--gap)); }
.nav-btn, .nav-chip { display: inline-flex; align-items: center; gap: 4px; border: 0; cursor: pointer;
                      border-radius: 999px; padding: 8px 14px; background: transparent; white-space: nowrap; }
.nav-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4;
               stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover:not(:disabled), .nav-chip:hover { background: rgba(255, 255, 255, 0.12); }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.nav-chip { background: var(--accent); color: var(--accent-ink); font-size: 14px;
            max-width: 36vw; overflow: hidden; text-overflow: ellipsis; display: block; }
.nav-chip:hover { background: #2f7ae6; }
.nav-extras { display: flex; gap: 6px; overflow-x: auto; }
.nav-extras:empty { display: none; }

/* Floor plan */
.floorplan { position: absolute; left: var(--gap); bottom: calc(max(var(--gap), env(safe-area-inset-bottom)) + 64px);
             width: min(300px, 40vw); padding: 6px; border-radius: var(--radius); background: var(--glass-strong);
             transition: all 0.2s; }
.floorplan.maximized { left: 50%; top: 50%; bottom: auto; width: auto; transform: translate(-50%, -50%);
                       z-index: 5; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6); }
/* The frame shrink-wraps the image so percentage dots line up with it at
   any size, including when the height limit kicks in. */
.plan-frame { position: relative; width: fit-content; margin: 0 auto; }
.plan-image { display: block; max-width: 100%; max-height: 80vh; border-radius: 6px; background: #fff; }
.plan-dots { position: absolute; inset: 0; }
.plan-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; padding: 0; border-radius: 50%;
            border: 2px solid #fff; background: #4a5568; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.plan-dot:hover { background: var(--accent); }
.plan-dot.current { background: var(--accent); width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
                    box-shadow: 0 0 0 4px rgba(59, 140, 255, 0.35); }
.maximized .plan-image { max-width: min(92vw - 12px, 1400px); }
.maximized .plan-dot { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.plan-toggle { position: absolute; top: 10px; right: 10px; z-index: 1; width: 30px; height: 30px; padding: 5px;
               border: 0; border-radius: 6px; background: var(--glass); cursor: pointer; }
.plan-toggle svg { width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 2; }

#version { position: fixed; right: 10px; bottom: 8px; font-size: 12px; color: #7a8190; pointer-events: none; }

@media (max-width: 600px) {
  .spot-title { font-size: 15px; }
  .nav-btn span { display: none; }
  .floorplan { width: 52vw; }
  #version { top: 4px; bottom: auto; }
  .item-card { top: auto; left: 0; right: 0; width: auto; max-height: 60vh; bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
}
