:root {
  --gateway-black: #020504;
  --gateway-ink: #07100d;
  --gateway-white: #f3f1e8;
  --gateway-mint: #78efb1;
  --gateway-gold: #e8c66b;
  --gateway-long: #67b8d7;
  --gateway-short: #d87870;
  --gateway-line: rgba(120, 239, 177, 0.35);
}

html[data-trinity-entry="gateway"],
html[data-trinity-entry="gateway"] body {
  min-height: 100%;
  background: var(--gateway-black);
}

html[data-trinity-entry="gateway"] body {
  margin: 0;
  overflow-x: hidden;
}

html[data-trinity-entry="gateway"] body > .skip-link,
html[data-trinity-entry="gateway"] body > main,
html[data-trinity-entry="gateway"] .trinity-gateway-return {
  display: none !important;
}

.trinity-gateway {
  display: none;
}

html[data-trinity-entry="gateway"] .trinity-gateway {
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  overflow: hidden;
  color: var(--gateway-white);
  background:
    radial-gradient(circle at 50% 52%, rgba(29, 125, 86, 0.17), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(232, 198, 107, 0.07), transparent 23%),
    linear-gradient(145deg, #06100d 0%, #020504 42%, #000 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.trinity-gateway-atmosphere,
.trinity-gateway-atmosphere::before,
.trinity-gateway-atmosphere::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.trinity-gateway-atmosphere {
  z-index: -1;
  opacity: 0.72;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.44) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(120, 239, 177, 0.36) 0 1px, transparent 1.4px);
  background-position: 0 0, 47px 31px;
  background-size: 113px 113px, 157px 157px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.trinity-gateway-atmosphere::before {
  content: "";
  background: linear-gradient(90deg, transparent, rgba(120, 239, 177, 0.09), transparent);
  transform: translateX(-70%) skewX(-22deg);
  animation: trinity-gateway-scan 12s ease-in-out infinite;
}

.trinity-gateway-header,
.trinity-gateway-footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1440px, calc(100% - 64px));
  margin-inline: auto;
}

.trinity-gateway-header {
  padding-block: max(24px, env(safe-area-inset-top)) 16px;
  border-bottom: 1px solid rgba(120, 239, 177, 0.15);
}

.trinity-gateway-wordmark {
  color: var(--gateway-mint);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.24em;
  text-decoration: none;
}

.trinity-gateway-wordmark span {
  margin-left: 0.55rem;
  color: rgba(243, 241, 232, 0.56);
  font-weight: 600;
}

.trinity-gateway-header p,
.trinity-gateway-footer p {
  margin: 0;
  color: rgba(243, 241, 232, 0.5);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.trinity-gateway-stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(560px, 1.2fr);
  align-items: center;
  gap: clamp(28px, 6vw, 100px);
  width: min(1280px, calc(100% - 64px));
  margin: auto;
  padding-block: 30px;
}

.trinity-gateway-copy {
  max-width: 480px;
}

.trinity-gateway-kicker {
  margin: 0 0 24px;
  color: var(--gateway-mint);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.3em;
}

.trinity-gateway-copy h1 {
  margin: 0;
  color: var(--gateway-white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.7rem, 7vw, 7.5rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.78;
}

.trinity-gateway-copy h1 em {
  color: var(--gateway-gold);
  font-weight: 400;
}

.trinity-gateway-copy > p:last-child {
  max-width: 420px;
  margin: 36px 0 0;
  color: rgba(243, 241, 232, 0.64);
  font-size: clamp(0.94rem, 1.5vw, 1.1rem);
  line-height: 1.7;
}

.trinity-triangle {
  --triangle-glow: rgba(120, 239, 177, 0.5);
  position: relative;
  width: min(100%, 680px, calc(100svh - 150px));
  aspect-ratio: 1.08 / 1;
  justify-self: end;
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, 0.72));
}

.trinity-triangle-frame {
  position: absolute;
  inset: 0;
  clip-path: polygon(1% 4%, 99% 4%, 50% 99%);
  background: linear-gradient(115deg, var(--gateway-long) 0%, rgba(243, 241, 232, 0.9) 47%, var(--gateway-short) 72%, var(--gateway-gold) 100%);
  box-shadow: inset 0 0 32px white;
}

.trinity-triangle-frame::after {
  content: "";
  position: absolute;
  inset: 9px;
  clip-path: polygon(1% 4%, 99% 4%, 50% 99%);
  background:
    radial-gradient(circle at 50% 43%, rgba(120, 239, 177, 0.17), transparent 33%),
    linear-gradient(25deg, #07110e 0%, #020504 80%);
}

.trinity-double-t-mark {
  position: absolute;
  z-index: 1;
  inset: 7% 8% 8%;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

.trinity-double-t-mark span {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  filter: saturate(0.75) drop-shadow(0 0 18px currentColor);
  transition: opacity 240ms ease, filter 240ms ease;
}

.trinity-double-t-long {
  color: var(--gateway-long);
  background: linear-gradient(145deg, rgba(103, 184, 215, 0.94), rgba(103, 184, 215, 0.42));
  clip-path: polygon(2% 2%, 76% 2%, 72% 16%, 27% 16%, 55% 96%, 42% 98%, 13% 16%, 2% 16%);
}

.trinity-double-t-short {
  color: var(--gateway-short);
  background: linear-gradient(215deg, rgba(216, 120, 112, 0.94), rgba(216, 120, 112, 0.4));
  clip-path: polygon(72% 2%, 86% 4%, 80% 17%, 98% 17%, 98% 31%, 74% 31%, 55% 96%, 42% 98%, 63% 31%, 22% 31%, 22% 17%, 69% 17%);
}

.trinity-axis {
  position: absolute;
  z-index: 3;
  color: rgba(243, 241, 232, 0.38);
  font-size: clamp(0.48rem, 0.72vw, 0.62rem);
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  pointer-events: none;
}

.trinity-axis-long {
  top: 2%;
  left: 4%;
  color: rgba(103, 184, 215, 0.7);
}

.trinity-axis-short {
  top: 2%;
  right: 4%;
  color: rgba(216, 120, 112, 0.7);
}

.trinity-axis-neutral {
  right: 0;
  bottom: 7%;
  left: 0;
  color: rgba(232, 198, 107, 0.76);
  text-align: center;
}

.trinity-triangle-route {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--gateway-white);
  background: rgba(2, 7, 5, 0.38);
  text-decoration: none;
  backdrop-filter: blur(5px);
  transition: color 220ms ease, filter 220ms ease, background-color 220ms ease, border-color 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

.trinity-triangle-route::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(120, 239, 177, 0.24), rgba(120, 239, 177, 0.04) 55%, transparent 78%);
  transition: opacity 220ms ease;
}

.trinity-triangle-captain {
  top: 6%;
  left: 0;
  justify-content: flex-end;
  width: 39%;
  text-align: right;
}

.trinity-triangle-legacy {
  top: 6%;
  right: 0;
  width: 39%;
}

.trinity-triangle-library {
  bottom: 12%;
  left: 28%;
  justify-content: center;
  width: 44%;
  text-align: center;
}

.trinity-route-number,
.trinity-route-copy {
  position: relative;
  z-index: 1;
}

.trinity-route-number {
  position: relative;
  color: var(--gateway-gold);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.trinity-route-copy {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trinity-route-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 1.8vw, 1.42rem);
  font-weight: 400;
  line-height: 1;
}

.trinity-route-copy small {
  color: rgba(243, 241, 232, 0.48);
  font-size: clamp(0.56rem, 0.85vw, 0.7rem);
  letter-spacing: 0.05em;
}

.trinity-triangle-route:hover,
.trinity-triangle-route:focus-visible {
  z-index: 3;
  border-color: rgba(120, 239, 177, 0.32);
  color: var(--gateway-mint);
  filter: drop-shadow(0 0 22px var(--triangle-glow));
  outline: none;
}

.trinity-triangle-route:hover::before,
.trinity-triangle-route:focus-visible::before,
.trinity-triangle[data-selected-route="captain"] .trinity-triangle-captain::before,
.trinity-triangle[data-selected-route="legacy"] .trinity-triangle-legacy::before,
.trinity-triangle[data-selected-route="library"] .trinity-triangle-library::before {
  opacity: 1;
}

.trinity-triangle:has(.trinity-triangle-captain:hover) .trinity-double-t-long,
.trinity-triangle:has(.trinity-triangle-captain:focus-visible) .trinity-double-t-long,
.trinity-triangle[data-selected-route="captain"] .trinity-double-t-long {
  opacity: 0.4;
  filter: saturate(1) drop-shadow(0 0 24px currentColor);
}

.trinity-triangle:has(.trinity-triangle-legacy:hover) .trinity-double-t-short,
.trinity-triangle:has(.trinity-triangle-legacy:focus-visible) .trinity-double-t-short,
.trinity-triangle[data-selected-route="legacy"] .trinity-double-t-short {
  opacity: 0.4;
  filter: saturate(1) drop-shadow(0 0 24px currentColor);
}

.trinity-triangle:has(.trinity-triangle-library:hover) .trinity-double-t-mark span,
.trinity-triangle:has(.trinity-triangle-library:focus-visible) .trinity-double-t-mark span,
.trinity-triangle[data-selected-route="library"] .trinity-double-t-mark span {
  opacity: 0.3;
  filter: saturate(0.85) drop-shadow(0 0 22px var(--gateway-gold));
}

.trinity-triangle-route:focus-visible .trinity-route-copy {
  outline: 2px solid var(--gateway-mint);
  outline-offset: 8px;
  border-radius: 2px;
}

.trinity-triangle-core {
  position: absolute;
  z-index: 5;
  top: 43%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 9px;
  width: clamp(112px, 20%, 148px);
  aspect-ratio: 1;
  place-content: center;
  border: 1px solid rgba(120, 239, 177, 0.42);
  border-radius: 50%;
  background: rgba(2, 7, 5, 0.9);
  box-shadow: 0 0 0 9px rgba(120, 239, 177, 0.04), 0 0 45px rgba(120, 239, 177, 0.16);
  transform: translate(-50%, -50%);
}

.trinity-triangle-core span {
  color: var(--gateway-white);
  font-size: clamp(0.62rem, 1vw, 0.78rem);
  font-weight: 850;
  letter-spacing: 0.22em;
}

.trinity-triangle-core i {
  width: 26px;
  height: 1px;
  background: var(--gateway-gold);
}

.trinity-triangle-core small {
  color: rgba(243, 241, 232, 0.43);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.trinity-gateway-footer {
  padding-block: 16px max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(120, 239, 177, 0.12);
}

.trinity-gateway-footer p:first-child span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gateway-mint);
  box-shadow: 0 0 14px var(--gateway-mint);
}

.trinity-gateway-return {
  display: none;
}

html[data-trinity-entry="legacy"] .trinity-gateway {
  display: none;
}

html[data-trinity-entry="legacy"] .trinity-gateway-return {
  position: fixed;
  z-index: 90;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(120, 239, 177, 0.36);
  border-radius: 999px;
  color: #dff8e9;
  background: rgba(3, 13, 10, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

html[data-trinity-entry="legacy"] .trinity-gateway-return:hover,
html[data-trinity-entry="legacy"] .trinity-gateway-return:focus-visible {
  border-color: var(--gateway-mint);
  outline: none;
}

@keyframes trinity-gateway-scan {
  0%, 15% { transform: translateX(-85%) skewX(-22deg); opacity: 0; }
  45% { opacity: 1; }
  85%, 100% { transform: translateX(85%) skewX(-22deg); opacity: 0; }
}

@media (max-width: 960px) {
  .trinity-gateway-stage {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    width: min(760px, calc(100% - 32px));
    padding-block: 20px;
  }

  .trinity-gateway-copy {
    max-width: 640px;
    text-align: center;
  }

  .trinity-gateway-kicker {
    margin-bottom: 15px;
  }

  .trinity-gateway-copy h1 {
    font-size: clamp(3.4rem, 12vw, 6.5rem);
    line-height: 0.82;
  }

  .trinity-gateway-copy > p:last-child {
    display: none;
  }

  .trinity-triangle {
    width: min(74vw, 580px);
    justify-self: center;
  }
}

@media (max-width: 620px) {
  .trinity-gateway-header,
  .trinity-gateway-footer {
    width: calc(100% - 32px);
  }

  .trinity-gateway-header {
    padding-bottom: 12px;
  }

  .trinity-gateway-header p,
  .trinity-gateway-footer p:last-child {
    display: none;
  }

  .trinity-gateway-stage {
    align-content: center;
    gap: 20px;
    min-height: 0;
    padding-block: 14px;
  }

  .trinity-gateway-copy h1 {
    font-size: clamp(3rem, 16vw, 4.75rem);
  }

  .trinity-triangle {
    width: min(92vw, 520px);
  }

  .trinity-triangle-frame::after {
    inset: 6px;
  }

  .trinity-triangle-captain,
  .trinity-triangle-legacy {
    top: 5%;
    width: 41%;
  }

  .trinity-triangle-library {
    bottom: 13%;
  }

  .trinity-route-number {
    display: none;
  }

  .trinity-route-copy strong {
    font-size: clamp(0.88rem, 4vw, 1.18rem);
  }

  .trinity-route-copy small {
    max-width: 112px;
    font-size: 0.53rem;
    line-height: 1.25;
  }

  .trinity-triangle-core {
    width: clamp(96px, 25%, 120px);
  }

  .trinity-gateway-footer {
    justify-content: center;
  }

  .trinity-gateway-footer p:first-child {
    font-size: 0.58rem;
    letter-spacing: 0.09em;
  }
}

@media (max-height: 720px) and (max-width: 960px) {
  .trinity-gateway-copy h1 {
    font-size: clamp(2.6rem, 10vh, 4rem);
  }

  .trinity-gateway-kicker {
    margin-bottom: 8px;
  }

  .trinity-triangle {
    width: min(72vh, 88vw, 500px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .trinity-gateway-atmosphere::before {
    animation: none;
  }

  .trinity-triangle-route,
  .trinity-triangle-route::before {
    transition: none;
  }
}
