/* ===== Theme Switch — componente animado Jarvis ===== */

/* Neutraliza reglas heredadas de design.css que aplican background: #003366
 * y box-shadow azul sobre #theme-toggle y #theme-toggle:hover con !important.
 * Como theme.css carga después de design.css, igual especificidad + !important
 * gana por orden de fuente (la declaración posterior prevalece).              */
#theme-toggle,
#mainNav.is-fixed #theme-toggle,
.navbar-light #theme-toggle {
  background: transparent !important;
  box-shadow: none !important;
  border-color: transparent !important;
  color: inherit !important;
}
#theme-toggle:hover,
#mainNav.is-fixed #theme-toggle:hover,
.navbar-light #theme-toggle:hover {
  background: transparent !important;
  box-shadow: none !important;
  border-color: transparent !important;
  color: inherit !important;
}

/* WRAPPER */
.theme-switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  padding: 4px;
  margin-left: 10px;
  background: none;
  border: none;
  user-select: none;
}

/* TRACK */
.ts-track {
  position: relative;
  width: 52px;
  height: 26px;
  background: #0a0a1a;
  border: 1.5px solid #06b6d4;
  border-radius: 13px;
  overflow: visible;
  transition: border-color 0.4s;
  flex-shrink: 0;
}
.ts-track::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: repeating-linear-gradient(
    90deg,
    transparent, transparent 4px,
    rgba(6,182,212,0.05) 4px, rgba(6,182,212,0.05) 5px
  );
}

/* THUMB */
.ts-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #06b6d4;
  box-shadow: 0 0 8px #06b6d4, 0 0 16px rgba(6,182,212,0.4);
  transition: left 0.4s cubic-bezier(0.4,0,0.2,1),
              background 0.4s,
              box-shadow 0.4s;
  z-index: 2;
}

/* ESTADO ACTIVO (tema claro) */
.theme-switch-wrap.light-active .ts-track {
  border-color: #f59e0b;
}
.theme-switch-wrap.light-active .ts-thumb {
  left: 29px;
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b, 0 0 16px rgba(245,158,11,0.4);
}

/* ICON WRAP */
.ts-icon-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ts-icon {
  font-size: 16px;
  position: relative;
  z-index: 2;
  transition: opacity 0.4s, filter 0.4s;
  line-height: 1;
}

/* LUNA — activa por defecto (tema oscuro) */
.ts-moon .ts-icon {
  filter: drop-shadow(0 0 5px rgba(6,182,212,0.9));
  opacity: 1;
}
.ts-moon.ts-dim .ts-icon {
  filter: none;
  opacity: 0.25;
}

/* Halos de luna */
.ts-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(6,182,212,0.4);
  animation: ts-moon-pulse 2.5s ease-in-out infinite;
  transition: opacity 0.4s;
}
.ts-halo-2 {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(6,182,212,0.15);
  animation: ts-moon-pulse 2.5s ease-in-out infinite 0.6s;
  transition: opacity 0.4s;
}
@keyframes ts-moon-pulse {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%       { transform: scale(1.2); opacity: 0.2; }
}
.ts-moon.ts-dim .ts-halo,
.ts-moon.ts-dim .ts-halo-2 { opacity: 0; }

/* Estrellas de luna */
.ts-star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #06b6d4;
  opacity: 0;
}
.ts-moon:not(.ts-dim) .ts-star { animation: ts-star-twinkle 2s ease-in-out infinite; }
.ts-star:nth-child(4) { top: 2px;  left: 4px;  animation-delay: 0s;   }
.ts-star:nth-child(5) { top: 4px;  left: 28px; animation-delay: 0.5s; }
.ts-star:nth-child(6) { top: 26px; left: 6px;  animation-delay: 1s;   }
.ts-star:nth-child(7) { top: 26px; left: 26px; animation-delay: 1.5s; }
@keyframes ts-star-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%       { opacity: 1; transform: scale(1.5); }
}

/* SOL — inactivo por defecto (tema oscuro) */
.ts-sun .ts-icon {
  filter: none;
  opacity: 0.25;
}
.ts-sun.ts-active-sun .ts-icon {
  filter: drop-shadow(0 0 6px rgba(245,158,11,0.9));
  opacity: 1;
  animation: ts-sun-spin 8s linear infinite;
}
@keyframes ts-sun-spin {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}

/* Rayos del sol */
.ts-ray {
  position: absolute;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: #f59e0b;
  transform-origin: center bottom;
  opacity: 0;
  transition: opacity 0.4s;
}
.ts-sun.ts-active-sun .ts-ray { animation: ts-ray-pulse 1.8s ease-in-out infinite; }
.ts-ray:nth-child(1) { top: -8px;  left: 15px;                          }
.ts-ray:nth-child(2) { top: -4px;  left: 25px; transform: rotate(45deg);  }
.ts-ray:nth-child(3) { top: 6px;   left: 29px; transform: rotate(90deg);  }
.ts-ray:nth-child(4) { top: 16px;  left: 25px; transform: rotate(135deg); }
.ts-ray:nth-child(5) { top: 20px;  left: 15px; transform: rotate(180deg); }
.ts-ray:nth-child(6) { top: 16px;  left: 5px;  transform: rotate(225deg); }
.ts-ray:nth-child(7) { top: 6px;   left: 1px;  transform: rotate(270deg); }
.ts-ray:nth-child(8) { top: -4px;  left: 5px;  transform: rotate(315deg); }
.ts-ray:nth-child(1) { animation-delay: 0s;   }
.ts-ray:nth-child(2) { animation-delay: 0.2s; }
.ts-ray:nth-child(3) { animation-delay: 0.4s; }
.ts-ray:nth-child(4) { animation-delay: 0.6s; }
.ts-ray:nth-child(5) { animation-delay: 0.8s; }
.ts-ray:nth-child(6) { animation-delay: 1s;   }
.ts-ray:nth-child(7) { animation-delay: 1.2s; }
.ts-ray:nth-child(8) { animation-delay: 1.4s; }
@keyframes ts-ray-pulse {
  0%, 100% { opacity: 0; transform: scaleY(0.5); }
  50%       { opacity: 1; transform: scaleY(1.3); }
}

/* Partículas del sol */
.ts-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #f59e0b;
  opacity: 0;
  pointer-events: none;
  top: 50%;
  left: 50%;
}
.ts-sun.ts-active-sun .ts-particle { animation: ts-particle-fly 2s ease-out infinite; }
.ts-particle:nth-child(9)  { animation-delay: 0s;   --tx: -14px; --ty: -12px; }
.ts-particle:nth-child(10) { animation-delay: 0.4s; --tx:  14px; --ty: -10px; }
.ts-particle:nth-child(11) { animation-delay: 0.8s; --tx:  15px; --ty:  12px; }
.ts-particle:nth-child(12) { animation-delay: 1.2s; --tx: -13px; --ty:  13px; }
.ts-particle:nth-child(13) { animation-delay: 1.6s; --tx:   0px; --ty: -16px; }
@keyframes ts-particle-fly {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(1); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0); }
}

/* Mobile — misma estructura, escala ligeramente menor */
@media (max-width: 991px) {
  .theme-switch-wrap { margin-left: 0; gap: 6px; }
  .ts-track          { width: 44px; height: 22px; }
  .ts-thumb          { width: 14px; height: 14px; }
  .theme-switch-wrap.light-active .ts-thumb { left: 25px; }
  .ts-icon-wrap      { width: 28px; height: 28px; }
  .ts-icon           { font-size: 14px; }
}

/* ===== Stack Tecnológico ===== */
.tech-stack {
  margin-top: 32px;
  margin-bottom: 8px;
}

.tech-stack h5 {
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #495057;
}

.tech-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  align-items: baseline;
}

.tech-list dt {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 18px !important;
  font-weight: 700;
  color: #495057;
  white-space: nowrap;
  opacity: 0;
  animation: techFadeIn 0.4s ease forwards;
}

.tech-list dd {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 18px !important;
  color: #1a1a1a;
  margin: 0;
  opacity: 0;
  animation: techFadeIn 0.4s ease forwards;
}

.tech-list dt:nth-child(1),  .tech-list dd:nth-child(2)  { animation-delay: 0.05s; }
.tech-list dt:nth-child(3),  .tech-list dd:nth-child(4)  { animation-delay: 0.13s; }
.tech-list dt:nth-child(5),  .tech-list dd:nth-child(6)  { animation-delay: 0.21s; }
.tech-list dt:nth-child(7),  .tech-list dd:nth-child(8)  { animation-delay: 0.29s; }
.tech-list dt:nth-child(9),  .tech-list dd:nth-child(10) { animation-delay: 0.37s; }
.tech-list dt:nth-child(11), .tech-list dd:nth-child(12) { animation-delay: 0.45s; }
.tech-list dt:nth-child(13), .tech-list dd:nth-child(14) { animation-delay: 0.53s; }

@keyframes techFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Dark theme — stack */
body.dark-theme .tech-stack h5 {
  color: #aaaaaa !important;
}

body.dark-theme .tech-list dt {
  color: #cccccc !important;
}

body.dark-theme .tech-list dd {
  color: #888888 !important;
}

body.dark-theme .tech-list dd {
  color: #e0e0e0 !important;
}

/* ===== Selector de idioma ===== */
.lang-selector {
  position: relative;
  display: inline-block;
  margin-left: 8px;
}

#lang-toggle {
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px;
  line-height: 1;
  transition: all 0.2s;
  white-space: nowrap;
}

#lang-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}

#mainNav.is-fixed #lang-toggle,
.navbar-light #lang-toggle {
  border-color: rgba(255, 255, 255, 0.9);
  color: #fff;
  background: rgba(52, 58, 64, 0.55);
}

#mainNav.is-fixed #lang-toggle:hover,
.navbar-light #lang-toggle:hover {
  background: rgba(52, 58, 64, 0.75);
  border-color: #fff;
}

#lang-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  min-width: 145px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1100;
}

#lang-dropdown.open {
  display: block;
}

#lang-dropdown li {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #212529;
  transition: background 0.1s;
}

#lang-dropdown li:hover {
  background: #f0f4f8;
}

@media only screen and (max-width: 991px) {
  .lang-selector {
    margin-left: 0;
    margin-top: 8px;
  }

  body.dark-theme #lang-toggle {
    border-color: rgba(255, 255, 255, 0.9);
    color: #fff;
    background: rgba(52, 58, 64, 0.55);
  }

  #lang-dropdown {
    position: static;
    box-shadow: none;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-top: 4px;
  }
}

/* ===== Selector de idioma en tema oscuro ===== */
body.dark-theme #lang-toggle,
body.dark-theme #mainNav.is-fixed #lang-toggle,
body.dark-theme .navbar-light #lang-toggle {
  border-color: rgba(224, 224, 224, 0.5) !important;
  color: #e0e0e0 !important;
  background: transparent !important;
}

body.dark-theme #lang-toggle:hover,
body.dark-theme #mainNav.is-fixed #lang-toggle:hover,
body.dark-theme .navbar-light #lang-toggle:hover {
  background: rgba(224, 224, 224, 0.15) !important;
  border-color: #e0e0e0 !important;
  color: #ffffff !important;
}

@media only screen and (max-width: 991px) {
  body.dark-theme #lang-toggle {
    border-color: rgba(224, 224, 224, 0.5) !important;
    color: #e0e0e0 !important;
  }
}

body.dark-theme #lang-dropdown {
  background: #16213e;
  border-color: #0f3460;
}

body.dark-theme #lang-dropdown li {
  color: #e0e0e0;
}

body.dark-theme #lang-dropdown li:hover {
  background: #0f3460;
}

/* ===== Tema oscuro ===== */
body.dark-theme {
  background-color: #1a1a2e !important;
  color: #e0e0e0 !important;
}

body.dark-theme a {
  color: #7eb8e0 !important;
}

body.dark-theme a:focus,
body.dark-theme a:hover {
  color: #4fc3f7 !important;
}

/* Navbar */
body.dark-theme #mainNav {
  background-color: #16213e !important;
  border-bottom-color: #0f3460 !important;
}

body.dark-theme #mainNav .navbar-brand,
body.dark-theme #mainNav .navbar-toggler,
body.dark-theme #mainNav .navbar-nav > li.nav-item > a {
  color: #e0e0e0 !important;
}

body.dark-theme #mainNav.is-fixed {
  background-color: rgba(22, 33, 62, 0.98) !important;
  border-bottom-color: #0f3460 !important;
}

body.dark-theme #mainNav.is-fixed .navbar-brand,
body.dark-theme #mainNav.is-fixed .navbar-nav > li.nav-item > a,
body.dark-theme #mainNav .navbar-nav > li.nav-item > a {
  color: #e0e0e0 !important;
  border-color: rgba(224, 224, 224, 0.5) !important;
}

body.dark-theme #mainNav.is-fixed .navbar-brand:hover,
body.dark-theme #mainNav.is-fixed .navbar-nav > li.nav-item > a:hover,
body.dark-theme #mainNav .navbar-nav > li.nav-item > a:hover {
  background: rgba(224, 224, 224, 0.15) !important;
  border-color: #e0e0e0 !important;
  color: #ffffff !important;
}


@media only screen and (max-width: 991px) {
  /* Ensure the collapsed hamburger menu area uses the dark navbar colour */
  body.dark-theme .navbar-collapse {
    background-color: #16213e !important;
  }

}

/* Contenido — texto blanco */
body.dark-theme,
body.dark-theme p,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6,
body.dark-theme li,
body.dark-theme span,
body.dark-theme strong,
body.dark-theme .container,
body.dark-theme .row,
body.dark-theme .text-dark,
body.dark-theme .text-muted {
  color: #e0e0e0 !important;
}

body.dark-theme header.masthead .site-heading h1 span[style*="color:#66d9e8"],
body.dark-theme header.masthead .page-heading h1 span[style*="color:#66d9e8"] {
  color: #66d9e8 !important;
}
body.dark-theme header.masthead .site-heading h1 span[style*="color:#f8f8f2"],
body.dark-theme header.masthead .page-heading h1 span[style*="color:#f8f8f2"] {
  color: #f8f8f2 !important;
}
body.dark-theme header.masthead .site-heading h1 span[style*="color:#e6db74"],
body.dark-theme header.masthead .page-heading h1 span[style*="color:#e6db74"] {
  color: #e6db74 !important;
}

body.dark-theme header.masthead .site-heading h1 #tw-text,
body.dark-theme header.masthead .page-heading h1 #tw-text {
  color: #66d9e8 !important;
}

body.dark-theme hr {
  border-color: #0f3460 !important;
}

/* Footer en dark mode */
body.dark-theme footer {
  background-color: #0d1117 !important;
}

body.dark-theme .footer-text,
body.dark-theme .footer-text a {
  color: #aaaaaa !important;
}

body.dark-theme .footer-text a:hover {
  color: #e0e0e0 !important;
}

body.dark-theme .footer-social a {
  color: #aaaaaa !important;
}

body.dark-theme .footer-social a:hover {
  color: #e0e0e0 !important;
}

body.dark-theme .footer-brand {
  color: #e0e0e0 !important;
}

body.dark-theme .footer-copyright {
  color: #555555 !important;
}

body.dark-theme .footer-divider {
  border-color: #222222 !important;
}

/* Formulario de contacto */
body.dark-theme .floating-label-form-group {
  border-bottom-color: #0f3460;
}

body.dark-theme .floating-label-form-group input,
body.dark-theme .floating-label-form-group textarea {
  color: #e0e0e0;
  background: transparent;
}

body.dark-theme .floating-label-form-group input::-webkit-input-placeholder,
body.dark-theme .floating-label-form-group textarea::-webkit-input-placeholder {
  color: #888;
}

body.dark-theme form .form-group:first-child .floating-label-form-group {
  border-top-color: #0f3460;
}

/* Post preview */
body.dark-theme .post-preview > a {
  color: #e0e0e0;
}

body.dark-theme .post-preview > a:hover {
  color: #4fc3f7;
}

body.dark-theme .post-preview > .post-meta {
  color: #aaaaaa;
}

/* ===== Tech divider ===== */
.tech-list dt {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 6px;
}
.tech-list dd {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 6px;
  margin-bottom: 6px;
}
body.dark-theme .tech-list dt,
body.dark-theme .tech-list dd {
  border-bottom-color: #0f3460;
}

/* ===== Idiomas ===== */
.languages-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.language-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.language-flag {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid #e0e0e0;
  overflow: hidden;
}
.language-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
  color: var(--color-text);
}
.language-level {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0;
  text-align: center;
}
.language-flag {
  background: transparent !important;
  border: none !important;
  overflow: hidden;
}
.language-flag img {
  width: 120%;
  height: 120%;
  object-fit: cover;
  border-radius: 50%;
  margin: -10%;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.language-flag img:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}
body.dark-theme .language-flag {
  background: #16213e;
  border-color: #0f3460;
}
body.dark-theme .language-name {
  color: #e0e0e0 !important;
}
body.dark-theme .language-level {
  color: #aaaaaa !important;
}

/* ===== Botón CV ===== */
.btn-cv {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #003366;
  background: #ffffff;
  border: 2px solid #003366;
  border-radius: 0;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none !important;
  transition: color 0.2s;
  margin-top: 1rem;
}
.btn-cv-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s;
  background: radial-gradient(circle, rgba(0,51,102,0.25) 0%, transparent 70%);
}
.btn-cv:hover .btn-cv-glow { opacity: 1; }
.btn-cv span, .btn-cv svg { position: relative; z-index: 1; }

body.dark-theme .btn-cv {
  color: #7eb8e0;
  background: #1a1a2e;
  border-color: #7eb8e0;
}
body.dark-theme .btn-cv-glow {
  background: radial-gradient(circle, rgba(126,184,224,0.35) 0%, transparent 70%);
}

.lang-option {
  position: relative;
  overflow: hidden;
  background-image: none !important;
  background-color: #fff;
}

body.dark-theme .lang-option {
  background-color: #16213e;
}

.lang-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: 150%;
  background-position: center;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  opacity: 0.5;
}

.lang-option[data-lang="es"]::before {
  background-image: url("/static/core/img/flags/idioma_espanol.26174fb672cb.webp");
}

.lang-option[data-lang="en"]::before {
  background-image: url("/static/core/img/flags/idioma_ingles.48aaf6f8e5f5.webp");
}

.lang-option[data-lang="pt"]::before {
  background-image: url("/static/core/img/flags/idioma_portugues.77cd4dbe1236.webp");
}

.lang-option:hover::before {
  transform: translateX(0);
}

.lang-flag-btn {
  width: 32px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
}

/* ===== Certificaciones — dark theme ===== */
body.dark-theme .cert-slide { background: rgba(255,255,255,0.04); }
body.dark-theme .cert-slide-img { background: rgba(255,255,255,0.06); }
body.dark-theme .cert-filter-btn { color: #e0e0e0 !important; border-color: rgba(255,255,255,0.2) !important; }
body.dark-theme .cert-filter-btn:hover,
body.dark-theme .cert-filter-btn.active { color: #ffffff !important; border-color: #ffffff !important; }
body.dark-theme .cert-slide-name { color: #e0e0e0 !important; }
body.dark-theme .cert-slide-emisor { color: #aaaaaa !important; }
body.dark-theme .cert-nav-btn { color: #e0e0e0 !important; border-color: rgba(255,255,255,0.2) !important; }
body.dark-theme .cert-nav-btn:hover { color: #ffffff !important; border-color: #ffffff !important; }
body.dark-theme .cert-hint { color: #aaaaaa !important; }
body.dark-theme .cert-dot { background: #aaaaaa !important; }
body.dark-theme .cert-dot.active { background: #e0e0e0 !important; }
