/* ==========================================================================
   1. Reset & Variables Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--fuente-base);
  line-height: 1.6;
  background-color: var(--color-bg, #0f172a);
  color: var(--color-text, #f8fafc);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--color-accent, #00d2ff);
  outline-offset: 3px;
}

/* ==========================================================================
   2. Header & Navegación (Desktop Base)
   ========================================================================== */
.site-header {
  background-color: var(--color-bg-header, #1e293b);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-text, #ffffff);
}

.logo img {
  height: 64px;
  width: auto;
  display: block;
}

.logo-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
}

.logo-title {
  font-family: var(--fuente-base);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text, #ffffff);
  letter-spacing: -0.01em;
}

.logo-tagline {
  font-family: var(--fuente-base);
  font-size: 0.725rem;
  font-weight: 400;
  color: var(--penumbra, #94a3b8);
  margin-top: 4px;
}

.logo:hover .logo-title {
  color: var(--color-primary, #a855f7);
}

/* Navegación Desktop */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--color-text-nav, #cbd5e1);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: var(--color-primary, #a855f7);
}

/* Botón Hamburguesa */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle-icon {
  display: block;
  position: relative;
  width: 24px;
  height: 2px;
  background-color: var(--color-text, #ffffff);
  transition: background-color 0.3s;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: var(--color-text, #ffffff);
  transition: transform 0.3s, top 0.3s;
}

.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background-color: transparent;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ==========================================================================
   3. Banner estilo Intranet (Desktop Base)
   ========================================================================== */
.page-banner {
  position: relative;
  width: 100%;
  min-height: 450px;
  background-image: url('../assets/img/01-pb-origen-banner-retro-futurista.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed; 
}

.banner-overlay {
  width: 100%;
  height: 100%;
  min-height: 450px;
  background: linear-gradient(
    90deg, 
    rgba(15, 23, 42, 0.3) 0%, 
    rgba(15, 23, 42, 0.75) 100%
  );
  display: flex;
  align-items: center;
}

/* ==========================================
   ALINEACIÓN Y ANCHO DEL BANNER INTRANET
   ========================================== */
.page-banner .banner-container {
  max-width: var(--container-max-width, 1200px); /* Usa la misma variable de ancho que el resto del sitio */
  width: 100%;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  display: flex;
  justify-content: flex-end; /* Alinea el contenido a la izquierda */
  align-items: center;
}

.banner-content {
  width: 100%;
  max-width: 100% !important;
  text-align: right; /* Asegura alineación a la izquierda */
  margin: 0;
}

.banner-title {
  white-space: nowrap;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  margin: 0;
  text-align: right;
}

/* ==========================================================================
   4. Layouts, Containers & Cards
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Layout por defecto con Sidebar (Para Blog, Servicios, etc.) */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

/* Layout de ancho completo (Ideal para la Home sin Sidebar) */
.layout-grid--full {
  display: grid;
  grid-template-columns: 1fr;
}

/* Card Styles */
.card {
  background-color: var(--color-card-bg, #1e293b);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card a:not(.btn) {
  color: var(--color-primary, #fff);
  text-decoration: underline;
}

.card a:not(.btn):hover {
  opacity: 0.8;
}

.card--highlight {
  border-left: 4px solid var(--color-primary, #e11d48);
}

.card h1, .card h2, .card h3 {
  margin-bottom: 0.75rem;
}

.card p {
  margin-bottom: 1rem;
}

/* Botones Base */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.btn--primary {
  background-color: var(--color-primary, #a855f7);
  color: #ffffff;
}

.btn--outline {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--color-accent, #38bdf8);
  border-radius: 6px;
  color: var(--color-accent, #38bdf8);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  text-align: center;
}

.btn--outline:hover {
  background-color: rgba(56, 189, 248, 0.1);
  color: #ffffff;
}

/* ==========================================================================
   5. Diagramaciones de Columnas (Grids Reutilizables)
   ========================================================================== */
.service-block {
  margin-bottom: 2rem;
}

.section-title {
  margin-bottom: 1rem;
  color: var(--color-accent, #38bdf8);
  font-size: 1.15rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

.services-sections .card {
  margin-bottom: 0;
  height: 100%;
}

.grid-2-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.grid-3-equal {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

.grid-1-4-3-4 {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 1.5rem;
}

.grid-1-3-2-3 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

.grid-1-full {
  display: grid;
  grid-template-columns: 1fr;
}

.badge {
  display: inline-block;
  background-color: var(--color-primary, #a855f7);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}



/* ==========================================
   06. ESTILOS GENERALES DEL FOOTER
   ========================================== */
.site-footer {
  background-color: #050505;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3rem 1.5rem 2rem 1.5rem;
  margin-top: 4rem;
}

.footer-nav, 
.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav a, 
.footer-social a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.footer-nav a:hover, 
.footer-social a:hover {
  color: var(--color-accent, #38bdf8);
}

.footer-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2rem 0;
}

.footer-credits {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  line-height: 1.6;
}



/* ==========================================
   PLACEHOLDER OSCURO CON DEGRADADO PARA MEDIA
   ========================================== */

/* Contenedor principal que funciona como Placeholder */
.media-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--border-radius-lg, 16px);
  overflow: hidden;
  position: relative;
  
  /* Degradado sutil oscuro de baja intensidad */
  background: linear-gradient(
    135deg, 
    rgba(255, 255, 255, 0.05) 0%, 
    rgba(255, 255, 255, 0.02) 50%, 
    rgba(255, 255, 255, 0.06) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Efecto opcional: Brillo / pulso sutil cinematográfico */
.media-frame::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.03) 50%, 
    transparent 100%
  );
  animation: placeholderShimmer 3s infinite linear;
}

@keyframes placeholderShimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(200%); }
}

/* Manejo de Placeholders: imágenes ocultas por defecto hasta confirmar carga */
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* Se mantiene oculta para evitar que el navegador dibuje el icono roto */
  position: relative;
  z-index: 1;
}

/* Clase dinámica aplicada por JS cuando la imagen carga correctamente */
.media-frame img.is-loaded {
  display: block;
}

/* Ocultar la imagen cuando falla su carga para mantener solo el placeholder limpio */
.media-frame img:not([src]), 
.media-frame img[src=""],
.media-frame img[src*="placeholder"] {
  opacity: 0;
}


/* ==========================================================================
   COMPONENTES DE ARTÍCULOS Y BLOG
   ========================================================================== */

/* Barra de progreso de lectura fija */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--color-accent, #38bdf8);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease-out;
}

/* Metadatos y alineación del banner de artículo */
.article-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--penumbra, #cbd5e1);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* Tipografía y espaciado del cuerpo del artículo */
.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #e2e8f0;
}

.article-content p {
  margin-bottom: 1.5rem;
}

/* Indicador de lectura completada */
.completion-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--color-accent, #38bdf8);
  color: var(--color-accent, #38bdf8);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  margin-top: 2rem;
  font-weight: 600;
}

.completion-badge.is-visible {
  display: flex;
}

/* Widgets para el Sidebar */
.sidebar-widget {
  margin-bottom: 2rem;
}

.sidebar-widget-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent, #38bdf8);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.related-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-posts-list li {
  margin-bottom: 1rem;
}

.related-posts-list a {
  color: #f8fafc;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  display: block;
  transition: color 0.2s ease;
}

.related-posts-list a:hover {
  color: var(--color-primary, #a855f7);
}

.related-posts-list span {
  display: block;
  font-size: 0.8rem;
  color: var(--penumbra, #94a3b8);
  margin-top: 0.25rem;
}


    .faq-accordion {
      display: flex;
      flex-direction: column;
      gap: 1rem;
      margin-top: 1.5rem;
    }
    .faq-item {
      background: var(--color-bg-card, rgba(30, 41, 59, 0.7));
      border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
      border-radius: 8px;
      overflow: hidden;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }
    .faq-item[open] {
      border-color: var(--color-primary, #e11d48);
      box-shadow: 0 4px 20px rgba(225, 29, 72, 0.15);
    }
    .faq-summary {
      padding: 1.25rem 1.5rem;
      font-weight: 600;
      font-size: 1.05rem;
      color: var(--color-text-bright, #ffffff);
      cursor: pointer;
      list-style: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
      user-select: none;
    }
    .faq-summary::-webkit-details-marker {
      display: none;
    }
    .faq-summary::after {
      content: "+";
      font-size: 1.4rem;
      line-height: 1;
      color: var(--color-primary, #e11d48);
      transition: transform 0.3s ease;
      margin-left: 1rem;
    }
    .faq-item[open] .faq-summary::after {
      content: "−";
      transform: rotate(180deg);
    }
    .faq-content {
      padding: 0 1.5rem 1.25rem 1.5rem;
      color: var(--color-text-muted, #cbd5e1);
      line-height: 1.6;
      font-size: 0.95rem;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      margin-top: 0.25rem;
      padding-top: 1rem;
    }

/* ==========================================================================
   LAYOUT CON SIDEBAR Y FORMULARIO DE CONTACTO
   ========================================================================== */

/* Layout de dos columnas: Contenido (70%) + Sidebar (30%) */
.layout-grid--sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 992px) {
  .layout-grid--sidebar {
    grid-template-columns: 1fr 320px;
  }
}

/* Grilla interna de Formulario + Imagen */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 0.8fr 1.2fr;
    align-items: start;
  }
}

/* Marco e Imagen Lateral */
.contact-image-frame {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  min-height: 380px;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.contact-image-badge {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

/* Campos de Formulario */
.card--form-wrapper {
  padding: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text-bright, #ffffff);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.15));
  border-radius: 6px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary, #e11d48);
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.25);
}

.form-control::placeholder {
  color: #64748b;
}

select.form-control option {
  background: #0f172a;
  color: #ffffff;
}

/* Mensajes de Resultado */
.form-result {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.form-result.loading {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-result.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.form-result.error {
  background: rgba(225, 29, 72, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(225, 29, 72, 0.4);
}

/* Sidebar Widgets */
.sidebar-widget {
  margin-bottom: 1.5rem;
}

.sidebar-contact-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  font-size: 0.9rem;
}

.sidebar-contact-list li {
  margin-bottom: 0.85rem;
  line-height: 1.4;
  color: var(--color-text-muted, #cbd5e1);
}

.sidebar-contact-list a {
  color: var(--color-primary, #e11d48);
  text-decoration: none;
}

.sidebar-contact-list a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   7. Media Queries Consolidados (Puntos de Interrupción)
   ========================================================================== */

/* Tablet (Max 992px) */
@media (max-width: 992px) {
  .grid-3-equal {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet / Móvil Horizontal (Max 900px) */
@media (max-width: 900px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
}

/* Móvil Estándar (Max 768px) */
@media (max-width: 768px) {
  /* Header y Menú desplegable */
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-bg-header, #1e293b);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    flex-direction: column;
    align-items: stretch;
    padding: 0 1.5rem;
    gap: 1rem;
  }

  .site-nav[data-visible="true"] {
    max-height: 380px;
    padding: 1.5rem;
  }

  .site-nav ul {
    flex-direction: column;
    padding: 0;
    gap: 1rem;
  }

  .site-nav .btn--nav {
    text-align: center;
    width: 100%;
  }

  /* Banner */
  .page-banner {
    background-attachment: scroll;
    min-height: 320px;
  }
  
  .banner-overlay {
    min-height: 320px;
  }

  /* Columnas generales */
  .grid-2-equal,
  .grid-3-equal,
  .grid-1-4-3-4,
  .grid-1-3-2-3 {
    grid-template-columns: 1fr;
  }
}

/* Móvil Pequeño (Max 480px) */
@media (max-width: 480px) {
  .logo-tagline {
    display: none; /* Oculta el eslogan en teléfonos muy estrechos */
  }
}

/* Accesibilidad y Preferencias de usuario */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}