/* =============================================================================
   gateway.css — Split-Screen Gateway (index.html)
   Portal de selección de servicio a pantalla completa.
   ========================================================================== */

html,
body.gateway-page {
  height: 100%;
}

body.gateway-page {
  overflow: hidden;
  background: #0b0d12;
}

.gateway {
  position: relative;
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

.gateway__panel {
  position: relative;
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  transition: flex-grow var(--dur) var(--ease-out), flex-basis var(--dur) var(--ease-out);
  text-align: center;
  color: #fff;
}

/* Separador diagonal */
.gateway__panel + .gateway__panel::before {
  content: "";
  position: absolute;
  left: -60px;
  top: 0;
  bottom: 0;
  width: 120px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  transform: skewX(-8deg);
  z-index: 2;
  pointer-events: none;
}

.gateway__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  transition: transform 1.1s var(--ease-out), filter var(--dur) var(--ease);
}

.gateway__overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  transition: opacity var(--dur) var(--ease);
}

/* Fondo Portes: degradado rojo-carbón */
.gateway__panel--portes .gateway__bg {
  background:
    radial-gradient(700px 480px at 20% 20%, rgba(230, 57, 70, 0.55), transparent 60%),
    radial-gradient(600px 500px at 85% 85%, rgba(214, 40, 40, 0.45), transparent 65%),
    linear-gradient(155deg, #1d2125 0%, #2b2d42 55%, #4a1216 100%);
}

/* Fondo Limpiezas: azul marino + destellos esmeralda */
.gateway__panel--limpiezas .gateway__bg {
  background:
    radial-gradient(700px 480px at 80% 18%, rgba(46, 196, 182, 0.45), transparent 60%),
    radial-gradient(620px 520px at 15% 85%, rgba(0, 119, 182, 0.55), transparent 65%),
    linear-gradient(205deg, #023e8a 0%, #013a63 55%, #0b2545 100%);
}

.gateway__overlay {
  background:
    radial-gradient(circle at 50% 120%, rgba(0, 0, 0, 0.55), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
}

.gateway__content {
  position: relative;
  z-index: 3;
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 520px;
  opacity: 0.92;
  transform: translateY(8px) scale(0.985);
  transition: opacity var(--dur) var(--ease), transform 0.6s var(--ease-out);
}

/* Logos de marca sobre el titular de cada panel */
.gateway__brand {
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0 auto 1.15rem;
  object-fit: contain;
}

.gateway__panel--portes .gateway__brand {
  height: clamp(84px, 12vh, 118px);
}

.gateway__panel--limpiezas .gateway__brand {
  height: clamp(46px, 7vh, 68px);
  max-width: min(100%, 340px);
}

.gateway__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.gateway h1,
.gateway h2 {
  color: #fff;
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  margin-bottom: 0.9rem;
  text-wrap: balance;
}

.gateway__sub {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
  margin-bottom: 1.8rem;
  text-wrap: pretty;
}

.gateway .btn {
  min-width: min(100%, 320px);
}

.gateway__panel--portes .btn {
  --btn-bg: #e63946;
  --btn-shadow: 0 14px 30px -14px rgba(230, 57, 70, 0.9);
}

.gateway__panel--limpiezas .btn {
  --btn-bg: #2ec4b6;
  --btn-fg: #04323a;
  --btn-shadow: 0 14px 30px -14px rgba(46, 196, 182, 0.9);
}

.gateway__foot {
  margin-top: 1.4rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.gateway__foot a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Expandir panel activo */
@media (hover: hover) and (min-width: 861px) {
  .gateway:hover .gateway__panel {
    flex-grow: 0.72;
  }
  .gateway__panel:hover {
    flex-grow: 1.3 !important;
  }
  .gateway__panel:hover .gateway__content {
    opacity: 1;
    transform: translateY(0) scale(1.02);
  }
  .gateway__panel:hover .gateway__bg {
    transform: scale(1.06);
  }
  .gateway:hover .gateway__panel:not(:hover) .gateway__overlay {
    opacity: 0.75;
  }
}

/* Estado con teclado / foco */
.gateway__panel:focus-visible {
  outline: none;
}

.gateway__panel:focus-visible .gateway__content {
  opacity: 1;
  transform: translateY(0) scale(1.02);
}

.gateway__panel:focus-visible::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: var(--radius-xl);
  border: 2px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

/* Preferencia recordada */
.gateway__panel.is-preferred .gateway__kicker {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
}

.gateway__panel.is-preferred .gateway__kicker::before {
  content: "★";
  font-size: 0.85rem;
}

/* Salida animada al navegar */
body.gateway-leaving .gateway {
  animation: gatewayOut 0.5s var(--ease) forwards;
}

body.gateway-leaving .gateway__panel--active {
  flex-grow: 3 !important;
}

@keyframes gatewayOut {
  to {
    opacity: 0;
    transform: scale(1.04);
  }
}

/* Logo superior */
.gateway__logo {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  background: rgba(10, 12, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
}

.gateway__logo svg {
  width: 20px;
  height: 20px;
}

.gateway__logo img {
  height: 52px;
  width: auto;
  display: block;
}

/* Enlaces legales (gateway y 404) */
.gateway__legal {
  position: fixed;
  bottom: max(0.55rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.85rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.62);
}

.gateway__legal a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gateway__legal a:hover {
  color: #fff;
}

@media (max-width: 860px) {
  .gateway__legal {
    bottom: max(0.45rem, env(safe-area-inset-bottom));
    gap: 0.25rem 0.6rem;
    font-size: 0.66rem;
  }
}

/* ---------- Móvil: división horizontal ---------- */
@media (max-width: 860px) {
  .gateway {
    flex-direction: column;
  }
  .gateway__panel {
    flex-basis: 50% !important;
    flex-grow: 1 !important;
    min-height: 0;
  }
  .gateway__panel + .gateway__panel::before {
    left: 0;
    right: 0;
    top: -50px;
    bottom: auto;
    width: auto;
    height: 100px;
    transform: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  }
  .gateway h1,
  .gateway h2 {
    font-size: clamp(1.6rem, 7vw, 2.1rem);
  }
  .gateway__sub {
    font-size: 0.95rem;
    margin-bottom: 1.1rem;
  }
  .gateway__kicker {
    display: none;
  }
  .gateway .btn {
    min-width: min(100%, 340px);
  }
  .gateway__content {
    padding: 0.9rem 1.25rem 1rem;
  }
  .gateway__panel--portes .gateway__content {
    padding-top: 3rem;
  }
  .gateway__panel--limpiezas .gateway__content {
    padding-bottom: 3.5rem;
  }
  .gateway__foot {
    display: none;
  }
  .gateway__logo {
    top: 0.5rem;
    font-size: 0.78rem;
    padding: 0.3rem 0.8rem;
  }
  .gateway__logo img {
    height: 40px;
  }
  .gateway__brand {
    margin-bottom: 0.45rem;
  }
  .gateway__panel--portes .gateway__brand {
    height: 64px;
  }
  .gateway__panel--limpiezas .gateway__brand {
    height: 40px;
    max-width: 200px;
  }
}

@media (max-height: 700px) and (min-width: 861px) {
  .gateway__content {
    padding-block: 1rem;
  }
  .gateway__brand {
    margin-bottom: 0.6rem;
  }
  .gateway__panel--portes .gateway__brand {
    height: 64px;
  }
  .gateway__panel--limpiezas .gateway__brand {
    height: 38px;
  }
}

@media (max-width: 860px) and (max-height: 700px) {
  .gateway__panel--limpiezas .gateway__brand {
    height: 34px;
  }
  .gateway__panel--limpiezas h2 {
    font-size: 1.35rem;
    margin-bottom: 0.45rem;
  }
  .gateway__panel--limpiezas .gateway__sub {
    font-size: 0.88rem;
    margin-bottom: 0.85rem;
  }
  .gateway__panel--limpiezas .btn {
    min-height: 46px;
    padding-block: 0.7rem;
  }
  .gateway__panel--limpiezas .gateway__content {
    padding-bottom: 4.5rem;
  }
  .gateway__legal {
    font-size: 0.62rem;
    bottom: max(0.3rem, env(safe-area-inset-bottom));
  }
  .wa-fab {
    width: 52px;
    height: 52px;
  }
  .wa-fab svg {
    width: 25px;
    height: 25px;
  }
}

@media (max-width: 860px) and (max-height: 620px) {
  .gateway__logo {
    top: 0.4rem;
    font-size: 0.7rem;
    padding: 0.25rem 0.7rem;
  }
  .gateway .btn {
    font-size: 0.88rem;
    padding-inline: 1rem;
  }
  .gateway__panel--portes .gateway__content {
    padding-top: 2.2rem;
  }
  .gateway__panel--portes .gateway__brand {
    height: 48px;
  }
  .gateway__panel--portes h1 {
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
  }
  .gateway__panel--portes .gateway__sub {
    font-size: 0.85rem;
    margin-bottom: 0.7rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .gateway__panel--portes .btn {
    min-height: 46px;
    padding-block: 0.65rem;
  }
  .gateway__panel--limpiezas .gateway__brand {
    height: 30px;
  }
  .gateway__panel--limpiezas h2 {
    font-size: 1.2rem;
  }
  .gateway__panel--limpiezas .gateway__sub {
    font-size: 0.82rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .gateway__panel--limpiezas .btn {
    min-height: 44px;
  }
  .gateway__legal {
    font-size: 0.58rem;
  }
  .wa-fab {
    width: 46px;
    height: 46px;
  }
  .wa-fab svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 400px) {
  .gateway h1,
  .gateway h2 {
    font-size: 1.4rem;
  }
  .gateway__kicker {
    font-size: 0.68rem;
  }
}

/* 404 reuse */
body.gateway-page.has-error {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

.error-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background:
    radial-gradient(700px 420px at 15% 10%, rgba(214, 40, 40, 0.35), transparent 60%),
    radial-gradient(700px 420px at 85% 90%, rgba(0, 119, 182, 0.4), transparent 60%),
    #0b0d12;
  color: #fff;
  text-align: center;
}

.error-page h1 {
  color: #fff;
  margin-bottom: 0.6rem;
}

.error-page p {
  color: rgba(255, 255, 255, 0.78);
  max-width: 48ch;
  margin: 0 auto 1.6rem;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}

.error-page__legal {
  margin-top: 1.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.85rem;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
}

.error-page__legal a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error-page__legal a:hover {
  color: #fff;
}
