/* =========================================================
   RESET Y VARIABLES
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --vino: #5c2040;
  --vino-claro: #7a2c56;
  --vino-oscuro: #3a1228;
  --fondo: #f4ede2;
  --papel: #ffffff;
  --tarjeta: #faf6f0;
  --texto: #333333;
  --texto-suave: #6b6258;
  --borde: rgba(92, 32, 64, 0.12);
  --radio: 10px;
  --ancho: 1000px;
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; } /* que la barra fija no tape los títulos */

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  padding-bottom: 60px;
}

/* =========================================================
   PORTADA: la foto de la portada a todo lo ancho + degradado
   ========================================================= */
.portada {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(460px, 78vh, 700px);
  padding: 120px 20px 120px;
  text-align: center;
  color: #fff;
  overflow: hidden;
  background: var(--vino-oscuro);
}
.portada::before {            /* foto */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('../img/portada-foto.jpg') center 35% / cover no-repeat;
}
.portada::after {             /* degradado: oscurece arriba y se funde con el vino abajo */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at center, rgba(58, 18, 40, 0.55) 0%, rgba(58, 18, 40, 0) 70%),
    linear-gradient(180deg,
      rgba(58, 18, 40, 0.70) 0%,
      rgba(92, 32, 64, 0.35) 38%,
      rgba(92, 32, 64, 0.80) 78%,
      var(--vino) 100%);
}
/* Barra con los logos oficiales: fija arriba, transparente sobre la portada
   y blanca en cuanto se desliza la página (clase .con-fondo, ver script.js) */
.barra-logos {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: transparent;
  box-shadow: none;
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
/* Sobre la foto: halo blanco para que las letras oscuras de los logos se lean */
.barra-logos:not(.con-fondo) .logo {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}
.barra-logos.con-fondo {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding-top: 8px;
  padding-bottom: 8px;
}
.logos-izq { display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); }
.logo { display: block; width: auto; }
.logo-visit { height: 46px; }
.logo-pueblo { height: 54px; }
.logo-comitan { height: 50px; animation: flotar 3.2s ease-in-out infinite; }

@keyframes flotar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-comitan, .boton-flor img { animation: none; }
}
@media (max-width: 600px) {
  .barra-logos { padding: 8px 16px; gap: 10px; }
  .logo-visit { height: 26px; }
  .logo-pueblo { height: 32px; }
  .logo-comitan { height: 28px; }
}

.portada-contenido { max-width: 760px; text-shadow: 0 3px 18px rgba(0, 0, 0, 0.55); }
.portada-saludo {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.1rem, 3.4vw, 1.9rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 700;
}
.portada h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.95;
  margin: 6px 0 4px;
  font-family: Impact, 'Arial Narrow Bold', 'Haettenschweiler', sans-serif;
  font-weight: 900;
  font-size: clamp(3.4rem, 15vw, 8rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f8a81d;
}
.portada-de {
  font-family: 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
  font-weight: 400;
  text-transform: none;
  font-size: clamp(1.5rem, 5.4vw, 2.8rem);
  letter-spacing: 0;
  color: #fff;
  margin-top: -0.1em;
}
.portada-mapa {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 22px;
  border-top: 2px solid #f8a81d;
  border-bottom: 2px solid #f8a81d;
  font-family: Impact, 'Arial Narrow Bold', sans-serif;
  font-size: clamp(1.1rem, 3.6vw, 1.8rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.portada-boton {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 12px 26px;
  border-radius: 999px;
  background: #fff;
  color: var(--vino);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  text-shadow: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.portada-boton:hover { transform: translateX(-50%) translateY(-2px); background: #fff3f8; }
.portada-boton:focus-visible { outline: 3px solid #f8b133; outline-offset: 3px; }

/* =========================================================
   ENCABEZADO (continúa el degradado de la portada)
   ========================================================= */
.encabezado {
  text-align: center;
  padding: 0 20px 48px;
  margin: 0 0 36px;
  color: #fff;
  background: linear-gradient(180deg, var(--vino) 0%, var(--vino-claro) 100%);
  border-radius: 0 0 28px 28px;
  box-shadow: 0 8px 22px rgba(92, 32, 64, 0.28);
}
.encabezado-sub { font-size: 1.05rem; opacity: 0.9; }

.header-buscador {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
#buscador {
  width: 100%;
  max-width: 420px;
  padding: 11px 16px;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--texto);
  background: rgba(255, 255, 255, 0.96);
}
#buscador:focus { outline: 3px solid rgba(255, 255, 255, 0.5); }

.filtros { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: var(--ancho); }
.chip {
  font-size: 0.82rem;
  font-family: inherit;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.chip:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.16); }
.chip.activo { background: #fff; color: var(--vino); border-color: #fff; font-weight: 600; }
.chip:focus-visible { outline: 3px solid #f8b133; outline-offset: 2px; }

/* =========================================================
   CATEGORÍAS Y TARJETAS
   ========================================================= */
.contenedor-categorias,
.seccion-mapa,
.sin-resultados,
footer {
  max-width: var(--ancho);
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}
.contenedor-categorias { display: flex; flex-direction: column; gap: 30px; }

.seccion-categoria {
  background: var(--papel);
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.titulo-categoria {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  padding: 14px 22px;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.titulo-icono { font-size: 1.3rem; line-height: 1; }
.titulo-contador {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
}

.lista-lugares {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  padding: 22px;
}
.tarjeta-lugar {
  display: flex;
  flex-direction: column;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-top: 4px solid var(--color-cat, #888);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tarjeta-lugar:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12); }

.tarjeta-imagen {
  position: relative;
  aspect-ratio: 2 / 1;
  background: #e9dfd0;
  overflow: hidden;
}
.tarjeta-imagen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tarjeta-cuerpo { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 16px; }
.tarjeta-lugar h3 { font-size: 1rem; color: #2c3e50; margin-bottom: 8px; line-height: 1.3; }
.tarjeta-direccion { font-size: 0.86rem; color: var(--texto-suave); line-height: 1.4; }

.tarjeta-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 14px; }
.ver-detalle,
.ir-maps {
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ver-detalle { color: var(--vino); background: #fff; border: 1px solid var(--vino); }
.ver-detalle:hover { background: #f8eef3; }
.ir-maps { color: #fff; background: var(--vino); border: 1px solid var(--vino); }
.ir-maps:hover { background: var(--vino-claro); }
.ver-detalle:focus-visible, .ir-maps:focus-visible { outline: 3px solid #f8b133; outline-offset: 2px; }

/* =========================================================
   MAPA (fondo transparente)
   ========================================================= */
.seccion-mapa { margin-top: 44px; margin-bottom: 36px; }
.seccion-mapa h2 { font-size: 1.25rem; color: var(--vino); margin-bottom: 8px; }
.ayuda-mapa { color: var(--texto-suave); margin-bottom: 12px; }
.controles-mapa { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.controles-mapa button {
  font: inherit; color: var(--vino); background: #fff; border: 1px solid var(--vino);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 44px;
}
.controles-mapa button:disabled { opacity: 0.4; cursor: default; }

.mapa-wrap {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  overflow: auto;
}
#mapaInteractivo { min-width: 720px; background: transparent; }
#mapaInteractivo svg { display: block; width: 100%; height: auto; background: transparent; }

.punto-mapa {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}
.punto-mapa:hover, .punto-mapa:focus-visible, .punto-mapa.seleccionado {
  transform: scale(1.22);
  filter: drop-shadow(0 0 2px #5c2040);
}
.punto-mapa:focus-visible { outline: 2px solid var(--vino); }
.punto-mapa.atenuado { opacity: 0.18; }

/* =========================================================
   ATRACTIVOS TURÍSTICOS: ventana flotante con tarjetas
   ========================================================= */
.panel-atractivos {
  margin: auto;
  width: min(1100px, calc(100% - 24px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--fondo);
  color: var(--texto);
  box-shadow: 0 20px 70px #0006;
  overflow: hidden;
}
.panel-atractivos[open] { display: flex; flex-direction: column; animation: aparecer 0.2s ease-out; }
.panel-atractivos::backdrop { background: #25152099; }
.panel-encabezado {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  color: #fff;
  background: linear-gradient(90deg, var(--vino-oscuro), var(--vino-claro));
}
.panel-encabezado h2 { font-size: 1.3rem; line-height: 1.2; }
.panel-encabezado p { font-size: 0.9rem; opacity: 0.9; margin-top: 4px; }
.cerrar-panel {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); color: var(--vino);
  font-size: 28px; line-height: 1; cursor: pointer;
}
.cerrar-panel:focus-visible { outline: 3px solid #f8b133; outline-offset: 2px; }
.panel-cuerpo {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.panel-cuerpo > .seccion-categoria { flex-shrink: 0; }
/* Sin foto: un recuadro con icono en lugar del hueco vacío */
.tarjeta-atractivo .tarjeta-imagen:empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #efe3d2, #e2d0bb);
}
.tarjeta-atractivo .tarjeta-imagen:empty::after { content: '🏞️'; font-size: 2.6rem; opacity: 0.55; }
.atractivo-datos { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.92rem; }
.atractivo-km { font-weight: 700; color: var(--vino); }
.atractivo-tiempo { color: var(--texto-suave); }
.atractivo-nota { font-size: 0.82rem; color: var(--texto-suave); margin-top: 6px; }
@media (max-width: 480px) {
  .panel-atractivos { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .panel-encabezado { padding: 14px 16px; }
  .panel-cuerpo { padding: 12px; }
  .panel-cuerpo .lista-lugares { padding: 14px; }
}

/* =========================================================
   MENÚ FLOTANTE: FLOR DE PUEBLO MÁGICO (abajo a la derecha)
   ========================================================= */
.menu-flor {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.boton-flor {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}
.boton-flor:hover { transform: scale(1.06); }
.boton-flor:focus-visible { outline: 3px solid #f8b133; outline-offset: 3px; }
.boton-flor img { width: 52px; height: auto; animation: girar 8s linear infinite; }
.boton-flor[aria-expanded="true"] img { animation-duration: 2.5s; }
@keyframes girar { to { transform: rotate(360deg); } }

.menu-flor-opciones {
  list-style: none;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  padding: 6px;
  animation: aparecer 0.18s ease-out;
  transform-origin: bottom right;
}
.menu-flor-opciones a {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--vino);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.menu-flor-opciones a:hover, .menu-flor-opciones a:focus-visible { background: #f8eef3; outline: none; }
@media (max-width: 600px) {
  .menu-flor { right: 16px; bottom: 16px; }
  .boton-flor { width: 58px; height: 58px; }
  .boton-flor img { width: 44px; }
}

/* =========================================================
   VENTANA DE DETALLE
   ========================================================= */
#detalleLugar {
  margin: auto;
  width: min(540px, calc(100% - 24px));
  max-height: 90vh;
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: var(--texto);
  background: var(--fondo);
  box-shadow: 0 20px 70px #0006;
}
#detalleLugar[open] { animation: aparecer 0.2s ease-out; }
#detalleLugar::backdrop { background: #25152099; }
.detalle-imagen { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: #e9dfd0; }
.detalle-cuerpo { padding: 22px 26px 26px; }
#detalleLugar h2 { color: var(--vino); margin: 6px 0 12px; line-height: 1.25; font-size: 1.35rem; }
#detalleLugar p { margin-top: 10px; }
.detalle-categoria { font-size: 0.8rem; color: var(--vino); font-weight: 600; margin-top: 0 !important; }
.detalle-direccion { color: var(--texto-suave); font-size: 0.92rem; }
.detalle-transporte {
  margin-top: 16px; padding: 14px 16px; border-radius: 10px;
  background: #fff; border: 1px solid var(--borde); border-left: 4px solid #253b85;
}
.detalle-transporte h3 { font-size: 0.98rem; color: #253b85; }
#detalleLugar .detalle-transporte p { margin-top: 6px; font-size: 0.92rem; }
.cerrar-detalle {
  position: absolute; right: 10px; top: 10px; z-index: 2; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--vino);
  font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px #0003;
}
.detalle-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.boton-maps {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.92rem;
  color: var(--vino); background: #fff; border: 1px solid var(--vino);
}
.boton-maps.primario { color: #fff; background: var(--vino); }
.boton-maps:hover { filter: brightness(1.08); }
.boton-maps:focus-visible, .cerrar-detalle:focus-visible {
  outline: 3px solid #f8b133; outline-offset: 2px;
}
@keyframes aparecer { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* =========================================================
   ESTADOS Y PIE
   ========================================================= */
.sin-resultados { margin-top: 30px; text-align: center; color: var(--texto-suave); font-size: 0.95rem; }
.aviso-error {
  max-width: 640px; margin: 0 auto; background: var(--papel); border: 1px solid var(--borde);
  border-left: 4px solid var(--vino); border-radius: var(--radio); padding: 20px 24px;
}
.aviso-error p { margin-bottom: 10px; font-size: 0.92rem; }
.aviso-error code, .aviso-error pre {
  background: var(--tarjeta); padding: 2px 6px; border-radius: 4px;
  font-family: 'Courier New', monospace; font-size: 0.85rem;
}
.aviso-error pre { display: block; padding: 10px 14px; margin: 8px 0; overflow-x: auto; }
#errorMapa { color: #8a1c1c; margin-top: 10px; }
footer { margin-top: 40px; text-align: center; font-size: 0.8rem; color: var(--texto-suave); }

/* =========================================================
   RESPONSIVE Y MOVIMIENTO REDUCIDO
   ========================================================= */
@media (max-width: 480px) {
  .lista-lugares { grid-template-columns: 1fr; padding: 16px; }
  .encabezado { padding: 0 14px 40px; }
  .portada { padding: 90px 14px 110px; }
  .detalle-cuerpo { padding: 18px 18px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .punto-mapa, .tarjeta-lugar, .portada-boton { transition: none; }
  #detalleLugar[open] { animation: none; }
}
