/* Simulador de Matrícula — pieces unique to this tool only (result panel,
   timeline scrubber, line chart, population pyramid). Layout chrome
   (.sim-shell/.sim-panel/.sim-field/.scenario-group/.chart-card) comes
   from simulador.css, shared with the other simulators for a consistent
   look — load that file on this page too. */

/* Guía de uso (reused inside the sidebar panel) */
.sim-guide {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}

.sim-guide-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.sim-guide-steps { display: grid; gap: 0.85rem; }

.sim-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.sim-guide-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
}

/* Panel principal de resultado */
.sim-result {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.75rem;
  margin-bottom: var(--gutter);
  position: relative;
  overflow: hidden;
}

.sim-result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-align: center;
}

.sim-result-label span { color: var(--wine); font-weight: 800; }

.sim-hero-number {
  font-family: var(--font-serif);
  font-size: 3.6rem;
  font-weight: 500;
  text-align: center;
  color: var(--ink);
  line-height: 1.05;
  margin: 0.35rem 0 0.15rem;
  letter-spacing: -0.02em;
  transition: color 0.4s var(--ease);
}

@media (max-width: 560px) { .sim-hero-number { font-size: 2.6rem; } }

.sim-hero-number.falling { color: var(--wine); }
.sim-hero-number.rising { color: var(--gold); }

.sim-delta {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
}

.sim-delta .arrow { font-size: 1rem; line-height: 1; }
.sim-delta.falling { color: var(--wine); }
.sim-delta.rising { color: var(--gold); }
.sim-delta .muted { color: var(--ink-soft); font-weight: 500; }

/* Timeline / scrubber */
.sim-timeline { display: flex; align-items: center; gap: 0.75rem; }

.sim-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
  padding: 0;
}

.sim-play-btn:hover { background: var(--gold); color: var(--bg); }
.sim-play-btn svg { width: 15px; height: 15px; }

.sim-year-track { flex-grow: 1; position: relative; }

.sim-year-label {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

input[type="range"].sim-slider {
  width: 100%;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"].sim-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--gold);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
input[type="range"].sim-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }

input[type="range"].sim-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--gold); cursor: pointer;
}

/* Gráfica de línea (matrícula proyectada) */
.sim-chart-svg { width: 100%; height: auto; display: block; overflow: visible; margin-top: 1rem; }

.sim-chart-path {
  fill: none;
  stroke: var(--wine);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: d 0.5s var(--ease), stroke 0.4s var(--ease);
}

.sim-chart-area { transition: d 0.5s var(--ease), opacity 0.4s var(--ease); }

.sim-chart-dot {
  fill: var(--ink);
  stroke: var(--gold);
  stroke-width: 2.5;
  transition: cx 0.25s linear, cy 0.25s linear;
}

.sim-chart-dot-glow {
  fill: var(--gold);
  opacity: 0.18;
  transition: cx 0.25s linear, cy 0.25s linear;
}

.sim-chart-axis text { font-family: var(--font-sans); font-size: 9px; fill: var(--ink-soft); }

/* Pirámide poblacional */
.sim-pyramid-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sim-pyramid-legend { display: flex; gap: 1rem; font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); }
.sim-pyramid-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.sim-pyramid-legend .swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.sim-pyramid-legend .swatch.men { background: var(--wine); }
.sim-pyramid-legend .swatch.women { background: var(--gold); }

.sim-pyramid-svg { width: 100%; height: auto; display: block; overflow: visible; margin-top: 1rem; }
.sim-pyramid-bar { transition: x 0.35s var(--ease), width 0.35s var(--ease); }
.sim-pyramid-bar.men { fill: var(--wine); }
.sim-pyramid-bar.women { fill: var(--gold); }
text.sim-pyramid-axis { font-family: var(--font-sans); font-size: 8px; fill: var(--ink-soft); }

.sim-pyramid-note { font-size: 0.76rem; color: var(--ink-soft); margin-top: 0.75rem; line-height: 1.5; }

/* Fuentes */
.sim-sources { font-size: var(--step--1); color: var(--ink-soft); line-height: 1.6; }
.sim-sources strong { color: var(--ink); }

/* Pulso sutil de énfasis al soltar el slider */
@keyframes sim-pulse {
  0% { box-shadow: 0 0 0 0 rgba(176, 141, 87, 0.35); }
  100% { box-shadow: 0 0 0 10px rgba(176, 141, 87, 0); }
}
.sim-result.pulse { animation: sim-pulse 0.6s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .sim-hero-number, .sim-chart-path, .sim-chart-area, .sim-chart-dot, .sim-chart-dot-glow{
    transition: none !important;
  }
  .sim-result.pulse { animation: none !important; }
}
