/* ==========================================================================
   OTRA RUTA - Web App Official Brand Design System
   Extracted from otraruta_diseno.pdf
   ========================================================================== */

:root {
  /* Official Brand Colors */
  --brand-lime: #D1E48F;        /* Primary Pistachio Lime Accent */
  --brand-charcoal: #302D31;    /* Primary Dark Charcoal / Off-Black */
  --brand-white: #FFFFFF;       /* Pure White */
  --brand-orange: #F89B29;      /* Services / Advertising Category */
  --brand-blue: #38BDF8;        /* Coastal / Water Category */
  --brand-muted: #A1A1A6;       /* Secondary Muted Text */

  /* UI Functional Tokens */
  --bg-dark: #000000;
  --bg-surface: #302D31;
  --bg-sheet: #FFFFFF;
  --bg-glass: rgba(48, 45, 49, 0.85);
  --border-glass: rgba(255, 255, 255, 0.2);

  --text-dark: #302D31;
  --text-light: #FFFFFF;
  --text-muted: #CBD5E1;

  /* Typography Specs (PDF Page 4) */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Elevation Shadows & Radius */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 16px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 18px rgba(209, 228, 143, 0.5);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--brand-charcoal);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 16px;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: var(--font-title);
}

/* Logo Dot Style */
.logo-dot {
  color: var(--brand-lime);
  display: inline-block;
}

/* ==========================================================================
   Splash Screen
   ========================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--brand-charcoal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: pulse-glow 2.5s infinite ease-in-out;
}

.splash-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: var(--brand-charcoal);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: #FFF;
}

.splash-icon svg {
  width: 46px;
  height: 46px;
}

.splash-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.splash-subtitle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brand-muted);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.splash-loader {
  margin-top: 36px;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand-lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* ==========================================================================
   Main App Container & Map View
   ========================================================================== */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: var(--brand-charcoal);
}

.leaflet-control-zoom, .leaflet-attribution-flag {
  display: none !important;
}

.leaflet-container {
  font-family: var(--font-body) !important;
  background: var(--brand-charcoal) !important;
}

/* Custom Category-Coded Map Markers */
.custom-node-pin {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-charcoal);
  border: 3px solid var(--pin-color, var(--brand-lime));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pin-color, var(--brand-lime));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.custom-node-pin:hover, .custom-node-pin.active {
  transform: scale(1.25) translateY(-4px);
  background: var(--pin-color, var(--brand-lime));
  color: var(--brand-charcoal);
  border-color: #FFFFFF;
  box-shadow: 0 0 20px var(--pin-color, var(--brand-lime));
  z-index: 999 !important;
}

.custom-node-pin svg {
  width: 22px;
  height: 22px;
}

/* User Location Pin */
.user-location-pin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-lime);
  border: 3px solid var(--brand-charcoal);
  box-shadow: var(--shadow-glow);
  position: relative;
}

.user-location-pin::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(209, 228, 143, 0.4);
  animation: pulse-ring 2s infinite ease-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================================
   Header & Clean Brand Pill
   ========================================================================== */
.top-header {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  left: 14px;
  right: 14px;
  z-index: 3500;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(48, 45, 49, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 8px 18px 8px 14px;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.2rem;
  color: #FFFFFF;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-brand-pill {
  padding: 8px 16px 8px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 1;
  visibility: visible;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-brand-pill.hide-on-video {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-8px) scale(0.9);
}

.header-brand-pill:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--brand-charcoal);
  border-color: var(--brand-lime);
  box-shadow: 0 0 20px rgba(209, 228, 143, 0.35);
  color: #FFFFFF;
}

.header-brand-pill:active {
  transform: translateY(0) scale(0.94);
}

.home-brand-icon, .project-node-icon {
  color: var(--brand-lime);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.header-brand-pill:hover .home-brand-icon,
.header-brand-pill:hover .project-node-icon {
  transform: scale(1.18);
}

/* Floating Action Buttons */
.floating-actions {
  position: absolute;
  right: 14px;
  bottom: calc(var(--safe-bottom) + 24px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-charcoal);
  border: 1px solid var(--border-glass);
  color: var(--brand-lime);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-fast);
}

.fab-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   FULLSCREEN IMMERSIVE VIDEO PLAYER MODAL (100% Mobile Viewport Coverage)
   ========================================================================== */
.detail-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 3000;
  background: #000000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.detail-modal.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* 100% Fullscreen Video Player Background */
.fullscreen-video-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-video-wrapper video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Dark Gradient Vignette for Text Legibility */
.video-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, 0.95) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Floating Top Controls */
.detail-nav-bar {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  right: 16px;
  z-index: 3100;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.icon-circle-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(30, 28, 32, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition-fast);
}

.icon-circle-btn:active {
  transform: scale(0.92);
}

/* Bottom Glassmorphism Overlay Card (20% Opacity Default, 40% Opacity Expanded) */
.detail-info-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 20px);
  z-index: 10;
  background: rgba(18, 16, 20, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  animation: slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.detail-info-overlay.expanded {
  background: rgba(18, 16, 20, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  gap: 8px;
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.detail-title {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 1px 3px rgba(0, 0, 0, 0.8);
}

.detail-subtitle {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--brand-lime);
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.detail-expandable-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.detail-info-overlay.expanded .detail-expandable-content {
  max-height: 45vh;
  opacity: 1;
  margin-top: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom subtle scrollbar */
.detail-expandable-content::-webkit-scrollbar {
  width: 4px;
}
.detail-expandable-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.detail-description-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  color: #F8FAFC;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  text-align: justify;
}

.detail-actions-row {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-external-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.external-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  text-decoration: none;
  transition: all 0.25s ease;
}

.external-icon-link:hover {
  background: var(--brand-lime);
  color: var(--brand-charcoal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.external-icon-link svg {
  width: 17px;
  height: 17px;
}

.read-more-btn {
  background: transparent;
  border: none;
  color: var(--brand-lime);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0 0;
  cursor: pointer;
  align-self: flex-start;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  transition: color 0.2s ease;
}

.read-more-btn:hover {
  color: #FFFFFF;
}

.read-more-icon {
  transition: transform 0.35s ease;
}

.detail-info-overlay.expanded .read-more-icon {
  transform: rotate(180deg);
}

/* Toast Notifications */
.toast-msg {
  position: fixed;
  top: calc(var(--safe-top) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 9999;
  background: var(--brand-charcoal);
  border: 1px solid var(--brand-lime);
  color: #FFF;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-normal);
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}

