/*
 * Public pages: age gate, denied page and error pages.
 * Same look as the game (Halloween night sky, gold frames, green buttons, Lilita One / Open Sans) but no game
 * content: only scenery from /static/img. Tokens come from base.css.
 */

/* ------------------------------------------------------------------ backdrop */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.backdrop::before {
  /* violet glow behind the card */
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(1100px, 150vw);
  aspect-ratio: 1.3;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgb(255 150 50 / 0.3), rgb(170 70 255 / 0.14) 55%, transparent),
    repeating-conic-gradient(from 0deg, rgb(255 226 190 / 0.1) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgb(0 0 0 / 0.6) 40%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 0%, rgb(0 0 0 / 0.6) 40%, transparent 100%);
}

.backdrop::after {
  /* keeps the footer legible over the scenery */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 170px;
  background: linear-gradient(180deg, transparent, rgb(11 3 20 / 0.8) 45%, rgb(11 3 20 / 0.94));
}

.backdrop__stars {
  position: absolute;
  inset: 0 0 25% 0;
  background: url('/static/img/stars.svg') 0 0 / 320px 320px repeat;
  opacity: 0.85;
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent);
  mask-image: linear-gradient(180deg, #000 45%, transparent);
}

.backdrop__stars--twinkle {
  background-size: 230px 230px;
  background-position: 117px 61px;
  opacity: 0.2;
  animation: gate-twinkle 3.6s ease-in-out infinite alternate;
}

.backdrop__moon {
  position: absolute;
  top: clamp(4px, 3vh, 40px);
  right: max(2vw, calc(50% - 640px));
  width: clamp(150px, 22vw, 300px);
  aspect-ratio: 1;
  background: url('/static/img/moon.svg') center / contain no-repeat;
}

.backdrop__scene {
  /* shifted left on mid-size landscape screens so the pumpkin locomotive sits just left of the centred card */
  --shift: min(0px, 19.4vw - 310px);
  position: absolute;
  left: var(--shift);
  right: 0;
  bottom: 0;
  height: max(43.75vw, 40vh);
  max-height: 88vh;
  background: url('/static/img/gate-scene.svg') left bottom / cover no-repeat;
}

@media (orientation: portrait) {
  .backdrop__scene {
    --shift: 0px;
    height: max(56vw, 34vh);
    background-position: 22% 100%;
  }
}

/*
 * Portrait tablets: the 540px card leaves a strip on each side. Slide the scene so the
 * locomotive's front (scene x = 500 of 1600, scale = 0.08vw per unit) ends just left of the card
 * instead of being hidden behind it: shift + 0.4 * 100vw = 50vw - 270px - 8px.
 */
@media (orientation: portrait) and (min-width: 700px) {
  .backdrop__scene {
    --shift: calc(10vw - 278px);
    background-position: left bottom;
  }
}

@keyframes gate-twinkle {
  from {
    opacity: 0.12;
  }
  to {
    opacity: 0.75;
  }
}

/* ------------------------------------------------------------------ layout */

.gate-main {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left));
}

/* ------------------------------------------------------------------ gold card */

.card {
  --frame: 6px;
  --pad-x: 40px;
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: 54px var(--pad-x) 28px;
  border: var(--frame) solid transparent;
  border-radius: 28px;
  background:
    radial-gradient(130% 50% at 50% 0%, rgb(143 79 224 / 0.3), transparent 70%) padding-box,
    linear-gradient(180deg, #2b0f4b 0%, #1d0a34 48%, #13061f 100%) padding-box,
    linear-gradient(
        135deg,
        #8f5508 0%,
        #ffe8a3 14%,
        #e9a623 30%,
        #8f5508 46%,
        #ffd86b 62%,
        #fff4cc 70%,
        #c47f12 84%,
        #6b3d05 100%
      )
      border-box;
  box-shadow:
    0 0 0 1px #3d2203,
    0 0 0 4px rgb(11 3 20 / 0.6),
    0 0 56px 4px rgb(177 77 255 / 0.32),
    0 26px 60px rgb(0 0 0 / 0.6),
    inset 0 0 0 1px rgb(0 0 0 / 0.6),
    inset 0 0 30px rgb(0 0 0 / 0.45);
  text-align: center;
}

.card::before {
  /* inner gold hairline */
  content: '';
  position: absolute;
  inset: 7px;
  border: 1.5px solid rgb(246 193 67 / 0.42);
  border-radius: 20px;
  pointer-events: none;
}

.card__orn {
  position: absolute;
  width: 60px;
  height: 60px;
  background: url('/static/img/frame-corner.svg') center / contain no-repeat;
  pointer-events: none;
}

.card__orn--tl {
  top: calc(-1 * var(--frame) - 7px);
  left: calc(-1 * var(--frame) - 7px);
}

.card__orn--tr {
  top: calc(-1 * var(--frame) - 7px);
  right: calc(-1 * var(--frame) - 7px);
  transform: scaleX(-1);
}

.card__orn--bl {
  bottom: calc(-1 * var(--frame) - 7px);
  left: calc(-1 * var(--frame) - 7px);
  transform: scaleY(-1);
}

.card__orn--br {
  bottom: calc(-1 * var(--frame) - 7px);
  right: calc(-1 * var(--frame) - 7px);
  transform: scale(-1, -1);
}

.card__crest {
  position: absolute;
  top: calc(-1 * var(--frame));
  left: 50%;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 5px solid transparent;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #4a1b7c 0%, #24093f 62%, #14061f 100%) padding-box,
    conic-gradient(from 210deg, #8f5508, #ffe8a3, #e9a623, #8f5508, #ffd86b, #fff4cc, #c47f12, #8f5508) border-box;
  box-shadow:
    0 0 0 2px #3d2203,
    0 0 26px rgb(255 140 30 / 0.45),
    0 8px 18px rgb(0 0 0 / 0.5),
    inset 0 0 0 2px rgb(0 0 0 / 0.45),
    inset 0 6px 14px rgb(0 0 0 / 0.55);
  transform: translate(-50%, -50%);
}

.card__crest img {
  width: 74%;
  height: 74%;
  animation: gate-glow 2.8s ease-in-out infinite alternate;
}

@keyframes gate-glow {
  from {
    filter: drop-shadow(0 0 2px rgb(255 160 40 / 0.35));
  }
  to {
    filter: drop-shadow(0 0 10px rgb(255 160 40 / 0.85));
  }
}

/* ------------------------------------------------------------------ typography */

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 0.22em;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7.4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* Same word mark as the game logo: gold "PUMPKIN", pumpkin-orange "EXPRESS". */
.brand__top,
.brand__bottom {
  padding: 0 0.04em;
  background: linear-gradient(180deg, #fffbe6 0%, #ffe48e 30%, #f8b733 55%, #d8770a 72%, #ffcf5a 90%, #fff1b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0.03em #3a1200;
  filter: drop-shadow(0 0.05em 0 #2a0d00) drop-shadow(0 0.1em 0.12em rgb(10 0 25 / 0.6)) drop-shadow(0 0 0.3em rgb(255 150 30 / 0.35));
}

.brand__bottom {
  background-image: linear-gradient(180deg, #ffe7c2 0%, #ffab4a 32%, #ff7a12 56%, #c94400 76%, #ff9a3a 100%);
}

.card__title {
  margin: 16px 0 8px;
  color: var(--gold-200);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4.4vw, 1.7rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.55), 0 0 18px rgb(246 193 67 / 0.25);
  text-wrap: balance;
}

.card__lead {
  max-width: 44ch;
  margin: 0 auto 14px;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ form */

.gate-form {
  margin: 0;
}

.gate-form__prompt {
  margin: 0 0 14px;
  color: var(--text);
  font-weight: 600;
}

.gate-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid rgb(255 107 107 / 0.75);
  border-radius: 12px;
  background: rgb(200 40 45 / 0.2);
  color: #ffe3e3;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.gate-error::before {
  content: '!';
  content: '!' / '';
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: -1px;
  border-radius: 50%;
  background: var(--danger);
  color: #2b0000;
  font-size: 0.85rem;
  font-weight: 900;
}

/* focused programmatically (tabindex=-1) so it is read first; it is not interactive, so no ring */
.gate-error:focus,
.gate-error:focus-visible {
  outline: none;
  border-radius: 12px;
  box-shadow: none;
}

.dob {
  min-width: 0;
  margin: 0;
  padding: 10px 16px 16px;
  border: 1px solid rgb(246 193 67 / 0.35);
  border-radius: 16px;
  background: rgb(11 3 20 / 0.38);
}

.dob__legend {
  margin-inline: auto;
  padding: 0 10px;
  color: var(--gold-300);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dob__fields {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr) minmax(0, 1.1fr);
  gap: 10px;
}

.dob__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.dob__label {
  padding-left: 4px;
  color: var(--gold-200);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dob__select {
  width: 100%;
  min-height: 52px;
  padding: 0 30px 0 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 2px solid #a86f12;
  border-radius: 12px;
  background:
    url('/static/img/chevron.svg') no-repeat right 11px center / 13px 8px,
    linear-gradient(180deg, #2e114d 0%, #1a0830 100%);
  box-shadow: inset 0 2px 8px rgb(0 0 0 / 0.55), 0 1px 0 rgb(255 232 163 / 0.12);
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dob__select:hover {
  border-color: var(--gold-400);
}

.dob__select:focus-visible {
  border-color: var(--gold-300);
  border-radius: 12px;
  box-shadow: var(--focus-ring), inset 0 2px 8px rgb(0 0 0 / 0.55);
}

.dob__select:invalid {
  color: var(--text-muted);
}

.dob__select option {
  background: #1d0a33;
  color: #fff6e5;
}

.dob__select[aria-invalid='true'] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger), inset 0 2px 8px rgb(0 0 0 / 0.55);
}

.dob__select[aria-invalid='true']:focus-visible {
  box-shadow: var(--focus-ring), inset 0 2px 8px rgb(0 0 0 / 0.55);
}

/* honeypot: kept out of sight and out of the tab order */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* ------------------------------------------------------------------ human check (Turnstile) */

/*
 * #gate-captcha: the widget (size "flexible": 100% of the box, at least 300 px wide; rendered 71 px tall in
 * Chromium, Firefox and WebKit), the hint under it (aria-describedby of Enter, polite live region) and a
 * retry button after a load failure / widget error.
 * data-state: idle (no JS yet) | loading | ready | done | expired | failed | blocked (set by gate.js;
 * "blocked" is rendered by the server while failed checks block this browser / network).
 */
.captcha {
  margin: 16px 0 0;
  border-radius: 12px;
}

/* gate.js focuses the group (tabindex=-1) after "Try again" or a press on the inactive Enter, so the next
   Tab enters the widget; the global :focus-visible ring (rounded here) shows where keyboard focus is */
.captcha__widget {
  min-width: 0;
  /* the placeholder has the rendered widget's height: Enter does not move when the widget appears */
  min-height: 71px;
  border-radius: 10px;
}

/* placeholder of the widget's exact size while api.js loads: no layout jump when it appears */
.captcha[data-state='idle'] .captcha__widget:empty,
.captcha[data-state='loading'] .captcha__widget:empty,
.captcha[data-state='ready'] .captcha__widget:empty {
  border: 1px solid rgb(246 193 67 / 0.28);
  background:
    linear-gradient(100deg, transparent 20%, rgb(255 232 163 / 0.07) 45%, transparent 70%) 0 0 / 200% 100%,
    rgb(11 3 20 / 0.55);
  animation: captcha-shimmer 1.6s linear infinite;
}

/* nothing to show when the script never loaded: the message and the retry button take its place */
.captcha[data-state='failed'] .captcha__widget:empty {
  display: none;
}

/* blocked after failed checks: a quiet placeholder (no shimmer, nothing is loading) until the wait is over */
.captcha[data-state='blocked'] .captcha__widget:empty {
  border: 1px dashed rgb(246 193 67 / 0.22);
  background: rgb(11 3 20 / 0.4);
}

@keyframes captcha-shimmer {
  from {
    background-position: 100% 0, 0 0;
  }
  to {
    background-position: -100% 0, 0 0;
  }
}

.captcha__feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 8px;
}

.captcha__status {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  text-wrap: pretty;
}

.captcha__status[hidden] {
  display: none;
}

.captcha__status::before {
  /* state icon: ring (waiting), check (done), "!" (expired / failed) */
  content: '';
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 0.5px;
  border: 2px solid var(--gold-400);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.captcha[data-state='done'] .captcha__status {
  color: #c9f7d0;
}

.captcha[data-state='done'] .captcha__status::before {
  content: '\2713';
  content: '\2713' / '';
  border-color: var(--spin-green);
  background: var(--spin-green);
  color: #08260d;
}

.captcha[data-state='expired'] .captcha__status,
.captcha[data-state='failed'] .captcha__status,
.captcha[data-state='blocked'] .captcha__status {
  color: var(--gold-100);
}

.captcha[data-state='expired'] .captcha__status::before,
.captcha[data-state='failed'] .captcha__status::before,
.captcha[data-state='blocked'] .captcha__status::before {
  content: '!';
  content: '!' / '';
  border-color: var(--pumpkin-400);
  background: var(--pumpkin-400);
  color: #2b1100;
}

.captcha[data-state='failed'] .captcha__feedback {
  margin-top: 0;
  padding: 12px 14px;
  border: 1px solid var(--pumpkin-400);
  border-radius: 12px;
  background: rgb(255 127 17 / 0.16);
}

.captcha__retry {
  min-height: 44px;
  padding: 0.4em 1.4em;
  font-size: 0.9rem;
  cursor: pointer;
}

.captcha__retry[hidden] {
  display: none;
}

/* without scripting there is no widget: the noscript notice (right above Enter) explains why, and Enter
   looks inactive - the server refuses the form without a solved check */
@media (scripting: none) {
  .captcha {
    display: none;
  }

  .gate-form--captcha .gate-submit {
    filter: grayscale(1) brightness(0.62);
    opacity: 0.7;
    cursor: not-allowed;
  }
}

@media (prefers-reduced-motion: reduce) {
  .captcha[data-state] .captcha__widget:empty {
    animation: none;
  }
}

.notice {
  margin: 14px 0 0;
  padding: 10px 14px;
  border: 1px dashed rgb(246 193 67 / 0.5);
  border-radius: 12px;
  background: rgb(246 193 67 / 0.08);
  color: var(--gold-100);
  font-size: 0.9rem;
  line-height: 1.4;
}

.notice--warn {
  border-style: solid;
  border-color: var(--pumpkin-400);
  background: rgb(255 127 17 / 0.16);
  font-weight: 600;
}

.notice--lock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 18px;
  border-style: solid;
  font-weight: 600;
}

.notice__icon {
  flex: none;
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold-300);
  border-radius: 50%;
}

.notice__icon::before,
.notice__icon::after {
  /* clock hands */
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  background: var(--gold-300);
  border-radius: 2px;
  transform-origin: 50% 0;
}

.notice__icon::before {
  height: 6px;
  transform: translate(-50%, 0) rotate(180deg);
}

.notice__icon::after {
  height: 5px;
  transform: translate(-50%, 0) rotate(-90deg);
}

/* ------------------------------------------------------------------ buttons */

.gate-submit {
  position: relative;
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  font-size: 1.3rem;
  letter-spacing: 0.16em;
}

.gate-submit:focus-visible,
.card .btn-cta:focus-visible {
  /* base .btn-cta sets its own shadow; keep the focus ring visible on top of it */
  box-shadow: var(--focus-ring), 0 6px 18px rgb(246 183 51 / 0.35);
}

.gate-submit__spinner {
  display: none;
  width: 1em;
  height: 1em;
  border: 3px solid rgb(58 21 0 / 0.28);
  border-top-color: #3a1500;
  border-radius: 50%;
}

.gate-submit.is-busy {
  cursor: progress;
}

/* waiting for the human check: clearly inactive (the hint above says why). gate.js uses aria-disabled
   so the button stays focusable and a press can explain; it looks exactly like a disabled one */
.gate-submit:disabled:not(.is-busy),
.gate-submit[aria-disabled='true']:not(.is-busy) {
  filter: grayscale(1) brightness(0.62);
  opacity: 0.7;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.25), inset 0 -3px 0 rgb(0 0 0 / 0.25);
  cursor: not-allowed;
}

.gate-submit[aria-disabled='true']:not(.is-busy):active {
  transform: none;
}

.gate-submit[aria-disabled='true']:not(.is-busy):focus-visible {
  box-shadow: var(--focus-ring), inset 0 2px 0 rgb(255 255 255 / 0.25), inset 0 -3px 0 rgb(0 0 0 / 0.25);
}

.gate-submit.is-busy:disabled {
  filter: none;
  opacity: 0.9;
}

.gate-submit.is-busy .gate-submit__spinner {
  display: inline-block;
  animation: gate-spin 0.8s linear infinite;
}

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

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.6em 1.6em;
  border: 2px solid var(--gold-400);
  border-radius: 999px;
  background: rgb(246 193 67 / 0.08);
  color: var(--gold-200);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.btn-outline:hover {
  background: rgb(246 193 67 / 0.18);
  color: var(--gold-100);
}

.btn-outline:focus-visible {
  border-radius: 999px;
}

/* ------------------------------------------------------------------ fine print, help, error extras */

.card__fineprint {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgb(246 193 67 / 0.22);
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.45;
}

.card__fineprint p {
  margin: 0 0 6px;
  text-wrap: pretty;
}

.card__fineprint p:last-child {
  margin-bottom: 0;
}

.card__help {
  padding-top: 16px;
  border-top: 1px solid rgb(246 193 67 / 0.22);
}

.card__help p {
  margin: 0 0 12px;
  color: var(--text-muted);
  text-wrap: balance;
}

.card__status {
  margin: 10px 0 -6px;
  color: var(--pumpkin-400);
  font-family: var(--font-spooky);
  font-size: 4.5rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-shadow: 0 3px 0 #4a1a00, 0 0 22px rgb(255 127 17 / 0.45);
}

.card__actions {
  margin: 20px 0 4px;
}

.card--denied,
.card--error {
  max-width: 500px;
  padding-bottom: 34px;
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 480px) {
  .gate-main {
    padding: 56px max(12px, env(safe-area-inset-right)) 14px max(12px, env(safe-area-inset-left));
  }

  .card {
    --frame: 5px;
    --pad-x: 16px;
    padding: 50px var(--pad-x) 22px;
    border-radius: 24px;
  }

  .card::before {
    inset: 5px;
    border-radius: 18px;
  }

  .card__orn {
    width: 48px;
    height: 48px;
  }

  .card__crest {
    width: 84px;
    height: 84px;
  }

  .card__lead {
    font-size: 0.925rem;
  }

  .dob {
    padding: 0;
    border: 0;
    background: none;
  }

  .dob__legend {
    margin-bottom: 8px;
    padding: 0;
  }

  .dob__fields {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.6fr) minmax(0, 1.05fr);
    gap: 8px;
  }

  .dob__select {
    min-height: 50px;
    padding: 0 22px 0 9px;
    background-position: right 8px center, 0 0;
    background-size: 11px 7px, auto;
    font-size: 1rem;
  }

  .gate-submit {
    margin-top: 16px;
  }

  /* the widget needs at least 300 px: let it use the card's side padding on narrow phones */
  .captcha__widget {
    margin-inline: calc(4px - var(--pad-x));
  }
}

/* very narrow phones (e.g. 320 px): squeeze paddings so the select values stay readable */
@media (max-width: 359px) {
  .gate-main {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .card {
    --pad-x: 12px;
  }

  .dob__fields {
    gap: 6px;
  }

  .dob__select {
    padding: 0 20px 0 6px;
    background-position: right 6px center, 0 0;
  }
}

/* short phones in portrait (e.g. 360x640, 375x667): tighter rhythm so the submit button stays
   above the fold even with an error message or the Turnstile widget */
@media (max-width: 480px) and (max-height: 760px) {
  .gate-main {
    padding-top: 46px;
  }

  .card {
    padding-top: 42px;
  }

  .card__crest {
    width: 72px;
    height: 72px;
  }

  .brand {
    font-size: 2rem;
  }

  .card__title {
    margin: 10px 0 6px;
  }

  .card__lead {
    margin-bottom: 10px;
    font-size: 0.875rem;
    line-height: 1.45;
  }

  .gate-form__prompt {
    margin-bottom: 10px;
  }

  .gate-error {
    margin-bottom: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .dob__legend {
    margin-bottom: 6px;
  }

  .gate-submit {
    margin-top: 14px;
    min-height: 54px;
  }

  .card__status {
    font-size: 3.75rem;
  }
}

/* two-column gate card: phones in landscape, and wide-but-short desktop windows
   (1366x657, 1280x600 ... laptops once the browser chrome is subtracted) */
@media (orientation: landscape) and (max-height: 560px) and (min-width: 640px),
  (min-width: 900px) and (max-height: 700px) {
  .card--gate {
    max-width: 880px;
  }

  .card--gate .card__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-areas:
      'head form'
      'fine form';
    column-gap: 30px;
    align-items: start;
  }

  .card--gate .card__head {
    grid-area: head;
  }

  .card--gate .gate-form {
    grid-area: form;
    align-self: center;
  }

  .card--gate .card__fineprint {
    grid-area: fine;
    margin-top: 6px;
    padding-top: 10px;
  }

  .card--gate .card__lead {
    margin-bottom: 0;
  }
}

/* phones in landscape (640x360 ... 932x430) */
@media (orientation: landscape) and (max-height: 560px) and (min-width: 640px) {
  .gate-main {
    /* leaves room above the crest, which overhangs the card by half its height */
    padding-top: 44px;
  }

  .card {
    padding-top: 36px;
    padding-bottom: 22px;
  }

  .card--gate {
    --pad-x: 22px;
    padding: 34px var(--pad-x) 22px;
  }

  .card--gate .card__layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    column-gap: 22px;
  }

  /* top-aligned so the submit button is above the fold even when the text column is taller */
  .card--gate .gate-form {
    align-self: start;
    padding-top: 0;
  }

  .gate-form__prompt {
    margin-bottom: 6px;
  }

  /* same compact, unboxed date fields as on portrait phones: the values must stay readable */
  .dob {
    padding: 0;
    border: 0;
    background: none;
  }

  .dob__legend {
    margin-bottom: 6px;
    padding: 0;
  }

  .dob__fields {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.6fr) minmax(0, 1.05fr);
    gap: 8px;
  }

  .dob__select {
    min-height: 46px;
    padding: 0 22px 0 9px;
    background-position: right 8px center, 0 0;
    background-size: 11px 7px, auto;
    font-size: 1rem;
  }

  /* the widget (71 px) + hint must still leave Enter above the fold on a 390 px tall screen */
  .gate-submit {
    margin-top: 8px;
    min-height: 48px;
  }

  .captcha {
    margin-top: 8px;
  }

  .captcha__feedback {
    margin-top: 4px;
  }

  .captcha__status {
    font-size: 0.8125rem;
  }

  /* denied / error cards: a little wider so the copy needs fewer lines and the button stays in view */
  .card--denied,
  .card--error {
    max-width: 600px;
  }

  .card--denied .brand,
  .card--error .brand {
    font-size: 1.9rem;
  }

  .notice--lock {
    margin: 2px 0 12px;
    padding-block: 8px;
  }

  .card__help {
    padding-top: 10px;
  }

  .card__help p {
    margin-bottom: 8px;
  }

  .card__title {
    margin-top: 10px;
    font-size: 1.35rem;
  }

  .card__status {
    margin-top: 6px;
    font-size: 3.2rem;
  }

  .card__actions {
    margin-top: 14px;
  }

  .card--gate .card__lead {
    font-size: 0.9rem;
  }

  .brand__top {
    font-size: 2.4rem;
  }

  .card__crest {
    width: 72px;
    height: 72px;
  }
}

/* short landscape screens (tablets / small laptops): tighten vertical rhythm */
@media (min-width: 640px) and (max-height: 820px) and (min-height: 561px) {
  .gate-main {
    padding-top: 54px;
    padding-bottom: 10px;
  }

  .card {
    padding-top: 46px;
    padding-bottom: 22px;
  }

  .card__crest {
    width: 88px;
    height: 88px;
  }

  .brand__top {
    font-size: 2.9rem;
  }

  .card__title {
    margin-top: 10px;
  }

  .card__lead {
    margin-bottom: 10px;
  }

  .gate-form__prompt {
    margin-bottom: 10px;
  }

  .dob {
    padding-bottom: 14px;
  }

  .gate-submit {
    margin-top: 14px;
    min-height: 54px;
  }

  .card__fineprint {
    margin-top: 14px;
    padding-top: 10px;
  }

  .site-footer {
    padding-top: 6px;
  }
}

/* 1280x720, 1536x730 ...: one more notch so the whole card and the footer fit without scrolling */
@media (min-width: 640px) and (max-height: 780px) and (min-height: 561px) {
  .gate-main {
    padding-top: 48px;
  }

  .card {
    padding-top: 42px;
    padding-bottom: 18px;
  }

  .card__crest {
    width: 80px;
    height: 80px;
  }

  .brand__top {
    font-size: 2.6rem;
  }

  .card__title {
    margin: 8px 0 6px;
  }

  .card__lead {
    margin-bottom: 8px;
    font-size: 0.94rem;
    line-height: 1.45;
  }

  .gate-form__prompt {
    margin-bottom: 8px;
  }

  .dob {
    padding-top: 6px;
    padding-bottom: 12px;
  }

  .gate-submit {
    margin-top: 12px;
    min-height: 52px;
  }

  .captcha {
    margin-top: 12px;
  }

  .card__fineprint {
    margin-top: 12px;
    padding-top: 8px;
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .site-footer {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* wide-but-short desktop windows: two-column card (grid above), sized for a mouse and a big screen */
@media (min-width: 900px) and (min-height: 561px) and (max-height: 700px) {
  .card--gate {
    padding: 46px 36px 24px;
  }

  .card--gate .card__layout {
    column-gap: 40px;
  }

  .card--gate .card__head {
    padding-top: 4px;
  }

  .card--gate .card__lead {
    font-size: 0.95rem;
  }

  .card--gate .gate-form {
    padding-top: 6px;
  }

  .card--gate .card__fineprint {
    margin-top: 14px;
    padding-top: 10px;
  }

  /*
   * Locomotive placement for the 880px card: its front (scene x = 500 of 1600) ends just left
   * of the card. In this range the scene is scaled by width, s = (100vw - shift) / 1600, so
   * shift = (50vw - 440px - 8px - 0.3125 * 100vw) / 0.6875. (Denied/error cards stay 500px wide,
   * the locomotive simply sits further from them.)
   */
  .backdrop__scene {
    --shift: min(0px, 27.27vw - 651.6px);
  }
}

/* ------------------------------------------------------------------ gate notice + privacy page */

.gate-notice {
  margin: 10px 0 0;
}

.card--privacy {
  max-width: 720px;
  text-align: center;
}

.prose {
  margin: 8px 0 18px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  text-align: left;
}

.prose h2 {
  margin: 20px 0 6px;
  color: var(--gold-200);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.prose p,
.prose ul {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.prose ul {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 4px;
}

@media (forced-colors: active) {
  .card {
    border-color: CanvasText;
  }

  .backdrop {
    display: none;
  }

  .brand__top {
    color: CanvasText;
    background: none;
    filter: none;
  }

  /* the box-shadow focus ring from base.css is dropped in forced colors: use a real outline */
  :focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }

  .gate-error:focus,
  .gate-error:focus-visible {
    outline: none;
  }

  .dob__select[aria-invalid='true'] {
    border-style: dashed;
  }
}

/* The gate has no lead paragraph: give the heading a little air above the date fields. */
.card--gate .card__title {
  margin-bottom: 18px;
}
