/* The theme cannot assume the parent's global box-sizing reaches here — the
   panel's padding was being added on top of its width, pushing it 18px wider
   than a 390px phone. */
.alw-gate,
.alw-gate *,
.alw-gate *::before,
.alw-gate *::after { box-sizing: border-box; }

/* ==========================================================================
   Researcher verification gate
   Same job as the MedVita gate, in Aletheia's language: marble panel on a
   deep navy scrim, Cinzel display, gold hairlines, the Pediment at the top.
   ========================================================================== */

.alw-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 1rem 1rem 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family: Jost, Futura, system-ui, sans-serif;
}

/* No JavaScript means no way to dismiss this, so it must not appear at all. */
.no-js .alw-gate { display: none; }

.alw-gate__scrim {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(70% 60% at 50% 0%, rgba(37, 99, 165, .32) 0%, rgba(4, 16, 30, 0) 70%),
    rgba(4, 16, 30, .92);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

.alw-gate__panel {
  position: relative;
  width: min(600px, 100%);
  margin: auto;
  background: linear-gradient(180deg, #FFFFFF 0%, #F7F4ED 100%);
  border: 1px solid rgba(198, 165, 92, .55);
  border-top: 3px solid #C6A55C;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  animation: alw-gate-in .45s cubic-bezier(.16, .84, .44, 1) both;
}

@keyframes alw-gate-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ lockup */

.alw-gate__mark {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 1.125rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(12, 47, 87, .12);
}

.alw-gate__lockup { display: flex; flex-direction: column; gap: 3px; }

.alw-gate__name {
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1;
  letter-spacing: .22em;
  text-indent: .22em;
  color: #0C2F57;
}

.alw-gate__sub {
  font-size: .5rem;
  letter-spacing: .02em;
  color: #8C6C2C;
  max-width: 128px;
  text-align: justify;
  text-align-last: justify;
}

/* ------------------------------------------------------------------- copy */

.alw-gate__eyebrow {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #8C6C2C;
  margin: 0 0 .625rem;
}

.alw-gate__title {
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: .03em;
  color: #0C2F57;
  margin: 0 0 .875rem;
}

.alw-gate__lede {
  font-size: .9375rem;
  line-height: 1.7;
  color: #5A6B7C;
  margin: 0 0 1.5rem;
}

/* --------------------------------------------------------------- controls */

.alw-gate__form { display: flex; flex-direction: column; gap: .875rem; }

.alw-gate__check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .75rem;
  align-items: start;
  padding: .875rem;
  border: 1px solid rgba(12, 47, 87, .16);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.alw-gate__check:hover { border-color: rgba(198, 165, 92, .7); }
.alw-gate__check:has(input:checked) {
  border-color: #C6A55C;
  background: rgba(198, 165, 92, .07);
}

/* The real input stays in the accessibility tree and keeps the label
   association; only its painting is replaced. */
.alw-gate__check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.alw-gate__box {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid #C6A55C;
  border-radius: 3px;
  background: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: background-color .18s, border-color .18s;
}
.alw-gate__box::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(.5);
  opacity: 0;
  transition: opacity .18s, transform .18s cubic-bezier(.16, .84, .44, 1);
}
.alw-gate__check input:checked + .alw-gate__box {
  background: #0C2F57;
  border-color: #0C2F57;
}
.alw-gate__check input:checked + .alw-gate__box::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}
.alw-gate__check input:focus-visible + .alw-gate__box {
  outline: 2px solid #C6A55C;
  outline-offset: 3px;
}

.alw-gate__text {
  font-size: .9375rem;
  line-height: 1.6;
  color: #0C2F57;
}

.alw-gate__btn {
  margin-top: .5rem;
  min-height: 54px;
  width: 100%;
  padding: 0 1.5rem;
  border: 1px solid #C6A55C;
  border-radius: 3px;
  background: #C6A55C;
  color: #071B33;
  font-family: Jost, Futura, system-ui, sans-serif;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .3s;
}
.alw-gate__btn:hover:not(:disabled) { background: #F0DCA8; border-color: #F0DCA8; transform: translateY(-1px); }
.alw-gate__btn:disabled {
  background: transparent;
  color: rgba(12, 47, 87, .38);
  border-color: rgba(12, 47, 87, .18);
  cursor: not-allowed;
}
.alw-gate__btn:focus-visible { outline: 2px solid #C6A55C; outline-offset: 2px; }

/* ------------------------------------------------------------------ fine */

.alw-gate__fine {
  margin: 1.25rem 0 1rem;
  font-size: .75rem;
  line-height: 1.65;
  color: #7B8794;
}

.alw-gate__terms {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8C6C2C;
  text-decoration: none;
  border-bottom: 1px solid rgba(198, 165, 92, .6);
}
.alw-gate__terms:hover { color: #0C2F57; border-bottom-color: #0C2F57; }

.alw-gate__exit {
  position: relative;
  margin: 1.25rem 0;
  text-align: center;
  font-size: .8125rem;
  color: rgba(238, 240, 244, .6);
}
.alw-gate__exit a {
  color: rgba(240, 220, 168, .9);
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .375rem;
}

/* Scroll lock while the gate is up. */
html.alw-gate-open,
body.alw-gate-open {
  overflow: hidden;
  /* touch-action stops the page behind from rubber-banding on iOS */
  touch-action: none;
}

@media (prefers-reduced-motion: reduce) {
  .alw-gate__panel { animation: none; }
  .alw-gate__btn:hover:not(:disabled) { transform: none; }
  .alw-gate__box::after { transition: none; }
}
