/* =============================================================
   RUTAS — barra de recorrido sobre el mapa 2D (modo ruta).
   Usa las variables de color de estilos.css.
   ============================================================= */

/* Mientras dura una ruta, los filtros y la leyenda no sirven (el resto de
   detectives está oculto) y se esconden para dejar sitio al mapa. */
body.en-ruta .filters,
body.en-ruta .legend { display: none; }

.ruta-barra {
  display: none;
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, calc(100% - 24px));
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 4px 12px var(--shadow-deep);
  padding: 10px 14px 12px;
  z-index: 1050;
}
body.en-ruta .ruta-barra { display: block; }

.ruta-cabecera {
  flex-wrap: nowrap;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ruta-nombre {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ruta-cerrar {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s;
  white-space: nowrap;
}
.ruta-cerrar:hover { text-decoration-color: var(--accent); }
.ruta-acciones { display: flex; align-items: baseline; gap: 16px; flex-shrink: 0; }
.ruta-compartir { color: var(--ink-faded); }
.ruta-compartir:hover { text-decoration-color: var(--ink-faded); }

/* Botón flotante «Rutas»: solo en móvil, donde sustituye al desplegable */
.ruta-flotante {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1040;
  text-align: right;
}
body.en-ruta .ruta-flotante { display: none; }
.ruta-flotante-boton {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--paper);
  background: var(--ink-soft);
  border: 1px solid var(--ink-soft);
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow-deep);
}
.ruta-flotante-lista {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 4px 12px var(--shadow-deep);
  min-width: 190px;
  text-align: left;
}
.ruta-flotante-lista[hidden] { display: none; }
.ruta-flotante-lista button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
}
.ruta-flotante-lista button:hover { color: var(--accent); background: var(--paper-dark); }

/* Bloque «Prueba una ruta» de la portada */
.rutas-section { text-align: center; padding: 8px 0 28px; }
.rutas-section[hidden] { display: none; }
.rutas-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.rutas-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-faded);
  margin-bottom: 16px;
}
.rutas-lista {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  padding: 0;
}
.ruta-enlace {
  display: inline-block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 8px 18px;
  transition: all 0.15s;
}
.ruta-enlace:hover { color: var(--accent); border-color: var(--accent); }

/* La «i» de aviso dentro del botón de la portada */
.ruta-item { position: relative; }
.ruta-enlace.con-info { padding-right: 46px; }
.ruta-info-portada {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  font-size: 14px;
}
.rutas-aviso {
  position: relative;
  max-width: 560px;
  margin: 18px auto 0;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 4px 12px var(--shadow);
  padding: 12px 40px 14px 16px;
}
.rutas-aviso[hidden] { display: none; }
.rutas-aviso-titulo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.rutas-aviso p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}

/* Aviso de la ruta: tarjeta sobre la barra, solo cuando se pulsa la «i» */
.ruta-titulo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ruta-info {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-faded);
  background: transparent;
  border: 1px solid var(--ink-faded);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.ruta-info[hidden] { display: none; }
.ruta-info:hover, .ruta-info[aria-expanded="true"] { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.ruta-info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ruta-aviso {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 4px 12px var(--shadow-deep);
  padding: 12px 38px 12px 14px;
  max-height: 45vh;
  overflow-y: auto;
}
.ruta-aviso[hidden] { display: none; }
.ruta-aviso p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}
.ruta-aviso-cerrar {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 15px;
  color: var(--ink-faded);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.ruta-aviso-cerrar:hover { color: var(--accent); }

.ruta-controles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.ruta-boton {
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--paper);
  background: var(--ink-soft);
  border: 1px solid var(--ink-soft);
  padding: 9px 14px;
  min-width: 112px;
  cursor: pointer;
  transition: background 0.15s;
}
.ruta-boton:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.ruta-boton:disabled { opacity: 0.35; cursor: default; }
.ruta-boton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ruta-indicador {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-faded);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .filtro-ruta { display: none; }
  .ruta-flotante { display: block; }
  body.en-ruta .ruta-flotante { display: none; }
  .ruta-barra { bottom: 10px; padding: 8px 10px 10px; }
  .ruta-nombre {
    font-size: 18px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .ruta-cabecera { align-items: flex-start; }
  .ruta-boton { flex: 1; min-width: 0; padding: 12px 6px; white-space: normal; line-height: 1.2; }
  .ruta-indicador { flex-shrink: 0; }
}
