/**
 * globe.css - Cesium-specific styles for 3D globe
 *
 * RESPONSIBILITY:
 * - Style the Cesium 3D viewer container
 * - Full-width/full-height responsive layout
 */

/* Globe container */
.globe-container {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* 3D Viewer (fills entire container) */
.globe-viewer {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Cesium viewer containers */
.cesium-viewer {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure Cesium canvas is focusable for keyboard nav */
.cesium-viewer canvas {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.cesium-viewer canvas:focus {
  outline-color: var(--pico-primary);
}

/* Floating toolbar */
.globe-toolbar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: var(--toolbar-background);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--toolbar-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.globe-toolbar h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.globe-toolbar p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--toolbar-text-muted);
}

/* Quality selector */
.quality-selector {
  position: relative;
}

.quality-button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 245, 252, 0.85) 100%);
  color: var(--text-primary);
  border: 1px solid rgba(var(--primary-rgb), 0.28);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 200ms ease;
  text-align: left;
  box-shadow: 0 10px 24px rgba(24, 18, 43, 0.12);
}

.quality-button:hover,
.quality-button:focus-visible {
  background: linear-gradient(135deg, rgba(255, 154, 98, 0.35) 0%, rgba(255, 111, 145, 0.25) 100%);
  border-color: rgba(var(--primary-rgb), 0.55);
  color: var(--text-primary);
  box-shadow: 0 14px 28px rgba(24, 18, 60, 0.22);
}

.quality-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--sidebar-bg) 80%, rgba(255, 255, 255, 0.2) 20%);
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  border-radius: 6px;
  box-shadow: 0 20px 40px rgba(23, 19, 40, 0.22);
  z-index: 1000;
  overflow: hidden;
  animation: slideDown 200ms ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quality-menu button {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: transparent;
  color: var(--text-primary);
  border: none;
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 150ms ease;
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
}

.quality-menu button:last-child {
  border-bottom: none;
}

.quality-menu button:hover,
.quality-menu button:focus-visible {
  background: rgba(var(--primary-rgb), 0.18);
  color: var(--text-primary);
}

.quality-menu button.active {
  background: rgba(var(--primary-rgb), 0.22);
  color: var(--text-primary);
  font-weight: 600;
}

.quality-menu button.active {
  background: var(--pico-primary-background);
  color: var(--pico-primary);
  font-weight: 600;
}

.quality-menu button.active::after {
  content: ' ✓';
  float: right;
}

/* Share button in toolbar */

.toolbar-share-btn {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
  text-align: center;
}

.toolbar-share-btn:hover,
.toolbar-share-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.toolbar-share-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.3);
}

/* Intro overlay */
.globe-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 2rem;
  opacity: 1;
  transition: opacity 600ms ease;
}

.globe-intro-overlay[hidden] {
  opacity: 0;
  pointer-events: none;
}

/* Gradient background */
.intro-gradient-bg {
  position: absolute;
  inset: 0;
  background: var(--intro-overlay-gradient);
  z-index: -1;
}

/* Content wrapper with centering */
.intro-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 800px;
  gap: 3rem;
}

.intro-content {
  max-width: 680px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.intro-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  animation: fadeInScale 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--intro-text-color);
}

.intro-title.fade-in {
  animation: fadeInScale 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Typewriter narrative text */
.intro-narrative-text {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.7;
  opacity: 0.95;
  font-weight: 400;
  letter-spacing: 0.3px;
  min-height: 5rem;
  animation: fadeInUp 600ms ease-out;
  color: var(--intro-muted-color);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing cursor */
.intro-narrative-text::after {
  content: '|';
  animation: blink 1s infinite;
  margin-left: 3px;
  color: var(--pico-primary);
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-narrative-text::after {
    animation: none;
    opacity: 0;
  }
}
/* Progress indicator dots */
.intro-progress {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.3);
  transition: all 320ms ease;
  cursor: pointer;
}

.progress-dot.active {
  background: rgba(255, 255, 255, 0.95);
  width: 12px;
  height: 12px;
  box-shadow: 0 0 14px rgba(109, 93, 252, 0.4);
}

.progress-dot.completed {
  background: rgba(109, 93, 252, 0.7);
  box-shadow: 0 0 10px rgba(109, 93, 252, 0.35);
}

.intro-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0;
}

.intro-button {
  padding: 0.75rem 2rem;
  border-radius: 999px;
  background: var(--intro-button-background);
  color: var(--intro-button-text);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: var(--intro-button-shadow);
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.intro-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.intro-button:hover,
.intro-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--intro-button-shadow-strong);
}

.intro-button:active {
  transform: translateY(0);
}

.intro-skip {
  padding: 0.75rem 2rem;
  border-radius: 999px;
  background: var(--intro-skip-background);
  color: var(--intro-text-color);
  border: 1.5px solid var(--intro-skip-border);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 300ms ease;
  backdrop-filter: blur(4px);
}

.intro-skip:hover,
.intro-skip:focus-visible {
  background: color-mix(in srgb, var(--intro-skip-background) 60%, rgba(var(--primary-rgb), 0.2) 40%);
  border-color: color-mix(in srgb, var(--intro-skip-border) 60%, rgba(var(--primary-rgb), 0.5) 40%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Reduced motion: avoid fades */
@media (prefers-reduced-motion: reduce) {
  .globe-intro-overlay {
    transition: none;
  }
}

/* Mobile: Full screen globe on mobile */
@media (max-width: 768px) {
  .globe-container {
    height: 100%;
  }

  .globe-viewer {
    width: 100%;
    height: 100%;
  }

  .globe-toolbar {
    top: auto;
    bottom: 1rem;
    left: 1rem;
  }
}
