/* =========================================================
   IDENTIDAD VISUAL
   Ciencia · Tecnología · Datos · IA · Gamificación
   ========================================================= */

:root {
  --azul-noche: #071827;
  --azul-profundo: #0b2942;
  --azul-tecnologico: #086788;
  --cian: #00b8d9;
  --cian-claro: #8be9fd;
  --violeta: #7c3aed;
  --verde-logro: #16a34a;
  --dorado-recompensa: #f59e0b;

  --fondo: #f5f8fc;
  --superficie: #ffffff;
  --superficie-azul: #edf7fb;

  --texto: #172033;
  --texto-secundario: #526273;
  --borde: rgba(8, 103, 136, 0.18);

  --sombra-suave: 0 10px 30px rgba(7, 24, 39, 0.08);
  --sombra-activa: 0 16px 40px rgba(0, 184, 217, 0.16);
  --radio: 16px;
}

/* =========================================================
   BASE GENERAL
   ========================================================= */

html {
  scroll-behavior: smooth;
}

body {
  color: var(--texto);
  background-color: var(--fondo);
  background-image:
    radial-gradient(
      circle at 8% 5%,
      rgba(0, 184, 217, 0.08),
      transparent 25rem
    ),
    radial-gradient(
      circle at 95% 18%,
      rgba(124, 58, 237, 0.07),
      transparent 28rem
    );
  background-attachment: fixed;
  font-family:
    Inter,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.7;
}

main.content {
  animation: entrada 0.55s ease-out both;
}

p,
li {
  color: var(--texto-secundario);
}

/* =========================================================
   BARRA DE NAVEGACIÓN
   ========================================================= */

.navbar {
  position: relative;
  background:
    linear-gradient(
      110deg,
      var(--azul-noche) 0%,
      var(--azul-profundo) 55%,
      #10385b 100%
    ) !important;
  box-shadow: 0 6px 24px rgba(7, 24, 39, 0.22);
  border-bottom: 1px solid rgba(139, 233, 253, 0.18);
}

/* Línea que recuerda una barra de progreso */
.navbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background:
    linear-gradient(
      90deg,
      var(--cian),
      var(--violeta),
      var(--dorado-recompensa)
    );
}

.navbar-brand,
.navbar-title,
.navbar-nav .nav-link {
  color: #ffffff !important;
}

.navbar-brand {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.navbar-nav .nav-link {
  position: relative;
  font-weight: 600;
  opacity: 0.88;
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--cian-claro) !important;
  opacity: 1;
  transform: translateY(-1px);
}

/* =========================================================
   PORTADA / HERO
   ========================================================= */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  padding: clamp(2.5rem, 6vw, 5rem);
  margin: 1rem 0 3rem;

  color: #ffffff;
  background:
    radial-gradient(
      circle at 82% 22%,
      rgba(0, 184, 217, 0.32),
      transparent 22rem
    ),
    radial-gradient(
      circle at 12% 90%,
      rgba(124, 58, 237, 0.28),
      transparent 24rem
    ),
    linear-gradient(
      135deg,
      var(--azul-noche) 0%,
      var(--azul-profundo) 58%,
      #104664 100%
    );

  border: 1px solid rgba(139, 233, 253, 0.2);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(7, 24, 39, 0.22);
}

/* Retícula científica y digital */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;

  background-image:
    linear-gradient(
      rgba(139, 233, 253, 0.07) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(139, 233, 253, 0.07) 1px,
      transparent 1px
    );

  background-size: 38px 38px;
  mask-image:
    linear-gradient(
      to bottom right,
      rgba(0, 0, 0, 0.95),
      transparent 85%
    );
}

/* Resplandor tecnológico */
.hero::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -90px;
  z-index: -1;

  width: 260px;
  height: 260px;

  background: rgba(0, 184, 217, 0.22);
  border-radius: 50%;
  filter: blur(14px);
}

.hero h1 {
  max-width: 850px;
  margin-bottom: 1rem;

  color: #ffffff;
  font-size: clamp(2.4rem, 5vw, 4.3rem);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.hero h2 {
  max-width: 900px;
  margin-bottom: 1.5rem;

  color: var(--cian-claro);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 650;
  line-height: 1.5;
}

.hero p {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

/* =========================================================
   TÍTULOS Y CONTENIDO
   ========================================================= */

h1,
h2,
h3 {
  color: var(--azul-profundo);
}

h2 {
  margin-top: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

main.content > h2 {
  position: relative;
  padding-bottom: 0.7rem;
}

main.content > h2::after {
  content: "";
  display: block;

  width: 74px;
  height: 4px;
  margin-top: 0.55rem;

  background:
    linear-gradient(
      90deg,
      var(--cian),
      var(--violeta)
    );

  border-radius: 999px;
}

h3 {
  margin-top: 1.7rem;
  font-weight: 750;
}

a {
  color: var(--azul-tecnologico);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--violeta);
}

/* =========================================================
   TARJETAS DE ESPECIALIZACIÓN
   ========================================================= */

.columns {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.columns > .column {
  position: relative;
  overflow: hidden;

  width: auto !important;
  min-height: 100%;
  padding: 1.6rem;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.98),
      rgba(237, 247, 251, 0.92)
    );

  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra-suave);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.columns > .column::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;

  height: 5px;
  background:
    linear-gradient(
      90deg,
      var(--cian),
      var(--violeta)
    );
}

.columns > .column:nth-child(2)::before {
  background:
    linear-gradient(
      90deg,
      var(--violeta),
      var(--dorado-recompensa)
    );
}

.columns > .column:nth-child(3)::before {
  background:
    linear-gradient(
      90deg,
      var(--verde-logro),
      var(--cian)
    );
}

.columns > .column:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 184, 217, 0.48);
  box-shadow: var(--sombra-activa);
}

.columns > .column h3 {
  margin-top: 0.3rem;
  color: var(--azul-profundo);
}

/* =========================================================
   BOTONES
   ========================================================= */

.btn {
  padding: 0.72rem 1.2rem;
  margin: 0.5rem 0.45rem 0.25rem 0;

  font-weight: 750;
  letter-spacing: 0.01em;

  border-width: 2px;
  border-radius: 10px;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.btn-primary {
  color: #ffffff !important;
  background:
    linear-gradient(
      110deg,
      var(--azul-tecnologico),
      var(--cian)
    ) !important;
  border-color: transparent !important;
  box-shadow: 0 8px 20px rgba(0, 184, 217, 0.22);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 184, 217, 0.34);
}

.btn-outline-primary {
  color: var(--cian-claro) !important;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--cian-claro) !important;
}

.btn-outline-primary:hover {
  color: var(--azul-noche) !important;
  background: var(--cian-claro) !important;
  transform: translateY(-2px);
}

.btn-secondary {
  color: #ffffff !important;
  background:
    linear-gradient(
      110deg,
      var(--violeta),
      #9b5de5
    ) !important;
  border-color: transparent !important;
}

/* =========================================================
   ELEMENTOS DE DATOS Y CONTENIDO
   ========================================================= */

blockquote {
  padding: 1rem 1.3rem;

  background: rgba(0, 184, 217, 0.07);
  border-left: 5px solid var(--cian);
  border-radius: 0 12px 12px 0;
}

code {
  color: #6435c9;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 5px;
}

pre code {
  border: 0;
}

table {
  overflow: hidden;
  background: var(--superficie);
  border-radius: 12px;
  box-shadow: var(--sombra-suave);
}

thead {
  color: #ffffff;
  background: var(--azul-profundo);
}

tbody tr:hover {
  background: rgba(0, 184, 217, 0.06);
}

.callout {
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(7, 24, 39, 0.06);
}

/* =========================================================
   ÍNDICE LATERAL
   ========================================================= */

#TOC {
  padding-left: 1rem;
  border-left: 2px solid rgba(0, 184, 217, 0.28);
}

#TOC .active {
  color: var(--violeta) !important;
  font-weight: 700;
}

/* =========================================================
   ACCESIBILIDAD
   ========================================================= */

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--dorado-recompensa);
  outline-offset: 4px;
  border-radius: 6px;
}

/* =========================================================
   PIE DE PÁGINA
   ========================================================= */

.nav-footer {
  margin-top: 4rem;
  color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(
      110deg,
      var(--azul-noche),
      var(--azul-profundo)
    );
  border-top: 3px solid var(--cian);
}

.nav-footer a {
  color: var(--cian-claro);
}

/* =========================================================
   ANIMACIÓN
   ========================================================= */

@keyframes entrada {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respeta la preferencia de usuarios sensibles al movimiento */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   ADAPTACIÓN A TABLET Y MÓVIL
   ========================================================= */

@media (max-width: 992px) {
  .columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .hero {
    padding: 2.2rem 1.3rem;
    border-radius: 16px;
  }

  .hero h1 {
    font-size: 2.35rem;
  }

  .hero h2 {
    font-size: 1.05rem;
  }

  .btn {
    display: block;
    width: 100%;
    margin-right: 0;
    text-align: center;
  }

  main.content > h2 {
    font-size: 1.65rem;
  }
}