/* main.css — Observatorio de Lucha Social
 * Tokens DS Casa Marx v1.0 + @font-face + reset + layout base
 * Ruta: mapa/assets/css/main.css
 */

/* ─── @font-face ─────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Aileron';
  src: url('fonts/aileron/Aileron-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Aileron';
  src: url('fonts/aileron/Aileron-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Aileron';
  src: url('fonts/aileron/Aileron-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sauce One';
  src: url('fonts/open-sauce-one/OpenSauceOne-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sauce One';
  src: url('fonts/open-sauce-one/OpenSauceOne-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sauce One';
  src: url('fonts/open-sauce-one/OpenSauceOne-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

/* ─── Tokens DS Casa Marx v1.0 ───────────────────────────────────────────── */

:root {
  /* Paleta base */
  --rojo:       #6D0A0A;
  --azul:       #08273B;
  --amarillo:   #CD790B;
  --verde:      #3F481B;
  --crema:      #F2F0EC;
  --hueso:      #E8E5DD;
  --gris-texto: #3A3A3A;
  --gris-sutil: #C8C8C8;

  /* Modo oscuro permanente */
  --dark-bg:      #0D0D0D;
  --dark-surface: #08273B;
  --dark-text:    #F2F0EC;
  --dark-accent:  #CD790B;

  /* Estructura */
  --radius:    4px;
  --sidebar-w: 260px;
  --maxw:      960px;

  /* Espaciado (escala 4px) */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-7: 28px;  --space-8: 32px;
  --space-9: 36px;  --space-10: 40px; --space-11: 44px; --space-12: 48px;

  /* Escala tipográfica */
  --text-xs:   12px;  --text-sm:   14px;  --text-base: 16px;
  --text-md:   18px;  --text-lg:   22px;  --text-xl:   28px;
  --text-2xl:  36px;  --text-3xl:  48px;  --text-4xl:  64px;

  /* Z-index */
  --z-base:     1;
  --z-dropdown: 100;
  --z-modal:    1000;
  --z-tooltip:  1500;

  /* Nodos del mapa / grafo */
  --nodo-persona:         #CD790B;
  --nodo-organizacion:    #6D0A0A;
  --nodo-lugar:           #3F481B;
  --nodo-evento-proceso:  #08273B;
  --nodo-evento-accion:   #F2F0EC;
  --nodo-documento:       #3A3A3A;

  /* Grafo */
  --arista-color:  #F2F0EC;
  --arista-hover:  #CD790B;
  --canvas-bg:     #0D0D0D;
  --legend-bg:     #08273B;
}

/* ─── Reset mínimo ───────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Aileron', 'Barlow Condensed', sans-serif;
  background-color: var(--dark-bg);
  color: var(--dark-text);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--amarillo);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

/* ─── Layout base del mapa ───────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#map-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

#map {
  flex: 1;
  height: 100%;
  position: relative;
}

/* ─── Heatmap pill-bar (top center del mapa) ─────────────────────────────── */

#heat-pill-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  gap: 2px;
  background: var(--dark-surface);
  border: 1px solid var(--rojo);
  padding: 3px;
  pointer-events: all;
}

#heat-pill-bar[hidden] { display: none; }

.heat-pill {
  font-family: 'Aileron', sans-serif;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242, 240, 236, 0.55);
  background: transparent;
  border: none;
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.heat-pill:hover {
  color: var(--crema);
}

.heat-pill.active {
  background: var(--rojo);
  color: var(--crema);
}

/* ─── Leyenda de heatmap ──────────────────────────────────────────────────── */

#heat-legend {
  position: absolute;
  bottom: 28px;
  right: 12px;
  z-index: 500;
  background: var(--legend-bg);
  border: 1px solid var(--rojo);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  pointer-events: none;
}

#heat-legend[hidden] { display: none; }

.heat-legend-title {
  font-family: 'Aileron', sans-serif;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gris-sutil);
}

.heat-legend-bar {
  width: 140px;
  height: 10px;
  border-radius: 0;
}

.heat-legend-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--gris-sutil);
}

/* ─── Leyenda de procesos ─────────────────────────────────────────────────── */

#heat-proceso-legend {
  position: absolute;
  bottom: 28px;
  right: 12px;
  z-index: 500;
  background: var(--legend-bg);
  border: 1px solid var(--rojo);
  padding: var(--space-2) var(--space-3);
  max-height: 260px;
  overflow-y: auto;
  min-width: 180px;
  max-width: 240px;
}

#heat-proceso-legend[hidden] { display: none; }

.proceso-legend-list {
  list-style: none;
  margin: var(--space-1) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.proceso-legend-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.proceso-legend-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 2px;
}

.proceso-legend-name {
  font-family: 'Aileron', sans-serif;
  font-size: 11px;
  color: var(--crema);
  line-height: 1.3;
}

.proceso-legend-name em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: var(--gris-sutil);
}