/* ============================================================================
   SAFE AMORX V2 - ESTILOS PRINCIPALES
   ============================================================================
   
   Estructura del archivo:
   1. Importación de fuentes
   2. Reset y estilos base
   3. Variables CSS
   4. Header de navegación
   5. Hero section (nueva)
   6. Transición con fotos (nueva)
   7. Mapa section (rediseñado)
   8. Tuberías del mapa
   9. Contenido dinámico (páginas internas)
   10. Responsive
   
   ============================================================================ */

/* ============================================================================
   1. IMPORTACIÓN DE FUENTES
   ============================================================================ */
@import url("https://fonts.googleapis.com/css2?family=BBH+Bogle:wght@400;700&family=Archivo:wght@400;500;600;700&family=Work+Sans:wght@400;500;600;700&family=Roboto+Condensed:wght@400;700&display=swap");

/* ============================================================================
   2. RESET Y ESTILOS BASE
   ============================================================================ */

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

html {
  width: 100%;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Roboto Condensed", Helvetica, Arial, sans-serif;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  z-index: 0;
  background-color: #000;
}

body.content-page {
  display: flex;
  flex-direction: column;
}

/* Prevenir scroll cuando lightbox está abierto */
body.lightbox-open {
  overflow: hidden;
}

/* ============================================================================
   3. VARIABLES CSS
   ============================================================================ */

:root {
  /* Fuentes */
  --font-headings: "BBH Bogle", "Roboto Condensed", sans-serif;
  --font-paragraphs: "Roboto Condensed", sans-serif;
  --font-map: "BBH Bogle", "Roboto Condensed", sans-serif;

  /* Colores de texto */
  --color-text-primary: #fff;
  --color-text-secondary: #ccc;

  /* Colores del mapa (home) */
  --map-text-color: #ffffff;
  --map-line-color: #ffffff;
  --map-stroke: 2px;

  /* Colores comerciales */
  --color-accent: #00ff88;
  --color-cta: #00ff88;
  --color-bg-dark: #000000;
  --color-bg-section: #0a0a0a;

  /* Espaciado de contenido */
  --spacing-section: 6rem;
  --spacing-paragraph: 1.1rem;
  --spacing-paragraph-break: 2rem;

  /* Layout home */
  --gallery-height: 20dvh;
  --hero-height: calc(100dvh - var(--gallery-height));

  /* Content width */
  --content-max-width: 900px;
}

/* ============================================================================
   4. HEADER DE NAVEGACIÓN (NIVEL 2)
   ============================================================================ */

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
}

.main-header.scrolled {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  backdrop-filter: blur(10px);
}

.header-home-link {
  color: var(--color-text-primary);
  text-decoration: none;
  font-family: var(--font-headings);
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all 0.3s ease;
  position: relative;
}

.header-home-link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.header-home-link:hover::after,
.header-home-link.active::after {
  width: 100%;
}

.header-home-link.active {
  color: var(--color-accent);
}

.main-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.main-nav a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-family: var(--font-headings);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
}

.main-nav a.active {
  color: var(--color-accent);
}

.main-nav a.cta-button {
  background: var(--color-cta);
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.main-nav a.cta-button::after {
  display: none;
}

.main-nav a.cta-button:hover {
  background: #00ffaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
}

/* ============================================================================
   5. HERO SECTION (HERO + GALLERY = 100DVH)
   ============================================================================ */

.hero-section {
  position: relative;
  width: 100%;
  height: var(--hero-height);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("../assets/images/background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: heroZoom 20s ease-in-out infinite alternate;
}

.hero-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
}

@keyframes heroZoom {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.1);
  }
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
}

.hero-logo {
  width: 100%;
  max-width: 500px;
  height: auto;
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ============================================================================
   6. GALLERY SECTION (20DVH) - DEGRADADO + SCROLL
   ============================================================================ */

.gallery-section {
  position: relative;
  width: 100%;
  height: var(--gallery-height);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%);
  z-index: 5;
}

.gallery-scroll {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  height: 100%;
  animation: slideGallery 40s linear infinite;
}

.gallery-scroll img {
  flex-shrink: 0;
  height: 70%;
  width: auto;
  object-fit: cover;
  border-radius: 8px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.gallery-scroll img:hover {
  opacity: 1;
}

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

/* ============================================================================
   6. MAPA SECTION (70DVH) - GRID CUADRADA
   ============================================================================ */

.map-section {
  position: relative;
  width: 100%;
  height: 70dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: #000;
}

.map-container {
  width: 100%;
  max-width: min(70dvh, 90vw); /* Mantener cuadrado */
  aspect-ratio: 1 / 1; /* Forzar cuadrado */
  display: grid;
  gap: 0;
}

/* ============================================================================
   8. CELDAS DEL MAPA
   ============================================================================ */

.grid-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  overflow: visible;
}

/* Celda HOME */
.grid-cell.home {
  background-color: transparent;
  border: none;
  z-index: 100;
}

.grid-cell.home .section-label {
  color: var(--map-text-color);
  font-family: var(--font-map);
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 700;
  text-transform: uppercase;
  z-index: 101;
}

/* Celdas DESTINOS */
.grid-cell.destination {
  background-color: transparent;
  border: none;
  z-index: 100;
}

.grid-cell.destination a {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--map-text-color);
  font-family: var(--font-map);
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  font-weight: 700;
  text-transform: uppercase;
  transition: all 0.3s ease;
  z-index: 101;
}

.grid-cell.destination a:hover {
  transform: scale(1.15);
  color: var(--color-accent);
  text-shadow: 0 0 20px var(--color-accent);
}

/* ============================================================================
   9. TUBERÍAS DEL MAPA
   ============================================================================ */

.grid-cell.pipe {
  --pipe-stroke: var(--map-stroke);
  --pipe-color: var(--map-line-color);
  --pipe-fill: linear-gradient(var(--pipe-color), var(--pipe-color));
  opacity: 0.7;
  background-repeat: no-repeat;
}

/* Rectas */
.pipe-straight-h {
  background: var(--pipe-fill) center / 100% var(--pipe-stroke);
}

.pipe-straight-v {
  background: var(--pipe-fill) center / var(--pipe-stroke) 100%;
}

/* Esquinas */
.pipe-curve-tr {
  background: var(--pipe-fill) right center / 50% var(--pipe-stroke),
    var(--pipe-fill) center bottom / var(--pipe-stroke) 50%;
}

.pipe-curve-br {
  background: var(--pipe-fill) right center / 50% var(--pipe-stroke),
    var(--pipe-fill) center top / var(--pipe-stroke) 50%;
}

.pipe-curve-tl {
  background: var(--pipe-fill) left center / 50% var(--pipe-stroke),
    var(--pipe-fill) center bottom / var(--pipe-stroke) 50%;
}

.pipe-curve-bl {
  background: var(--pipe-fill) left center / 50% var(--pipe-stroke),
    var(--pipe-fill) center top / var(--pipe-stroke) 50%;
}

/* Forma T */
.pipe-t-up {
  background: var(--pipe-fill) center / 100% var(--pipe-stroke),
    var(--pipe-fill) center top / var(--pipe-stroke) 50%;
}

.pipe-t-down {
  background: var(--pipe-fill) center / 100% var(--pipe-stroke),
    var(--pipe-fill) center bottom / var(--pipe-stroke) 50%;
}

.pipe-t-left {
  background: var(--pipe-fill) center / var(--pipe-stroke) 100%,
    var(--pipe-fill) left center / 50% var(--pipe-stroke);
}

.pipe-t-right {
  background: var(--pipe-fill) center / var(--pipe-stroke) 100%,
    var(--pipe-fill) right center / 50% var(--pipe-stroke);
}

/* Cruz */
.pipe-cross {
  background: var(--pipe-fill) center / 100% var(--pipe-stroke),
    var(--pipe-fill) center / var(--pipe-stroke) 100%;
}

/* Puntas */
.pipe-end-right {
  background: var(--pipe-fill) right center / 50% var(--pipe-stroke);
}

.pipe-end-left {
  background: var(--pipe-fill) left center / 50% var(--pipe-stroke);
}

.pipe-end-down {
  background: var(--pipe-fill) center bottom / var(--pipe-stroke) 50%;
}

.pipe-end-up {
  background: var(--pipe-fill) center top / var(--pipe-stroke) 50%;
}

/* ============================================================================
   10. PÁGINAS INTERNAS - CONTENIDO
   ============================================================================ */

/* Fondo para páginas internas */
body:not(.home-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("../assets/images/background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgba(0, 0, 0, 0.7);
  background-blend-mode: multiply;
}

.content-wrapper {
  min-height: 100vh;
  padding-top: 100px;
  padding-bottom: 4rem;
}

body.content-page .content-wrapper {
  flex: 1 0 auto;
  min-height: 0;
}

/* Base para todas las content-section */
.content-section {
  max-width: var(--content-max-width);
  margin: 0 auto 3rem auto;
  padding: 3rem;
  border-radius: 12px;
  position: relative;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Animaciones de scroll (solo si JS está activo) */
.content-section.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
}

.content-section.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* TIPO 1: Glass blanco básico (default) */
.content-section,
.content-section.type-1 {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* TIPO 2: Glass negro */
.content-section.type-2 {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* TIPO 3: Con imagen de fondo + glass */
.content-section.type-3 {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: overlay;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* TIPO 4: Glass verde destacado */
.content-section.type-4 {
  background: rgba(0, 255, 136, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 255, 136, 0.3);
  box-shadow: 0 8px 32px rgba(0, 255, 136, 0.2);
}

/* TIPO 5: Con imagen sin glass */
.content-section.type-5 {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgba(0, 0, 0, 0.6);
  background-blend-mode: multiply;
  backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.content-section h1 {
  font-family: var(--font-headings);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.content-section h2 {
  font-family: var(--font-headings);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.content-section h3 {
  font-family: var(--font-headings);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-section p {
  font-family: var(--font-paragraphs);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-text-primary);
  margin-bottom: 1.5rem;
}

.content-section p + p {
  margin-top: 1.5rem;
}

.content-section ul,
.content-section ol {
  font-family: var(--font-paragraphs);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.content-section li {
  margin-bottom: 0.8rem;
}

.content-section a {
  color: var(--color-accent);
  text-decoration: none;
  transition: all 0.3s ease;
  border-bottom: 1px solid transparent;
}

.content-section a:hover {
  color: #00ffaa;
  border-bottom-color: #00ffaa;
}

.content-section strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.content-block {
  margin-top: 2rem;
}

.content-block:first-child {
  margin-top: 0;
}

.content-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.content-block-header h3 {
  margin: 0;
  flex: 1;
}

.block-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-accent);
  font-family: var(--font-headings);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.block-toggle:hover,
.block-toggle:focus-visible {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.6);
  color: #00ffaa;
}

.content-block:not(.is-collapsed) .block-toggle {
  transform: rotate(90deg);
}

.content-paragraphs {
  max-height: var(--content-max-height, 9999px);
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.35s ease;
}

.content-block.is-collapsed .content-paragraphs {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
}

/* ============================================================================
   11. RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .main-header {
    padding: 1rem 1.5rem;
  }

  .header-logo {
    height: 30px;
  }

  .main-nav {
    gap: 1rem;
  }

  .main-nav a {
    font-size: 0.8rem;
  }

  .main-nav a.cta-button {
    padding: 0.5rem 1rem;
  }

  .hero-logo {
    max-width: 300px;
  }

  .map-section {
    padding: 1.5rem;
  }

  .content-section {
    padding: 2rem 1.5rem;
  }

  .page-section-header {
    padding: 0 1.5rem 2rem 1.5rem;
  }

  .content-section + .content-section {
    margin-top: 2rem;
  }

  .content-section h1 {
    font-size: 2rem;
  }

  .content-section h2 {
    font-size: 1.5rem;
  }

  .content-section p,
  .content-section ul,
  .content-section ol {
    font-size: 1rem;
  }
}

/* ============================================================================
   12. PÁGINAS VACÍAS (PRÓXIMAMENTE)
   ============================================================================ */

.empty-page .content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
}

.empty-page-message {
  text-align: center;
  font-family: var(--font-paragraphs);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-primary);
  letter-spacing: 0.1em;
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 0.8;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
  }
}

/* ============================================================================
   13. SECCIÓN HEADER CON 30DVH AIRE
   ============================================================================ */

.page-section-header {
  height: 30dvh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto 3rem auto;
  padding: 0 3rem 2rem 3rem;
}

.page-section-title {
  font-family: var(--font-headings);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-primary);
  letter-spacing: 0.05em;
  text-align: right;
  margin: 0;
}

/* ============================================================================
   14. FOOTER
   ============================================================================ */

.main-footer {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 2rem 3rem;
  text-align: center;
  color: var(--color-text-primary);
  font-family: var(--font-headings);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.main-footer a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.main-footer a:hover {
  color: var(--color-accent);
  transform: translateY(-2px);
}

/* ============================================================================
   13. UTILIDADES
   ============================================================================ */

.text-center {
  text-align: center;
}

.text-accent {
  color: var(--color-accent);
}

.mb-2 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 2rem;
}
