:root {
  --blue:   #0073CF;
  --dark:   #003594;
  --red:    #E31837;
  --light:  #E8F4FD;
  --border: #B8D9F2;
  --text:   #1a1a2e;
  --gray:   #F5F5F5;
}
#crosshair, #coords-hud { display: none; }
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { background: #000; overflow: hidden; font-family: 'Segoe UI', Arial, sans-serif; }

/* ── Header / branding ── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 68px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 0 24px;          /* right edge reserved for the square menu button */
  z-index: 300;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
#header img.logo { height: 48px; width: auto; display: block; }

/* ── Header right cluster: language switch + square menu button ── */
#header-right { margin-left: auto; display: flex; align-items: center; gap: 18px; height: 100%; }

/* ── Language switch (globe + EN/ES) — minimal, no chrome ── */
#lang-switch { display: inline-flex; align-items: center; gap: 5px; }
#lang-switch .globe { font-size: 0.95rem; line-height: 1; opacity: 0.6; }
#lang-switch button {
  background: none; border: none; cursor: pointer;
  font-family: 'Segoe UI', Arial, sans-serif; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.03em; color: #9aa7b5; padding: 2px 2px; transition: color 0.15s;
}
#lang-switch button:hover { color: var(--dark); }
#lang-switch button.active { color: var(--blue); }
#lang-switch button + button { border-left: 1px solid #d8e2ea; padding-left: 7px; margin-left: 3px; }

/* ── Header menu: full-height white square with hamburger ── */
#main-menu { position: relative; height: 100%; }
#menu-btn {
  height: 100%; width: 66px;
  background: #fff; border: none; border-left: 1px solid #e6eef5;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; transition: background 0.15s;
}
#menu-btn:hover { background: #f2f7fb; }
#main-menu.open #menu-btn { background: #eaf3fb; }
.menu-bars { display: inline-flex; flex-direction: column; gap: 4px; width: 22px; }
.menu-bars span { display: block; height: 2.5px; background: var(--blue); border-radius: 2px; }
.menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 280px; max-width: 84vw; background: #fff; border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-height: 74vh; overflow-y: auto; overflow-x: hidden;
}
#main-menu.open .menu-dropdown { opacity: 1; transform: translateY(0); pointer-events: auto; }
.menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 12px 16px; font-family: 'Segoe UI', Arial, sans-serif; font-size: 0.88rem;
  color: var(--text); cursor: pointer; border-top: 1px solid #eef2f7; transition: background 0.12s;
}
.menu-item:first-child { border-top: none; }
.menu-item:hover { background: var(--light); color: var(--dark); }

/* ── Pano viewport (Marzipano) ── */
#pano {
  position: fixed;
  top: 68px; left: 0; right: 0; bottom: 0;
  width: auto; height: auto;
  cursor: grab;
}
#pano:active { cursor: grabbing; }
#pano canvas { display: block; }

/* ── Center crosshair ── */
#crosshair {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  margin-top: 34px;                 /* offset for the 68px header */
  font-size: 28px; color: rgba(0,255,0,0.7);
  z-index: 50; pointer-events: none;
  text-shadow: 0 0 4px #000;
  font-family: monospace;
}

/* ── Coordinate HUD (click to read center yaw/pitch) ── */
#coords-hud {
  position: fixed; bottom: 52px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.75); color: #0f0; font: 13px monospace;
  padding: 6px 16px; border-radius: 20px; z-index: 50; pointer-events: none;
}

/* ── HUD hint ── */
.hud {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.52);
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  padding: 6px 18px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  letter-spacing: 0.03em;
}

/* ── Autorotate toggle ── */
#autorotateToggle {
  position: fixed;
  bottom: 18px; right: 18px;
  width: 40px; height: 40px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#autorotateToggle img.icon { width: 18px; height: 18px; }
#autorotateToggle .icon.on  { display: none; }
#autorotateToggle .icon.off { display: block; }
#autorotateToggle.enabled .icon.on  { display: block; }
#autorotateToggle.enabled .icon.off { display: none; }

/* ── About Chevron contact button + popover (bottom-left) ── */
#about-chevron { position: fixed; bottom: 18px; left: 18px; z-index: 350; }
#ac-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--blue); color: #fff; border: none;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 9px 15px; border-radius: 22px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
  transition: background 0.15s;
}
#ac-btn:hover { background: var(--dark); }
#ac-btn .ac-i {
  font-style: normal; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem;
}
.ac-pop {
  position: absolute; bottom: calc(100% + 10px); left: 0;
  width: 260px; max-width: 78vw; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 44px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
#about-chevron.open .ac-pop { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ac-pop-head { background: var(--blue); color: #fff; font-size: 0.82rem; font-weight: 700; padding: 11px 16px; letter-spacing: 0.02em; }
.ac-row { padding: 11px 16px; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid #eef2f7; }
.ac-row:first-of-type { border-top: none; }
.ac-label { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #7a8699; margin-bottom: 2px; }
.ac-row a { color: var(--blue); font-size: 0.9rem; font-weight: 600; text-decoration: none; word-break: break-word; }
.ac-row a:hover { text-decoration: underline; }
.ac-emergency { background: #fff5f5; }
.ac-emergency .ac-label, .ac-emergency a { color: var(--red); }

/* ── Hotspot bubbles (Marzipano-positioned) ── */
.hs-bubble {
  /* Per-hotspot color (set inline from JS). Defaults to Chevron blue.
     --hs-rgb is the same color as "r,g,b" so the pulse ring can fade its alpha. */
  --hs-color: #0073CF;
  --hs-rgb: 0,115,207;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--hs-color);
  border: 3px solid rgba(255,255,255,0.75);
  color: #fff;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 20px;
  font-weight: 700;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  margin-left: -28px; margin-top: -28px;   /* center on anchor point */
  animation: hs-pulse 2.8s ease infinite;
}
/* Custom marker image: white glyph centered on the colored circle (keeps the
   white ring + pulse). Sized under 100% so there's padding around the icon. */
.hs-bubble.has-image {
  background-size: 52% auto;
  background-position: center;
  background-repeat: no-repeat;
  text-indent: -9999px;   /* hide any fallback text */
}
@keyframes hs-pulse {
  0%,100% { box-shadow: 0 0 0 0    rgba(var(--hs-rgb),0.7), 0 3px 10px rgba(0,0,0,0.35); }
  55%     { box-shadow: 0 0 0 14px rgba(var(--hs-rgb),0),   0 3px 10px rgba(0,0,0,0.35); }
}

/* Invisible kiosk click zone */
.kiosk-zone {
  width: 90px; height: 100px;
  margin-left: -45px; margin-top: -70px;
  cursor: pointer;
  pointer-events: auto;
}

/* Invisible "Where We Operate" click zone, right of the kiosk. */
.kiosk-zone-where-we-operate {
  width: 90px; height: 70px;
  margin-left: -38px; margin-top: -35px;
  cursor: pointer;
  pointer-events: auto;
}
/* Debug: add the `debug-zones` class to #pano to outline the zones. */
#pano.debug-zones .kiosk-zone,
#pano.debug-zones .kiosk-zone-where-we-operate {
  border: 3px solid #00ff00;
  background: rgba(0, 255, 0, 0.15);
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
}

/* ── Modals ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.58); z-index: 400;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: #fff; border-radius: 14px; width: 100%; max-width: 500px; max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,0.5); overflow: hidden;
}

.modal-head {
  background: var(--blue); color: #fff; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-head h2 { font-size: 0.95rem; font-weight: 700; letter-spacing: 0.02em; }
.modal-close {
  background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer;
  line-height: 1; padding: 2px 6px; border-radius: 4px; opacity: 0.8;
  transition: opacity 0.15s, background 0.15s;
}
.modal-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* height set per-current-slide by JS (fitSlideHeight): hugs short content,
   caps + scrolls tall content. flex:0 0 auto so it's exactly its JS height. */
.slides-viewport { position: relative; overflow: hidden; flex: 0 0 auto; min-height: 0; transition: height 0.3s ease; }
/* Scroll affordance: fade + nudging chevron shown while more content is below
   (toggled via .can-scroll-down by JS), hidden once scrolled to the bottom. */
.slides-viewport::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  background: linear-gradient(to top, #fff 12%, rgba(255,255,255,0));
  opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 1;
}
.slides-viewport::before {
  content: ''; position: absolute; left: 50%; bottom: 9px;
  width: 9px; height: 9px; margin-left: -5px;
  border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue);
  opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 2;
  animation: scroll-nudge 1.4s ease-in-out infinite;
}
.slides-viewport.can-scroll-down::after,
.slides-viewport.can-scroll-down::before { opacity: 0.9; }
@keyframes scroll-nudge {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50%      { transform: rotate(45deg) translate(2px, 2px); }
}
.slides-track { display: flex; height: 100%; min-height: 0; transition: transform 0.35s cubic-bezier(.4,0,.2,1); will-change: transform; }
.slide { flex: 0 0 100%; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 22px 22px 18px; }
.slide-img {
  width: 100%; /*height: 154px;*/
  background: linear-gradient(135deg, var(--light) 0%, #c6e2f5 100%);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; margin-bottom: 14px; border: 1px solid var(--border); overflow: hidden; flex-shrink: 0;
}
.slide-img img { width: 100%; height: 100%; object-fit: cover; }
.slide h3 { font-size: 1rem; color: var(--dark); margin-bottom: 9px; }
.slide p  { font-size: 0.86rem; line-height: 1.68; color: #444; white-space: pre-line; }
.slide p a { color: var(--blue); font-weight: 600; text-decoration: underline; word-break: break-word; }

.slide-link { display: inline-block; margin-top: 12px; color: var(--blue); font-size: 0.84rem; font-weight: 600; text-decoration: none; }
.slide-link:hover { text-decoration: underline; }
.btn-enter { display: block; margin: 18px auto 0; padding: 12px 32px; background: var(--blue); color: #fff; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: background 0.15s; }
.btn-enter:hover { background: var(--dark); }

/* ── State-directory slide: clickable US map + jump dropdown ── */
.slide-statemap {
  width: 100%; margin-bottom: 8px; padding: 10px;
  background: var(--light); border: 1px solid var(--border); border-radius: 8px;
}
.slide-statemap svg { width: 100%; height: auto; display: block; }
.slide-statemap .state-path {
  fill: #d7e3ec; stroke: #fff; stroke-width: 1; cursor: pointer;
  transition: fill 0.15s;
}
.slide-statemap .state-path:hover { fill: var(--blue); }
.slide-statemap .state-path.has-pipeline { fill: #9ec6e6; }
.slide-statemap .state-path.has-pipeline:hover { fill: var(--dark); }

.statemap-legend {
  font-size: 0.72rem; color: #666; margin-bottom: 14px; line-height: 1.7;
}
.statemap-legend .lg {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block; vertical-align: middle;
  margin-right: 5px;    /* swatch -> its own word */
  margin-left: 16px;    /* gap before the next group */
}
.statemap-legend .lg:first-child { margin-left: 0; }
.statemap-legend .lg-pipe    { background: #9ec6e6; }
.statemap-legend .lg-other   { background: #d7e3ec; }
.statemap-legend .lg-west    { background: #0073CF; }
.statemap-legend .lg-central { background: #00A05B; }
.statemap-legend .lg-south   { background: #E58A00; }
.statemap-legend .lg-newenergies { background: #673ab7; }

/* Region map ("Where We Operate"): only the 3 regions are colored/clickable;
   every other state renders inert gray. */
.slide-statemap.is-regionmap path { fill: #e2e8ee; stroke: #fff; stroke-width: 1; }
.slide-statemap.is-regionmap .region-path { cursor: pointer; transition: fill 0.15s, filter 0.15s; }
.slide-statemap.is-regionmap .region-west    { fill: #0073CF; }
.slide-statemap.is-regionmap .region-central { fill: #00A05B; }
.slide-statemap.is-regionmap .region-south   { fill: #E58A00; }
.slide-statemap.is-regionmap .region-newEnergies { fill: #673ab7; }
.slide-statemap.is-regionmap .region-path.rg-hover { filter: brightness(1.15); }

.slide-state-row { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.slide-state-row label { font-size: 0.82rem; font-weight: 600; color: var(--dark); }

.modal-foot {
  padding: 12px 18px; background: var(--gray); border-top: 1px solid #ddd;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 10px;
}
.slide-dots { display: flex; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #ccc; cursor: pointer; border: none; transition: background 0.2s, transform 0.2s; }
.dot.active { background: var(--blue); transform: scale(1.3); }
.nav-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); border: none; color: #fff; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, opacity 0.15s; flex-shrink: 0; }
.nav-btn:hover:not(:disabled) { background: var(--dark); }
.nav-btn:disabled { opacity: 0.22; cursor: default; }

/* ── State modal ── */
/* Scroll the WHOLE dialog as one region (not just the bottom card), with the
   header pinned — otherwise the alert/intro/dropdown above get cut off. */
.state-modal-card {
  max-width: 560px;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.state-modal-card .modal-head { position: sticky; top: 0; z-index: 3; }
.state-landing { padding: 22px 22px 10px; flex-shrink: 0; }
.state-landing .alert-box { background: #FFF3CD; border: 1.5px solid #F0C040; border-radius: 8px; padding: 12px 14px; font-size: 0.82rem; line-height: 1.6; color: #5a3e00; margin-bottom: 14px; }
.state-landing .alert-box strong { display: block; margin-bottom: 3px; font-size: 0.88rem; }
.state-landing p { font-size: 0.84rem; line-height: 1.65; color: #444; margin-bottom: 14px; }
.state-selector-row { display: flex; gap: 10px; align-items: center; padding: 0 22px 16px; flex-shrink: 0; }
.state-selector-row label { font-size: 0.82rem; font-weight: 600; color: var(--dark); white-space: nowrap; }
.state-select { flex: 1; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 0.88rem; color: var(--text); background: #fff; cursor: pointer; appearance: auto; transition: border-color 0.15s; }
.state-select:focus { outline: none; border-color: var(--blue); }
.state-info-area { flex: 0 0 auto; padding: 0 22px 22px; }  /* the card itself scrolls now, not just this */
.state-card { display: none; background: var(--light); border: 1.5px solid var(--border); border-radius: 10px; padding: 18px; animation: fadeIn 0.25s ease; }
.state-card.visible { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.state-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.state-abbr-badge { width: 48px; height: 48px; background: var(--blue); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; letter-spacing: 0.04em; flex-shrink: 0; }
.state-card-header h3 { font-size: 1.05rem; color: var(--dark); }
.state-card-header .pipeline-tag { display: inline-block; background: var(--blue); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 440px) { .info-grid { grid-template-columns: 1fr; } }

/* Visible scrollbar so users can tell these regions scroll (desktop/Firefox;
   iOS uses the native on-scroll indicator + the slide fade/chevron hint). */
.slide, .state-modal-card { scrollbar-width: thin; scrollbar-color: rgba(0,115,207,0.55) rgba(0,0,0,0.06); }
.slide::-webkit-scrollbar, .state-modal-card::-webkit-scrollbar { width: 9px; }
.slide::-webkit-scrollbar-track, .state-modal-card::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 5px; }
.slide::-webkit-scrollbar-thumb, .state-modal-card::-webkit-scrollbar-thumb { background: rgba(0,115,207,0.5); border-radius: 5px; }
.slide::-webkit-scrollbar-thumb:hover, .state-modal-card::-webkit-scrollbar-thumb:hover { background: rgba(0,115,207,0.75); }

/* ── Mobile: give long slide content room + keep footer nav on-screen ── */
@media (max-width: 600px) {
  .modal-overlay { padding: 10px; }
  .modal-card { max-width: 100%; max-height: 92dvh; }
  .modal-head { padding: 12px 14px; }
  .slide { padding: 16px 16px 14px; }
  .slide-img { height: 120px; margin-bottom: 12px; }
  .slide p { font-size: 0.9rem; }  /* nudge up for small-screen readability */
  /* keep prev/next/dots above the iOS home indicator */
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  /* hide the drag hint on small screens — touch users get drag/tap naturally,
     and it kept floating above the bottom controls */
  .hud { display: none; }
}
.info-cell { font-size: 0.82rem; }
.info-cell label { display: block; font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #888; margin-bottom: 3px; }
.info-cell a { color: var(--blue); text-decoration: none; font-weight: 600; }
.info-cell a:hover { text-decoration: underline; }
.info-cell .badge { display: inline-block; background: #fff; border: 1.5px solid var(--border); border-radius: 5px; padding: 3px 10px; font-weight: 700; color: var(--dark); }
.divider { grid-column: 1/-1; border: none; border-top: 1px solid var(--border); margin: 2px 0; }

/* ── Video overlays (equirect scene) ── */
/* Marzipano transforms .video-hotspot-wrap each frame; the <video> is
   centered inside it so its own transform is never overwritten. */
.video-hotspot-wrap { position: absolute; width: 0; height: 0; pointer-events: none; will-change: transform; }
.video-hotspot {
  position: absolute; left: 0; top: 0;
  transform: translate3d(-50%, -50%, 0);   /* center on the anchor point */
  max-width: none; height: auto; display: block;
  pointer-events: none;                    /* let drags pass through to the pano */
  backface-visibility: hidden;
  background: transparent;                 /* let the webm alpha show through */
}
