/* ===========================================================
   DREAM-THEATER — Gateway
   A split entry: Human MCN (left) vs AI MCN (right)
   =========================================================== */

:root {
  --bg: #0a0812;
  --fg: #f5f2ea;
  --muted: rgba(245, 242, 234, 0.6);
  --line: rgba(245, 242, 234, 0.14);

  /* Side palettes */
  --human-a: #1a120a;
  --human-b: #2a1a0e;
  --human-accent: #e7c287;

  --ai-a: #070716;
  --ai-b: #0d0b25;
  --ai-accent: #d6ff3a;

  /* Motion */
  --ease: cubic-bezier(0.6, 0.05, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  mix-blend-mode: difference;
}
.cursor__ring,
.cursor__dot,
.cursor__label {
  position: absolute;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
}
.cursor__ring {
  width: 36px; height: 36px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  transition: transform 0.28s var(--ease), background 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.cursor__dot {
  width: 5px; height: 5px;
  background: #fff;
  border-radius: 50%;
  transition: opacity 0.2s var(--ease);
}
.cursor__label {
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 600;
  text-transform: uppercase;
  color: #0a0812;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), color 0.25s var(--ease);
  white-space: nowrap;
}
.cursor.is-enter .cursor__ring { transform: translate(-50%, -50%) scale(2.4); background: #fff; border-color: #fff; }
.cursor.is-enter .cursor__dot { opacity: 0; }
.cursor.is-enter .cursor__label { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* Over text: keep the ring shape as-is, just fade the ENTER label out */
.cursor.is-over-text .cursor__label { opacity: 0; }

@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}

/* ---------- Intro (Logo gauge loader) ---------- */
.intro {
  position: fixed;
  inset: 0;
  background: #050410;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 46px;
  z-index: 200;
}
.intro__logo-wrap {
  position: relative;
  width: clamp(180px, 22vw, 320px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.intro__logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.intro__logo--base {
  filter: grayscale(1) brightness(0.28) contrast(1.05);
  opacity: 0.5;
}
.intro__logo--fill {
  clip-path: inset(100% 0 0 0);
  -webkit-clip-path: inset(100% 0 0 0);
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
  will-change: clip-path;
}
.intro__progress {
  display: flex;
  align-items: center;
  gap: 16px;
  width: clamp(240px, 28vw, 380px);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.intro__progress-label {
  flex: 0 0 auto;
  font-weight: 600;
}
.intro__progress-bar {
  flex: 1 1 auto;
  position: relative;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border-radius: 2px;
}
.intro__progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--human-accent), var(--ai-accent));
  transition: width 0.05s linear;
}
.intro__progress-value {
  flex: 0 0 auto;
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Gateway Top (header) ---------- */
.gateway-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px;
  z-index: 40;
  mix-blend-mode: difference;
  color: #fff;
}
.gateway-top__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.22em;
  opacity: 0;
  text-transform: uppercase;
  color: inherit;
  text-decoration: none;
}
.gateway-top__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.gateway-top__brand:hover .gateway-top__logo {
  transform: rotate(-8deg) scale(1.08);
}
.gateway-top__meta {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Gateway (split) ---------- */
.gateway {
  --split-x: 50%;                       /* moves with the parallax band */
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: var(--split-x) 1fr;
  overflow: hidden;
}

.half {
  position: relative;
  display: block;
  overflow: hidden;
  cursor: none;
  transition: flex 0.8s var(--ease), opacity 0.6s var(--ease);
}

.half__bg {
  position: absolute;
  /* over-scaled beyond the half so parallax translate never exposes edges */
  inset: -6%;
  z-index: 0;
  transition: opacity 0.6s var(--ease);
  will-change: transform;
}
.half--human .half__bg {
  background:
    radial-gradient(1200px 800px at 20% 70%, rgba(231, 194, 135, 0.18), transparent 60%),
    linear-gradient(180deg, var(--human-a) 0%, var(--human-b) 100%);
}
.half--ai .half__bg {
  background:
    radial-gradient(1000px 700px at 80% 30%, rgba(214, 255, 58, 0.14), transparent 60%),
    linear-gradient(180deg, var(--ai-a) 0%, var(--ai-b) 100%);
}

.half__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.45) 100%);
}
.half__noise {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
  background-size: 160px 160px;
  mix-blend-mode: overlay;
}

/* AI side: grid overlay */
.half__grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(to right, rgba(214, 255, 58, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(214, 255, 58, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Half inner content */
.half__inner {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  height: 100%;
  padding: 120px 64px 72px;
  gap: 18px;
}
.half--ai .half__inner { align-items: flex-end; text-align: right; }

.half__top {
  margin-top: 18px;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: clamp(24px, 2.4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  opacity: 0;
  will-change: transform;
  transition: color 0.35s var(--ease);
}
.half--human .half__top { transform-origin: left center; }
.half--ai    .half__top { transform-origin: right center; }

.half__title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(56px, 9vw, 140px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: #fff;
}
.half__title .row {
  display: block;
  overflow: hidden;
}
.half__title .row > * {
  display: inline-block;
  transform: translateY(110%);
  will-change: transform;
}

.half--human .half__title { color: var(--fg); }
.half--ai .half__title { color: var(--fg); }

.half__desc {
  max-width: 38ch;
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
}

.half__bottom {
  margin-top: 22px;
  display: inline-flex;
  opacity: 0;
}

/* Pill-style enter button */
.half__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  padding: 12px 26px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  transition:
    color 0.35s var(--ease),
    border-color 0.35s var(--ease),
    background 0.35s var(--ease),
    transform 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.half--human:hover .half__btn {
  color: #1a120a;
  border-color: var(--human-accent);
  background: var(--human-accent);
  box-shadow: 0 8px 30px rgba(231, 194, 135, 0.25);
  transform: translateY(-2px);
}
.half--ai:hover .half__btn {
  color: #0a0a12;
  border-color: var(--ai-accent);
  background: var(--ai-accent);
  box-shadow: 0 8px 30px rgba(214, 255, 58, 0.28);
  transform: translateY(-2px);
}

/* Divider — hairline + soft, wide "center band" that parallaxes with mouse */
.gateway__divider {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--split-x);          /* follows the same split as the grid */
  width: min(720px, 44vw);       /* wide atmospheric band */
  margin: 0;
  translate: -50% 0;             /* keep centered on the split line */
  z-index: 10;
  pointer-events: none;
  will-change: transform;
  background:
    /* hairline */
    linear-gradient(90deg,
      transparent 0%,
      transparent calc(50% - 0.5px),
      rgba(255, 255, 255, 0.28) calc(50% - 0.5px),
      rgba(255, 255, 255, 0.28) calc(50% + 0.5px),
      transparent calc(50% + 0.5px),
      transparent 100%),
    /* soft glow band */
    radial-gradient(closest-side at 50% 50%,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.05) 35%,
      rgba(255, 255, 255, 0.015) 60%,
      transparent 78%);
  mix-blend-mode: screen;
  transition: opacity 0.4s var(--ease);
}

/* Emphasize the band lightly on hover, so the parallax feels alive */
.gateway.is-hover-human .gateway__divider,
.gateway.is-hover-ai .gateway__divider { opacity: 1; }

/* Hover state: dim the opposite side */
.gateway.is-hover-human .half--ai .half__bg { opacity: 0.55; }
.gateway.is-hover-ai .half--human .half__bg { opacity: 0.55; }

/* Exit transitions (bg scale is driven by JS parallax loop) */
.gateway.is-exit .half:not(.is-exit-target) { opacity: 0.2; }

/* During transition we hide the custom cursor & halt interactions */
.is-transitioning .cursor { opacity: 0 !important; }
.is-transitioning .half { cursor: default; }

/* ---------- Page-transition overlay (soft fade to black) ---------- */
.page-wipe {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  opacity: 0;
  will-change: opacity;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(20, 20, 40, 0.92) 0%, #040310 70%),
    #040310;
}

/* ---------- Gateway Bottom (footer) ---------- */
.gateway-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  z-index: 40;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  mix-blend-mode: difference;
  opacity: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  /*
   * One screen, no scroll: lock to the *small* viewport (svh) where supported so
   * Human + AI halves + CTAs always fit without panning past the fold.
   */
  html {
    height: 100%;
    overflow: hidden;
  }

  body {
    margin: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    height: 100svh;
    max-height: 100svh;
  }

  .gateway {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .half {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }

  .half__inner {
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
    height: 100%;
    gap: clamp(3px, 0.9vh, 10px);
    padding-left: calc(18px + env(safe-area-inset-left, 0px));
    padding-right: calc(18px + env(safe-area-inset-right, 0px));
    overflow: hidden;
  }

  /* Top half: clear fixed header only */
  .half--human .half__inner {
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
  }

  .half--ai .half__inner {
    align-items: flex-start;
    text-align: left;
    padding-top: 6px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .half__top {
    margin-top: 2px;
    font-size: clamp(9px, 2.4vw, 16px);
    letter-spacing: 0.14em;
  }

  .half__title {
    font-size: clamp(24px, min(10vw, 7.5svh), 52px);
    line-height: 0.88;
  }

  .half__desc {
    max-width: 100%;
    margin: 0;
    font-size: clamp(10px, 2.7vw, 13px);
    line-height: 1.28;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .half__bottom {
    margin-top: clamp(4px, 1vh, 10px);
  }

  .half__btn {
    min-width: 88px;
    padding: 7px 16px;
    font-size: 9px;
    letter-spacing: 0.16em;
  }

  .gateway__divider {
    top: 50%;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
    margin: 0;
    translate: 0 -50%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 35%, rgba(255,255,255,0.18) 65%, rgba(255,255,255,0) 100%);
  }

  .gateway-top {
    padding: calc(12px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 12px calc(16px + env(safe-area-inset-left, 0px));
  }

  /* Fixed strip: no document height — avoids pushing AI half below the fold */
  .gateway-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px calc(14px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(14px + env(safe-area-inset-left, 0px));
    font-size: 8px;
    letter-spacing: 0.14em;
    z-index: 45;
    pointer-events: none;
  }
}

/* Extra-tight: very short viewports (landscape phones, small SE) */
@media (max-width: 860px) and (max-height: 520px) {
  .half--human .half__inner {
    padding-top: calc(36px + env(safe-area-inset-top, 0px));
  }

  .half__title {
    font-size: clamp(22px, min(9vw, 12svh), 44px);
  }

  .half__desc {
    -webkit-line-clamp: 1;
    font-size: clamp(9px, 2.4vw, 11px);
  }

  .half__btn {
    padding: 6px 14px;
    font-size: 8px;
  }
}
