/* ===============================
   RESET
=============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

body {
  height: 100vh;
  overflow: hidden;
  background: #000;
  color: #fff;
}

/* ===============================
   APP MODES (GLOBAL)
=============================== */

.mode-gallery .content,
.mode-gallery .floating-menu,
.mode-gallery .subscription-teaser,
.mode-gallery .fog,

.mode-section .content,
.mode-section .floating-menu,
.mode-section .subscription-teaser,
.mode-section .fog,

.mode-modal .content,
.mode-modal .floating-menu,
.mode-modal .subscription-teaser,
.mode-modal .fog {
  display: none !important;
}

body[class*="mode-"] {
  overflow: hidden;
}

/* ===============================
   LOADER
=============================== */
.loader {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity .6s ease;
}

.loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===============================
   BACKGROUNDS
=============================== */
.backgrounds {
  position: fixed;
  inset: 0;
  z-index: -3;
}

.bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

.bg.active {
  opacity: 1;
  animation: zoom 12s ease-in-out forwards;
}

@keyframes zoom {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.background-caption {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12;
  max-width: min(360px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 1px 6px rgba(0,0,0,0.72);
  transition: opacity .4s ease;
}

.mode-gallery .background-caption,
.mode-section .background-caption,
.mode-modal .background-caption {
  display: none;
}

/* ===============================
   NIEBLA
=============================== */
.fog {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.fog-layer {
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  animation: fogMove 60s linear infinite;
}

.fog-layer:nth-child(2) {
  animation-duration: 90s;
  opacity: 0.6;
}

@keyframes fogMove {
  from { transform: translate(-25%, -25%); }
  to { transform: translate(25%, 25%); }
}

/* ===============================
   CONTENT
=============================== */
.content {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
}

h1 {
  font-size: 2.6rem;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

p {
  margin-top: 8px;
  font-size: 1.2rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.subscription-teaser {
  position: fixed;
  left: 18px;
  bottom: 86px;
  z-index: 35;
  max-width: 270px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 14px 42px rgba(0,0,0,0.24);
}

.subscription-teaser span {
  display: block;
  margin-bottom: 5px;
  color: rgba(255,255,255,0.66);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subscription-teaser strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.22;
}

/* ===============================
   FLOATING MENU
=============================== */
.floating-menu {
  position: fixed;
  right: 15px;
  bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
}

.floating-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 30px;
  border: none;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  color: white;
  cursor: pointer;
  transition: .3s;
}

.floating-menu button:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.floating-menu svg {
  width: 20px;
  height: 20px;
}

.floating-menu span {
  font-size: 14px;
}

/* ===============================
   SECCIONES
=============================== */
.section {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  padding: 20px;
  z-index: 100;
}

.section.active {
  display: block;
}

/* ===============================
   SUSCRIPCION
=============================== */
.subscription-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.46);
  backdrop-filter: blur(10px);
}

.subscription-modal.active {
  display: flex;
}

.subscription-panel {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  background: rgba(8,13,20,0.82);
  box-shadow: 0 24px 80px rgba(0,0,0,0.42);
}

.subscription-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.subscription-header span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.66);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subscription-header h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.05;
}

.subscription-header button,
.subscription-actions button,
.subscription-form button {
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.subscription-header button {
  flex: 0 0 auto;
  padding: 9px 13px;
}

.subscription-panel > p {
  max-width: 460px;
  margin: 14px 0 20px;
  color: rgba(255,255,255,0.78);
  font-size: 1rem;
  line-height: 1.45;
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.subscription-actions button {
  min-height: 42px;
  padding: 10px 15px;
}

.subscription-actions button:first-child {
  background: rgba(22,163,74,0.28);
  border-color: rgba(134,239,172,0.44);
}

.subscription-form {
  display: grid;
  gap: 12px;
}

.subscription-form label {
  display: grid;
  gap: 7px;
  color: rgba(255,255,255,0.72);
  font-size: 0.86rem;
  font-weight: 700;
}

.subscription-form input,
.subscription-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.09);
  color: #fff;
  padding: 10px 12px;
  outline: none;
}

.subscription-form input::placeholder {
  color: rgba(255,255,255,0.44);
}

.subscription-form select option {
  color: #111;
}

.subscription-form button {
  min-height: 46px;
  margin-top: 4px;
  background: #fff;
  color: #111827;
}

.subscription-status {
  min-height: 20px;
  margin-top: 14px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  line-height: 1.4;
}

.subscription-status.success {
  color: #bbf7d0;
}

.subscription-status.error {
  color: #fecaca;
}

/* ===============================
   MAPA MODAL
=============================== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

#mapModal {
  padding: 72px 20px 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 90%;
  max-width: 1000px;
  height: min(85vh, calc(100vh - 96px));
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

/* BOTÓN REGRESAR MAPA */
.close {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-size: 14px;
  font-weight: 700;
  background: rgba(15,23,42,0.88);
  border: 1px solid rgba(255,255,255,0.65);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* MAPA */
.map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.map-wrapper iframe,
#laCacicaMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  pointer-events: auto;
  text-align: center;
  backdrop-filter: blur(8px);
}

.map-overlay a {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.leaflet-container {
  background: #111;
}

.map-area-label {
  background: rgba(15,23,42,0.88);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 7px 12px;
}

.map-area-label::before {
  display: none;
}

/* ===============================
   GALERÍA
=============================== */
.gallery-container {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  background: #050505;
  z-index: 60;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) rgba(0,0,0,0.2);
}

.mode-gallery .gallery-container {
  display: block;
}

.gallery-slide {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
  background-size: cover;
  background-position: center;
}

.gallery-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0,0,0,0.58), rgba(0,0,0,0.04) 44%, rgba(0,0,0,0.18)),
    linear-gradient(to right, rgba(0,0,0,0.16), transparent 34%);
  pointer-events: none;
}

.gallery-info {
  position: absolute;
  left: clamp(18px, 4vw, 56px);
  right: 150px;
  bottom: clamp(22px, 6vh, 58px);
  z-index: 1;
  max-width: 520px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: none;
}

.gallery-eyebrow {
  display: block;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.74);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-info h2 {
  font-size: clamp(1.8rem, 3.6vw, 3rem);
  line-height: 1.08;
  text-shadow: 0 3px 14px rgba(0,0,0,0.75);
}

.gallery-info p {
  max-width: 520px;
  margin: 10px 0 18px;
  font-size: 1rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.86);
}

.gallery-info a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 999px;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.gallery-info a:hover {
  background: rgba(255,255,255,0.22);
}

/* DOTS */
.dots {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: none;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  background: rgba(8,13,20,0.42);
  backdrop-filter: blur(10px);
  scrollbar-width: none;
}

.dots::-webkit-scrollbar {
  display: none;
}

.mode-gallery .dots {
  display: block;
}

.dot {
  width: 72px;
  height: 46px;
  margin: 0 0 8px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background-color: rgba(255,255,255,0.14);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  opacity: 0.66;
  transition: border-color .2s ease, opacity .2s ease, transform .2s ease;
}

.dot.active {
  border-color: #fff;
  opacity: 1;
  transform: translateX(-4px);
}

/* BOTÓN BACK */
.back-btn {
  display: none;
  position: fixed;
  top: 18px;
  left: 24px;
  z-index: 80;
  background: rgba(8,13,20,0.68);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
}

.mode-gallery .back-btn {
  display: block;
}

.gallery-counter {
  display: none;
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 80;
  min-width: 74px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  background: rgba(8,13,20,0.68);
  backdrop-filter: blur(14px);
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
}

.mode-gallery .gallery-counter {
  display: block;
}

/* ===============================
   TIMELINE
=============================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-inline {
  background: rgba(255,255,255,0.1);
  border: none;
  padding: 6px 12px;
  border-radius: 12px;
  color: white;
  cursor: pointer;
}

.timeline {
  position: relative;
  margin-top: 30px;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.2);
}

.year {
  font-size: 18px;
  margin-bottom: 15px;
  opacity: 0.8;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 20px;
}

.timeline-item .dot {
  position: absolute;
  left: -2px;
  top: 6px;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
}

.timeline-content {
  background: rgba(255,255,255,0.05);
  padding: 12px;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

/* ===============================
   EVENT / PROJECT MODAL
=============================== */
.event-modal,
.project-modal {
  display: none;
  align-items: center;
  justify-content: center;
}

.event-modal.active,
.project-modal.active {
  display: flex;
}

.event-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: rgba(0,0,0,0.94);
  padding: 20px;
}

.event-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.95), rgba(0,0,0,0.55));
  padding: 10px 0 18px;
}

.event-header h2 {
  font-size: 1.4rem;
  line-height: 1.2;
}

.event-container p {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: 1rem;
  opacity: 0.86;
}

.event-header .back-inline,
.viewer-close {
  flex: 0 0 auto;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.event-gallery {
  display: grid;
  gap: 18px;
  padding-bottom: 24px;
  scroll-snap-type: y proximity;
}

.event-gallery img {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 320px;
  object-fit: contain;
  background: #050505;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  cursor: pointer;
  scroll-snap-align: center;
}

/* ===============================
   IMAGE VIEWER
=============================== */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.image-viewer.active {
  display: flex;
}

.image-viewer img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
}

.viewer-close {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 301;
  background: rgba(0,0,0,0.68);
}

@media (max-width: 640px) {
  .background-caption {
    top: 18px;
    right: 14px;
    max-width: 46vw;
    font-size: 11px;
  }

  .subscription-teaser {
    top: 42px;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    width: min(250px, calc(100vw - 28px));
    max-width: none;
    padding: 9px 12px;
    text-align: center;
    border-radius: 999px;
    background: rgba(0,0,0,0.22);
  }

  .subscription-teaser span {
    display: none;
  }

  .subscription-teaser strong {
    font-size: 0.82rem;
    line-height: 1.1;
  }

  .subscription-modal {
    align-items: flex-end;
    padding: 0;
  }

  .subscription-panel {
    width: 100%;
    max-height: 92svh;
    max-height: min(92dvh, calc(100vh - 20px));
    padding: 20px 18px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .subscription-header h2 {
    font-size: 1.35rem;
  }

  .subscription-panel > p {
    font-size: 0.875rem;
    margin: 10px 0 14px;
  }

  .subscription-actions {
    display: grid;
  }

  .gallery-info {
    left: 16px;
    right: 16px;
    bottom: 20px;
  }

  .gallery-info h2 {
    font-size: 1.8rem;
  }

  .gallery-info p {
    font-size: 0.95rem;
  }

  .gallery-info a {
    min-height: 42px;
  }

  .back-btn {
    left: 14px;
    top: 14px;
    padding: 10px 14px;
  }

  .gallery-counter {
    right: 14px;
    top: 14px;
    min-width: 64px;
    padding: 10px 12px;
  }

  .dots {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 132px;
    transform: none;
    display: none;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 8px;
    border-radius: 14px;
  }

  .dot {
    display: inline-block;
    width: 58px;
    height: 38px;
    margin: 0 6px 0 0;
  }

  .dot.active {
    transform: translateY(-3px);
  }

  .event-container {
    padding: 14px;
  }

  .event-header {
    align-items: flex-start;
  }

  .event-gallery img {
    height: 68vh;
    min-height: 260px;
  }
}
