/* ══════════════════════════════════════════════════════════════════
   VIEWER OVERRIDES
   Standalone Detail-Scene viewer — strips everything except the 3D
   scene and the right-side tools (Tags · Measures · Transparency ·
   Animation). Loaded AFTER app.css so these rules win.
   ══════════════════════════════════════════════════════════════════ */

/* No top bar → reclaim its height so side panels use the full viewport */
:root { --topbar-h: 0px; }

/* ══════════════════════════════════════════════════════════════════
   VIEWER SIDEBAR  — toolbar + part list in one shared container
   ══════════════════════════════════════════════════════════════════ */
#viewer-sidebar {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 300;
  display: flex;
  flex-direction: row;
  align-items: flex-start;           /* toolbar keeps its natural height */
  /* NO overflow:hidden — would clip tooltips */
  /* box-shadow is on children individually   */
}

/* ── Toolbar: static child of sidebar ───────────────────────────── */
#right-toolbar {
  position: static !important;
  right: auto !important;
  left:  auto !important;
  top:   auto !important;
  transform: none !important;
  z-index: auto !important;

  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 8px 4px !important;
  background: rgba(14, 15, 18, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55) !important;
  overflow: visible !important;   /* tooltips must not be clipped */
  max-height: calc(100vh - 120px);
}

/* rt-group inside sidebar: no background of its own, just spacing */
#right-toolbar .rt-group {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 4px 0 !important;
  gap: 2px !important;
}

/* Divider between groups */
#right-toolbar .rt-group + .rt-group {
  border-top: 1px solid rgba(255,255,255,0.07) !important;
  margin-top: 4px !important;
  padding-top: 8px !important;
}

/* ── Button size +10% ─────────────────────────────────────────── */
.rt-btn {
  width:  51px !important;
  height: 51px !important;
}
.tb-icon-img {
  width:  26px !important;
  height: 26px !important;
}

/* ── Tooltips: to the right ──────────────────────────────────── */
.rt-tip {
  right: auto !important;
  left: calc(100% + 8px) !important;
  transform: translateY(-50%) translateX(-4px) !important;
}
.rt-btn:hover .rt-tip {
  transform: translateY(-50%) translateX(0) !important;
}

/* ══════════════════════════════════════════════════════════════════
   PART LIST  — sibling of toolbar inside #viewer-sidebar
   Height is set via JS to match toolbar height.
   ══════════════════════════════════════════════════════════════════ */
.partlist-panel {
  position: static !important;
  left: auto !important;
  top:  auto !important;
  transform: none !important;

  width: 260px;
  /* height set by JS — matches toolbar clientHeight */
  display: flex;
  flex-direction: column;
  background: rgba(14, 15, 18, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55);
  margin-left: 8px;
  overflow: hidden;

  transition: width 0.28s ease, opacity 0.28s ease, margin-left 0.28s ease;
}

.partlist-panel.hidden {
  width: 0;
  opacity: 0;
  pointer-events: none;
  margin-left: 0;
  transform: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   VIEWER TOP BANNER
   ══════════════════════════════════════════════════════════════════ */
#viewer-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 68px;
  pointer-events: auto;
  /* no background — transparent over canvas */
}

.vtb-left,
.vtb-right {
  flex: 0 0 160px;
  display: flex;
  align-items: center;
}

.vtb-right { justify-content: flex-end; }

.vtb-logo-sigler {
  height: 40px;   /* +10% de 36px */
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5));
}

.vtb-logo-carrier {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5));
}

.vtb-nav {
  display: flex;
  align-items: center;
  gap: 36px;
  flex: 1;
  justify-content: center;
}

.vtb-link {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s;
  position: relative;
}

.vtb-link:hover,
.vtb-link.active {
  color: #fff;
}

.vtb-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: #2563eb;
  border-radius: 2px;
}

/* Hamburger — hidden on desktop, shown on mobile */
#vtb-hamburger {
  display: none;
  background: rgba(14, 15, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 10px;
  transition: background 0.15s;
}
#vtb-hamburger.active,
#vtb-hamburger:hover { background: #2563eb; }

/* Product badge */
#viewer-badge {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 390;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 28px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.40);
}

/* Back button — top-left, below banner */
#viewer-back-btn {
  position: fixed;
  top: 80px;
  left: 80px;
  z-index: 395;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px 9px 14px;
  background: rgba(14, 15, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, opacity 0.25s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
#viewer-back-btn:hover {
  background: #2563eb;
  color: #fff;
  transform: translateX(-2px);
}
#viewer-back-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

/* Bottom CTA */
#viewer-cta {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 390;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.70);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  line-height: 1.4;
  animation: ctaBounce 2s ease-in-out infinite;
}

#viewer-cta strong {
  color: #fff;
  font-weight: 600;
}

.vtb-cta-arrow {
  opacity: 0.80;
}

@keyframes ctaBounce {
  0%, 100% { transform: translateX(-50%) translateY(0);   }
  50%       { transform: translateX(-50%) translateY(5px); }
}

/* ══════════════════════════════════════════════════════════════════
   INFO PANEL — right side descriptive card
   ══════════════════════════════════════════════════════════════════ */
/* Right-side shared column — Part Info stacks above Overview, never overlap */
#viewer-info-stack {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 290;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  max-height: calc(100vh - 150px);
  pointer-events: none;   /* empty gaps don't block the canvas */
}
#viewer-info-stack > * { pointer-events: auto; }

.info-panel {
  /* now a flex child of #viewer-info-stack */
  position: static;
  width: clamp(260px, 28vw, 380px);
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(16, 17, 20, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  padding: 28px 30px 30px;
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.info-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
}

/* Image card above the overview (Sensors → SmartVu interface) */
.info-image-card {
  width: clamp(260px, 28vw, 380px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(16, 17, 20, 0.82);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.info-image-card img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.info-image-card.hidden {
  display: none;
}

/* Fullscreen image lightbox */
#img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: imgLbFade 0.2s ease;
}
#img-lightbox.hidden { display: none; }
#img-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.7);
}
@keyframes imgLbFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.info-panel-close {
  /* inline — nunca absoluto, así no se superpone */
  position: static;
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.14s, background 0.14s;
}
.info-panel-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.info-panel-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  border-right: 5px solid #2563eb;
  padding-right: 6px;
  display: inline-block;
  white-space: nowrap;   /* evita que el título rompa línea en modo pastilla */
}

.info-panel-body {
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  max-height: 600px;
  opacity: 1;
}

/* Minimized — pastilla en la parte inferior con solo el título */
.info-panel.minimized .info-panel-body {
  display: none !important;
}

.info-panel.minimized .info-panel-header {
  margin-bottom: 0 !important;
}

.info-panel.minimized {
  /* stays in the flex column (below Part Info) → never overlaps it.
     align-self keeps it right-aligned, shrunk to a pill. */
  align-self: flex-end;
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  max-height: none !important;
  padding: 12px 18px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  flex-direction: column !important;
}

/* ══════════════════════════════════════════════════════════════════
   PART INFO PANEL — descripción de la parte seleccionada (bottom-right)
   ══════════════════════════════════════════════════════════════════ */
.part-info-panel {
  /* flex child of #viewer-info-stack — stacks ABOVE the overview */
  position: static;
  width: clamp(260px, 26vw, 360px);
  max-height: 42vh;
  overflow-y: auto;
  background: rgba(16, 17, 20, 0.90);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  /* thin project-blue border to draw attention */
  border: 1px solid #2563eb;
  border-radius: 16px;
  padding: 20px 24px 22px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55),
              0 0 0 1px rgba(37, 99, 235, 0.25),
              0 6px 28px rgba(37, 99, 235, 0.22);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.part-info-panel.hidden {
  /* collapse out of the flex flow so it doesn't reserve space */
  display: none;
}

.part-info-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #fff;
  letter-spacing: -0.01em;
}

.part-info-body {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.part-info-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.74);
}
.part-info-body:empty { display: none; }

.part-info-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.part-info-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.74);
}

.part-info-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2563eb;
}

/* Download PDF button */
.part-info-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(37, 99, 235, 0.55);
  color: #8fc0ff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.part-info-pdf:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  transform: translateY(-1px);
}
.part-info-pdf.hidden { display: none; }
.part-info-pdf svg { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════
   PART LIST PANEL
   ══════════════════════════════════════════════════════════════════ */
.partlist-panel {
  position: fixed;
  left: 70px;          /* just right of the toolbar (46px btn + 12px margin + gap) */
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: rgba(16, 17, 20, 0.90);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  overflow: hidden;
  z-index: 290;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.partlist-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-10px);
}

/* ── Header ── */
.pl-header {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  min-height: 46px;
}

.pl-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.pl-tab {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.40);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 14px 10px;
  white-space: nowrap;
  transition: color 0.14s;
  position: relative;
}

.pl-tab.active {
  color: #fff;
}

.pl-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: #2563eb;
  border-radius: 2px 2px 0 0;
}

.pl-tab:hover:not(.active) {
  color: rgba(255, 255, 255, 0.70);
}

/* ── "In Showcase" toggle ──────────────────────────────────────── */
.pl-showcase-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.pl-toggle-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  transition: color 0.15s;
}

.pl-showcase-toggle input { display: none; }

.pl-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.18s ease;
  flex-shrink: 0;
}

.pl-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.pl-showcase-toggle input:checked ~ .pl-toggle-track {
  background: #2563eb;
}
.pl-showcase-toggle input:checked ~ .pl-toggle-track .pl-toggle-thumb {
  transform: translateX(16px);
}
.pl-showcase-toggle input:checked ~ .pl-toggle-label,
.pl-showcase-toggle:hover .pl-toggle-label {
  color: #fff;
}

/* ── List ── */
.pl-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.pl-list::-webkit-scrollbar { width: 4px; }
.pl-list::-webkit-scrollbar-track { background: transparent; }
.pl-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.pl-item {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  user-select: none;
  gap: 10px;
}

.pl-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.pl-item.active {
  border-left-color: #2563eb;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.pl-empty {
  padding: 20px 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* ══════════════════════════════════════════════════════════════════
   CLICKABLE TAGS — hover enlarges, click selects the part
   ══════════════════════════════════════════════════════════════════ */
.tag-label.tag-clickable {
  pointer-events: auto;       /* override app.css (none) so tags receive clicks */
  cursor: pointer;
  transform: scale(1.15);     /* base +15% */
  transition: transform 0.16s ease, border-color 0.16s ease,
              background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  transform-origin: center bottom;
}

.tag-label.tag-clickable:hover {
  transform: scale(1.3225);   /* +15% sobre el +15% base (1.15 × 1.15) */
  border-color: rgba(79, 195, 247, 0.95);
  background: rgba(8, 14, 26, 0.97);
  color: #fff;
  box-shadow: 0 4px 16px rgba(22, 131, 255, 0.35);
  z-index: 10;
}

/* ══════════════════════════════════════════════════════════════════
   SENSORS — top legend + animated signal markers
   ══════════════════════════════════════════════════════════════════ */
#sensors-legend {
  position: fixed;
  top: 122px;          /* below the product badge so they don't overlap */
  left: 0;
  right: 0;
  z-index: 360;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 34px;
  padding: 6px 24px;
  pointer-events: none;   /* only items are clickable */
  flex-wrap: wrap;
}
#sensors-legend.hidden { display: none; }

#sensors-legend .sl-title {
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
  margin-right: 8px;
  white-space: nowrap;
}

.sl-item {
  pointer-events: auto;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 2px 4px;
  transition: opacity 0.15s;
}

.sl-item .sl-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  line-height: 1.25;
  max-width: 120px;
}

.sl-item .sl-bar {
  width: 100%;
  min-width: 90px;
  height: 4px;
  border-radius: 2px;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

.sl-item.off { opacity: 0.32; }
.sl-item.off .sl-bar { box-shadow: none; filter: grayscale(0.4); }
.sl-item:hover { opacity: 0.85; }

/* ── Sensor signal marker (CSS2D) ── */
.sensor-marker {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
  color: var(--c);
}

.sensor-marker .sensor-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px var(--c);
  pointer-events: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

/* Marker "hot" state — triggered by hovering its corresponding tag */
.sensor-marker.sensor-hot .sensor-dot {
  transform: scale(1.7);
  box-shadow: 0 0 18px var(--c), 0 0 5px #fff;
}
.sensor-marker.sensor-hot .sensor-wave {
  animation-duration: 1.0s;
}

/* ── Sensor tag: pill lives on the inner wrapper so it can be nudged (repel) ── */
.tag-label.tag-sensor {
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.tag-label.tag-sensor::after { display: none !important; }   /* marker dot already marks the point */
.tag-label.tag-sensor .tag-inner {
  display: inline-block;
  padding: 4px 11px;
  background: rgba(5, 8, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
  pointer-events: auto;        /* hoverable (no click) to light up its sensor */
  cursor: default;
  transition: transform 0.2s ease;   /* smooth declutter nudge */
}

.sensor-marker .sensor-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--c);
  opacity: 0;
  animation: sensorWave 2.4s ease-out infinite;
}
.sensor-marker .sensor-wave:nth-child(2) { animation-delay: 1.2s; }

@keyframes sensorWave {
  0%   { transform: scale(1);   opacity: 0.75; }
  80%  { transform: scale(4.5); opacity: 0;    }
  100% { transform: scale(4.5); opacity: 0;    }
}

/* ══════════════════════════════════════════════════════════════════
   CLOUD ICON — floating cloud / world-web badge over the "Cloud" object
   ══════════════════════════════════════════════════════════════════ */
/* Root element — positioned by CSS2DRenderer (transform reserved for it) */
.cloud-icon {
  pointer-events: none;
  user-select: none;
}

/* Inner wrapper — carries all visuals + the float animation */
.cloud-icon-inner {
  position: relative;
  width: 81px;
  height: 81px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #6fe9ff;
  background: radial-gradient(circle at 50% 45%,
              rgba(12, 28, 52, 0.92) 0%, rgba(8, 16, 30, 0.78) 70%);
  border: 2px solid rgba(0, 209, 255, 0.55);
  box-shadow: 0 0 27px rgba(0, 200, 255, 0.45),
              inset 0 0 18px rgba(0, 200, 255, 0.18);
  animation: cloudFloat 3.2s ease-in-out infinite;
}

.cloud-icon-inner svg {
  width: 51px;
  height: 51px;
  filter: drop-shadow(0 0 6px rgba(0, 220, 255, 0.6));
  position: relative;
  z-index: 1;
}

/* expanding signal ping ring */
.cloud-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 209, 255, 0.7);
  animation: cloudPing 2.4s ease-out infinite;
}

@keyframes cloudFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

@keyframes cloudPing {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(1.8); opacity: 0;   }
  100% { transform: scale(1.8); opacity: 0;   }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — phones & tablets (≤ 820px)
   Text boxes collapse to compact title chips; tap to expand.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {

  /* ── Top banner: shrink, nav becomes a hamburger dropdown ── */
  #viewer-topbar { height: 52px; padding: 0 14px; }
  .vtb-left, .vtb-right { flex: 0 0 auto; }
  .vtb-logo-sigler  { height: 28px; }
  .vtb-logo-carrier { height: 30px; }

  #vtb-hamburger { display: flex; }

  /* Nav → dropdown panel toggled by the hamburger */
  .vtb-nav {
    display: none;
    position: fixed;
    top: 56px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    background: rgba(14, 15, 18, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 401;
  }
  .vtb-nav.open { display: flex; }
  .vtb-nav .vtb-link { padding: 9px 20px; font-size: 14px; }
  .vtb-nav .vtb-link.active::after { display: none; }

  /* ── Product badge ── */
  #viewer-badge {
    top: 58px;
    font-size: 11px;
    padding: 6px 16px;
    max-width: 86vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Sidebar toolbar: smaller buttons ── */
  #viewer-sidebar { left: 8px; }
  .rt-btn      { width: 42px !important; height: 42px !important; }
  .tb-icon-img { width: 22px !important; height: 22px !important; }
  .partlist-panel { width: 200px; }

  /* ── Sensors legend: scrollable strip ── */
  #sensors-legend {
    top: 92px;
    gap: 14px;
    padding: 6px 10px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  #sensors-legend .sl-title { display: none; }
  .sl-item .sl-label { font-size: 10.5px; max-width: 90px; }
  .sl-item .sl-bar   { min-width: 70px; }

  /* ── Bottom CTA: keep, but compact + centered ── */
  #viewer-cta { bottom: 14px; font-size: 11px; }
  #viewer-cta .vtb-cta-arrow svg { width: 18px; height: 18px; }

  /* ── Image card: hidden on mobile (still openable via lightbox if expanded) ── */
  .info-image-card { display: none !important; }

  /* ══ Info stack → bottom-right, panels collapse to chips ══ */
  #viewer-info-stack {
    top: auto;
    bottom: 52px;          /* clear the bottom CTA */
    right: 12px;
    left: auto;
    transform: none;
    align-items: flex-end;
    gap: 10px;
    max-height: 78vh;
  }

  /* Collapsed chip — Overview */
  .viewer-mobile .info-panel {
    width: auto;
    max-width: 72vw;
    max-height: none;
    padding: 10px 16px;
    border-radius: 999px;
    overflow: visible;
    cursor: pointer;
  }
  .viewer-mobile .info-panel-header { margin-bottom: 0; }
  .viewer-mobile .info-panel-title  { font-size: 16px; border-right-width: 4px; }
  .viewer-mobile .info-panel-close  { display: none; }   /* tap the chip instead */
  .viewer-mobile .info-panel .info-panel-body { display: none; }

  /* Expanded — Overview */
  .viewer-mobile .info-panel.mobile-open {
    width: 88vw;
    max-width: 380px;
    max-height: 62vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 20px 22px 22px;
  }
  .viewer-mobile .info-panel.mobile-open .info-panel-header { margin-bottom: 14px; }
  .viewer-mobile .info-panel.mobile-open .info-panel-body   { display: block; }

  /* Collapsed chip — Part Info */
  .viewer-mobile .part-info-panel {
    width: auto;
    max-width: 72vw;
    max-height: none;
    padding: 10px 16px;
    border-radius: 999px;
    overflow: visible;
    cursor: pointer;
  }
  .viewer-mobile .part-info-title { margin: 0; font-size: 15px; }
  .viewer-mobile .part-info-panel .part-info-body,
  .viewer-mobile .part-info-panel .part-info-list,
  .viewer-mobile .part-info-panel .part-info-pdf { display: none; }

  /* Expanded — Part Info */
  .viewer-mobile .part-info-panel.mobile-open {
    width: 88vw;
    max-width: 360px;
    max-height: 62vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 18px 20px 20px;
  }
  .viewer-mobile .part-info-panel.mobile-open .part-info-title { margin-bottom: 12px; }
  .viewer-mobile .part-info-panel.mobile-open .part-info-body  { display: block; }
  .viewer-mobile .part-info-panel.mobile-open .part-info-list  { display: flex; }
  .viewer-mobile .part-info-panel.mobile-open .part-info-pdf:not(.hidden) { display: inline-flex; }

  /* A small "tap" affordance caret on collapsed chips */
  .viewer-mobile .info-panel:not(.mobile-open) .info-panel-title::after,
  .viewer-mobile .part-info-panel:not(.mobile-open) .part-info-title::after {
    content: ' ⌃';
    opacity: 0.6;
    font-size: 0.8em;
  }
}

/* ══════════════════════════════════════════════════════════════════
   SCROLL LANDING INTEGRATION — 3D hero + scroll-down sections
   ══════════════════════════════════════════════════════════════════ */
/* Allow the page to scroll (app.css locks it for the fullscreen viewer) */
html, body { overflow: visible !important; height: auto !important; }
body { min-height: 100vh; }

/* Canvas stays as the fixed hero background */
#canvas-wrapper { z-index: 0 !important; }

/* Hexagon texture behind the transparent 3D canvas (over the dark page bg).
   The PNG had a white background — it was keyed to transparency (hex-pattern.png)
   so only the coloured hex lines show over the dark viewer. */
#hex-bg {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 20vw;                 /* only the left ~20% of the background */
  z-index: -1;                 /* behind the canvas (z:0), above the body gradient */
  background: url('../images/hex-pattern.png') repeat;
  background-size: 650px auto;
  opacity: 0.5;
  pointer-events: none;
  /* Soft fade across the whole strip so it has no hard cut */
  -webkit-mask-image: linear-gradient(to right, #000 0%, transparent 100%);
          mask-image: linear-gradient(to right, #000 0%, transparent 100%);
}

/* Sections scroll above the canvas.
   The wrapper is click-through so the 3D canvas stays interactive on the hero;
   only the actual section content captures pointer events. */
#landing-sections { position: relative; z-index: 5; pointer-events: none; }
#landing-sections > section { pointer-events: auto; }
/* NOTE: the VAV modal (.sv-modal) is fixed/full-screen — it must keep its own
   pointer-events (none when closed, auto via .is-open) so it never blocks the
   3D canvas. Do NOT force pointer-events on it here. */
#hero-spacer { height: 100vh; pointer-events: none; }

/* Perf optimisations:
   • Hide the fixed WebGL canvas once fully into the sections so the GPU isn't
     re-compositing a full-screen canvas behind opaque content while scrolling.
   • Promote animated section elements to their own layer to avoid first-paint jank. */
body.past-hero #canvas-wrapper { visibility: hidden; }
#landing-sections [data-reveal] { will-change: transform, opacity; }

/* CTA is now an anchor → make it clickable */
#viewer-cta { pointer-events: auto !important; cursor: pointer; text-decoration: none; }

/* Banner gains a solid backdrop once scrolled past the hero */
body.past-hero #viewer-topbar {
  background: rgba(6, 14, 28, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Hide the 3D viewer chrome while browsing the scroll sections */
#viewer-sidebar, #viewer-info-stack, #viewer-cta,
#sensors-legend, #viewer-badge, #viewer-back-btn {
  transition: opacity 0.3s ease;
}
body.past-hero #viewer-sidebar,
body.past-hero #viewer-info-stack,
body.past-hero #viewer-cta,
body.past-hero #sensors-legend,
body.past-hero #viewer-badge,
body.past-hero #viewer-back-btn {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   HERO INTRO STATE — AquaForce headline + "Move equipment to Interact"
   Shown on load; hidden once the user clicks the equipment (body loses
   .viewer-intro), which also reveals the full viewer interface.
   ══════════════════════════════════════════════════════════════════ */
#viewer-hero {
  position: fixed;
  left: 5.5vw;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  max-width: 46vw;
  pointer-events: none;
  color: #fff;
  font-family: 'Poppins', 'Inter', sans-serif;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.vh-title {
  font-size: clamp(2rem, 4.6vw, 4.3rem);
  font-weight: 500;   /* Poppins Medium */
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}
.vh-title sup { font-size: 0.38em; top: -0.7em; }
.vh-accent { color: #2B9ED4; }
.vh-sub {
  margin-top: 20px;
  font-size: clamp(0.9rem, 1.15vw, 1.15rem);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  max-width: 34ch;
}

/* ── Interaction hotspot (pulsing ring over the equipment) ── */
#viewer-hotspot {
  position: fixed;
  left: 78%;
  top: 72%;
  transform: translate(-50%, -50%);
  z-index: 30;
  width: 74px;
  height: 74px;
  display: none;
  cursor: pointer;
}
#viewer-hotspot .vh-core {
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: #2B9ED4;
  box-shadow: 0 0 12px rgba(43, 158, 212, 0.8);
}
#viewer-hotspot .vh-ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 74px; height: 74px;
  margin: -37px 0 0 -37px;
  border-radius: 50%;
  border: 2px solid rgba(43, 158, 212, 0.7);
  transform: scale(0.2);
  opacity: 0;
  animation: vh-ping 2.2s ease-out infinite;
}
#viewer-hotspot .vh-ring:nth-of-type(2) { animation-delay: 1.1s; }
@keyframes vh-ping {
  0%   { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(1);   opacity: 0;   }
}
#viewer-hotspot .vh-hint {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  padding: 14px 34px;
  border-radius: 40px;
  background: rgba(18, 24, 34, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
}

/* "Back to intro" button — only while interacting on the hero (not during the
   intro itself, and not once scrolled into the sections). */
#viewer-home-btn {
  position: fixed;
  top: 74px;
  left: 22px;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  border-radius: 30px;
  background: rgba(18, 24, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
#viewer-home-btn:hover {
  background: rgba(34, 44, 60, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}
body:not(.viewer-intro):not(.past-hero) #viewer-home-btn { display: inline-flex; }

/* Intro ON → show hero text + hotspot. "Click to see" (#viewer-cta) stays
   visible from the start, so it is NOT hidden here. */
body.viewer-intro #viewer-hero    { opacity: 1; visibility: visible; }
body.viewer-intro #viewer-hotspot { display: block; }

/* Intro ON → hide the interactive chrome (revealed after the click) */
body.viewer-intro #viewer-sidebar,
body.viewer-intro #viewer-info-stack,
body.viewer-intro #viewer-badge,
body.viewer-intro #sensors-legend {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Scrolled past the hero → hide the intro overlay so it never covers sections */
body.past-hero #viewer-hero,
body.past-hero #viewer-hotspot {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
