/* The checkpoint: unit BR-4D's terminal at the door. Same room, different
   fixture — machine text and filament amber, not the sign's neon script.
   The card is the robot's CRT: dark plum glass, faint scanlines, one red stamp. */

.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 4vw, 2rem);
  background: rgba(5, 2, 4, 0.82);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
/* display:grid above would defeat the hidden attribute (UA display:none);
   without this, the "hidden" overlay still blankets the page for no-JS
   visitors and swallows every click after close. */
.gate[hidden] { display: none; }

.gate__card {
  position: relative;
  width: min(33rem, 100%);
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  padding: clamp(1.1rem, 4.5vw, 1.9rem);
  background: rgba(13, 7, 12, 0.96);
  border: 1px solid rgba(255, 177, 78, 0.28);
  box-shadow:
    0 0 0 1px rgba(5, 2, 4, 0.9),
    0 22px 70px rgba(5, 2, 4, 0.85),
    0 0 44px rgba(255, 46, 200, 0.07);
  font-family: var(--font-machine);
  color: var(--amber);
  font-size: clamp(0.82rem, 2.6vw, 0.95rem);
  line-height: 1.55;
}
/* CRT scanlines — texture, not decoration; sits under the text. */
.gate__card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 246, 251, 0.022) 0 1px,
    transparent 1px 3px);
}

.gate__head {
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px dashed rgba(255, 177, 78, 0.3);
}
.gate__title {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--tube-core);
  text-shadow: 0 0 6px rgba(69, 200, 255, 0.7), 0 0 18px rgba(69, 200, 255, 0.35);
}
.gate__sub {
  margin-top: 0.2rem;
  font-size: 0.86em;
  color: var(--amber-dim);
}

/* --- Scan readout --- */
.gate__scan { min-height: 7.8em; } /* 5 lines × 1.55 lh: no reflow as lines land */
.gate__line { white-space: pre-wrap; }
.gate__line strong { color: var(--tube-core); font-weight: 400; }

.gate__verdict {
  margin-top: 0.9rem;
  font-size: 1.35em;
  letter-spacing: 0.2em;
  color: var(--tube-core);
  text-shadow: var(--glow-red);
  /* The stamp moment: it THUNKS in when gate.js clears hidden (display:none
     holds the animation until then). Overshoot lives in the keyframes. */
  animation: gate-stamp-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes gate-stamp-in {
  0%   { opacity: 0; transform: scale(1.7) rotate(-4deg); }
  60%  { opacity: 1; transform: scale(0.96) rotate(0.6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.gate__verdict-mark { color: var(--red); }

/* --- Consent --- */
.gate__consent { margin-top: 1rem; }
.gate__note { color: var(--amber-dim); }

.gate__check {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.9rem 0 0;
  padding: 0.55rem 0.7rem;
  min-height: 44px;
  border: 1px solid rgba(255, 177, 78, 0.3);
  background: rgba(5, 2, 4, 0.55);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
/* Native box does the a11y; this square does the reCAPTCHA cosplay. */
.gate__check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.gate__box {
  flex: none;
  width: 1.35em;
  height: 1.35em;
  border: 2px solid var(--amber-dim);
  background: rgba(255, 246, 251, 0.04);
  display: grid;
  place-items: center;
}
.gate__check input:checked + .gate__box::after {
  content: '\2713';
  color: var(--pink);
  text-shadow: 0 0 8px rgba(255, 46, 200, 0.8);
  font-size: 1.05em;
  line-height: 1;
}
.gate__check input:focus-visible + .gate__box {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.gate__check:hover .gate__box { border-color: var(--amber); }

.gate__aside {
  margin-top: 0.35rem;
  color: var(--amber-dim);
  font-style: italic;
  font-size: 0.9em;
}

.gate__terms {
  margin-top: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px dashed rgba(255, 177, 78, 0.3); /* terminal rule vocabulary, not a callout stripe */
  font-size: 0.88em;
  color: var(--amber-dim);
}

/* --- Actions --- */
.gate__actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.gate__admit {
  font: inherit;
  font-family: var(--font-machine);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 0.7rem 1.3rem;
  min-height: 44px;
  color: var(--tube-core);
  background: transparent;
  border: 1px solid var(--pink);
  box-shadow: 0 0 12px rgba(255, 46, 200, 0.25), inset 0 0 10px rgba(255, 46, 200, 0.08);
  text-shadow: 0 0 7px rgba(255, 46, 200, 0.75);
  cursor: pointer;
}
.gate__admit:hover:not(:disabled),
.gate__admit:focus-visible {
  box-shadow: 0 0 22px rgba(255, 46, 200, 0.5), inset 0 0 14px rgba(255, 46, 200, 0.16);
}
.gate__admit:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
  text-shadow: none;
  border-color: var(--amber-dim);
  color: var(--amber-dim);
}
.gate__refuse {
  font: inherit;
  font-family: var(--font-machine);
  padding: 0.7rem 0.6rem;
  min-height: 44px;
  color: var(--amber-dim);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gate__refuse:hover { color: var(--amber); }

.gate__admit:focus-visible,
.gate__refuse:focus-visible,
.soundtoggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.gate__fine {
  margin-top: 1.1rem;
  font-size: 0.78em;
  color: var(--amber-dim); /* full strength: it's the smallest text on the card */
}

/* --- Corner sound toggle (appears once the gate closes) --- */
.soundtoggle {
  position: fixed;
  right: max(0.4rem, env(safe-area-inset-right));
  bottom: max(0.4rem, env(safe-area-inset-bottom));
  z-index: 5;
  font-family: var(--font-machine);
  font-size: var(--size-fine);
  letter-spacing: 0.06em;
  color: var(--amber-dim);
  background: none;
  border: none;
  padding: 0.9rem 0.8rem; /* ~44px hit area, quiet footprint */
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(5, 2, 4, 0.95);
}
.soundtoggle:hover { color: var(--amber); }
.soundtoggle[aria-pressed="true"] {
  color: var(--blue);
  text-shadow: 0 0 8px rgba(69, 200, 255, 0.6), 0 1px 2px rgba(5, 2, 4, 0.95);
}
