/* GuardianX invitation threshold
   Isolated from the public-site stylesheet so the gateway cannot disturb
   existing desktop or mobile layouts. */

:root {
  color-scheme: dark;
  --gate-red: #d51e2b;
  --gate-red-bright: #ef3343;
  --gate-red-deep: #6f0f18;
  --gate-ink: #050505;
  --gate-panel: rgba(7, 7, 8, 0.84);
  --gate-text: #f5f5f3;
  --gate-muted: #a5a3a4;
  --gate-line: rgba(255, 255, 255, 0.17);
  --gate-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gate-display: "Inter Tight", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--gate-ink);
}

body {
  min-width: 320px;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--gate-ink);
  color: var(--gate-text);
  font-family: var(--gate-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.gate-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(98, 10, 18, 0.3), transparent 27%),
    linear-gradient(180deg, #080606 0%, #020202 72%);
  perspective: 1500px;
  isolation: isolate;
}

.gate-void {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(213, 30, 43, 0.16), transparent 16%),
    repeating-linear-gradient(90deg, transparent 0 69px, rgba(213, 30, 43, 0.035) 70px 71px),
    #030303;
}

.gate-leaf {
  position: absolute;
  inset: -1px;
  z-index: 2;
  overflow: hidden;
  backface-visibility: hidden;
  will-change: transform, filter;
  transition:
    transform 1.25s cubic-bezier(0.72, 0, 0.18, 1),
    filter 800ms ease,
    opacity 500ms ease;
}

.gate-leaf picture,
.gate-leaf img {
  display: block;
  width: 100%;
  height: 100%;
}

.gate-leaf img {
  object-fit: cover;
  object-position: 50% 50%;
  user-select: none;
  pointer-events: none;
}

.gate-leaf--left {
  clip-path: inset(0 50% 0 0);
  transform-origin: 0 50%;
}

.gate-leaf--right {
  clip-path: inset(0 0 0 50%);
  transform-origin: 100% 50%;
}

.gate-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 24%, transparent 72%, rgba(0, 0, 0, 0.78)),
    radial-gradient(ellipse at 50% 48%, transparent 10%, rgba(0, 0, 0, 0.22) 58%, rgba(0, 0, 0, 0.72) 100%);
  transition: opacity 650ms ease;
}

.gate-seam {
  position: absolute;
  top: 5%;
  bottom: 4%;
  left: 50%;
  z-index: 4;
  width: 1px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(218, 33, 47, 0.35) 20%, rgba(255, 83, 95, 0.58) 50%, rgba(218, 33, 47, 0.26) 78%, transparent);
  box-shadow: 0 0 14px rgba(213, 30, 43, 0.28);
  opacity: 0.72;
  animation: gate-seam-breathe 5.6s ease-in-out infinite;
  transition: width 500ms ease, left 500ms ease, opacity 350ms ease, box-shadow 500ms ease;
}

@keyframes gate-seam-breathe {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 0.78; }
}

.gate-shell {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  padding:
    max(22px, env(safe-area-inset-top))
    max(28px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(28px, env(safe-area-inset-left));
}

.gate-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 13px;
  min-width: 0;
  opacity: 0;
  animation: gate-arrive 700ms 120ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gate-brand img {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(213, 30, 43, 0.5);
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 0 26px rgba(213, 30, 43, 0.14);
}

.gate-brand div {
  display: grid;
  gap: 4px;
}

.gate-brand strong,
.gate-brand span,
.access-kicker,
.invitation-form label,
.invitation-hint,
.invitation-submit,
.invitation-status,
.gate-footer {
  font-family: var(--gate-mono);
}

.gate-brand strong {
  font-size: 15px;
  letter-spacing: 0.2em;
}

.gate-brand span {
  color: #858283;
  font-size: 10px;
  letter-spacing: 0.15em;
}

.gate-main {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 28px 0;
}

.access-panel {
  position: relative;
  width: min(100%, 440px);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(145deg, rgba(20, 17, 18, 0.91), rgba(5, 5, 6, 0.9)),
    rgba(5, 5, 5, 0.9);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(213, 30, 43, 0.08) inset,
    0 0 52px rgba(111, 15, 24, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(12px);
  animation: gate-arrive 780ms 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 350ms ease, transform 500ms ease, border-color 250ms ease;
}

.access-panel::before,
.access-panel::after {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: rgba(213, 30, 43, 0.68);
  content: "";
  pointer-events: none;
}

.access-panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.access-panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

@keyframes gate-arrive {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.access-sigil {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 21px;
  border: 1px solid rgba(213, 30, 43, 0.54);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(213, 30, 43, 0.035);
  transition: box-shadow 300ms ease, border-color 300ms ease, transform 300ms ease;
}

.access-sigil span {
  width: 12px;
  height: 12px;
  border: 2px solid #e03846;
  transform: rotate(45deg);
}

.access-kicker {
  margin: 0 0 10px;
  color: #df3947;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.access-panel h1 {
  margin: 0;
  color: #f7f5f3;
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.access-intro {
  max-width: 34ch;
  margin: 16px 0 27px;
  color: var(--gate-muted);
  font-size: 15px;
  line-height: 1.55;
}

.invitation-form {
  display: grid;
}

.invitation-form label {
  margin-bottom: 9px;
  color: #d2cfd0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.invitation-control {
  position: relative;
}

.invitation-control input {
  width: 100%;
  min-height: 54px;
  padding: 14px 17px;
  border: 1px solid rgba(255, 255, 255, 0.21);
  border-radius: 0;
  outline: none;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  caret-color: var(--gate-red-bright);
  font-family: var(--gate-mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.invitation-control input:hover {
  border-color: rgba(255, 255, 255, 0.34);
}

.invitation-control input:focus-visible {
  border-color: rgba(239, 51, 67, 0.88);
  background: rgba(5, 2, 3, 0.82);
  box-shadow: 0 0 0 3px rgba(213, 30, 43, 0.16), 0 0 32px rgba(213, 30, 43, 0.11);
}

.invitation-control input:disabled {
  cursor: wait;
  opacity: 0.72;
}

.input-corners::before,
.input-corners::after {
  position: absolute;
  width: 8px;
  height: 8px;
  content: "";
  pointer-events: none;
}

.input-corners::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--gate-red-bright);
  border-left: 1px solid var(--gate-red-bright);
}

.input-corners::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--gate-red-bright);
  border-bottom: 1px solid var(--gate-red-bright);
}

.invitation-hint {
  margin: 8px 0 17px;
  color: #777475;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.invitation-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 13px 20px;
  border: 1px solid rgba(255, 117, 127, 0.62);
  border-radius: 0;
  background: linear-gradient(180deg, #c31929, #8f101c);
  color: #fff;
  box-shadow: 0 13px 34px rgba(127, 10, 20, 0.3), 0 1px 0 rgba(255, 255, 255, 0.14) inset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.invitation-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 162, 169, 0.85);
  background: linear-gradient(180deg, #dc2635, #9e121f);
  box-shadow: 0 17px 40px rgba(127, 10, 20, 0.4), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.invitation-submit:active:not(:disabled) {
  transform: translateY(0);
}

.invitation-submit:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.invitation-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.invitation-submit.is-loading .button-mark {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  font-size: 0;
  animation: gate-spin 700ms linear infinite;
}

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

.invitation-status {
  min-height: 19px;
  margin: 12px 0 0;
  color: #b8b4b5;
  font-size: 11px;
  line-height: 1.55;
}

.invitation-status.is-error {
  color: #f0707a;
}

.invitation-status.is-success {
  color: #f1edef;
}

.access-panel.has-error {
  border-color: rgba(239, 51, 67, 0.44);
  animation: gate-subtle-shake 280ms ease-out;
}

@keyframes gate-subtle-shake {
  0%, 100% { transform: translateX(0); }
  32% { transform: translateX(-4px); }
  67% { transform: translateX(3px); }
}

.noscript-message {
  margin: 4px 0 0;
  color: #f0707a;
  font-family: var(--gate-mono);
  font-size: 11px;
  line-height: 1.55;
}

.gate-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  color: #777475;
  font-size: 10px;
  letter-spacing: 0.05em;
  opacity: 0;
  animation: gate-arrive 700ms 280ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gate-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 20px;
}

.gate-footer a {
  color: #aaa6a7;
  text-decoration: none;
  transition: color 160ms ease;
}

.gate-footer a:hover {
  color: #fff;
}

.gate-footer a:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--gate-red-bright);
  outline-offset: 4px;
}

body.is-opening .access-panel {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  pointer-events: none;
}

body.is-opening .gate-brand,
body.is-opening .gate-footer {
  opacity: 0;
  transition: opacity 260ms ease;
}

body.is-opening .gate-leaf--left {
  transform: translateX(-51%) rotateY(8deg);
  filter: brightness(0.68);
}

body.is-opening .gate-leaf--right {
  transform: translateX(51%) rotateY(-8deg);
  filter: brightness(0.68);
}

body.is-opening .gate-vignette {
  opacity: 0.3;
}

body.is-opening .gate-seam {
  left: 43%;
  width: 14%;
  opacity: 0;
  background: rgba(231, 50, 64, 0.2);
  box-shadow: 0 0 90px 30px rgba(213, 30, 43, 0.24);
  animation: none;
}

body.is-opening .access-sigil {
  border-color: rgba(255, 100, 111, 0.9);
  box-shadow: 0 0 36px rgba(213, 30, 43, 0.45);
  transform: scale(1.08);
}

@media (max-width: 700px) {
  .gate-stage {
    perspective: 900px;
  }

  .gate-leaf img {
    object-position: 50% 50%;
  }

  .gate-vignette {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 28%, rgba(0, 0, 0, 0.12) 45%, rgba(0, 0, 0, 0.86) 100%),
      radial-gradient(ellipse at 50% 38%, transparent 8%, rgba(0, 0, 0, 0.25) 70%, rgba(0, 0, 0, 0.58));
  }

  .gate-shell {
    grid-template-rows: auto 1fr auto;
    padding:
      max(14px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .gate-brand {
    gap: 10px;
  }

  .gate-brand img {
    width: 44px;
    height: 44px;
    border-radius: 9px;
  }

  .gate-brand strong {
    font-size: 13px;
  }

  .gate-brand span {
    font-size: 8px;
  }

  .gate-main {
    align-items: end;
    padding: 26px 0 18px;
  }

  .access-panel {
    width: 100%;
    padding: 23px 20px 20px;
    border-color: rgba(255, 255, 255, 0.19);
    background: linear-gradient(160deg, rgba(20, 16, 17, 0.92), rgba(4, 4, 5, 0.94));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .access-sigil {
    width: 34px;
    height: 34px;
    margin-bottom: 15px;
  }

  .access-sigil span {
    width: 10px;
    height: 10px;
  }

  .access-kicker {
    margin-bottom: 7px;
    font-size: 9px;
  }

  .access-panel h1 {
    font-size: clamp(29px, 9vw, 38px);
    line-height: 1;
  }

  .access-intro {
    margin: 11px 0 19px;
    font-size: 14px;
    line-height: 1.45;
  }

  .invitation-control input {
    min-height: 52px;
    font-size: 16px;
  }

  .invitation-submit {
    min-height: 50px;
  }

  .gate-footer {
    align-items: flex-start;
    gap: 10px;
    font-size: 8px;
  }

  .gate-footer > span {
    display: none;
  }

  .gate-footer nav {
    justify-content: center;
    width: 100%;
    gap: 8px 14px;
  }

  body.is-opening .gate-leaf--left {
    transform: translateX(-52%);
  }

  body.is-opening .gate-leaf--right {
    transform: translateX(52%);
  }
}

@media (max-width: 380px) {
  .gate-shell {
    padding-inline: max(12px, env(safe-area-inset-left));
  }

  .gate-brand span {
    display: none;
  }

  .gate-main {
    padding-top: 18px;
  }

  .access-panel {
    padding: 20px 17px 17px;
  }

  .access-intro {
    font-size: 13px;
  }
}

@media (max-height: 690px) and (max-width: 700px) {
  .gate-brand img {
    width: 38px;
    height: 38px;
  }

  .gate-main {
    padding: 12px 0 10px;
  }

  .access-panel {
    padding-block: 17px 14px;
  }

  .access-sigil {
    display: none;
  }

  .access-intro {
    margin-block: 8px 13px;
  }

  .invitation-hint {
    margin-bottom: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .gate-brand,
  .access-panel,
  .gate-footer {
    opacity: 1;
    transform: none;
  }

  body.is-opening .gate-leaf {
    opacity: 0;
    transform: none;
  }
}
