/*
 * MOX — capa de pulido UX sobre el CSS exportado de Webflow.
 * Se carga después de mox-landing-template.webflow.shared.*.css en todas las páginas.
 * Secciones:
 *   1. Base y accesibilidad
 *   2. Layout responsive (desbordes)
 *   3. Componentes (navegación, formularios, tarjetas, blog, footer)
 *   4. CTA de cierre en páginas de servicio
 *   5. Movimiento reducido
 */

/* ---------------------------------------------------------------- 1. Base */

:root {
  --mox-focus: #b69cff;
  --mox-radius-lg: 36px;
  --mox-radius-md: 18px;
}

html {
  scroll-padding-top: 96px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Decorative blurred circles and waves must never create horizontal scroll. */
body {
  overflow-x: hidden;
}
@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

/* Images with explicit width/height attributes keep their aspect ratio (prevents CLS). */
:where(img[width][height]) {
  height: auto;
}

h1, h2, h3, .heading-5, .new-title-services, .alternate-title {
  text-wrap: balance;
}
p, .large-text {
  text-wrap: pretty;
}

/* Visible keyboard focus (Webflow removes outlines on nav, dropdown and tabs). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
.w-nav-button:focus-visible,
.w-dropdown-toggle:focus-visible,
.w-tab-link:focus-visible,
.w-checkbox-input:focus-visible {
  outline: 2px solid var(--mox-focus);
  outline-offset: 3px;
}

.mox-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------ 2. Layout responsive */

/* Grid items default to min-width:auto, so on phones wide images or text blow the
   single track out of the viewport (service heroes, demo form). Scoped to phones:
   on wider screens those grids rely on content sizing for their title boxes. */
@media screen and (max-width: 479px) {
  .columns > *,
  .w-layout-grid > * {
    min-width: 0;
  }
}

/* Phone headings scale with the viewport so long words ("Infraestructura",
   "socioeconómico", "comportamiento") never overflow on 320–360px screens. */
@media screen and (max-width: 479px) {
  h1,
  .heading-5 {
    font-size: min(36px, 9vw);
  }
  .medium-heading {
    font-size: min(32px, 8vw);
  }
}

/* Home hero: "Alternativos" is a separate h2 and was not scaled with the h1. */
@media screen and (max-width: 991px) {
  .heading-5 { font-size: 57px; line-height: 1.1em; }
}
@media screen and (max-width: 767px) {
  .heading-5 { font-size: 43px; line-height: 1.2em; }
}
@media screen and (max-width: 479px) {
  .heading-5 { font-size: 36px; line-height: 1.2em; }
}

/* Service hero title box: long words ("socioeconómico") were clipped on phones. */
@media screen and (max-width: 479px) {
  .customer-story-metric {
    padding: 24px;
  }
  .customer-story-metric .large-heading {
    font-size: min(28px, 6.4vw);
    line-height: 1.2em;
  }
}

/* Service hero: image + title box stack cleanly on small screens. */
@media screen and (max-width: 991px) {
  .case-studiy-image {
    width: 100%;
  }
  .customer-story-metric {
    max-width: 100%;
  }
}

/* --------------------------------------------------------- 3. Componentes */

/* Back-to-top: hidden until the visitor has scrolled. */
.back-to-top-button {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s, background-color .2s;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.mox-scrolled .back-to-top-button {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .25s ease, transform .25s ease, visibility 0s, background-color .2s;
}

/* Nav dropdown: the list now has 7 services. */
.dropdown-link-text {
  white-space: nowrap;
}

/* Demo form: was a fixed 850px wide, overflowing every screen below 1280px. */
.form-block {
  width: 100%;
  max-width: 850px;
}
/* Empty leftover wrapper rendered as a stray bar between phone and message fields. */
.select-wrapper:empty {
  display: none;
}
/* Reserve the reCAPTCHA box (it loads on first interaction) so nothing jumps. */
.g-recaptcha {
  min-height: 78px;
}
.form-input::placeholder {
  color: rgba(255, 255, 255, .55);
}
.form-input:user-invalid {
  border-color: #ff8a8a;
}
.w-form-done,
.w-form-fail {
  border-radius: 12px;
  text-align: left;
}
.w-form-fail {
  color: #ffd6d6;
  background-color: rgba(255, 80, 80, .14);
  border: 1px solid rgba(255, 120, 120, .4);
}
.w-form input[type="submit"][disabled] {
  opacity: .6;
  cursor: progress;
}

/* ARCO: text column + form were forced side by side on phones (form off-screen). */
@media screen and (max-width: 767px) {
  .flex-block-2 {
    display: flex !important;
    flex-direction: column;
    gap: 36px;
    max-width: 100% !important;
    width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }
  .flex-block-2 > *,
  .flex-block-2 .w-form,
  .form-block-2 {
    width: 100%;
  }
  /* keep the decorative wave below the form instead of across the submit button */
  .section-2.bammer-home {
    padding-bottom: 220px;
  }
}

/* ARCO "Contáctanos: email" row wraps instead of overflowing on tablets/phones. */
@media screen and (max-width: 991px) {
  .flex-block-3 {
    flex-wrap: wrap;
  }
}

/* Service cards on home: clearer hover affordance (they are links). */
.customer-box {
  transition: transform .25s ease;
}
.customer-box:hover {
  transform: translateY(-4px);
}

/* "Datos alternativos y KYC" boxes on phones: icon + title aligned, smaller type. */
@media screen and (max-width: 479px) {
  .box {
    justify-content: flex-start;
    gap: 16px;
  }
  .box > img {
    flex: 0 0 auto;
  }
  .alternate-title {
    font-size: 22px;
  }
  .alternate-title br {
    display: none;
  }
  .new-title-services {
    font-size: 26px;
  }
}

/* Footer: less dead space, comfortable tap targets. */
.footer {
  padding-top: 96px;
  padding-bottom: 72px;
}
@media screen and (max-width: 767px) {
  .footer {
    padding-top: 72px;
    padding-bottom: 48px;
  }
}
.footer-link.small {
  display: inline-block;
  padding-top: 6px;
  padding-bottom: 6px;
}
.footer-link.small:hover,
.footer-link.small:focus-visible {
  opacity: 1;
}
@media screen and (max-width: 479px) {
  .footer-link.small {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .footer-details {
    gap: 8px;
  }
}

/* Legal pages: blank paragraphs that were empty <h1> elements. */
.mox-legal-spacer {
  height: 1em;
}

/* --------------------------------------- 4. CTA de cierre (páginas de servicio) */

.section.mox-cta-section {
  padding-top: 96px;
  padding-bottom: 24px;
}
.mox-cta {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 72px;
  border-radius: var(--mox-radius-lg);
  background:
    radial-gradient(120% 140% at 85% 120%, rgba(193, 92, 255, .55) 0%, rgba(107, 55, 217, .35) 35%, transparent 70%),
    linear-gradient(180deg, #120a24 0%, var(--primary-2) 100%);
  border: 1px solid rgba(107, 55, 217, .45);
}
.mox-cta__copy {
  max-width: 640px;
}
.mox-cta__title {
  font-size: 43px;
  line-height: 1.15em;
}
.mox-cta__text {
  margin-top: 18px;
  margin-bottom: 0;
  color: var(--light-2);
}
.mox-cta__actions {
  flex: 0 0 auto;
}
.mox-related {
  margin-top: 48px;
}
.mox-related__label {
  margin-bottom: 18px;
  color: var(--light-2);
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mox-related__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.mox-related__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 200px;
  background-color: var(--light-4);
  border: 1px solid transparent;
  color: var(--light-1);
  font-size: 16px;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease;
}
.mox-related__link:hover {
  background-color: var(--light-3);
  border-color: rgba(255, 255, 255, .25);
}
.mox-related__link img {
  width: 16px;
  height: 16px;
  transition: transform .2s ease;
}
.mox-related__link:hover img {
  transform: translateX(3px);
}
@media screen and (max-width: 991px) {
  .mox-cta {
    flex-direction: column;
    align-items: flex-start;
    padding: 48px;
  }
  .mox-cta__title {
    font-size: 36px;
  }
}
@media screen and (max-width: 479px) {
  .section.mox-cta-section {
    padding-top: 60px;
  }
  .mox-cta {
    gap: 28px;
    padding: 32px 24px;
    border-radius: var(--mox-radius-md);
  }
  .mox-cta__title {
    font-size: 28px;
    line-height: 1.25em;
  }
  .mox-cta__actions,
  .mox-cta__actions .button {
    width: 100%;
  }
  .mox-related__link {
    font-size: 14px;
    padding: 10px 16px;
  }
}

/* --------------------------------- 6. Interacciones (sustituyen a webflow.js/IX2) */
/* Valores y tiempos extraídos de la configuración IX2 del export de Webflow.
   Los estados iniciales dependen de html.mox-anim (script inline en <head>):
   si el JS no carga, una salvaguarda quita la clase y todo queda visible. */

@media (prefers-reduced-motion: no-preference) {
  /* Títulos: suben desde abajo con desenfoque (Fade In First / Second). */
  .mox-anim .fade-in-first .fade-in-contents,
  .mox-anim .fade-in-second .fade-in-contents {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(100%);
  }
  .mox-anim .fade-in-first.is-in .fade-in-contents,
  .mox-anim .fade-in-second.is-in .fade-in-contents {
    opacity: 1;
    filter: blur(0);
    transform: none;
    transition: opacity .75s ease, filter .75s ease, transform .75s ease;
  }
  .mox-anim .fade-in-second.is-in .fade-in-contents {
    transition-delay: .32s;
  }

  /* Onda decorativa: aparece al entrar en pantalla (0 → 0,3). */
  .mox-anim .wave {
    opacity: 0;
  }
  .mox-anim .wave.is-in {
    opacity: .3;
    transition: opacity .5s ease-in;
  }

  /* Primera sección (hero): se anima con CSS desde el primer pintado, sin esperar
     al JS. Si esperara, el elemento principal (LCP) quedaría oculto hasta que
     cargue mox-site.js; medido, eso retrasaba el LCP móvil ~2-3 s. Una animación
     con fill "both" se impone a los estados iniciales ocultos de arriba. */
  .mox-anim .navbar-wrapper + .section .fade-in-first .fade-in-contents {
    animation: mox-fade-up .75s ease both;
  }
  .mox-anim .navbar-wrapper + .section .fade-in-second .fade-in-contents {
    animation: mox-fade-up .75s ease .32s both;
  }
  .mox-anim .navbar-wrapper + .section .wave {
    animation: mox-wave-in .5s ease-in both;
  }

  /* Snippets de código de la home: entrada escalonada (solo escritorio). */
  @media (min-width: 992px) {
    .mox-anim .ui-snippet-frame .grid-background,
    .mox-anim .ui-snippet-frame .container---xs.ui-snippet,
    .mox-anim .ui-snippet-frame .code-snippet.bg-white.overlay-bottom {
      opacity: 0;
    }
    .mox-anim .ui-snippet-frame .container---xs.ui-snippet {
      transform: scale(.9);
    }
    .mox-anim .ui-snippet-frame .code-snippet.bg-white.overlay-bottom {
      transform: translateX(-48px);
    }
    .mox-anim .ui-snippet-frame.is-in .grid-background {
      opacity: 1;
      transition: opacity 1s ease;
    }
    .mox-anim .ui-snippet-frame.is-in .container---xs.ui-snippet {
      opacity: 1;
      transform: none;
      transition: opacity .75s ease .5s, transform .75s ease .5s;
    }
    .mox-anim .ui-snippet-frame.is-in .code-snippet.bg-white.overlay-bottom {
      opacity: 1;
      transform: none;
      transition: opacity .75s ease .75s, transform .75s ease .75s;
    }
  }

  /* Dropdown de servicios: entra desde la izquierda (solo escritorio). */
  @media (min-width: 992px) {
    .dropdown-list.w--open {
      animation: mox-dropdown-in .2s ease-in both;
    }
  }
}

@keyframes mox-fade-up {
  from { opacity: 0; filter: blur(5px); transform: translateY(100%); }
  to { opacity: 1; filter: blur(0); transform: none; }
}
@keyframes mox-wave-in {
  from { opacity: 0; }
  to { opacity: .3; }
}

@keyframes mox-dropdown-in {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: none; }
}

/* Botón hamburguesa → cruz, en tres fases de 200 ms (abrir) y en orden inverso (cerrar). */
.menu-button-horizontal-line {
  transition: transform .2s ease-out .4s;
}
.menu-button-horziontal {
  transition: opacity .2s ease .2s, width .2s ease .2s;
}
.menu-button-cross {
  transition: opacity .2s ease .2s;
}
.menu-button-cross-line {
  transition: transform .2s ease-out 0s;
}
.w-nav-button.w--open .menu-button-horizontal-line {
  transition-delay: 0s;
}
.w-nav-button.w--open .menu-button-horizontal-line.line-1 {
  transform: translateY(8px);
}
.w-nav-button.w--open .menu-button-horizontal-line.line-3 {
  transform: translateY(-8px);
}
.w-nav-button.w--open .menu-button-horziontal {
  opacity: 0;
  width: 75%;
}
.w-nav-button.w--open .menu-button-cross {
  opacity: 1;
}
.w-nav-button.w--open .menu-button-cross-line {
  transition-delay: .4s;
}
.w-nav-button.w--open .menu-button-cross-line.line-1 {
  transform: rotate(-45deg);
}
.w-nav-button.w--open .menu-button-cross-line.line-2 {
  transform: rotate(45deg);
}

/* Hovers que hacía IX2. */
.dropdown-link .dropdown-link-icon {
  transition: opacity .2s ease;
}
.dropdown-link:hover .dropdown-link-icon,
.w-dropdown-toggle.w--open .dropdown-link-icon {
  opacity: 1;
}
.button.icon.bg-light-3 .button-icon {
  transition: filter .2s ease;
}
.button.icon.bg-light-3:hover .button-icon {
  filter: invert(100%);
}
.underlined-link .underline {
  transition: none;
}
.underlined-link .underlined-link-text {
  transition: opacity .2s ease;
}
.underlined-link:hover .underline {
  animation: mox-underline .4s linear;
}
.underlined-link:hover .underlined-link-text {
  animation: mox-underline-text .4s linear;
}
@keyframes mox-underline {
  0% { transform: translateX(0); }
  50% { transform: translateX(100%); }
  50.01% { transform: translateX(-100%); }
  100% { transform: translateX(0); }
}
@keyframes mox-underline-text {
  0%, 100% { opacity: 1; }
  50% { opacity: .75; }
}

/* Tarjetas de servicio: imagen 1.05 + borde morado (IX2, solo escritorio). */
.customer-box-image {
  border: 1px solid transparent;
  transition: transform .15s ease, border-color .15s ease;
}
@media (min-width: 992px) and (hover: hover) {
  .customer-box:hover .customer-box-image {
    transform: scale(1.05);
    border-color: rgb(107, 55, 217);
  }
}

/* ------------------------------------------------------- 5. Movimiento reducido */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .customer-box:hover {
    transform: none;
  }
}
