/**
 * gate.css — Habillage de la couche d'accès par token (overlay plein écran).
 *
 * L'overlay (#gate-overlay) recouvre toute la page tant que l'accès n'est pas
 * accordé : la roue dessous reste invisible et injouable. Une fois "authorized",
 * gate.js retire l'overlay et révèle le jeu.
 *
 * Mobile-first : la majorité ouvre le lien depuis un SMS sur smartphone.
 */

#gate-overlay,
#gate-overlay * {
  box-sizing: border-box;
}

#gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  /* calc(var(--vh)) pour gérer la barre d'adresse mobile si gate.js la fournit */
  min-height: 100%;
  background: linear-gradient(160deg, #0f2027 0%, #203a43 55%, #2c5364 100%);
  color: #f5f7fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-align: center;
  overflow-y: auto;
}

/* Quand l'accès est accordé, gate.js ajoute cet attribut pour tout masquer. */
#gate-overlay[hidden] {
  display: none !important;
}

/* IMPORTANT : l'attribut `hidden` natif est écrasé par toute règle `display`
   de la page hôte (la roue). On force donc le masquage pour TOUT élément hidden
   à l'intérieur de l'overlay (formulaire, sous-messages, vues, etc.). */
#gate-overlay [hidden] {
  display: none !important;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.gate-card h1 {
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0 0 14px;
  font-weight: 700;
}

.gate-card p {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 14px;
  color: #dbe4ea;
}

.gate-sub {
  font-size: 0.9rem !important;
  color: #aebcc6 !important;
}

/* --- Vues : une seule visible à la fois (gate.js bascule l'attribut hidden) --- */
.gate-view[hidden] {
  display: none !important;
}

/* --- Spinner de chargement --- */
.gate-spinner {
  width: 46px;
  height: 46px;
  margin: 8px auto 18px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: gate-spin 0.9s linear infinite;
}

@keyframes gate-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate-spinner {
    animation-duration: 2.4s;
  }
}

/* --- Boutons (cible tactile >= 44px) --- */
.gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  margin-top: 6px;
  font-size: 1.02rem;
  font-weight: 600;
  color: #0f2027;
  background: #ffd24c;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
}

.gate-btn:hover {
  background: #ffdd6b;
}

.gate-btn:active {
  transform: translateY(1px);
}

.gate-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.gate-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.gate-btn--ghost {
  color: #f5f7fa;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.gate-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* --- Formulaire de rappel --- */
.gate-form {
  margin-top: 18px;
  text-align: left;
}

.gate-form label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #dbe4ea;
}

.gate-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font-size: 1.05rem; /* >=16px pour éviter le zoom auto iOS */
  color: #0f2027;
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 12px;
}

.gate-input:focus {
  outline: none;
  border-color: #ffd24c;
}

.gate-input[aria-invalid='true'] {
  border-color: #ff6b6b;
}

.gate-error {
  display: block;
  min-height: 1.1em;
  margin-top: 7px;
  font-size: 0.85rem;
  color: #ff9b9b;
}

.gate-success {
  margin-top: 16px;
  font-size: 1.02rem;
  line-height: 1.5;
  color: #b8f5c9;
}

/* visually-hidden pour les libellés/annonces lecteur d'écran */
.gate-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
