/* ============================================================
   GenNarrativa AI — CAPA DESTILADO (nexus_destilado.css) v1.0
   ============================================================
   Carga DESPUÉS de styles_v3.css. No reemplaza el sistema:
   lo corrige por encima. Quitar este archivo = revertir todo.

   Qué hace:
   1. ESCALA TIPOGRÁFICA — piso de 12px; elimina los 8-11px que
      producían la textura "ladrillo". Inter para UI, Fraunces
      para títulos editoriales, Lora opcional para lectura.
   2. DOS REGISTROS — superficies de escritura (Guion, Biblia)
      en modo "estudio": calmas, columna legible, sin glow.
      Superficies analíticas (Análisis, Rendimiento) conservan
      la estética Nexus, que pasa de ruido a firma.
   3. NAVEGACIÓN AGRUPADA — Diseña / Estructura / Escribe /
      Sistema, con separadores en escritorio y etiquetas al
      expandir.
   4. PLEGADO — estilos para <details class="gnx-fold"> que
      ui_destilado.js aplica al formulario de personajes.
   5. MOVIMIENTO — respeta prefers-reduced-motion.
   ============================================================ */

/* ------------------------------------------------------------
   0. TOKENS DE LA CAPA
   ------------------------------------------------------------ */
:root {
  /* Escala tipográfica (piso absoluto: 12px) */
  --fs-xs: 12px;      /* micro-etiquetas, badges, eyebrows     */
  --fs-sm: 13px;      /* labels de formulario, botones de barra */
  --fs-base: 14px;    /* cuerpo de UI                           */
  --fs-md: 16px;      /* cuerpo destacado, inputs               */
  --fs-read: 17px;    /* lectura larga (editor de guion)        */
  --fs-lg: 19px;      /* títulos de panel                       */
  --fs-xl: 24px;      /* títulos de sección                     */
  --lh-ui: 1.45;
  --lh-read: 1.75;

  --font-ui: 'Inter', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;   /* títulos editoriales */
  --font-read: 'Lora', Georgia, serif;          /* lectura opcional    */

  /* Estudio: superficie calma para escribir */
  --studio-bg: #0d1017;
  --studio-panel: #12161f;
  --studio-border: #232a38;
  --studio-ink: #e8e6df;        /* tinta cálida, no blanco frío */
  --studio-dim: #9aa3b5;
}

/* ------------------------------------------------------------
   1. RE-ESCALA TIPOGRÁFICA GLOBAL
   Sobreescribe los 21 selectores que vivían entre 8 y 11px.
   ------------------------------------------------------------ */
body { font-size: var(--fs-base); line-height: var(--lh-ui); }

/* Micro-etiquetas y badges: de 8-10px → 12px */
.badge, .genre-tag, .brain-pill, .pill::after,
.act-axis-label, .actant-role, .rubik-legend,
.lego-subtitle, .esc-label, .trait-label,
.selector-label, .toolbar-label, .xp-bar-label {
  font-size: var(--fs-xs) !important;
  letter-spacing: 0.04em;
}

/* Labels e inputs de formulario: de 10-11px → 13-14px */
.form-group label { font-size: var(--fs-sm) !important; }
.form-group input, .form-group select, .form-group textarea,
.esc-step input { font-size: var(--fs-base) !important; }

/* Botones de barras de herramientas: de 10-11px → 13px */
.metz-toolbar button, .script-toolbar button {
  font-size: var(--fs-sm) !important;
  padding-top: 6px; padding-bottom: 6px;
}

/* Texto secundario que estaba en 10-11px */
.char-info-nexus p, .export-option p { font-size: var(--fs-sm) !important; line-height: 1.5; }
.export-option h5 { font-size: var(--fs-base) !important; }

/* Títulos de panel: jerarquía real */
.panel-header h3 {
  font-size: 15px;
  letter-spacing: 0.02em;
  font-weight: 600;
}

/* Etiquetas del sidebar al expandir (móvil): 11px → 12px */
@media (max-width: 1024px) {
  .nav-label { font-size: var(--fs-xs) !important; }
}

/* ------------------------------------------------------------
   2. REGISTRO DE ESTUDIO — Guion y Biblia
   Donde se escribe, la interfaz se aparta.
   ------------------------------------------------------------ */
#section-script, #section-bible {
  background: var(--studio-bg);
}

#section-script .panel, #section-bible .panel {
  background: var(--studio-panel);
  border: 1px solid var(--studio-border);
  box-shadow: none;              /* fuera glow: aquí no hay dashboard */
}

#section-script .panel-header h3,
#section-bible .panel-header h3,
#bible-article-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--studio-ink);
}

/* El editor: columna de lectura, tinta cálida, aire */
.script-textarea {
  font-size: var(--fs-read) !important;
  line-height: var(--lh-read) !important;
  max-width: 72ch;
  margin: 0 auto;
  display: block;
  padding: 28px 24px !important;
  color: var(--studio-ink) !important;
  background: transparent !important;
  border: none !important;
  caret-color: var(--accent-purple, #a78bfa);
}
.script-textarea:focus { outline: none; box-shadow: none !important; }

/* Modo serif de lectura (toggle "Aa" que inyecta ui_destilado.js) */
body.gnx-serif .script-textarea { font-family: var(--font-read) !important; }

/* Contadores de palabras: presentes pero discretos */
#script-word-count, #script-page-count {
  font-size: var(--fs-xs);
  color: var(--studio-dim);
}

/* Biblia: el documento maestro se lee como documento */
#section-bible .panel-body {
  font-size: var(--fs-md);
  line-height: 1.7;
  max-width: 76ch;
}

/* La Escaleta queda a medio camino: estructural pero sin glow */
#section-beatsheet .panel { box-shadow: none; }

/* ------------------------------------------------------------
   3. NAVEGACIÓN AGRUPADA
   ------------------------------------------------------------ */
.gnx-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12); /* separador en escritorio */
}
.gnx-group:last-child { border-bottom: none; margin-bottom: 0; }

/* Etiqueta de grupo: oculta en el dock de iconos, visible al expandir */
.gnx-group-label {
  display: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.55);
  padding: 6px 12px 2px;
}
@media (max-width: 1024px) {
  .sidebar.expanded .gnx-group-label { display: block; }
}

/* Divulgación progresiva: secciones aún no desbloqueadas */
.nav-btn.gnx-locked { display: none !important; }

/* Píldora "ver todo" que inyecta ui_destilado.js */
.gnx-nav-toggle {
  margin: 4px 8px 0;
  padding: 6px 8px;
  background: none;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  color: rgba(148, 163, 184, 0.7);
  font: 500 var(--fs-xs) var(--font-ui);
  cursor: pointer;
  width: calc(100% - 16px);
}
.gnx-nav-toggle:hover { color: var(--accent-purple, #a78bfa); border-color: var(--accent-purple, #a78bfa); }

/* ------------------------------------------------------------
   4. PLEGADO DE FORMULARIOS (ficha de personaje por capas)
   ------------------------------------------------------------ */
details.gnx-fold {
  margin-top: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  overflow: hidden;
}
details.gnx-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  font: 600 var(--fs-sm) var(--font-ui);
  color: var(--accent-purple, #a78bfa);
  background: rgba(124, 58, 237, 0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
details.gnx-fold > summary::-webkit-details-marker { display: none; }
details.gnx-fold > summary::before {
  content: '▸';
  transition: transform 0.15s ease;
}
details.gnx-fold[open] > summary::before { transform: rotate(90deg); }
details.gnx-fold > .gnx-fold-body { padding: 6px 14px 14px; }

/* ------------------------------------------------------------
   5. MOVIMIENTO DISCIPLINADO
   tetrisDrop se conserva como firma; el resto baja el volumen.
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* En el estudio no hay animaciones ambientales: solo el texto */
#section-script *, #section-bible * {
  animation-name: none;
}
#section-script .panel, #section-bible .panel { animation: none; }
