:root {
    --color-principal: #1f7a5c;
    --color-secundario: #ecffbd;
    --color-acento: #ebd20c;
    --color-fondo: #06623e;
    --color-superficie: #eef6f1;
    --color-texto: #2e1c03;
    --color-texto-suave: #5f726b;
    --radio-circulo: 90px;
    --duracion-animacion: 0.35s;
    --curva-suave: cubic-bezier(.2, .8, .2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    background: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
}

.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    transform: translateZ(0);
}

section {
    height: 100vh;
    width: 100vw;
    position: relative;
    scroll-snap-align: start;
    z-index: 1
}

.background-content {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
    text-align: center;
    color: var(--color-texto);
    transform: translateZ(0);
}

.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(46, 28, 3, 0.8) 0%, rgba(46, 28, 3, 0.4) 40%, transparent 80%);
    z-index: 2;
    pointer-events: none;
    will-change: auto;
}

.rv_logo {
    width: 75vh;
    height: 75vh;
    max-width: 90vw;
    margin: auto;
    background-image: url('../imas/rv_logo3.svg');
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 4;
    transform: translateZ(0);
}

.content-text h1 {
    font-size: 5vw;
}

.grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.grid span {
    border: 1px solid #222;
    padding: 10px 20px;
    border-radius: 5px;
}

/* Capa de Esferas */
#main-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    contain: layout style paint;
    transform: translateZ(0);
}

#main-svg image {
    transition: opacity 2s ease-in-out;
    will-change: opacity;
    transform: translateZ(0);
}

/* Esferas */
.blob {
    will-change: cx, cy;
    shape-rendering: optimizeSpeed;
    pointer-events: none;
}

.blob-group {
    color-interpolation-filters: sRGB;
}

.svg-overlay {
    opacity: 0.95;
    transform: translateZ(0);
    pointer-events: none;
    z-index: 4;
}

/* El tamaño y posición se manejan dinámicamente vía JavaScript */
.svg-overlay.bottom-right {
    /* JavaScript establecerá width, height, x, y */
}


/* scroll contenedor general */
.scroll-nav{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:900;
}

/* triángulos */
.scroll-tri{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  cursor:pointer;
  z-index: 950;
  pointer-events:auto;
  animation: tembleque 2s infinite ease-in-out;
}

.scroll-tri img{
  width:clamp(30px,5vw,60px);
  display:block;
  opacity:.7;
}

/* posiciones - usando viewport height estándar con fallback */
.scroll-prev{ 
  top: 20px;
  top: max(20px, env(safe-area-inset-top, 20px));
}

.scroll-next{ 
  bottom: 20px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
}

/* rotación solo imagen prev */
.scroll-prev img{
  transform:rotate(180deg);
}

/* hover next */
.scroll-next:hover img{
  opacity:1;
  transform:scale(1.1);
}

/* hover prev */
.scroll-prev:hover img{
  opacity:1;
  transform:rotate(180deg) scale(1.1);
  
}

/* animación flotante */
@keyframes tembleque{
  0%   { transform:translateX(-50%) translateY(0); }
  50%  { transform:translateX(-50%) translateY(-6px); }
  100% { transform:translateX(-50%) translateY(0); }
}

/* Mapa Leaflet */
#mapita {
    background-color: var(--color-secundario);
    display:flex;
    justify-content:center;
    align-items:center;
    position: relative;
    z-index: 8;
}

.mapita-wrapper{
  position:relative;
  display:flex;
  justify-content:center;
  align-items:center;
  isolation:isolate;
}

#mapa-leaflet {
    margin:auto;
    overflow: hidden;
    transform: translateZ(0);
    will-change: transform;
    width:100vw;
    height:100vh;
}

.leaflet-container {
	background: transparent;
	}

.tits{
  position:absolute;
  top:60px;
  left:0px;
  height:90px;
  z-index:1000;
  pointer-events:none;
  user-select:none;
}
.tits_sm{
  position:absolute;
  top:60px;
  left:0px;
  height:50px;
  z-index:1000;
  pointer-events:none;
  user-select:none;
}
/* Norte del mapa - posicionamiento mejorado para móvil */
.nortemap{
  position: absolute;
  right: 20px;
  bottom: 20px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  width: 60px;
  pointer-events: none;
  user-select: none;
  z-index: 600;
  opacity: .9;
  transition: opacity .25s ease;
}

.map-modal.abierto ~ .mapita-wrapper .nortemap{
  opacity:0;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .nortemap {
        width: 48px;
        bottom: 24px;
    }
    .scroll-prev {
        top: 24px;
    }
    .scroll-next {
        bottom: 24px;
    }
}

@media (max-width: 480px) {
    .tits {
        height:60px;
    }
    .tits_sm {
        height:35px;
    }      
    .svg-overlay.top-left {
        height: 60px;
    }
    .scroll-indicator svg {
        animation-duration: 4s;
    }
    .nortemap {
        width: 42px;
        bottom: 28px;
    }
    .scroll-prev {
        top: 28px;
    }
    .scroll-next {
        bottom: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .scroll-indicator svg {
        animation: none;
    }
    .leaflet-marker-icon {
        animation: none !important;
    }
}

@media (prefers-reduced-motion: reduce),
(prefers-contrast: more),
(hover: none) {
    .vignette-overlay {
        background: rgba(46, 28, 3, 0.5);
    }
}

/* Animaciones del modal */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#map-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
}

#map-modal.open {
  display: block;
}

#map-modal.open #map-modal-overlay {
  animation: overlayFadeIn 0.25s ease;
}

#map-modal.open #map-modal-box {
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#map-modal-overlay {
  position: fixed;
  inset: 0;
  background: #513622EE;
}

#map-modal-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1100px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--color-secundario);
  padding: 20px;
  border-radius: 12px;
  z-index: 1000000;
  box-shadow: 0 0 30px rgba(81, 54, 34, 0.6);
}

#map-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  color: var(--color-texto);
}

#map-modal-close:hover {
  background: rgba(0,0,0,0.1);
  transform: rotate(90deg);
}

#rutas{
    background-color: var(--color-fondo);
}
#contacto{
    background-color: var(--color-acento);
}