/* ═══════════════════════════════════════════
   DARK MODE — Sistema completo de tema oscuro
   Coherente con el brandbook de Manuel López Rivero
   ═══════════════════════════════════════════ */

/* ── Variables Dark Mode ── */
[data-theme="dark"] {
  --bg-base: #0D1117;
  --bg-surface: #161B22;
  --bg-elevated: #1F2733;
  --text-primary: #E8EDF2;
  --text-secondary: #8893A4;
  --accent: #2B9E8B;
  --accent-hover: #35B5A0;
  --border-subtle: rgba(255,255,255,0.07);
  --shadow-dark: 0 4px 24px rgba(0,0,0,0.4);

  /* Override navy scale for dark */
  --navy-950: #E8EDF2;
  --navy-900: #D0D8E4;
  --navy-800: #B8C4D6;
  --navy-700: #9AABC4;
  --navy-600: #7D92B0;
  --navy-500: #6B82A0;
  --navy-400: #586F8E;
  --navy-300: #3D5470;
  --navy-200: rgba(255,255,255,0.10);
  --navy-100: rgba(255,255,255,0.07);
  --navy-50: rgba(255,255,255,0.04);

  /* Override ink scale */
  --ink: #E8EDF2;
  --ink-muted: #C8D0DC;
  --ink-soft: #8893A4;
  --ink-faint: #5C6678;
  --surface: #161B22;

  /* Override warm scale */
  --warm-600: #D4AD5E;
  --warm-500: #C49642;
  --warm-400: #D4AD5E;
  --warm-200: rgba(196,150,66,0.2);
  --warm-50: rgba(196,150,66,0.08);

  /* Override shadows */
  --shadow-xs: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.6);
}

/* ── Transiciones globales suaves ── */
*, *::before, *::after {
  transition:
    background-color 0.3s ease,
    color 0.25s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
/* Excepciones: no afectar animaciones existentes */
.hero-orb, .hero-orb-1, .hero-orb-2,
.bg-orb, .bg-sweep,
.reveal, .tl-unified::before,
[class*="kenBurns"],
.confetti-particle {
  transition: none !important;
}
/* Respetar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ═══════════════════════════════════════════
   TOGGLE BUTTON
   ═══════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
.theme-toggle:hover {
  background: var(--navy-50);
  border-color: var(--navy-100);
}
.theme-toggle:focus-visible {
  outline: 2px solid #2B9E8B;
  outline-offset: 2px;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), opacity 0.25s ease;
  position: absolute;
}

/* Icono luna: visible en light mode */
.theme-toggle .icon-moon {
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  transform: rotate(0deg);
}
/* Icono sol: oculto en light mode */
.theme-toggle .icon-sun {
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: rotate(-45deg);
}

/* Dark mode: mostrar sol, ocultar luna */
[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(45deg);
}
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
  stroke: #E8EDF2;
}

/* Toggle en hero mode */
.nav.hero-mode .theme-toggle .icon-moon {
  stroke: rgba(255,255,255,0.55);
}
.nav.hero-mode .theme-toggle:hover .icon-moon {
  stroke: rgba(255,255,255,0.9);
}
.nav.hero-mode .theme-toggle:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}
/* Hero mode + dark */
[data-theme="dark"] .nav.hero-mode .theme-toggle .icon-sun {
  stroke: rgba(255,255,255,0.55);
}
[data-theme="dark"] .nav.hero-mode .theme-toggle:hover .icon-sun {
  stroke: rgba(255,255,255,0.9);
}

/* Toggle en dark scrolled */
[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}

/* ═══════════════════════════════════════════
   BASE — body, selection, scrollbar
   ═══════════════════════════════════════════ */
[data-theme="dark"] body {
  background: #0D1117;
  color: #C8D0DC;
}
[data-theme="dark"] ::selection {
  background: rgba(43,158,139,0.25);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #3D5470;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0D1117;
}

/* ═══════════════════════════════════════════
   NAV — Barra de navegacion
   ═══════════════════════════════════════════ */
[data-theme="dark"] .nav.scrolled {
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
[data-theme="dark"] .nav.scrolled .logo-wordmark {
  color: #E8EDF2;
}
[data-theme="dark"] .nav.scrolled .nav-link {
  color: #8893A4;
}
[data-theme="dark"] .nav.scrolled .nav-link:hover {
  color: #C8D0DC;
  background: rgba(255,255,255,0.05);
}
[data-theme="dark"] .nav.scrolled .nav-link.active {
  color: #E8EDF2;
  background: rgba(255,255,255,0.07);
}
[data-theme="dark"] .nav.scrolled .nav-link::after {
  background: linear-gradient(90deg, rgba(255,255,255,0.15), rgba(255,255,255,0.3));
}
[data-theme="dark"] .nav.scrolled .nav-hamburger span {
  background: #8893A4;
}
[data-theme="dark"] .nav.scrolled .nav-hamburger:hover {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .nav.scrolled .nav-hamburger:hover span {
  background: #E8EDF2;
}

/* ── Dropdown panel dark ── */
[data-theme="dark"] .nav.scrolled .nav-dropdown-menu {
  background: rgba(13,17,23,0.97);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
[data-theme="dark"] .nav.scrolled .nav-dropdown-menu .nav-link { color: #8893A4; }
[data-theme="dark"] .nav.scrolled .nav-dropdown-menu .nav-link:hover { color: #E8EDF2; background: rgba(255,255,255,0.05); }
[data-theme="dark"] .nav.scrolled .nav-dropdown-menu .nav-link.active { color: #E8EDF2; background: rgba(255,255,255,0.07); }
[data-theme="dark"] .nav.scrolled .nav-dropdown-trigger.parent-active { color: #E8EDF2; background: rgba(255,255,255,0.07); }

/* ═══════════════════════════════════════════
   HERO — Orbes y foto
   ═══════════════════════════════════════════ */
[data-theme="dark"] .hero-orb {
  opacity: 0.4;
}
[data-theme="dark"] .hero-photo img {
  filter: brightness(0.92);
}

/* ═══════════════════════════════════════════
   SECCIONES CON FONDO BLANCO (inline style override)
   ═══════════════════════════════════════════ */
[data-theme="dark"] .section[style*="background:#fff"],
[data-theme="dark"] .section[style*="background: #fff"],
[data-theme="dark"] .section-sm[style*="background:#fff"],
[data-theme="dark"] .section-sm[style*="background: #fff"],
[data-theme="dark"] .quote-section {
  background: rgba(196,150,66,0.06) !important;
}
[data-theme="dark"] .section-sm[style*="background:var(--navy-50)"] {
  background: #161B22 !important;
}
[data-theme="dark"] .personas-teaser {
  background: rgba(255,255,255,0.04) !important;
}
[data-theme="dark"] .utilia-section[style*="background:var(--navy-50)"] {
  background: #161B22 !important;
}
/* ── Chapter opener — dark mode ── */
[data-theme="dark"] .chapter-opener {
  background: #0B0F1A;
}
[data-theme="dark"] .chapter-opener__highlight strong {
  background: linear-gradient(135deg, rgba(22,160,134,0.95), rgba(44,182,125,0.85), rgba(22,160,134,0.95));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Propuesta heading gradient — dark variant */
[data-theme="dark"] .section > .section-inner > .sh h2 {
  background: linear-gradient(90deg, rgba(186,206,238,0.95), rgba(120,162,220,0.8), rgba(160,190,232,0.9), rgba(186,206,238,0.95));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Propval cards hover — dark variant */
[data-theme="dark"] .propval-grid .card:hover {
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 0 2px rgba(74,122,184,0.25);
}
[data-theme="dark"] .propval-grid .card::before {
  background: conic-gradient(from var(--border-angle, 0deg), rgba(74,122,184,0.15), rgba(74,122,184,0.35), rgba(74,122,184,0.15), rgba(74,122,184,0.35), rgba(74,122,184,0.15));
}
/* Recursos items hover — dark variant */
[data-theme="dark"] .recursos-teaser-item:hover {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 0 1px rgba(74,122,184,0.2);
}
/* line-accent */
[data-theme="dark"] .line-accent {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

/* ═══════════════════════════════════════════
   LAYOUT — Cabeceras y secciones
   ═══════════════════════════════════════════ */
/* Page headers: ya son dark, no necesitan cambio significativo */

/* ═══════════════════════════════════════════
   COMPONENTS — Cards, botones, formularios, tags
   ═══════════════════════════════════════════ */

/* ── Cards ── */
[data-theme="dark"] .card {
  background: #161B22;
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .card:hover {
  box-shadow: 0 14px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}
[data-theme="dark"] .card-icon {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .card:hover .card-icon {
  background: rgba(255,255,255,0.1);
}

/* ── Botones ── */
[data-theme="dark"] .btn-white {
  background: #E8EDF2;
  color: #0D1117;
}
[data-theme="dark"] .btn-white:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
[data-theme="dark"] .btn-outline {
  color: #8893A4;
  border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .btn-outline:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.2);
  color: #E8EDF2;
}

/* ── Tags ── */
[data-theme="dark"] .tag {
  background: rgba(255,255,255,0.06);
  color: #8893A4;
}
[data-theme="dark"] .tag-warm {
  background: rgba(196,150,66,0.1);
  color: #D4AD5E;
}

/* ── Quote block ── */
[data-theme="dark"] .quote-block {
  border-image: linear-gradient(180deg, #586F8E, #3D5470, rgba(255,255,255,0.1)) 1;
}
[data-theme="dark"] .quote-block:hover {
  border-image: linear-gradient(180deg, #6B82A0, #586F8E, #3D5470) 1;
}
[data-theme="dark"] .quote-block p {
  color: #C8D0DC;
}
[data-theme="dark"] .quote-section .quote-block p {
  color: #C8D0DC;
}
[data-theme="dark"] .quote-section .quote-block::before {
  color: rgba(147,181,225,0.25);
}
[data-theme="dark"] .quote-section .quote-block cite {
  color: rgba(200,208,220,0.6);
}
[data-theme="dark"] .quote-logo-light { display: none; }
[data-theme="dark"] .quote-logo-dark { display: inline; }

/* ── Formulario de contacto ── */
[data-theme="dark"] .form-group label {
  color: #E8EDF2;
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: #161B22;
  border-color: rgba(255,255,255,0.1);
  color: #E8EDF2;
}
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
  color: #5C6678;
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  border-color: #2B9E8B;
  box-shadow: 0 0 0 3px rgba(43,158,139,0.15);
}
/* Select arrow para dark mode */
[data-theme="dark"] #page-contacto .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238893A4' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ── Estadisticas ── */
[data-theme="dark"] .stat-val {
  background: linear-gradient(135deg, #9AABC4, #6B82A0);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ── Contact info ── */
[data-theme="dark"] .contact-link {
  color: #6B82A0;
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .contact-link:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.15);
}

/* ── Contact cards ── */
[data-theme="dark"] .contact-card {
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .contact-card:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .contact-card-icon {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .contact-card:hover .contact-card-icon {
  background: rgba(255,255,255,0.1);
}
[data-theme="dark"] .contact-card strong {
  color: #E8EDF2;
}
[data-theme="dark"] .contact-link-inline {
  color: #2B9E8B;
  border-color: rgba(43,158,139,0.3);
}
[data-theme="dark"] .contact-link-inline:hover {
  color: #35B5A0;
  border-color: rgba(43,158,139,0.5);
}

/* ── Contact map ── */
[data-theme="dark"] .contact-map {
  border-color: rgba(255,255,255,0.07);
}

/* ── Digital card QR ── */
[data-theme="dark"] .digital-card-qr {
  background: linear-gradient(135deg, #161B22, #1F2733);
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .digital-card-qr::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
}
[data-theme="dark"] .digital-card-qr:hover {
  background: linear-gradient(135deg, #1F2733, #161B22);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .digital-card-qr-code {
  background: #1F2733;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .digital-card-qr-label {
  color: #E8EDF2;
}

/* ── Copy tooltip ── */
[data-theme="dark"] .copy-tooltip {
  background: #1F2733;
  color: #E8EDF2;
}
[data-theme="dark"] .copy-tooltip::after {
  background: #1F2733;
}

/* ── Availability badge ── */
[data-theme="dark"] .availability-badge {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .availability-badge.available {
  background: rgba(44,182,125,0.1);
  border-color: rgba(44,182,125,0.2);
}
[data-theme="dark"] .availability-badge.available .availability-text {
  color: #2CB67D;
}
[data-theme="dark"] .availability-badge.after-hours {
  background: rgba(196,150,66,0.1);
  border-color: rgba(196,150,66,0.2);
}
[data-theme="dark"] .availability-badge.after-hours .availability-text {
  color: #D4AD5E;
}
[data-theme="dark"] .availability-badge.holiday .availability-text {
  color: #D4AD5E;
}
[data-theme="dark"] .availability-badge.weekend .availability-text {
  color: #8893A4;
}

/* ── Contact form header ── */
[data-theme="dark"] .contact-form-header h2 {
  color: #E8EDF2;
}

/* ── Contact submit button (btn-navy) ── */
[data-theme="dark"] .btn-navy {
  background: #1F2733;
  border: 1px solid rgba(255,255,255,0.1);
}
[data-theme="dark"] .btn-navy:hover {
  background: #283344;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .contact-submit.sent {
  background: #2CB67D;
  border-color: transparent;
}

/* ═══════════════════════════════════════════
   PAGES — Timeline, articulos, perspectiva
   ═══════════════════════════════════════════ */

/* ── Timeline unified ── */
[data-theme="dark"] .tl-unified::before {
  background: linear-gradient(180deg, #586F8E, #4A5B72 30%, #3A4A5E 70%, #2A3A4E);
}
[data-theme="dark"] .tl-legend-item { color: #8899AA; }
[data-theme="dark"] .tl-legend-exp .tl-legend-dot {
  background: linear-gradient(135deg, #6B82A0, #586F8E); border-color: #586F8E;
}
[data-theme="dark"] .tl-legend-form .tl-legend-dot {
  background: linear-gradient(135deg, #C49642, #A67C37); border-color: #A67C37;
}
[data-theme="dark"] .tl-era span {
  background: linear-gradient(135deg, #1F2733, #2A3644);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
}
[data-theme="dark"] .tl-dot { background: #161B22; }
[data-theme="dark"] .tl-entry[data-branch="exp"] .tl-dot { border-color: #586F8E; }
[data-theme="dark"] .tl-entry[data-branch="form"] .tl-dot { border-color: #A67C37; }
[data-theme="dark"] .tl-entry[data-branch="exp"]:hover .tl-dot {
  border-color: #6B82A0; background: #1F2733;
  box-shadow: 0 0 0 5px rgba(107,130,160,0.15), 0 0 20px rgba(107,130,160,0.1);
}
[data-theme="dark"] .tl-entry[data-branch="form"]:hover .tl-dot {
  border-color: #C49642; background: #2A2218;
  box-shadow: 0 0 0 5px rgba(196,150,66,0.15), 0 0 20px rgba(196,150,66,0.1);
}
[data-theme="dark"] .tl-entry:first-of-type .tl-dot {
  border-color: #6B82A0;
  background: linear-gradient(135deg, #6B82A0, #586F8E);
  box-shadow: 0 0 0 4px rgba(107,130,160,0.15);
}
[data-theme="dark"] .tl-entry[data-branch="exp"]:hover .tl-body {
  background: linear-gradient(135deg, rgba(107,130,160,0.06), rgba(107,130,160,0.02));
  border-color: rgba(255,255,255,0.07);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
[data-theme="dark"] .tl-entry[data-branch="form"]:hover .tl-body {
  background: linear-gradient(135deg, rgba(196,150,66,0.06), rgba(196,150,66,0.02));
  border-color: rgba(255,255,255,0.07);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
[data-theme="dark"] .tl-entry[data-branch="exp"] .tl-year {
  background: linear-gradient(135deg, #3A5A82, #4A6A92);
}
[data-theme="dark"] .tl-entry[data-branch="form"] .tl-year {
  background: linear-gradient(135deg, #8A6A2A, #A67C37);
}
[data-theme="dark"] .tl-badge-exp {
  color: #93B5E1; background: rgba(107,130,160,0.1); border-color: rgba(107,130,160,0.2);
}
[data-theme="dark"] .tl-badge-form {
  color: #D4AD5E; background: rgba(196,150,66,0.1); border-color: rgba(196,150,66,0.2);
}

/* ── Formacion items ── */
[data-theme="dark"] .form-item {
  border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .form-item:hover {
  background: linear-gradient(90deg, rgba(255,255,255,0.03), transparent);
  border-left-color: #586F8E;
}
[data-theme="dark"] .form-item .year {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .form-item:hover .year {
  background: rgba(255,255,255,0.1);
}

/* ── Articles (Ideas) ── */
[data-theme="dark"] .article-item {
  border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .article-item:hover {
  background: linear-gradient(90deg, rgba(107,130,160,0.05), transparent 50%);
}
[data-theme="dark"] .article-expand-inner {
  background: rgba(255,255,255,0.03);
  border-left-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .read-more {
  color: #2B9E8B;
}
[data-theme="dark"] .read-more:hover {
  color: #35B5A0;
}

/* ── Perspectiva ── */
[data-theme="dark"] .persp-item {
  border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .persp-item:hover {
  border-left-color: #586F8E;
  background: linear-gradient(90deg, rgba(255,255,255,0.03), transparent);
}
[data-theme="dark"] .persp-expand-inner {
  background: rgba(255,255,255,0.03);
  border-left-color: rgba(255,255,255,0.1);
}

/* ── Utilia section ── */
[data-theme="dark"] .utilia-visual {
  background: linear-gradient(145deg, #161B22, #1F2733, #161B22);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
}
[data-theme="dark"] .utilia-visual:hover {
  box-shadow: 0 28px 70px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.1);
}
[data-theme="dark"] .utilia-photo::before {
  background: linear-gradient(135deg, rgba(74,122,184,0.06), rgba(44,182,125,0.04), rgba(74,122,184,0.06));
}
[data-theme="dark"] .utilia-visual:hover .utilia-photo::before {
  background: linear-gradient(135deg, rgba(74,122,184,0.15), rgba(44,182,125,0.1), rgba(74,122,184,0.15));
}
[data-theme="dark"] .utilia-photo::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), rgba(255,255,255,0.07), rgba(255,255,255,0.03), transparent);
}
[data-theme="dark"] .utilia-photo img {
  box-shadow:
    0 2px 8px rgba(0,0,0,0.2),
    0 8px 24px rgba(0,0,0,0.25),
    inset 0 0 0 1px rgba(255,255,255,0.06);
}
[data-theme="dark"] .utilia-visual:hover .utilia-photo img {
  box-shadow:
    0 4px 12px rgba(0,0,0,0.25),
    0 16px 40px rgba(74,122,184,0.15),
    0 24px 56px rgba(0,0,0,0.3),
    inset 0 0 0 1px rgba(255,255,255,0.1);
}
[data-theme="dark"] .utilia-badge {
  background: rgba(45,110,191,0.12);
  color: #6B9AD4;
}
[data-theme="dark"] strong[style*="color:var(--ink)"] {
  color: #E8EDF2 !important;
}

/* ═══════════════════════════════════════════
   EFFECTS — Orbes, sweep, glow
   ═══════════════════════════════════════════ */

[data-theme="dark"] .bg-orb {
  opacity: 0.25;
}
[data-theme="dark"] .bg-sweep {
  opacity: 0 !important;
}

/* ═══════════════════════════════════════════
   PHOTO BANNER — reducir brillo en dark
   ═══════════════════════════════════════════ */
[data-theme="dark"] .photo-banner img {
  filter: brightness(0.85);
}
[data-theme="dark"] .photo-banner:hover img {
  filter: brightness(0.95) contrast(1.03);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Menu movil dark
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  [data-theme="dark"] .nav-links {
    background: #0D1117;
  }
  [data-theme="dark"] .nav-links .nav-link {
    color: #8893A4;
  }
  [data-theme="dark"] .nav-links .nav-link:hover {
    color: #E8EDF2;
    background: rgba(255,255,255,0.05);
  }
  [data-theme="dark"] .nav-links .nav-link.active {
    background: rgba(255,255,255,0.07);
    color: #E8EDF2;
  }
  [data-theme="dark"] .nav-dropdown-trigger.parent-active {
    color: #E8EDF2; background: rgba(255,255,255,0.07);
  }
  [data-theme="dark"] .nav-dropdown-menu { background: transparent; }

  /* Toggle en movil */
  .theme-toggle {
    position: absolute;
    right: 88px;
    top: 50%;
    transform: translateY(-50%);
  }
}

/* ═══════════════════════════════════════════
   BASE IA — Capitulos de formacion
   ═══════════════════════════════════════════ */
[data-theme="dark"] .baseia-nav {
  background: #161B22;
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .baseia-nav-item {
  color: #8893A4;
}
[data-theme="dark"] .baseia-nav-item:hover {
  color: #E8EDF2;
  background: rgba(255,255,255,0.05);
}
[data-theme="dark"] .baseia-nav-item.active {
  color: #E8EDF2;
  background: rgba(255,255,255,0.07);
}
[data-theme="dark"] .baseia-chapter {
  background: #161B22;
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-section {
  background: #161B22;
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-section:hover {
  border-color: rgba(255,255,255,0.10);
}
[data-theme="dark"] .baseia-section-header {
  border-bottom-color: rgba(255,255,255,0.05);
}
[data-theme="dark"] .baseia-section-header:hover {
  background: rgba(255,255,255,0.02);
}
[data-theme="dark"] .baseia-callout {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .baseia-callout-info {
  background: rgba(43,158,139,0.06);
  border-color: rgba(43,158,139,0.15);
}
[data-theme="dark"] .baseia-compare-col {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-compare-col.before {
  background: rgba(231,76,60,0.05);
  border-color: rgba(231,76,60,0.12);
}
[data-theme="dark"] .baseia-compare-col.after {
  background: rgba(44,182,125,0.05);
  border-color: rgba(44,182,125,0.12);
}
[data-theme="dark"] .baseia-exercise-btn {
  background: #1F2733;
  border-color: rgba(255,255,255,0.08);
  color: #C8D0DC;
}
[data-theme="dark"] .baseia-exercise-btn:hover {
  border-color: rgba(255,255,255,0.15);
  background: #283344;
}
[data-theme="dark"] .baseia-test-opt {
  background: #1F2733;
  border-color: rgba(255,255,255,0.08);
  color: #C8D0DC;
}
[data-theme="dark"] .baseia-test-opt:hover {
  border-color: rgba(255,255,255,0.15);
  background: #283344;
}
[data-theme="dark"] .baseia-test-opt.selected {
  background: rgba(107,130,160,0.12);
  border-color: rgba(107,130,160,0.3);
  color: #E8EDF2;
}
[data-theme="dark"] .baseia-test-opt.correct {
  background: rgba(44,182,125,0.1);
  border-color: rgba(44,182,125,0.3);
  color: #2CB67D;
}
[data-theme="dark"] .baseia-test-opt.incorrect {
  background: rgba(231,76,60,0.08);
  border-color: rgba(231,76,60,0.2);
  color: #e74c3c;
}
[data-theme="dark"] .baseia-feedback {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .baseia-progress-count { color: var(--navy-700); }
[data-theme="dark"] .baseia-progress-bar { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .baseia-progress-fill { box-shadow: 0 0 12px rgba(100,160,220,0.3); }
[data-theme="dark"] .baseia-ch-active:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .baseia-ch-active:hover .baseia-ch-num { background: var(--navy-400); }
[data-theme="dark"] .baseia-blocks > div {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-step {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-step-num {
  background: rgba(43,158,139,0.12);
  color: #2B9E8B;
}
[data-theme="dark"] .baseia-reflection-q {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-callout-warning {
  background: rgba(196,150,66,0.06);
  border-color: rgba(196,150,66,0.15);
}
[data-theme="dark"] .baseia-callout-tip {
  background: rgba(44,182,125,0.06);
  border-color: rgba(44,182,125,0.15);
}
[data-theme="dark"] .baseia-exercise-scenario {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-cierre-key {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .baseia-test-feedback.correct {
  background: rgba(44,182,125,0.1);
  color: #2CB67D;
}
[data-theme="dark"] .baseia-test-feedback.incorrect {
  background: rgba(231,76,60,0.08);
  color: #e74c3c;
}
[data-theme="dark"] .baseia-compare-col.before strong { color: #e74c3c; }
[data-theme="dark"] .baseia-compare-col.after strong { color: #2CB67D; }
[data-theme="dark"] .baseia-test-result.good {
  background: rgba(44,182,125,0.1);
  border-color: rgba(44,182,125,0.2);
  color: #2CB67D;
}
[data-theme="dark"] .baseia-test-result.needs-work {
  background: rgba(196,150,66,0.1);
  border-color: rgba(196,150,66,0.2);
  color: #D4AD5E;
}
[data-theme="dark"] .baseia-exercise-feedback.correct {
  background: rgba(44,182,125,0.08);
  color: #2CB67D;
}
[data-theme="dark"] .baseia-exercise-feedback.incorrect {
  background: rgba(231,76,60,0.06);
  color: #e74c3c;
}

/* ═══════════════════════════════════════════
   PRINT — Forzar light mode siempre
   ═══════════════════════════════════════════ */
@media print {
  [data-theme="dark"] body {
    background: #fff !important;
    color: #353840 !important;
  }
  [data-theme="dark"] .card,
  [data-theme="dark"] .section,
  [data-theme="dark"] .form-group input,
  [data-theme="dark"] .form-group textarea {
    background: #fff !important;
    color: #353840 !important;
    border-color: #ddd !important;
  }
  .theme-toggle { display: none !important; }
}

/* ═══════════════════════════════════════════
   FAQ — Preguntas frecuentes
   ═══════════════════════════════════════════ */
[data-theme="dark"] .faq-item {
  border-bottom-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .faq-item:first-child {
  border-top-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .faq-header {
  color: #E8EDF2;
}
[data-theme="dark"] .faq-header:hover {
  color: #9AABC4;
}
[data-theme="dark"] .faq-icon {
  background: rgba(255,255,255,0.06);
  color: #6B82A0;
}
[data-theme="dark"] .faq-item.open .faq-icon {
  background: #586F8E;
  color: #E8EDF2;
}
[data-theme="dark"] .faq-content p {
  color: #8893A4;
}

/* ═══════════════════════════════════════════
   SCROLL-TO-TOP FAB
   ═══════════════════════════════════════════ */
[data-theme="dark"] .baseia-scroll-top {
  background: rgba(22,27,34,0.92);
  border-color: rgba(255,255,255,0.08);
  color: var(--ink-soft);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
[data-theme="dark"] .baseia-scroll-top:hover {
  background: #1F2733;
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════════
   BASE IA — 3-Level Navigation System
   ═══════════════════════════════════════════ */

/* Progress & continue button */
[data-theme="dark"] .baseia-l1-progress-label { color: #E8EDF2; }
[data-theme="dark"] .baseia-l1-progress-text { color: #8893A4; }
[data-theme="dark"] .baseia-l1-progress-note { color: #6B82A0; }
[data-theme="dark"] .baseia-progress-track { background: rgba(22,160,134,0.15); }
[data-theme="dark"] .baseia-continue-btn { background: #1ABC9C; }
[data-theme="dark"] .baseia-continue-btn:hover { background: #16A086; }

/* Section cards */
[data-theme="dark"] .baseia-section-card {
  background: #161B22;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  animation-name: baseiaCardGlowDark;
}
@keyframes baseiaCardGlowDark {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0 rgba(22,160,134,0); }
  50%      { box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 14px -2px rgba(22,160,134,0.10); }
}
[data-theme="dark"] .baseia-section-card:hover {
  box-shadow: 0 4px 20px rgba(22,160,134,0.10), 0 2px 8px rgba(0,0,0,0.3);
  border-color: rgba(22,160,134,0.35);
}
[data-theme="dark"] .baseia-sc-badge {
  background: rgba(22,160,134,0.12);
  color: #2B9E8B;
}
[data-theme="dark"] .baseia-sc-title { color: #E8EDF2; }
[data-theme="dark"] .baseia-sc-desc { color: #8893A4; }
[data-theme="dark"] .baseia-sc-meta { color: #6B82A0; }
[data-theme="dark"] .baseia-sc-progress-text { color: #6B82A0; }
[data-theme="dark"] .baseia-sc-done-badge {
  background: rgba(22,160,134,0.12);
  color: #2B9E8B;
}

/* Chapter rows */
[data-theme="dark"] .baseia-chapter-row {
  background: #161B22;
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .baseia-chapter-row:hover {
  background: rgba(22,160,134,0.06);
  border-color: rgba(22,160,134,0.25);
}
[data-theme="dark"] .baseia-cr-status--pending { border-color: rgba(255,255,255,0.15); }
[data-theme="dark"] .baseia-cr-status--inprogress { border-color: #2B9E8B; }
[data-theme="dark"] .baseia-cr-status--inprogress::after { background: #2B9E8B; }
[data-theme="dark"] .baseia-cr-num { color: #6B82A0; }
[data-theme="dark"] .baseia-cr-title { color: #E8EDF2; }
[data-theme="dark"] .baseia-cr-time {
  background: rgba(255,255,255,0.05);
  color: #6B82A0;
}
[data-theme="dark"] .baseia-section-nav { border-top-color: rgba(255,255,255,0.06); }

/* Level 3 nav bar */
[data-theme="dark"] .baseia-l3-nav { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .baseia-l3-nav-center {
  color: #8893A4;
  background: #161B22;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .baseia-l3-nav-center:hover {
  color: #2B9E8B;
  border-color: rgba(22,160,134,0.3);
  background: rgba(22,160,134,0.06);
}
[data-theme="dark"] .baseia-l3-section-done { color: #2B9E8B; }

/* Note: page-header, breadcrumb--light, header-back, L3 meta/section-link
   are all on the dark blue background and don't need dark mode overrides.
   The page-header is always dark by design. */

/* Images — reduce brightness in dark mode */
[data-theme="dark"] #baseia-level-3 .baseia-chapter-img img { filter: brightness(0.9); }

/* ═══════════════════════════════════════════
   FOOTER — Mantener siempre oscuro
   ═══════════════════════════════════════════ */
[data-theme="dark"] .footer {
  background: #0D1117;
}
[data-theme="dark"] .footer-bottom {
  border-top-color: rgba(255,255,255,0.05);
}

/* ═══════════════════════════════════════════
   ANIMACIONES AVANZADAS — Dark mode overrides
   ═══════════════════════════════════════════ */
[data-theme="dark"] .tl-progress-line {
  background: linear-gradient(180deg, #586F8E, #3D5478);
}
[data-theme="dark"] .tl-entry.tl-active .tl-body {
  border-left-color: #586F8E;
}
[data-theme="dark"] .tl-entry[data-branch="form"].tl-active .tl-body {
  border-left-color: #A67C37;
}
[data-theme="dark"] .tl-entry.tl-active .tl-body h3 {
  color: #8BAAD4;
}
[data-theme="dark"] .tl-entry[data-branch="form"].tl-active .tl-body h3 {
  color: #D4AD5E;
}
[data-theme="dark"] .tl-entry[data-branch="exp"].tl-active .tl-dot {
  background: #586F8E;
  border-color: #586F8E;
}
[data-theme="dark"] .tl-entry[data-branch="form"].tl-active .tl-dot {
  background: #A67C37;
  border-color: #A67C37;
}
[data-theme="dark"] .tl-dot:focus-visible {
  outline-color: #586F8E;
}
