/* ==========================================================================
   BLACKOUT — INDUSTRIAL WORLD
   Minimalist Architectural Liquid Glass UI
   ========================================================================== */

:root {
  --bg-studio: #ffffff;
  --ink-primary: #111318;
  --ink-secondary: #4e5563;
  --ink-muted: #7c8494;
  --accent-orange: #ff5500;
  --accent-orange-soft: rgba(255, 85, 0, 0.12);
  --accent-orange-glow: rgba(255, 85, 0, 0.28);

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.84);
  --glass-border: rgba(255, 255, 255, 0.92);
  --glass-outline: rgba(17, 19, 24, 0.08);
  --glass-shadow:
    0 12px 36px rgba(17, 22, 34, 0.08),
    0 2px 8px rgba(17, 22, 34, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-pill: 999px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-studio);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Layered Smooth Sky Backdrop (1.7s crossfade matching 3D lighting transitions) */
#sky-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sky-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.sky-day {
  background: #ffffff;
  opacity: 1;
}

.sky-sunset {
  background: linear-gradient(180deg, #fff5eb 0%, #fde9d6 52%, #f9dec6 100%);
}

.sky-night {
  background: linear-gradient(180deg, #0b1322 0%, #132038 55%, #1b2c49 100%);
}

body.theme-sunset .sky-sunset {
  opacity: 1;
}

body.theme-night .sky-night {
  opacity: 1;
}

/* Adaptive Night Liquid Glass Tokens (clean legibility over deep nocturnal sky) */
body.theme-night {
  --ink-primary: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --glass-bg: rgba(16, 25, 42, 0.72);
  --glass-bg-strong: rgba(20, 32, 54, 0.88);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-outline: rgba(255, 255, 255, 0.08);
  --glass-shadow:
    0 14px 38px rgba(4, 8, 18, 0.45),
    0 2px 8px rgba(4, 8, 18, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.theme-night .liquid-glass-subtle {
  background: rgba(16, 25, 42, 0.66);
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-night .sector-floating-label {
  background: rgba(16, 25, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(4, 8, 18, 0.36);
}

body.theme-night .sector-floating-label .label-num {
  background: var(--accent-orange);
}

body.theme-night .speech-bubble::before,
body.theme-night .speech-bubble::after {
  background: rgba(16, 25, 42, 0.86);
  border-color: rgba(255, 255, 255, 0.16);
}

body.theme-night .dock-item.active,
body.theme-night .lighting-btn.active {
  background: var(--accent-orange);
  color: #ffffff;
}

body.theme-night .dock-item.active .dock-num {
  color: #ffffff;
}

body.theme-night .project-slot-card,
body.theme-night .panel-back-btn,
body.theme-night .panel-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

/* WebGL Canvas */
#world-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#world-canvas:active {
  cursor: grabbing;
}

/* Liquid Glass Shared Surface */
.liquid-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), 0 0 0 1px var(--glass-outline);
}

.liquid-glass-subtle {
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(17, 19, 24, 0.06);
  box-shadow: 0 4px 16px rgba(17, 22, 34, 0.05);
}

/* ==========================================================================
   TOP-LEFT BRANDING
   ========================================================================== */
.brand-header {
  position: fixed;
  top: 22px;
  left: 24px;
  z-index: 20;
  pointer-events: none;
}

.brand-badge {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  padding: 13px 20px;
  border-radius: 18px;
}

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  /* black.png is white-on-transparent; render crisp black in Day/Sunset */
  filter: brightness(0);
  transition: filter 0.6s var(--ease-out);
}

body.theme-night .brand-logo {
  filter: none;
}

/* ==========================================================================
   TOP-RIGHT LIGHTING SWITCHER & PERMANENT VISTA GENERAL BUTTON
   ========================================================================== */
.top-controls {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.lighting-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: var(--radius-pill);
}

.lighting-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

.lighting-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.lighting-btn:hover {
  color: var(--ink-primary);
  background: rgba(128, 140, 160, 0.12);
}

.lighting-btn.active {
  background: var(--ink-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(17, 19, 24, 0.18);
}

.lighting-btn.active svg {
  color: var(--accent-orange);
}

body.theme-night .lighting-btn.active svg {
  color: #ffffff;
}

.overview-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.25s ease, box-shadow 0.25s ease;
}

.overview-btn svg {
  width: 15px;
  height: 15px;
  color: var(--accent-orange);
}

.overview-btn:hover {
  background: var(--glass-bg-strong);
  transform: translateY(-1px);
}

/* ==========================================================================
   3D-PROJECTED FLOATING SECTOR LABELS & ENGINEER SPEECH BUBBLE
   ========================================================================== */
#overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.sector-floating-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 20px rgba(17, 22, 34, 0.1), 0 0 0 1px rgba(17, 19, 24, 0.06);
  color: var(--ink-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transform: translate3d(-9999px, -9999px, 0);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
  white-space: nowrap;
}

.sector-floating-label .label-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  transition: background 0.2s ease;
}

.sector-floating-label:hover,
.sector-floating-label.hovered,
.sector-floating-label.active {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 26px rgba(255, 85, 0, 0.18), 0 0 0 1.5px var(--accent-orange);
}

.sector-floating-label:hover .label-num,
.sector-floating-label.hovered .label-num,
.sector-floating-label.active .label-num {
  background: var(--accent-orange);
}

/* Engineer Comic Cloud Speech Bubble (Liquid Glass) */
.speech-bubble {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 268px;
  padding: 13px 32px 13px 16px;
  border-radius: 28px 28px 28px 24px;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity 0.35s var(--ease-out);
  z-index: 14;
}

/* Comic-style descending cloud trail bubbles (Liquid Glass) */
.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 10px rgba(17, 22, 34, 0.08), 0 0 0 1px var(--glass-outline);
  transform: translateX(-50%);
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -21px;
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 3px 8px rgba(17, 22, 34, 0.08), 0 0 0 1px var(--glass-outline);
  transform: translateX(-50%);
}

.speech-bubble.hidden {
  opacity: 0;
  pointer-events: none;
}

.speech-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-orange);
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent-orange-glow);
}

.speech-bubble p {
  font-size: 12.5px;
  line-height: 1.42;
  color: var(--ink-primary);
  font-weight: 500;
}

.bubble-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.bubble-close:hover {
  color: var(--ink-primary);
  background: rgba(17, 19, 24, 0.06);
}

/* ==========================================================================
   BOTTOM FLOATING INDUSTRY DOCK
   ========================================================================== */
.bottom-dock-wrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
}

.industry-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-pill);
}

.dock-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s var(--ease-out);
}

.dock-item .dock-num {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  transition: color 0.25s ease;
}

.dock-item:hover {
  background: rgba(17, 19, 24, 0.045);
  color: var(--ink-primary);
}

.dock-item:hover .dock-num {
  color: var(--accent-orange);
}

.dock-item.active {
  background: var(--ink-primary);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(17, 19, 24, 0.2);
}

.dock-item.active .dock-num {
  color: var(--accent-orange);
}

.nav-hint {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}

/* ==========================================================================
   RIGHT-SIDE INDUSTRY DETAIL DRAWER (LIQUID GLASS)
   ========================================================================== */
.industry-panel {
  position: fixed;
  top: 120px;
  right: 24px;
  bottom: 112px;
  width: 372px;
  max-width: calc(100vw - 32px);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s var(--ease-out), opacity 0.35s ease;
}

.industry-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

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

.panel-sector-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-orange);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.panel-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.panel-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(17, 19, 24, 0.08);
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-close-btn svg {
  width: 15px;
  height: 15px;
}

.panel-close-btn:hover {
  background: var(--ink-primary);
  color: #fff;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  line-height: 1.15;
}

.panel-tagline {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-orange);
  line-height: 1.35;
}

.panel-description {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--ink-secondary);
}

.panel-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.capability-chip {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(17, 19, 24, 0.05);
  border: 1px solid rgba(17, 19, 24, 0.07);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-primary);
}

.panel-divider {
  height: 1px;
  background: rgba(17, 19, 24, 0.08);
  margin: 18px 0 14px;
}

.panel-projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-projects-header h3 {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

.phase-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-orange);
  background: var(--accent-orange-soft);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.panel-projects {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.project-slot-card {
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(17, 19, 24, 0.14);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.project-slot-card:hover {
  border-color: rgba(255, 85, 0, 0.45);
  background: rgba(255, 255, 255, 0.85);
}

.project-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.project-slot-cat {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.project-slot-status {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: rgba(17, 19, 24, 0.06);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.project-slot-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 4px;
}

.project-slot-summary {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.panel-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(17, 19, 24, 0.07);
}

.panel-back-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(17, 19, 24, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-back-btn:hover {
  background: var(--ink-primary);
  color: #fff;
  border-color: var(--ink-primary);
}

/* ==========================================================================
   RESPONSIVE MOBILE ADAPTATION
   ========================================================================== */
@media (max-width: 768px) {
  .brand-header {
    top: 14px;
    left: 14px;
  }

  .brand-badge {
    padding: 10px 15px;
  }

  .brand-logo {
    height: 28px;
  }

  .top-controls {
    top: 14px;
    right: 14px;
    gap: 8px;
  }

  .lighting-btn {
    padding: 6px 9px;
    font-size: 11px;
  }

  .lighting-btn span {
    display: none;
  }

  .overview-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .bottom-dock-wrap {
    bottom: 14px;
    width: calc(100vw - 20px);
  }

  .industry-dock {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .industry-dock::-webkit-scrollbar {
    display: none;
  }

  .dock-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .nav-hint {
    font-size: 10.5px;
    padding: 5px 11px;
  }

  .industry-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 92px;
    width: auto;
    max-width: none;
    max-height: 48vh;
    transform: translateY(calc(100% + 120px));
  }

  .industry-panel.open {
    transform: translateY(0);
  }

  .speech-bubble {
    max-width: 225px;
    padding: 9px 26px 9px 11px;
  }

  .speech-bubble p {
    font-size: 11.5px;
  }
}
