/* =====================
   HEADER
   ===================== */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  backdrop-filter: blur(12px);
  /* casi opaco: sobre páginas claras, más transparencia lo volvía gris
     medio y el texto blanco bajaba de 7:1 */
  background: rgba(22, 23, 26, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1000;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: 24px;
  width: auto;
  display: block;
}

.nav {
  display: flex;
  gap: 1rem;
}

.dropdown {
  position: relative;
}

.dropdown button {
  background: none;
  border: none;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dropdown .caret {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.55);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.55);
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.2s ease;
}

.dropdown:hover .caret,
.dropdown[data-open="true"] .caret {
  transform: rotate(225deg);
  margin-top: 3px;
}

/* puente invisible: sostiene el hover entre el botón y el panel */
.dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: -12px;
  right: -12px;
  height: 14px;
}

.menu {
  position: absolute;
  top: calc(100% + 14px);
  left: -14px;
  min-width: 200px;
  background: rgba(30, 26, 28, 0.55);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
  display: flex;
  flex-direction: column;
}

.dropdown:hover .menu,
.dropdown[data-open="true"] .menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s;
}

.menu a {
  min-height: 44px; /* WCAG 2.5.5 */
  box-sizing: border-box;
  padding: 13px 10px;
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none;
  color: white;
  position: relative;
  transition: background 0.12s ease, padding-left 0.12s ease;
}

.menu a::before {
  content: "";
  width: 3px;
  height: 0;
  background: var(--color-accent);
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: height 0.12s ease;
}

.menu a:hover,
.menu a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  padding-left: 15px;
}

.menu a:hover::before,
.menu a:focus-visible::before {
  height: 16px;
}

.menu a:focus-visible {
  outline: 1.5px solid var(--color-accent);
  outline-offset: -1.5px;
}

.nav-soon {
  display: flex;
  align-items: center;
  padding: 9px 10px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.32);
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .menu,
  .dropdown .caret,
  .menu a {
    transition: none !important;
  }
}

.right img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.right-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.lang-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.lang-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.mobile-menu {
  display: none;
  flex-direction: column;
  background: rgba(11, 11, 13, 0.98);
  backdrop-filter: blur(12px);
  padding: 0.5rem 1.5rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu-section {
  padding: 0.875rem 0 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-menu-section:last-child {
  border-bottom: none;
}

.mobile-menu-section h5 {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6b70;
  font-family: "Space-Grotesk", system-ui, sans-serif;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.mobile-menu-section a {
  display: flex;
  align-items: center;
  min-height: 44px; /* WCAG 2.5.5 */
  padding: 0.4rem 0;
  font-size: 0.88rem;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.12s;
}

.mobile-menu-section a:hover {
  color: var(--color-accent);
}

.mobile-menu-section .nav-soon {
  padding: 0.4rem 0;
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .auth-btn-outline {
    display: none;
  }
}

/* =====================
   BADGE / CTA
   (antes vivían en la sección del carrusel, que ya no existe)
   ===================== */
.badge {
  background: var(--color-accent);
  color: var(--color-bg-alt);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  width: fit-content;
  margin-bottom: 1rem;
}

.cta {
  margin-top: 1rem;
  color: var(--color-accent);
  font-weight: 700;
  text-decoration: none;
}

/* =====================
   SECCIONES FEATURE
   ===================== */
.feature {
  position: relative;
  padding: 6rem 0;
}

.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.content.reverse {
  direction: rtl;
}

.content.reverse > * {
  direction: ltr;
}

.image img {
  width: 100%;
  border-radius: 16px;
}

.feature-a {
  background: linear-gradient(
    to bottom,
    #F6F4EF 0%,
    #F6F4EF 70%,
    #0B0B0D 100%
  );
  color: var(--color-text-alt);
}

.feature-b {
  background: linear-gradient(
    to bottom,
    #0B0B0D 0%,
    #0B0B0D 70%,
    #F3F0EA 100%
  );
  color: var(--color-text);
}

.feature-c {
  background: var(--color-bg-alt);
  color: var(--color-text-alt);
}

.feature::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: inherit;
  filter: blur(40px);
  transform: translateY(50%);
  z-index: -1;
}

@media (max-width: 768px) {
  .content {
    grid-template-columns: 1fr;
  }
}

/* =====================
   FOOTER
   ===================== */
.footer {
  background: var(--color-bg);
  color: var(--color-text);
  padding: 3rem 2rem;
  font-size: 0.9rem;
}

.footer a {
  color: var(--color-text);
  text-decoration: none;
}

.footer a:hover {
  color: var(--color-accent);
}

.footer-top {
  max-width: 1200px;
  margin: 0 auto 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-weight: 800;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
}

.footer-logo-img {
  height: 26px;
  width: auto;
  display: block;
}

.socials {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: -13px; /* el ícono queda alineado al borde aunque el área sea de 44 px */
}

.socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.socials a:hover { opacity: 1; }

.social-soon {
  display: flex;
  align-items: center;
  opacity: 0.25;
  cursor: default;
}

.socials svg { width: 18px; height: 18px; }

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2rem 0;
}

.footer-links {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* El footer de kodeval.com usa h2 (orden de títulos correcto en toda
   página); el de Kodeval Pages todavía usa h4. Mismo aspecto en ambos. */
.col h4,
.col h2 {
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: normal;
  margin: 0 0 0.75rem;
}

/* cada link del footer ocupa 44 px de alto (WCAG 2.5.5) */
.col a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #9ca3af;
}

.legal {
  display: flex;
  gap: 1rem;
}

/* =====================
   ÁREA TÁCTIL MÍNIMA (WCAG 2.5.5, AAA: 44 × 44 px)
   =====================
   Links y botones que se ven chicos: una capa invisible amplía el área
   que se puede tocar sin cambiar el diseño. .hit-44 sirve para links
   puntuales de cada página. */
.logo, .footer-logo, button.misc, .auth-btn, .lang-toggle, .cta,
.footer-bottom a, .hit-44 {
  position: relative;
}

/* button.misc y no .misc: los menús desplegables también llevan esa clase */
.logo::after, .footer-logo::after, button.misc::after, .auth-btn::after,
.lang-toggle::after, .cta::after, .footer-bottom a::after, .hit-44::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

/* =====================
   TONOS: fondos oscuros en degradé
   =====================
   Paleta de Kodeval para las zonas oscuras (reemplaza al marrón #251E1D).
   Una clase de tono por sección; se pone en el contenedor de la página
   para que las variables lleguen también a bloques fuera del hero:
     .tone-carmesi  secciones comunes / institucionales y páginas de sistema
     .tone-tinta    legales
     .tone-grafito  técnicas (estado, changelog)
     .tone-ciruela  blog

   .bg-tone pinta el degradé animado. La animación mueve una capa con
   transform (la resuelve el compositor: sin repintado ni layout por
   frame) y se apaga con prefers-reduced-motion.
   Contraste verificado contra el punto más claro de cada degradé
   (--tone-2): texto ≥ 8:1, --tone-muted ≥ 5:1, --tone-accent ≥ 4.9:1 (AA). */
.tone-carmesi {
  --tone-1: #1C0407; --tone-2: #7A0F18; --tone-3: #2B0716; --tone-end: #14040A;
}
.tone-tinta {
  --tone-1: #0A0F22; --tone-2: #26407A; --tone-3: #101633; --tone-end: #0A0D1C;
}
.tone-grafito {
  --tone-1: #0C0D10; --tone-2: #343E50; --tone-3: #14181F; --tone-end: #0D0F13;
}
.tone-ciruela {
  --tone-1: #170A1E; --tone-2: #5E2268; --tone-3: #220C26; --tone-end: #130816;
}
.tone-carmesi, .tone-tinta, .tone-grafito, .tone-ciruela {
  --tone-text:   var(--k-on-dark);
  --tone-muted:  var(--k-on-dark-muted);
  --tone-line:   rgba(236, 237, 239, 0.14);
  --tone-accent: var(--k-red-on-dark);
}

.bg-tone {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--tone-end);
}

.bg-tone::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: -100%;
  width: 400%;
  height: 100%;
  /* Cuatro repeticiones idénticas, cada una del ancho del contenedor:
     desplazar una repetición deja la capa igual que al empezar, así el
     bucle es continuo, a velocidad constante y sin frenadas.
     El skewX inclina las bandas (efecto diagonal) sin romper el bucle;
     queda al menos un ancho de margen a cada lado durante todo el
     recorrido, que cubre las esquinas inclinadas (alcanza hasta un alto ≈ 5.5×ancho). */
  background: repeating-linear-gradient(90deg,
    var(--tone-1) 0%, var(--tone-2) 8.333%,
    var(--tone-3) 16.667%, var(--tone-1) 25%);
  transform: translate3d(0, 0, 0) skewX(-20deg);
  animation: tone-drift 16s linear infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes tone-drift {
  to { transform: translate3d(-25%, 0, 0) skewX(-20deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-tone::before { animation: none; will-change: auto; }
  .motion-toggle { display: none; }
}

/* Pausa manual del degradé (WCAG 2.2.2): el botón lo agrega
   components.js en cada .bg-tone y la elección se recuerda */
.motion-paused .bg-tone::before { animation-play-state: paused; }

/* .bg-tone > .motion-toggle: gana a reglas como ".help-hero > *" */
.bg-tone > .motion-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(236, 237, 239, 0.35);
  border-radius: 50%;
  background: rgba(22, 23, 26, 0.55);
  color: var(--k-on-dark);
  cursor: pointer;
}
.motion-toggle:hover { background: rgba(22, 23, 26, 0.8); }
.motion-toggle svg { width: 16px; height: 16px; }
.motion-toggle .icon-play { display: none; }
.motion-paused .motion-toggle .icon-play { display: block; }
.motion-paused .motion-toggle .icon-pause { display: none; }

/* En zonas oscuras el anillo de foco pasa a claro */
.header, .footer, .bg-tone, .lang-selector { --k-focus-ring: var(--k-on-dark); }

/* Variante estática para bloques chicos (tarjetas, badges) */
.bg-tone-static {
  background: linear-gradient(135deg, var(--tone-1), var(--tone-2) 60%, var(--tone-3));
}

/* Paleta del footer — antes duplicada inline en cada página */
.footer {
  background: linear-gradient(160deg, #0D0F13 0%, #1A1F28 55%, #0D0F13 100%);
  color: var(--k-on-dark);
}

.footer hr {
  border-color: rgba(236, 237, 239, 0.14);
}

.footer-logo {
  color: var(--k-on-dark);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.footer .socials a,
.footer-links a,
.footer-bottom a {
  color: rgba(236, 237, 239, 0.8);
  text-decoration: none;
}

.footer .socials a:hover,
.footer-links a:hover {
  color: var(--k-on-dark);
}

.footer-links h4,
.footer-links h2 {
  color: var(--k-on-dark);
}

.footer-bottom span {
  color: var(--k-on-dark-muted);
}

@media (max-width: 768px) {
  .footer-top,
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  /* en columna los íconos quedan a la izquierda: se alinean con el texto */
  .socials {
    margin-right: 0;
    margin-left: -13px;
  }

  .footer-links {
    grid-template-columns: 1fr;
  }
}