:root {
  --navy: #102347;
  --navy-dark: #0A152C;

  --gold: #C9A227;
  --gold-soft: rgba(201, 162, 39, 0.12);

  --ice-blue: #99c5ff;
  --cream: #F0F6FF;
  --background: #D6E4FF;
  --paper: #FFFFFF;

  --ink: #1E293B;
  --muted: #64748B;

  --border: #BCE3FF;

  --shadow-soft: 0 4px 18px rgba(16, 35, 71, 0.08);
  --shadow-medium: 0 10px 30px rgba(16, 35, 71, 0.15);

  --header-h: 90px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 280px;
  --content-max: 820px;
  --gap-lg: 32px;
  --transition-base: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.8), transparent 40%),
    linear-gradient(135deg, #D6E4FF 0%, #E6EEFF 50%, #C7DCFF 100%);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Barra de progreso de lectura */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), #0252CC);
  z-index: 1000;
  transition: width 0.1s ease-out;
}

/* Header & Navegación */
.site-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
  background: var(--paper);
  border-bottom: 1px solid rgba(153, 197, 255, 0.4);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--navy);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
}

.logo img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(16, 35, 71, 0.2);
  object-fit: cover;
}

.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  display: inline-flex;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--navy);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-base);
}

.main-nav a:hover {
  background: var(--navy);
  color: #FFFFFF;
  transform: translateY(-2px);
}

/* Hero / Banner */
.hero-container {
  width: min(1200px, calc(100% - 40px));
  margin: 30px auto 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  box-shadow: var(--shadow-medium);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--ice-blue);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.titulo-principal {
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.35;
  color: var(--navy);
  max-width: 65ch;
}

.titulo-principal span {
  color: #0252CC;
  border-bottom: 3px solid rgba(2, 82, 204, 0.25);
}

.marketing img {
  width: 750px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 15px rgba(16, 35, 71, 0.12));
  transition: transform var(--transition-base);
}

.marketing:hover img {
  transform: translateY(-6px) scale(1.02);
}

/* Layout Principal */
.page-layout {
  width: min(1200px, calc(100% - 40px));
  margin: var(--gap-lg) auto 60px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap-lg);
  align-items: start;
}

.contenido-principal {
  min-width: 0;
}

/* Sidebar Index */
.sidebar-index {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
}

.sidebar-index__inner {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.indice-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--navy);
}

.indice-header span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--ice-blue);
  color: var(--navy);
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.indice-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.indice-lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.indice-lista a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-base);
}

.indice-lista a span {
  color: #0252CC;
  font-weight: 800;
  font-size: 0.75rem;
}

.indice-lista a:hover {
  background: var(--cream);
  padding-left: 16px;
}

.indice-lista a.active {
  background: var(--cream);
  border-left-color: var(--ice-blue);
  color: var(--navy);
  font-weight: 700;
}

.sidebar-progress {
  margin-top: 16px;
  height: 4px;
  width: 100%;
  background: var(--cream);
  border-radius: 999px;
  overflow: hidden;
}

.sidebar-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--ice-blue);
  transition: width 0.15s linear;
}

/* Categorías y Tarjetas */
.categoria {
  margin-bottom: 40px;
  background: rgba(255, 255, 255, 0.5);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(188, 227, 255, 0.8);
}

.categoria-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--ice-blue);
  padding-bottom: 10px;
}

.num-cat {
  background: var(--navy);
  color: var(--ice-blue);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.9rem;
}

.categoria-header h2 {
  font-size: 1.3rem;
  color: var(--navy);
  font-weight: 700;
}

.tarjeta-seccion {
  background: var(--paper);
  border: 1px solid var(--border);
  border-left: 5px solid var(--ice-blue);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: calc(var(--header-h) + 20px);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.tarjeta-seccion:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.titulo-seccion {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 20px 24px 12px;
  font-size: 1.25rem;
  color: var(--navy);
}

.titulo-num {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0252CC;
}

.contenido-seccion {
  padding: 0 24px 24px;
  max-width: var(--content-max);
}

.contenido-seccion p {
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 16px;
}

.contenido-seccion p:last-child {
  margin-bottom: 0;
}

.pregunta-problema-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.pregunta-problema-container .callout-box {
  flex: 1;
  margin-bottom: 0;
}

.figura-pregunta-lateral {
  flex-shrink: 0;
  width: 180px;
}

.figura-pregunta-lateral img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Callout General */
.callout-box {
  background: var(--cream);
  border-left: 4px solid var(--navy);
  padding: 18px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.callout-box p {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0;
}

/* Grid de Objetivos */
.objetivos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.objetivo-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.objetivo-card h4 {
  color: var(--navy);
  font-size: 1.05rem;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--ice-blue);
  display: inline-block;
  padding-bottom: 4px;
}

.objetivo-card ul {
  padding-left: 18px;
}

.objetivo-card li {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

/* Acordeones */
.acordeones-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.acordeon-item {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: background var(--transition-base);
}

.acordeon-item[open] {
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.acordeon-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

.acordeon-header::-webkit-details-marker {
  display: none;
}

.acordeon-header h4 {
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.acordeon-icon {
  color: #0252CC;
  font-weight: 800;
  transition: transform var(--transition-base);
}

.acordeon-item[open] .acordeon-icon {
  transform: rotate(180deg);
}

.acordeon-contenido {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 16px;
}

/* Leyes */
.leyes-lista {
  list-style: none;
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.leyes-lista li {
  background: var(--cream);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.leyes-lista strong {
  color: var(--navy);
}

/* Figuras */
.figura-documento {
  margin: 24px 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1px solid var(--border);
  text-align: left;
}

.figura-documento figcaption {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.figura-numero {
  font-weight: 800;
  color: var(--navy);
  font-size: 0.95rem;
}

.figura-titulo {
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  font-size: 0.92rem;
}

.figura-nota {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.figura-documento img {
  margin: 0 auto;
  border-radius: var(--radius-sm);
  max-height: 480px;
  object-fit: contain;
  box-shadow: var(--shadow-soft);
}

/* Tabla Original */
.tabla-resultados-original {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  background: #FFFFFF;
}

.tabla-resultados-original caption {
  font-weight: bold;
  margin-bottom: 8px;
  text-align: left;
  color: var(--navy);
}

.tabla-resultados-original th,
.tabla-resultados-original td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

/* ESTILOS DE CITAS E INTERACTIVIDAD DE REFERENCIAS */
.cita-link {
  color: #0252CC;
  font-weight: 700;
  text-decoration: none;
  background: rgba(153, 197, 255, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-base);
  cursor: pointer;
}

.cita-link:hover {
  background: var(--navy);
  color: #FFFFFF;
  text-decoration: none;
}

.referencias-lista {
  padding-left: 20px;
  display: grid;
  gap: 12px;
}

.referencias-lista li {
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base), transform var(--transition-base);
}

.referencias-lista li.destacado-ref {
  background: #FFEAA7;
  border-left: 4px solid var(--gold);
  transform: translateX(6px);
}

.referencias-lista a {
  color: #0252CC;
  text-decoration: underline;
}

/* ==========================================
   ESTILOS TEST INTERACTIVO Y ESPACIOS DE FOTO
   ========================================== */
.test-container {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-soft);
}

.test-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-pregunta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.test-badge {
  background: var(--navy);
  color: var(--ice-blue);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.test-pregunta-header h4 {
  color: var(--navy);
  font-size: 1.1rem;
}

/* Espacio reservado para las fotos descargables */
.foto-espacio-test {
  width: 100%;
  background: #FFFFFF;
  border: 2px dashed var(--ice-blue);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.img-test-slot {
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.foto-caption {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

.pregunta-texto {
  font-weight: 600;
  color: var(--navy);
  font-size: 1.05rem;
}

.test-opciones {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-opcion-test {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 4px rgba(16, 35, 71, 0.04);
}

.btn-opcion-test:hover {
  background: var(--navy);
  color: #FFFFFF;
  transform: translateX(6px);
  border-color: var(--navy);
}

.resultado-box {
  background: #FFFFFF;
  border: 2px solid #0252CC;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.resultado-box h3 {
  color: var(--navy);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.titulo-resultado-sesgo {
  font-size: 1.2rem;
  color: #0252CC;
  margin-bottom: 10px;
  font-weight: 800;
}

.btn-reiniciar {
  background: var(--navy);
  color: #FFFFFF;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: background var(--transition-base);
}

.btn-reiniciar:hover {
  background: var(--navy-dark);
}

/* Grid Evidencias */
.evidencias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.evidencia-item {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  transition: transform var(--transition-base);
}

.evidencia-item:hover {
  transform: translateY(-4px);
}

.evidencia-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  background: #FFFFFF;
  margin-bottom: 8px;
}

.evidencia-item figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Volver Arriba */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ice-blue);
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--shadow-medium);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-base);
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--navy-dark);
}

/* Footer */
.site-footer {
  width: 100%;
  padding: 24px;
  background: var(--navy);
  color: #B9C0D1;
  text-align: center;
  font-size: 0.85rem;
  border-top: 3px solid var(--ice-blue);
}

.hidden {
  display: none !important;
}

/* Responsividad Móvil */
@media (max-width: 980px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-index {
    position: relative;
    top: 0;
    max-height: none;
  }

  .indice-lista {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .pregunta-problema-container {
    flex-direction: column;
  }

  .figura-pregunta-lateral {
    width: 100%;
    max-width: 180px;
  }
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .hero-container {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }

  .marketing img {
    width: 200px;
  }
}