/* ============================================================================
   CHICAGO PIZZA - ENTER GATE STYLES (enter-gate.css)
   Cinematic Spotlight Arch & Audio Activation Welcome Gate
   Strictly Namespaced: #enter-gate, .eg-*
   ============================================================================ */

#enter-gate {
  --eg-progress: 0;
  --eg-radius: 0px;
  --eg-lamp-x: 50%;
  --eg-lamp-y: 13%;

  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
  user-select: none;
  -webkit-user-select: none;
}

@media (orientation: portrait) {
  #enter-gate {
    --eg-lamp-y: 17%;
  }
}

#enter-gate.eg-fade-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.eg-scroll-locked {
  overflow: hidden !important;
  touch-action: none !important;
}

/* 1. Fullscreen Background Picture (Landscape vs Portrait) */
.eg-bg-picture,
.eg-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  pointer-events: none;
  z-index: 1;
}

/* 2. Spotlight Cone & Dynamic Light Reveal */
.eg-spotlight-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background-color: #000000;
  -webkit-mask-image: radial-gradient(
    circle at var(--eg-lamp-x, 50%) var(--eg-lamp-y, 13%),
    transparent 0%,
    transparent var(--eg-radius, 0px),
    rgba(0, 0, 0, 0.45) calc(var(--eg-radius, 0px) + 70px),
    #000000 calc(var(--eg-radius, 0px) + 190px)
  );
  mask-image: radial-gradient(
    circle at var(--eg-lamp-x, 50%) var(--eg-lamp-y, 13%),
    transparent 0%,
    transparent var(--eg-radius, 0px),
    rgba(0, 0, 0, 0.45) calc(var(--eg-radius, 0px) + 70px),
    #000000 calc(var(--eg-radius, 0px) + 190px)
  );
  transition: opacity 0.5s ease;
}

#enter-gate.eg-fully-lit .eg-spotlight-layer {
  opacity: 0 !important;
}

/* Subtle Lamp Glow Flicker once at the start */
.eg-lamp-glow {
  position: absolute;
  top: var(--eg-lamp-y, 13%);
  left: var(--eg-lamp-x, 50%);
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 195, 90, 0.5) 0%, rgba(255, 120, 20, 0.2) 40%, transparent 70%);
  pointer-events: none;
  z-index: 3;
  animation: eg-lamp-flicker 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.15s 1 normal forwards;
}

@keyframes eg-lamp-flicker {
  0% { opacity: 0; }
  20% { opacity: 0.85; }
  35% { opacity: 0.25; }
  50% { opacity: 1; }
  65% { opacity: 0.6; }
  80% { opacity: 0.95; }
  100% { opacity: 0.85; }
}

/* 3. Text-Safe Arch Content Box (Centered in the Red Arch) */
.eg-arch-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  max-width: 82vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  pointer-events: auto;
}

@media (orientation: portrait) {
  .eg-arch-content {
    top: 52%;
    width: 290px;
    max-width: 84vw;
  }
}

/* 4. Small letter-spaced heading with thin line below */
.eg-header-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.eg-brand-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 5px;
  color: #f5f5f7;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.eg-subtitle-line {
  width: 28px;
  height: 1.5px;
  background: #ff2a2a;
  box-shadow: 0 0 6px rgba(255, 42, 42, 0.85);
  margin-top: 6px;
  border-radius: 1px;
}

/* 5. Existing Chicago Pizza Brand Logo */
.eg-logo-wrap {
  margin-bottom: 16px;
}

.eg-logo-img {
  display: block;
  width: 135px;
  max-width: 44vw;
  height: auto;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.9));
}

/* 6. Monospace Frame Counter & Thin Red Progress Bar */
.eg-meta-box {
  width: 100%;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.eg-counter-display {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.eg-ready-text {
  color: #ff2a2a !important;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(255, 42, 42, 0.85);
}

.eg-progress-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.eg-progress-fill {
  height: 100%;
  width: 0%;
  background: #ff2a2a;
  box-shadow: 0 0 8px #ff2a2a;
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* 7. ONE Pill-Shaped Button: ▶ ENTER */
.eg-action-wrap {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eg-enter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  min-width: 168px;
  padding: 10px 26px;
  background: linear-gradient(135deg, rgba(32, 20, 24, 0.95) 0%, rgba(14, 10, 12, 0.95) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid #ff2a2a;
  border-radius: 9999px;
  color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 42, 42, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.eg-enter-btn.eg-ready {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

.eg-enter-btn:hover,
.eg-enter-btn:focus-visible {
  border-color: #ff4d4d;
  box-shadow: 0 0 30px rgba(255, 42, 42, 0.8), 0 4px 18px rgba(0, 0, 0, 0.7);
  transform: translateY(-2px) !important;
}

.eg-enter-btn:focus-visible {
  outline: 2px solid #ff2a2a;
  outline-offset: 3px;
}

.eg-enter-btn:active {
  transform: translateY(1px) !important;
  box-shadow: 0 0 14px rgba(255, 42, 42, 0.5);
}

.eg-btn-label {
  display: inline-block;
  line-height: 1;
}

/* Red Record Dot on the Right */
.eg-record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff2a2a;
  box-shadow: 0 0 8px #ff2a2a, inset 0 0 2px #ffffff;
  flex-shrink: 0;
}

/* 8. Mobile Breakpoints (320px - 430px) */
@media (max-width: 480px) {
  .eg-arch-content {
    top: 51%;
    width: 270px;
    max-width: 86vw;
  }
  .eg-brand-subtitle {
    font-size: 10px;
    letter-spacing: 4px;
  }
  .eg-logo-img {
    width: 115px;
  }
  .eg-meta-box {
    max-width: 230px;
    margin-bottom: 18px;
    gap: 7px;
  }
  .eg-counter-display {
    font-size: 11px;
    letter-spacing: 1.5px;
  }
  .eg-enter-btn {
    min-height: 46px;
    min-width: 156px;
    padding: 10px 22px;
    font-size: 12px;
    letter-spacing: 1.5px;
  }
  .eg-record-dot {
    width: 8px;
    height: 8px;
  }
}

/* 9. Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  #enter-gate,
  .eg-progress-fill,
  .eg-enter-btn,
  .eg-spotlight-layer {
    transition: none !important;
  }
  .eg-lamp-glow {
    animation: none !important;
    opacity: 0.85 !important;
  }
  .eg-spotlight-layer {
    display: none !important;
    opacity: 0 !important;
  }
}
