/* ============================================
   ESTILOS PULSO (PUENTE DE HERENCIA)
   ============================================ */

#pulso_canvas {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #fff;

  background-image: linear-gradient(#eee 1px, transparent 1px);
  background-size: 100% 26px;
  background-position: 0px 0px;
  background-repeat: repeat;
}

.guia_vertical {
  stroke: #eee;
  stroke-width: 1;
}
.guia_lustro {
  stroke: #e2e0e0;
  stroke-width: 1;
}

.contenedor_grafico {
  flex-grow: 1;
  width: 100%;
  position: relative;
  display: flex;
}
.contenedor_grafico svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.boton_flotante_hitos {
  display: none;
}

/* LÍNEAS */
/* La línea que el usuario VE */
.linea_visual {
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.15));
  opacity: 0.8;
  transition:
    opacity 0.3s ease,
    stroke-width 0.3s ease;
  pointer-events: none;
}

/* La línea que SE VE */
.linea_visual {
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.15));
  opacity: 0.8;
  transition:
    opacity 0.3s ease,
    stroke-width 0.3s ease;
  pointer-events: none; /* Importante: el mouse la atraviesa */
}

/* El SENSOR INVISIBLE (área de hit de 20px) */
.linea_sensor {
  fill: none;
  stroke: transparent;
  stroke-width: 20px;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  pointer-events: stroke; /* Solo reacciona a la línea, no al fondo */
}

/* Efecto Hover: Cuando tocas el sensor, iluminamos la visual */
.linea_sensor:hover + .linea_visual {
  opacity: 1;
  stroke-width: 2.5px;
}
.linea_total {
  stroke: var(--sistema-color);
  filter: drop-shadow(0 0 10px rgba(0, 148, 184, 0.4));
}

/* REFERENCIA (LEYENDA) */
#leyenda_items {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 20px;
}
.leyenda_item {
  cursor: default !important;
  pointer-events: none;
  animation: fadeIn 0.4s ease forwards;
}

/* --- ESTILOS TIRAS SVG --- */
.hito_circulo {
  fill: #ffcc00;
  stroke: #fff;
  stroke-width: 1.5px;
  r: 7; /* Radio unificado por CSS */
}

.edades_label {
  fill: #444;
  font-family: var(--font-principal);
  font-size: 13px;
  font-weight: 400;
  text-transform: lowercase;
}

.anio {
  font-family: var(--font-principal);
  font-size: 13px;
  font-weight: 700; /* Mantenemos el bold solo para el año */
}

.edades_bg_svg {
  fill: rgba(255, 249, 224, 0.5);
}

.crono_bg_svg {
  fill: #ffffff;
}

.borde_tira_svg {
  stroke: #777;
  stroke-width: 0.8px;
}

/* Evitar recortes en los bordes del SVG */
svg {
  overflow: visible !important;
}

/* --- INTEGRACIÓN FILTROS SIDEBAR --- */

#seccion_filtros {
  border-top: 1px dashed #ccc;
  padding: 18px 0 0;
}

.btn_reiniciar {
  margin: 10px 0 15px;
  display: inline-block;
}

.btn_reiniciar.modo-limpiar {
  background: transparent;
  border: 1px dashed #ccc;
  color: #999;
  font-weight: normal;
}

/* ETIQUETAS SVG (HERENCIA DIRECTA) */
.ejes_contenedor .anio,
.ejes_contenedor .edades {
  fill: #444;
}

.label_eje_y {
  font-family: var(--font-principal);
  font-size: 9px;
  font-weight: 700;
  fill: var(--sistema-color);
  opacity: 0.4;
  letter-spacing: 2px;
}

/* GRID VISTA SEPARADA */
.contenedor_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  padding: 20px;
  overflow-y: auto;
  background: #fff;
}
.mini_grafico_wrapper {
  padding: 10px;
  height: 30vh;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #ddd;
  margin: 10px;
}
.mini_grafico_titulo {
  font-family: var(--font-principal);
  font-weight: 700;
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 5px;
}

@keyframes escribir {
  to {
    stroke-dashoffset: 0;
  }
}
.animar_linea {
  stroke-dasharray: 3000;
  stroke-dashoffset: 3000;
  animation: escribir 2.5s ease-out forwards;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
  }
}

/* ============================================
   RESPONSIVE - Mobile
   ============================================ */

@media only screen and (max-device-width: 480px) {
  body {
    margin: 0;
    padding: 0;
    min-height: 110dvh;
    min-height: calc(100dvh + 100px);
    scroll-behavior: smooth;
  }
  .mvl_titulo {
    position: sticky;
    top: 0;
  }
  .boton_flotante_hitos {
    left: auto;
    right: 20px;
    bottom: 25px;
    z-index: 10;
  }
  .menu_linea .enlace_idioma {
    top: 15px;
  }
  .menu_linea {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 40dvh;
    margin-bottom: 5dvh;
    max-height: none;
    padding: 25px;
    visibility: visible;
    overflow: scroll;
    box-shadow: 0 -7px 15px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }
  #pulso_canvas {
    position: fixed;
    top: 5dvh;
    height: 48dvh;
    background-size: 100% 13px;
  }
  rect.edades_bg_svg {
    fill: #fff;
    border-bottom: 1px solid #ccc;
  }
  .contenedor_grafico {
    padding: 0 14px;
  }
  .contenedor_grid {
    grid-template-columns: 1fr !important;
    padding: 10px;
  }

  .anio:nth-child(4n-2 of .anio) {
    display: none;
  }
  .anio:nth-child(odd of .anio),
  .edades_label:nth-child(even of .edades_label),
  .hito_circulo:nth-child(even of .hito_circulo),
  .edades_label:nth-child(4n-1 of .edades_label),
  .hito_circulo:nth-child(4n-1 of .hito_circulo) {
    display: none;
  }

  .ejes_contenedor .anio,
  .ejes_contenedor .edades_label {
    font-size: 10px;
    letter-spacing: 0px;
  }
  .mini_grafico_wrapper {
    width: 100% !important;
    height: 20vh;
    margin: 10px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  .mini_grafico_svg {
    flex-grow: 1;
    width: 100%;
    height: 100%;
  }
  .zona_scroll {
    height: 20dvh;
    opacity: 0;
    pointer-events: none;
  }
}
