/* ============================================================================
   IFRIT LABS · gate.css
   Página de protección con password maestra. Mobile-first.
   Breakpoints: 481 / 720 / 1024
   ============================================================================ */

.gate-body {
  font-family: var(--font-mono);
  position: relative;
  min-height: 100dvh;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================================
   Fondo en capas — grid + scan line + ruido + vignette
   ============================================================================ */
.gate-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.gate-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--gray-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-line) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 0%, transparent 75%);
}

.gate-scan {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      transparent 0%,
      transparent 49.6%,
      rgba(255, 0, 0, 0.55) 50%,
      transparent 50.4%,
      transparent 100%);
  background-size: 100% 100vh;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  opacity: 0.3;
  animation: scanVertical 8s linear infinite;
}
@keyframes scanVertical {
  0%   { background-position: 0 -100%; }
  100% { background-position: 0 200%; }
}

.gate-noise {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    radial-gradient(circle at 20% 30%, var(--white) 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, var(--white) 1px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, var(--white) 1px, transparent 1.5px),
    radial-gradient(circle at 85% 15%, var(--white) 1px, transparent 1.5px);
  background-size: 110px 110px, 80px 80px, 130px 130px, 90px 90px;
}

.gate-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center,
      transparent 0%,
      transparent 40%,
      rgba(0, 0, 0, 0.7) 100%);
}

/* ============================================================================
   Esquinas HUD militares (mobile small)
   ============================================================================ */
.gate-corners {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--red);
  filter: drop-shadow(0 0 6px var(--red-glow-soft));
}
.corner.tl { top: 12px; left: 12px;     border-right: 0; border-bottom: 0; }
.corner.tr { top: 12px; right: 12px;    border-left: 0;  border-bottom: 0; }
.corner.bl { bottom: 12px; left: 12px;  border-right: 0; border-top: 0; }
.corner.br { bottom: 12px; right: 12px; border-left: 0;  border-top: 0; }

/* ============================================================================
   Header (mobile base)
   ============================================================================ */
.gate-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  padding-top: max(0.9rem, env(safe-area-inset-top));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.brand-mark {
  color: var(--red);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 8px var(--red-glow));
  animation: markFlicker 4s ease-in-out infinite;
}
@keyframes markFlicker {
  0%, 100%, 47%, 49%, 91%, 93% { opacity: 1; }
  48% { opacity: 0.4; }
  92% { opacity: 0.5; }
}
.brand-name {
  font-weight: 800;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
}

.gate-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-text);
  font-size: 0.7rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1;   box-shadow: 0 0 12px var(--red); }
  50%      { opacity: 0.4; box-shadow: 0 0 4px var(--red); }
}

/* ============================================================================
   Main · Card central (mobile base)
   ============================================================================ */
.gate-main {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 160px);
  min-height: calc(100vh - 160px);
  padding: 1.5rem 1rem;
}

.gate-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: 2rem 1.4rem;
  background: var(--black-card);
  border: 1px solid var(--white);
  box-shadow:
    0 0 0 1px var(--black),
    0 0 50px var(--red-glow-faint),
    0 20px 50px rgba(0, 0, 0, 0.7);
  animation: cardEntry 0.85s var(--ease-out) both;
}
@keyframes cardEntry {
  0%   { opacity: 0; transform: translateY(20px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-card::before,
.gate-card::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
}
.gate-card::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--red);
  border-left: 2px solid var(--red);
}
.gate-card::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--red);
  border-right: 2px solid var(--red);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--gray-text);
  letter-spacing: 0.2em;
  margin-bottom: 1.6rem;
  text-transform: uppercase;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.meta-label {
  color: var(--red);
  text-shadow: 0 0 6px var(--red-glow-soft);
}
.meta-id { font-weight: 500; }

/* ============================================================================
   Título y subtítulo
   ============================================================================ */
.gate-title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 9vw, 4rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.gate-title-accent {
  color: var(--red);
  text-shadow: 0 0 28px var(--red-glow);
  position: relative;
}
.gate-title-accent::after {
  content: '_';
  margin-left: 0.08em;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.gate-subtitle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--gray-text);
  letter-spacing: 0.05em;
  line-height: 1.7;
  margin-bottom: 2rem;
}

/* ============================================================================
   Form
   ============================================================================ */
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gate-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gray-text);
}
.label-prefix {
  color: var(--red);
  font-weight: 800;
  font-size: 0.85rem;
}

.input-wrap {
  position: relative;
  border: 1px solid var(--gray-line-2);
  background: var(--black);
  transition: border-color 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out);
}
.input-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 60%;
  background: var(--red);
  transform: translateY(-50%) scaleY(0);
  transform-origin: center;
  transition: transform 0.25s var(--ease-out);
}
.input-wrap:focus-within {
  border-color: var(--red);
  box-shadow:
    0 0 0 3px var(--red-glow-soft),
    0 0 30px var(--red-glow-soft);
}
.input-wrap:focus-within::before {
  transform: translateY(-50%) scaleY(1);
}

.gate-input {
  width: 100%;
  padding: 1.1rem 1.2rem;
  background: transparent;
  border: 0;
  color: var(--white);
  font-family: var(--font-mono);
  /* font-size >= 16px para que iOS no haga zoom al focus */
  font-size: 1rem;
  letter-spacing: 0.18em;
  outline: none;
  caret-color: var(--red);
  min-height: 48px;
}
.gate-input::placeholder {
  color: var(--gray-mute);
  letter-spacing: 0.22em;
}

.gate-actions {
  display: flex;
  justify-content: stretch;
  margin-top: 0.4rem;
}

.gate-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 48px;
  padding: 1rem 1.4rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid var(--red);
  cursor: pointer;
  transition:
    background 0.2s var(--ease-out),
    color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    transform 0.1s linear;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.gate-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, var(--white-glow) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.55s var(--ease-out);
}
.gate-btn:active { transform: translateY(1px); }
.gate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--black-card);
  color: var(--gray-text);
  border-color: var(--gray-line-2);
  box-shadow: none;
}
.gate-btn .btn-arrow {
  font-size: 1rem;
  transition: transform 0.2s var(--ease-out);
}

/* Hover sólo en dispositivos con puntero fino (no touch) */
@media (hover: hover) and (pointer: fine) {
  .gate-btn:hover {
    background: var(--white);
    color: var(--red);
    box-shadow: 0 0 35px var(--red-glow);
  }
  .gate-btn:hover::after { transform: translateX(100%); }
  .gate-btn:hover .btn-arrow { transform: translateX(5px); }
}

.gate-feedback {
  margin-top: 0.4rem;
  min-height: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray-text);
  word-break: break-word;
}
.gate-feedback.is-error {
  color: var(--red);
  text-shadow: 0 0 12px var(--red-glow);
  animation: errorBlink 0.5s linear;
}
.gate-feedback.is-success {
  color: var(--white);
  text-shadow: 0 0 16px var(--white-glow);
}
@keyframes errorBlink {
  0%, 40%, 80%, 100% { opacity: 1; }
  20%, 60%           { opacity: 0.3; }
}

.gate-card.shake { animation: shake 0.45s var(--ease-out); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-9px); }
  40%      { transform: translateX(9px); }
  60%      { transform: translateX(-7px); }
  80%      { transform: translateX(7px); }
}

.gate-card.success {
  border-color: var(--red);
  box-shadow:
    0 0 0 1px var(--red),
    0 0 80px var(--red-glow),
    0 30px 80px rgba(0, 0, 0, 0.7);
  transition: border-color 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

/* ============================================================================
   Footer (mobile base)
   ============================================================================ */
.gate-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 1rem;
  padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray-text);
  text-align: center;
}
.footer-sep { color: var(--gray-mute); }
.footer-pulse {
  display: none; /* oculto en móvil para no saturar */
  color: var(--red);
  animation: flicker 3.2s ease-in-out infinite;
}
@keyframes flicker {
  0%, 20%, 22%, 60%, 62%, 100% { opacity: 0.85; }
  21%, 61%                     { opacity: 1; }
  20%, 22%                     { opacity: 0.35; }
  60%, 62%                     { opacity: 0.5; }
}

/* ============================================================================
   ▲ Tablet pequeño / phablet (≥ 481px)
   ============================================================================ */
@media (min-width: 481px) {
  .gate-status .status-text { display: inline; }
  .gate-actions { justify-content: flex-end; }
  .gate-btn {
    width: auto;
    padding: 1rem 1.7rem;
    font-size: 0.82rem;
  }
}

/* ============================================================================
   ▲ Tablet / desktop pequeño (≥ 720px)
   ============================================================================ */
@media (min-width: 720px) {
  .gate-grid { background-size: 56px 56px; }

  .gate-header {
    padding: 1.3rem 2.2rem;
    font-size: 0.75rem;
  }
  .brand-mark { font-size: 1.2rem; }
  .brand-name { font-size: 0.82rem; letter-spacing: 0.3em; }

  .corner {
    width: 30px;
    height: 30px;
  }
  .corner.tl, .corner.tr { top: 18px; }
  .corner.bl, .corner.br { bottom: 18px; }
  .corner.tl, .corner.bl { left: 18px; }
  .corner.tr, .corner.br { right: 18px; }

  .gate-card {
    padding: 2.6rem 2rem;
  }
  .gate-card::before,
  .gate-card::after {
    width: 26px;
    height: 26px;
  }
  .card-meta {
    font-size: 0.7rem;
    margin-bottom: 2rem;
  }
  .gate-subtitle { font-size: 0.85rem; }

  .footer-pulse { display: inline; }
  .gate-footer  { font-size: 0.7rem; gap: 0.85rem; padding: 1.5rem 2rem; }
}

/* ============================================================================
   ▲ Desktop estándar (≥ 1024px)
   ============================================================================ */
@media (min-width: 1024px) {
  .gate-grid { background-size: 64px 64px; }

  .gate-header {
    padding: 1.6rem 4rem;
  }
  .brand-name { font-size: 0.85rem; letter-spacing: 0.32em; }

  .corner {
    width: 36px;
    height: 36px;
  }
  .corner.tl, .corner.tr { top: 24px; }
  .corner.bl, .corner.br { bottom: 24px; }
  .corner.tl, .corner.bl { left: 24px; }
  .corner.tr, .corner.br { right: 24px; }

  .gate-card {
    padding: 3.2rem 2.6rem;
  }
  .gate-card::before,
  .gate-card::after {
    width: 28px;
    height: 28px;
  }

  .gate-btn {
    padding: 1.05rem 1.9rem;
    font-size: 0.85rem;
  }
}

/* ============================================================================
   Reduced motion
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
