/* =================================================================
   MENTOR GUADIANA — Design System v2
   Paleta unificada: logo amber #C9A84C · azul noche #060F1E
   Fuentes: Inter (UI) + JetBrains Mono (datos/código)
   Inyectado como última hoja en todas las páginas MG.
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ----------------------------------------------------------------
   TOKENS — modo oscuro (default, identidad de marca)
   ---------------------------------------------------------------- */
:root {
  /* Fondo — azul noche del logo */
  --mg-bg:      #060F1E;
  --mg-bg1:     #0A1628;
  --mg-bg2:     #0F2440;
  --mg-bg3:     #132B50;
  --mg-line:    rgba(48, 54, 61, .85);
  --mg-line2:   rgba(48, 54, 61, .40);

  /* Marca — amber #C9A84C */
  --mg-amber:       #C9A84C;
  --mg-amber2:      #fbbf24;
  --mg-amber-dim:   rgba(201, 168, 76, .09);
  --mg-amber-glow:  rgba(201, 168, 76, .18);
  --mg-amber-dark:  #a8872e;

  /* Texto */
  --mg-text:    #f0f6fc;
  --mg-muted:   #8b949e;
  --mg-low:     #c9d1d9;

  /* Semánticos */
  --mg-emerald: #10b981;
  --mg-rose:    #f43f5e;
  --mg-blue:    #3b82f6;

  /* Tipografía */
  --mg-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --mg-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Sombras */
  --mg-shadow:  0 8px 32px rgba(0, 0, 0, .45);
  --mg-shadow2: 0 2px 8px rgba(0, 0, 0, .30);

  /* -------------------------------------------------------
     ALIASES — retrocompatibilidad con variables existentes
     Todas las páginas usan alguna combinación de estas.
     Al redefinirlas aquí (cargado último) se unifican.
     ------------------------------------------------------- */

  /* Fondos — las páginas "light" usaban --paper: #f8fafc */
  --paper:        #060F1E;
  --bg:           #060F1E;
  --bg0:          #060F1E;
  --bg1:          #0A1628;
  --bg2:          #0F2440;
  --bg3:          #132B50;

  /* Texto — las páginas "light" usaban --ink: #0f172a */
  --ink:          #f0f6fc;
  --text:         #f0f6fc;
  --muted:        #8b949e;
  --low:          #c9d1d9;
  --slate:        #8b949e;

  /* Marca */
  --amber:        #C9A84C;
  --amber2:       #fbbf24;
  --amber-dim:    rgba(201, 168, 76, .09);
  --amber-glow:   rgba(201, 168, 76, .18);
  --amber-dark:   #a8872e;

  /* Override: páginas que usaban --green para CTAs → amber */
  --green:        #C9A84C;
  --green-dark:   #a8872e;
  --green-soft:   rgba(201, 168, 76, .09);
  --green-dim:    rgba(201, 168, 76, .09);

  /* Override: emprendimiento usaba --capi: #6d28d9 (violeta) → amber */
  --capi:         #C9A84C;
  --capi-dark:    #a8872e;
  --capi-soft:    rgba(201, 168, 76, .09);

  /* Semánticos */
  --emerald:      #10b981;
  --emerald-dim:  rgba(16, 185, 129, .09);
  --rose:         #f43f5e;
  --blue:         #3b82f6;
  --blue-dim:     rgba(59, 130, 246, .09);

  /* Bordes */
  --line:         rgba(48, 54, 61, .85);
  --line2:        rgba(48, 54, 61, .40);
  --border:       rgba(48, 54, 61, .85);
  --border-hover: rgba(201, 168, 76, .45);

  /* Tipografía — unifica todas las variantes */
  --sans:         'Inter', system-ui, sans-serif;
  --mono:         'JetBrains Mono', monospace;
  --serif:        'Inter', system-ui, sans-serif;  /* no serif en MG */
  --display:      'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Shadow */
  --shadow:       0 8px 32px rgba(0, 0, 0, .45);
}

/* ----------------------------------------------------------------
   MODO LIGHT — dark-softer (no blanco, respeta la marca)
   Activado por preferencia del sistema
   ---------------------------------------------------------------- */
@media (prefers-color-scheme: light) {
  :root {
    --mg-bg:    #0C1A30;
    --mg-bg1:   #102035;
    --mg-bg2:   #14273E;
    --mg-bg3:   #192F4A;
    --mg-text:  #EBF1F8;
    --mg-muted: #8DA0B5;
    --mg-low:   #C0CEDB;
    --mg-line:  rgba(60, 70, 85, .80);

    /* Aliases */
    --paper:  #0C1A30;
    --bg:     #0C1A30;
    --bg0:    #0C1A30;
    --bg1:    #102035;
    --bg2:    #14273E;
    --bg3:    #192F4A;
    --ink:    #EBF1F8;
    --text:   #EBF1F8;
    --muted:  #8DA0B5;
    --low:    #C0CEDB;
    --line:   rgba(60, 70, 85, .80);
    --border: rgba(60, 70, 85, .80);
    --shadow: 0 8px 32px rgba(0, 0, 0, .55);
  }
}

/* ----------------------------------------------------------------
   BASE — aplicado a todas las páginas MG
   ---------------------------------------------------------------- */
html {
  color-scheme: dark;
}

body {
  background-color: var(--mg-bg) !important;
  color: var(--mg-text) !important;
  font-family: var(--mg-sans) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--mg-sans) !important;
  color: var(--mg-text);
}

p { color: inherit; }

/* Links */
a:not([class*="btn"]):not([class*="cta"]):not([class*="nav"]) {
  color: var(--mg-amber);
}
a:not([class*="btn"]):not([class*="cta"]):not([class*="nav"]):hover {
  color: var(--mg-amber2);
}

/* ----------------------------------------------------------------
   NAVEGACIÓN — unifica todos los patrones de nav
   ---------------------------------------------------------------- */
nav,
.nav,
header nav,
.nav-inner {
  background: rgba(6, 15, 30, .92) !important;
  border-bottom-color: var(--mg-line) !important;
  backdrop-filter: blur(16px) !important;
}

/* ----------------------------------------------------------------
   CARDS — unifica .card de las páginas light (tenían fondo blanco)
   ---------------------------------------------------------------- */
.card,
.grid-2 .card,
.feature-card {
  background: var(--mg-bg1) !important;
  border-color: var(--mg-line) !important;
  color: var(--mg-text) !important;
}

.card h3, .card h4, .card strong {
  color: var(--mg-text) !important;
}

.card p, .card span {
  color: var(--mg-muted);
}

/* ----------------------------------------------------------------
   TABLAS — contraste en páginas oscuras
   ---------------------------------------------------------------- */
table { color: var(--mg-text); }
th {
  background: var(--mg-bg2);
  color: var(--mg-low);
  border-color: var(--mg-line);
}
td {
  border-color: var(--mg-line);
  color: var(--mg-text);
}
tr:hover td { background: var(--mg-bg1); }

/* ----------------------------------------------------------------
   ALERTAS E INFO BOXES — corrección de cajas con fondo claro
   ---------------------------------------------------------------- */
.alert-box,
.info-box,
.notice,
[class*="alert"],
[class*="callout"] {
  background: var(--mg-bg2) !important;
  border-color: var(--mg-line) !important;
  color: var(--mg-text) !important;
}

/* ----------------------------------------------------------------
   FORMULARIOS
   ---------------------------------------------------------------- */
input, textarea, select {
  background: var(--mg-bg1) !important;
  color: var(--mg-text) !important;
  border-color: var(--mg-line) !important;
}
input::placeholder, textarea::placeholder {
  color: var(--mg-muted) !important;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--mg-amber) !important;
  outline: none;
}

/* ----------------------------------------------------------------
   BOTONES — unifica CTAs
   ---------------------------------------------------------------- */
.btn-primary,
.nav-cta,
a[href*="/entrar"][class*="btn"],
a[href*="/chat"][class*="btn"] {
  background: var(--mg-amber) !important;
  color: var(--mg-bg) !important;
  font-family: var(--mg-sans) !important;
}
.btn-primary:hover,
.nav-cta:hover {
  background: var(--mg-amber2) !important;
}

/* ----------------------------------------------------------------
   CORRECCIONES DE TEXTOS HARDCODED
   Colores oscuros (#0f172a, #1e293b, etc.) que quedan invisibles
   sobre fondo oscuro en páginas que venían de light.
   ---------------------------------------------------------------- */
[style*="color:#0f172a"],
[style*="color: #0f172a"],
[style*="color:#1e293b"],
[style*="color: #1e293b"],
[style*="color:#334155"],
[style*="color: #334155"],
[style*="color:#475569"],
[style*="color: #475569"],
[style*="color:#64748b"],
[style*="color: #64748b"],
[style*="color:#111827"],
[style*="color: #111827"] {
  color: var(--mg-text) !important;
}

/* Fondos hardcoded claros que deben ser oscuros */
[style*="background:#f8fafc"],
[style*="background: #f8fafc"],
[style*="background:#ffffff"],
[style*="background: #ffffff"],
[style*="background:#fff"],
[style*="background: #fff"],
[style*="background-color:#f8fafc"],
[style*="background-color: #f8fafc"],
[style*="background-color:#fff"],
[style*="background-color: #fff"] {
  background: var(--mg-bg1) !important;
}

/* ----------------------------------------------------------------
   FOOTER — unifica el footer en todas las páginas
   ---------------------------------------------------------------- */
footer {
  background: var(--mg-bg) !important;
  border-top-color: var(--mg-line) !important;
  color: var(--mg-muted) !important;
  font-family: var(--mg-sans) !important;
}
footer a {
  color: var(--mg-muted) !important;
}
footer a:hover {
  color: var(--mg-amber) !important;
}
.footer-brand {
  color: var(--mg-text) !important;
  font-family: var(--mg-sans) !important;
}

/* ----------------------------------------------------------------
   GRID TEXTURE — unifica el fondo reticulado de MG
   (solo en páginas que NO lo tienen definido ya)
   ---------------------------------------------------------------- */
body:not([data-notexture])::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(48, 54, 61, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, .12) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ----------------------------------------------------------------
   SCROLLBAR — dark branded
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--mg-bg); }
::-webkit-scrollbar-thumb { background: var(--mg-line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--mg-amber-dark); }

/* ----------------------------------------------------------------
   AMPLIACIÓN v2.1 — Alert boxes semánticas + textos dark hardcoded
   Cubre los patrones encontrados en mg-startups/*.html y legales
   ---------------------------------------------------------------- */

/* Alert boxes — rojo */
[style*="background:#fee2e2"],[style*="background: #fee2e2"],
[style*="background:#fef2f2"],[style*="background: #fef2f2"],
[style*="background:#fff5f5"],[style*="background: #fff5f5"],
[style*="background:#fef2f2"],[style*="background:#fff1f2"],
[style*="background-color:#fee2e2"],[style*="background-color:#fef2f2"] {
  background: rgba(239,68,68,.10) !important;
  border-left-color: rgba(239,68,68,.45) !important;
}

/* Alert boxes — azul */
[style*="background:#eff6ff"],[style*="background: #eff6ff"],
[style*="background:#dbeafe"],[style*="background: #dbeafe"],
[style*="background:#e0f2fe"],[style*="background: #e0f2fe"],
[style*="background:#bfdbfe"],[style*="background: #bfdbfe"],
[style*="background-color:#eff6ff"],[style*="background-color:#dbeafe"] {
  background: rgba(59,130,246,.10) !important;
  border-left-color: rgba(59,130,246,.45) !important;
}

/* Alert boxes — amarillo/ámbar */
[style*="background:#fffbeb"],[style*="background: #fffbeb"],
[style*="background:#fef3c7"],[style*="background: #fef3c7"],
[style*="background:#fff7ed"],[style*="background: #fff7ed"],
[style*="background:#fde68a"],[style*="background: #fde68a"],
[style*="background-color:#fffbeb"],[style*="background-color:#fef3c7"] {
  background: rgba(201,168,76,.10) !important;
  border-left-color: rgba(201,168,76,.45) !important;
}

/* Alert boxes — verde */
[style*="background:#f0fdf4"],[style*="background: #f0fdf4"],
[style*="background:#d1fae5"],[style*="background: #d1fae5"],
[style*="background:#dcfce7"],[style*="background: #dcfce7"] {
  background: rgba(16,185,129,.10) !important;
  border-left-color: rgba(16,185,129,.45) !important;
}

/* Alert boxes — púrpura */
[style*="background:#fdf4ff"],[style*="background: #fdf4ff"],
[style*="background:#f3e8ff"],[style*="background: #f3e8ff"],
[style*="background:#ede9fe"],[style*="background: #ede9fe"],
[style*="background:#fce7f3"],[style*="background: #fce7f3"],
[style*="background:#fdf2f8"],[style*="background: #fdf2f8"] {
  background: rgba(139,92,246,.10) !important;
  border-left-color: rgba(139,92,246,.35) !important;
}

/* Textos oscuros hardcoded invisibles en dark bg */
[style*="color:#991b1b"],[style*="color: #991b1b"],
[style*="color:#7f1d1d"],[style*="color: #7f1d1d"],
[style*="color:#b91c1c"],[style*="color:#dc2626"],
[style*="color:#1e40af"],[style*="color: #1e40af"],
[style*="color:#1e3a8a"],[style*="color:#1d4ed8"],
[style*="color:#92400e"],[style*="color: #92400e"],
[style*="color:#78350f"],[style*="color:#713f12"],
[style*="color:#0f172a"],[style*="color: #0f172a"],
[style*="color:#1e293b"],[style*="color: #1e293b"],
[style*="color:#111827"],[style*="color: #111827"],
[style*="color:#374151"],[style*="color:#4b5563"],
[style*="color:#1c1917"],[style*="color: #1c1917"],
[style*="color:#166534"],[style*="color: #166534"],
[style*="color:#14532d"],[style*="color:#15803d"] {
  color: var(--mg-low) !important;
}

/* Textos semánticos — aclarar para dark bg */
[style*="color:#059669"],[style*="color: #059669"],
[style*="color:#0369a1"],[style*="color: #0369a1"],
[style*="color:#0284c7"],[style*="color:#0ea5e9"] {
  color: var(--mg-low) !important;
}

/* Fondos blancos en páginas legales y de precio */
[style*="background:white"],[style*="background: white"],
[style*="background-color:white"],[style*="background-color: white"],
[style*="background:#f1f5f9"],[style*="background: #f1f5f9"],
[style*="background:#e2e8f0"],[style*="background: #e2e8f0"],
[style*="background:#fef9c3"],[style*="background: #fef9c3"] {
  background: var(--mg-bg1) !important;
}

/* Strong/b dentro de alert boxes con color oscuro hardcoded */
strong[style*="color:#"],b[style*="color:#"] {
  color: var(--mg-low) !important;
}

/* ----------------------------------------------------------------
   AMPLIACIÓN v2.2 — variable --white + clases de startups pages
   Cubre: mg-startups.html, mg-startups/*.html, articulos-hub.js
   ---------------------------------------------------------------- */

/* Variable --white no estaba remapeada → origen de todos los fondos blancos */
:root {
  --white: #0A1628;
  --shadow: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .25);
}

/* Cards de startups (fondo-card, ayuda-card, comp-card, quick-link…) */
.fondo-card, .ayuda-card, .comp-card, .quick-link,
.calc-box, .cluster-link, .article-card, .post-card {
  background: #0A1628 !important;
  border-color: rgba(48, 54, 61, .85) !important;
  color: #f0f6fc !important;
}

/* Textos dentro de cards que usaban colores oscuros */
.fondo-card *, .ayuda-card *, .comp-card *, .quick-link *,
.calc-box *, .cluster-link * {
  color: inherit;
}

/* Badges de tipo de fondo (VC, Seed, BA…) */
.fondo-tag, .fc-tipo {
  background: rgba(201, 168, 76, .12) !important;
  color: #C9A84C !important;
  border-color: rgba(201, 168, 76, .2) !important;
}

/* Estados ayudas */
.ay-estado.activa {
  background: rgba(16, 185, 129, .12) !important;
  color: #10b981 !important;
}
.ay-estado.pendiente {
  background: rgba(201, 168, 76, .12) !important;
  color: #C9A84C !important;
}

/* Inputs de calculadoras */
.calc-field input, .calc-field select {
  background: #060F1E !important;
  border-color: rgba(48, 54, 61, .85) !important;
  color: #f0f6fc !important;
}

/* Section titles y subtítulos */
.section-title { color: #f0f6fc !important; }
.section-sub   { color: #8b949e !important; }

/* Tags de comparador (good/neutral/alert) */
.comp-tag.good    { background: rgba(16,185,129,.12) !important; color:#10b981 !important; }
.comp-tag.neutral { background: rgba(201,168,76,.12) !important; color:#C9A84C !important; }
.comp-tag.alert   { background: rgba(239,68,68,.12)  !important; color:#f43f5e !important; }

/* Ticket y fases en fondos VC (eran verde oscuro hardcoded) */
.fc-ticket, .fc-fases { color: #C9A84C !important; }

/* Links externos de fondos */
.fondo-card a, .ayuda-card a { color: #C9A84C !important; }
.fondo-card a:hover, .ayuda-card a:hover { color: #fbbf24 !important; }

/* Quick links hover */
.quick-link:hover {
  border-color: rgba(201, 168, 76, .4) !important;
  background: rgba(201, 168, 76, .06) !important;
}

/* Inline tool cards con background:#fff hardcoded (fondos blancos inline) */
a[style*="background:#fff"], a[style*="background: #fff"],
div[style*="background:#fff"], div[style*="background: #fff"] {
  background: #0A1628 !important;
}
a[style*="border:1.5px solid #e2e8f0"], a[style*="border: 1.5px solid #e2e8f0"] {
  border-color: rgba(48, 54, 61, .85) !important;
}

/* Texto oscuro dentro de tool cards inline */
a[style*="color:inherit"] h3, a[style*="color:inherit"] p,
a[style*="color:inherit"] span {
  color: #f0f6fc !important;
}

/* ----------------------------------------------------------------
   AMPLIACIÓN v2.3 — unificación de tokens bg2/bg3/line/display
   Cubre páginas con design system antiguo (#0a0a0c, #111114, etc.)
   ---------------------------------------------------------------- */
:root {
  --bg2:    #0A1628;
  --bg3:    #0F2440;
  --bg4:    #132B50;
  --amber-dark: #a8872e;
  --display: 'Inter', system-ui, sans-serif;
  --serif:   'Inter', system-ui, sans-serif;
}

/* Fuerza el fondo correcto en sections/divs que usan var(--bg) o var(--bg2) */
/* ya cubierto por body !important, pero este override captura elementos nested */
.hero, .section, .module, .card-section {
  background-color: inherit;
}
