/* MuseoModerno delgada (el Theme Header solo carga la 700) */
@import url("https://fonts.googleapis.com/css2?family=MuseoModerno:wght@300;400&display=swap");

/* Operación Libertad · portada con scroll
   Plano (izquierda) + logos (derecha) -> el plano se encoge y sale -> logos centrados,
   título con estado del CTF, contador, botón y redes.
   Colores: usan las variables --lib-* del Theme Header (con respaldo). */

.lib-home {
  --lib-nav: 56px;
  --h-amber: var(--lib-amber, #ffb000);
  --h-line: var(--lib-line, #8fd0ff);
  --h-cyan: var(--lib-cyan, #7efcff);
  --h-text: var(--lib-text, #dff3ff);
  --h-panel: var(--lib-panel, #01142c);
  position: relative;
  /* <main> ya ocupa todo el ancho: no hace falta 100vw (con barra de scroll desbordaba) */
  width: 100%;
  margin-left: 0;
  color: var(--h-text);
}

/* ---------- escenario con scroll ---------- */
.lib-track { position: relative; height: 330vh; }
.lib-viewport {
  position: sticky;
  top: var(--lib-nav);
  height: calc(100vh - var(--lib-nav));
  min-height: 520px;
  overflow: hidden;
}

/* el plano 3D (el iframe que ya existía) */
.lib-plan { position: absolute; transform-origin: left center; }
.lib-plan #lib-intro-box {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}
/* durante la intro a pantalla completa no puede haber transformaciones en los ancestros */
.lib-home.is-intro .lib-plan { transform: none !important; opacity: 1 !important; }
/* .lib-viewport (sticky) crea su propio contexto de apilamiento: hay que subirlo por encima
   del navbar fijo (z-index 1030) para que el video a pantalla completa lo tape */
.lib-home.is-intro .lib-viewport { z-index: 2000; }

/* logos */
.lib-logo {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lib-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(126, 252, 255, 0.18));
}
.lib-home.is-intro .lib-logo,
.lib-home.is-intro .lib-center { visibility: hidden; }

/* bloque central: título, estado y contador */
.lib-center {
  position: absolute;
  left: 50%;
  width: min(94vw, 980px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.lib-center.is-on { pointer-events: auto; }

.lib-title {
  margin: 0 0 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, min(5.2vw, 7vh), 3.4rem); /* también limitado por el alto */
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--h-cyan);
  text-shadow: 0 0 18px rgba(126, 252, 255, 0.25);
}
/* "Competencia" delgada; "CTF@JCUN:/2026$" más grande, como prompt de terminal */
.lib-title .lib-title-word {
  font-family: 'MuseoModerno', sans-serif !important;
  font-weight: 300 !important;
  font-size: 0.7em;
}
.lib-title .lib-title-term {
  display: block;
  font-family: 'Share Tech Mono', monospace !important;
  font-weight: 400 !important;
  font-size: 1.5em;
  letter-spacing: 0;
  white-space: nowrap;
}
.lib-title .lib-title-term b { color: var(--lib-amber, #FF6A4D); font-weight: 400; }
.lib-title-cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.9em;
  margin-left: 0.15em;
  vertical-align: -0.08em;
  background: currentColor;
  animation: lib-cursor 1s steps(1) infinite;
}
@keyframes lib-cursor { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lib-title-cursor { animation: none; } }
.lib-subtitle {
  margin: 0 0 18px;
  font-family: 'MuseoModerno', sans-serif !important;
  font-weight: 300;
  font-size: clamp(0.95rem, 2.2vw, 1.5rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(223, 243, 255, 0.7);
}
.lib-status {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 2rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}
.lib-dot {
  width: 12px;
  height: 12px;
  background: var(--h-amber);
  box-shadow: 0 0 12px rgba(255, 176, 0, 0.7);
  animation: lib-pulse 1.4s steps(2, jump-none) infinite;
}
.lib-center[data-state="fin"] .lib-dot { background: #ff5a4a; box-shadow: 0 0 12px rgba(255, 90, 74, 0.6); animation: none; }
.lib-center[data-state="durante"] .lib-dot { background: #39ff14; box-shadow: 0 0 12px rgba(57, 255, 20, 0.5); }
@keyframes lib-pulse { 50% { opacity: 0.25; } }

.lib-slogan {
  margin: 0 0 18px;
  font-size: clamp(0.85rem, 1.8vw, 1.05rem);
  color: rgba(223, 243, 255, 0.75);
}

/* contador */
.lib-count { display: inline-flex; gap: clamp(8px, 2vw, 18px); margin-top: 4px; }
.lib-count[hidden] { display: none; }
.lib-cell {
  min-width: clamp(58px, 11vw, 96px);
  padding: 10px 6px 8px;
  background: rgba(1, 20, 44, 0.88);
  border: 1px solid rgba(143, 208, 255, 0.35);
  border-top: 3px solid var(--h-amber);
}
.lib-cell b {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700; /* el Theme Header pone MuseoModerno: que se vean en negrita */
  font-size: clamp(1.4rem, min(5vw, 6.5vh), 3rem);
  line-height: 1.05;
  color: var(--h-amber);
  font-variant-numeric: tabular-nums;
}
.lib-cell span {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--h-line);
}
.lib-count-note {
  margin-top: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--h-line);
}

/* ---------- sección inferior: botón + redes ---------- */
.lib-after {
  position: relative;
  padding: 36px 16px 90px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(0, 14, 36, 0.6));
}
.lib-cta {
  display: inline-block;
  min-width: 240px;
  padding: 14px 34px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none !important;
  background: var(--h-amber);
  color: #000e24 !important;
  border: 1px solid var(--h-amber);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(255, 176, 0, 0.35);
}
.lib-cta:hover { background: #ffd166; border-color: #ffd166; }
.lib-cta.is-disabled {
  background: rgba(1, 30, 69, 0.9);
  color: var(--h-line) !important;
  border-color: rgba(143, 208, 255, 0.35);
  box-shadow: none;
  pointer-events: none;
}
.lib-cta-note { margin: 12px 0 0; font-size: 0.9rem; color: rgba(223, 243, 255, 0.75); }

.lib-rule {
  width: min(88vw, 1030px);
  height: 1px;
  margin: 38px auto 26px;
  background: linear-gradient(90deg, transparent, var(--h-line), transparent);
}
.lib-social-title {
  margin: 0 0 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: #fff;
}
.lib-social { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.lib-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  font-size: 1.35rem;
  color: var(--h-cyan);
  background: rgba(1, 20, 44, 0.85);
  border: 1px solid rgba(143, 208, 255, 0.35);
  border-radius: 50%;
  text-decoration: none !important;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.lib-social a:hover { color: var(--h-amber); border-color: var(--h-amber); transform: translateY(-2px); }
.lib-social a.is-pending { opacity: 0.55; }

@media (prefers-reduced-motion: reduce) {
  .lib-dot { animation: none; }
  .lib-social a { transition: none; }
}

/* ---------- limpieza de la portada (a pedido) ---------- */
/* sin la franja ámbar a la izquierda del plano */
.lib-plan #lib-intro-box { border: 0 !important; }
/* el cuadro "OP. LIBERTAD // CANAL RF" se oculta solo en la portada, porque tapa el plano */
body.lib-on-home #lib-hud { display: none !important; }

/* el escenario usa 100vw: con barra de scroll vertical eso desbordaba unos px y aparecía scroll horizontal */
body.lib-on-home { overflow-x: clip; }

/* ---------- marca de JCUN en el menú ---------- */
.lib-brand { display: inline-flex; align-items: center; padding: 0; margin-right: 1.25rem; }
.lib-brand-logo { display: block; height: 34px; width: auto; max-width: 100%; }
@media (max-width: 575.98px) { .lib-brand-logo { height: 28px; } }

/* Navbar con la misma letra que "Competencia" (MuseoModerno delgada) */
.navbar .nav-link {
  font-family: 'MuseoModerno', sans-serif !important;
  font-weight: 300 !important;
}
/* MuseoModerno es más ancha que Lato: entre 992 y 1099 px el menú no cabía en una línea */
@media (min-width: 992px) and (max-width: 1099.98px) {
  .navbar .nav-link { font-size: .74rem !important; padding-left: .25rem !important; padding-right: .25rem !important; }
}

/* Aviso "Haz scroll para continuar" (abajo a la izquierda de la portada) */
.lib-scroll-hint {
  position: fixed; /* fijo a la ventana: el contenedor del plano puede quedar desplazado */
  left: 18px;
  bottom: 22px;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: rgba(15, 14, 11, 0.85);
  border: 1px solid rgba(143, 191, 69, 0.6);
  color: #C6E490;
  font: 900 12px 'Lato', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.lib-scroll-hint.is-hidden { opacity: 0; transform: translateY(8px); }
.lib-home.is-intro .lib-scroll-hint { display: none; }
.lib-scroll-sub {
  display: block;
  margin-top: 3px;
  font: 300 11px 'Lato', sans-serif;
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(242, 242, 242, 0.75);
}
.lib-scroll-mouse {
  position: relative;
  flex: none;
  width: 18px;
  height: 28px;
  border: 2px solid #C6E490;
  border-radius: 10px;
}
.lib-scroll-mouse::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #FF6A4D;
  animation: lib-wheel 1.4s ease-in-out infinite;
}
.lib-scroll-chev { color: #FF6A4D; font-size: 18px; line-height: 1; animation: lib-bob 1.4s ease-in-out infinite; }
@keyframes lib-wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(9px); } }
@keyframes lib-bob { 50% { transform: translateY(4px); } }
@media (max-width: 575.98px) {
  .lib-scroll-hint { left: 50%; transform: translateX(-50%); bottom: 16px; white-space: nowrap; }
  .lib-scroll-hint.is-hidden { transform: translate(-50%, 8px); }
}
@media (prefers-reduced-motion: reduce) { .lib-scroll-mouse::after, .lib-scroll-chev { animation: none; } }

/* ===== Modal de retos: contraste en modo claro y oscuro =====
   En modo claro Bootstrap pone --bs-emphasis-color en negro y la pestaña activa
   quedaba negra sobre fondo oscuro; el modal además era semitransparente. */
:root, [data-bs-theme="light"], [data-bs-theme="dark"] {
  --bs-emphasis-color: #F2F2F2;
  --bs-emphasis-color-rgb: 242, 242, 242;
  --bs-secondary-color: rgba(242, 242, 242, 0.75);
  --bs-heading-color: #F2F2F2;
}
.modal-backdrop.show { opacity: 0.85 !important; background: #050504 !important; }
.modal .modal-content {
  background: #0F0E0B !important;
  border: 1px solid rgba(143, 191, 69, 0.55) !important;
  border-radius: 14px !important;
  box-shadow: 0 0 28px rgba(143, 191, 69, 0.18) !important;
  color: #F2F2F2 !important;
}
.modal .modal-content .challenge-name { color: #F2F2F2 !important; }
.modal .modal-content .challenge-value { color: #C6E490 !important; }
.modal .nav-tabs { border-bottom: 1px solid rgba(143, 191, 69, 0.45) !important; }
.modal .nav-tabs .nav-link {
  color: #8FBF45 !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  font-weight: 400;
}
.modal .nav-tabs .nav-link:hover { color: #C6E490 !important; border-color: rgba(143, 191, 69, 0.3) !important; }
.modal .nav-tabs .nav-link.active {
  color: #C6E490 !important;
  background: #184000 !important;
  border-color: rgba(143, 191, 69, 0.55) rgba(143, 191, 69, 0.55) #184000 !important;
  font-weight: 900;
}
.modal .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: 0.8; }
.modal .btn-close:hover { opacity: 1; }
.modal .form-control::placeholder { color: rgba(242, 242, 242, 0.5) !important; }
