/* THE GATE (door.css)
   Two-column interactive intro gate & asset-loading barrier.
   Left: Omar's avatar on a machined metallic disc (waving -> talking on scroll).
   Right: Full name (Omar, Mohamed-, Saied, Hamed) coalescing & reordering into "ohms".
   Gradual crossfade from caps to lowercase on scroll.
   NO auto-exit on scroll.
*/

html.doored {
  overflow: hidden !important;
  height: 100vh !important;
}

.door {
  display: none;
}

@keyframes gateFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

html.doored .door,
.door.out {
  display: block !important;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg, #050805);
  color: var(--text, #f3f4f1);
  clip-path: inset(0 0 0 0);
  will-change: clip-path, opacity;
  font-family: "Space Grotesk", Archivo, system-ui, sans-serif;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  animation: gateFadeIn 0.35s ease both;
}

.door::-webkit-scrollbar {
  display: none;
}

.door.out {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s cubic-bezier(.77, 0, .175, 1);
  pointer-events: none;
}

/* Scroll track: creates physical scroll length for scrub */
.door__track {
  height: 250vh;
  position: relative;
}

/* Sticky stage */
.door__stage {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1.5rem, 3.5vh, 4rem) var(--gut, 5.5vw);
  box-sizing: border-box;
  overflow: hidden;
}

/* Main 2-column layout */
.door__main {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0 clamp(2.5rem, 5vw, 6rem);
  align-items: center;
  width: 100%;
  max-width: 1560px;
  margin: auto 0;
  box-sizing: border-box;
}

/* Left Column: Avatar & Habbo Circular Stage */
.door__left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.door__avatar-stage {
  position: relative;
  width: 220px;
  height: 350px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* Habbo Circular Stage Plinth (authentic Habbo isometric pixel art, 50% scale) */
.door__pedestal {
  position: absolute;
  bottom: 0px;
  left: calc(50% + 10px);
  transform: translateX(-50%);
  width: 146px;
  height: 101px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  z-index: 1;
}

.avatar-contact-shadow {
  position: absolute;
  bottom: 53px;
  left: calc(50% + 10px);
  transform: translateX(-50%);
  width: 68px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.25) 50%, transparent 75%);
  filter: blur(2px);
  z-index: 2;
  pointer-events: none;
}

/* Avatar: 176px x 302px, feet midpoint centered precisely on top plate of circular stage */
.door__avatar {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: 176px;
  height: 302px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: none;
  z-index: 3;
}

.door__avatar.is-active {
  display: block;
}

/* Mobile Avatar Badge (circular PFP) */
.door__avatar-badge {
  display: none;
}

/* Right Column: CSS Grid Stack holding Intro State and Settled State centered together */
.door__right {
  position: relative;
  display: grid;
  grid-template-areas: "stack";
  align-items: center;
  min-width: 0;
  width: 100%;
}

/* Layer 1: Intro State (Full Name) */
.door__intro-wrap {
  grid-area: stack;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  z-index: 2;
  pointer-events: none;
}

.door__kicker {
  font-family: var(--mono);
  font-size: clamp(1.15rem, 1.25vw, 1.45rem);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-light, #7a9e6a);
  margin: 0 0 clamp(0.6rem, 1.2vh, 1.2rem);
  opacity: .95;
  will-change: opacity;
}

.door__fullname {
  font-family: "Space Grotesk", Archivo, system-ui, sans-serif;
  font-size: clamp(4.2rem, min(13vw, 16.5vh), 14.5rem);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: -0.045em;
  color: #ffffff;
}

.door__row {
  position: relative;
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}

/* The 4 Initials: GREEN from the start to pop the O-M-S-H acronym inside full name */
.char-init {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
  will-change: transform;
}

.glyph-upper {
  display: inline-block;
  color: var(--green-light, #7a9e6a);
  will-change: transform, opacity, filter;
  transform-origin: left bottom;
}

.glyph-lower {
  position: absolute;
  left: 0;
  bottom: 0;
  display: inline-block;
  opacity: 0;
  color: var(--green-light, #7a9e6a);
  will-change: transform, opacity, filter;
  transform-origin: left bottom;
}

.char-rest {
  display: inline-block;
  color: #ffffff;
  opacity: 1;
  will-change: opacity, transform;
}

.door__callme {
  font-family: var(--mono);
  font-size: clamp(1.15rem, 1.25vw, 1.45rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-light, #7a9e6a);
  margin: clamp(1rem, 1.5vh, 1.8rem) 0 0;
  opacity: .95;
  will-change: transform, opacity;
}

/* Layer 2: Settled State (ohms, pitch, Enter) */
.door__settled-wrap {
  grid-area: stack;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  z-index: 1;
  pointer-events: none;
}

.door__settled-wrap #callMeTarget {
  margin: 0 0 clamp(0.8rem, 1.2vh, 1.4rem);
  visibility: hidden;
  pointer-events: none;
}

/* Target row directly UNDER "but you can call me..." where "o h m s" coalesces */
.door__target {
  position: relative;
  font-family: "Space Grotesk", Archivo, system-ui, sans-serif;
  font-size: clamp(4.2rem, min(13vw, 16.5vh), 14.5rem);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: -0.045em;
  display: flex;
  align-items: baseline;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  height: 0.86em;
}

.target-slot {
  display: inline-block;
  visibility: hidden;
}

/* Settled body: pitch and Enter button */
.door__settled-body {
  margin-top: clamp(1.4rem, 2.2vh, 2.4rem);
  max-width: 46ch;
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
  pointer-events: none;
}

.door__pitch {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(1.8rem, 2.2vw, 2.6rem);
  line-height: 1.32;
  color: var(--text, rgba(255,255,255,.92));
  max-width: 38ch;
  margin: 0 0 2rem;
  font-weight: 400;
}

/* Enter button with 100% full-width underline */
.door__enter {
  position: relative;
  display: inline-block;
  padding: 0 0 .5rem;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-family: var(--mono);
  font-size: clamp(1.3rem, 1.4vw, 1.65rem);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.door__enter .sw {
  position: relative;
  display: block;
  height: 1.4em;
  overflow: hidden;
}

.door__enter .sw span {
  display: block;
  height: 1.4em;
  line-height: 1.4em;
  transition: transform .5s cubic-bezier(.215, .61, .355, 1);
}

.door__enter:hover .sw span,
.door__enter:focus-visible .sw span {
  transform: translateY(-100%);
}

.door__enter::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--green-light, #7a9e6a);
  transition: background-color .3s ease, height .3s ease;
}

.door__enter:hover::before,
.door__enter:focus-visible::before {
  height: 2px;
  background: #ffffff;
}

.door__enter:focus-visible {
  outline: none;
}

/* Scroll hint: pinned at bottom left */
.door__hint {
  position: absolute;
  bottom: clamp(1.5rem, 3.5vh, 2.5rem);
  left: var(--gut, 5.5vw);
  font-family: var(--mono);
  font-size: 1.15rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(255,255,255,.4));
  pointer-events: none;
  will-change: opacity;
  transition: opacity .2s ease;
}

/* Page behind the door: completely suspended */
html.doored:not(.door-opening) main,
html.doored:not(.door-opening) .e-foot {
  display: none !important;
}

html.doored .rv > * {
  transform: translate3d(0, 102%, 0) !important;
  transition: none !important;
}

html.doored .fu {
  opacity: 0 !important;
  transform: translateY(3.3rem) !important;
  transition: none !important;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .door__stage {
    padding: 1.5rem var(--gut, 5vw);
    justify-content: center;
  }

  .door__main {
    grid-template-columns: 1fr;
    gap: 1.5rem 0;
    text-align: center;
    max-width: 100%;
  }

  .door__left {
    margin-bottom: 0.5rem;
  }

  .door__avatar-stage {
    display: none;
  }

  .door__avatar-badge {
    display: flex;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #111a12;
    border: 2px solid var(--green-light, #7a9e6a);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.4);
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }

  .door__badge-img {
    width: 72px;
    height: 124px;
    image-rendering: pixelated;
    margin-top: 20px;
    display: none;
  }

  .door__badge-img.is-active {
    display: block;
  }

  .door__fullname,
  .door__target {
    font-size: clamp(2.8rem, 11vw, 4.8rem);
    width: max-content;
    margin: 0 auto;
  }

  .door__row {
    justify-content: flex-start;
  }

  .door__target {
    justify-content: center;
  }

  .door__kicker,
  .door__callme {
    text-align: center;
  }

  .door__pitch {
    font-size: 1.35rem;
    margin: 1rem auto 1.5rem;
    max-width: 32ch;
  }

  .door__hint {
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.2rem;
  }
}
