/* The Spaces vestibule is a presentation of the existing server-authoritative
   Space list. The artwork is one continuous map: invisible hit regions select
   rooms inside it without creating a second route, store or visual card layer. */
.spaces-vestibule {
  --vestibule-ink: #f6f4ed;
  --vestibule-muted: rgba(226, 232, 242, .7);
  --vestibule-line: rgba(224, 232, 244, .16);
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--vestibule-ink);
  background: #070a10;
}

.spaces-vestibule[open] {
  display: block;
}

.spaces-vestibule::backdrop {
  background: #070a10;
}

.spaces-vestibule-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(28, 46, 73, .16), transparent 46%),
    #070a10;
}

.spaces-vestibule-map {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: min(100%, calc(100dvh * 8 / 5));
  aspect-ratio: 8 / 5;
  overflow: hidden;
  background: #080c13;
  transform: translate(-50%, -50%);
}

.spaces-vestibule-artwork {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.spaces-vestibule-map::before {
  position: absolute;
  inset: 0;
  content: '';
  pointer-events: none;
}

.spaces-vestibule-map::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 49%, transparent 0 19%, rgba(3, 6, 11, .08) 52%, rgba(3, 6, 11, .62) 100%),
    linear-gradient(90deg, rgba(3, 6, 11, .34), transparent 22% 78%, rgba(3, 6, 11, .34)),
    rgba(2, 5, 10, .08);
  opacity: .74;
  transition: opacity .28s ease, background-color .28s ease;
}

.spaces-vestibule-map:has(.team-space-option:is(:hover, :focus-visible))::before {
  opacity: .82;
}

.spaces-vestibule-header {
  position: absolute;
  z-index: 5;
  top: max(22px, env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  left: max(28px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.spaces-vestibule-brand,
.spaces-vestibule-close {
  pointer-events: auto;
}

.spaces-vestibule-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--vestibule-ink);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .8);
}

.spaces-vestibule-brand > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
}

.spaces-vestibule-brand svg {
  display: block;
  width: 27px;
  height: 27px;
  fill: currentColor;
}

.spaces-vestibule-brand .spaces-vestibule-brand-accent {
  fill: #19d95a;
}

.spaces-vestibule-brand strong {
  font-size: 19px;
  letter-spacing: -.045em;
}

.spaces-vestibule-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--vestibule-line);
  border-radius: 14px;
  color: var(--vestibule-muted);
  background: rgba(7, 10, 16, .48);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.spaces-vestibule-close:hover {
  border-color: rgba(239, 244, 251, .34);
  color: var(--vestibule-ink);
  background: rgba(15, 21, 30, .74);
}

.spaces-vestibule-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
}

.spaces-vestibule-intro {
  position: absolute;
  z-index: 4;
  top: clamp(84px, 11vh, 122px);
  left: max(34px, calc((100vw - min(100vw, 160dvh)) / 2 + 34px));
  width: min(370px, 30vw);
  text-align: left;
  pointer-events: none;
  text-shadow: 0 3px 24px rgba(0, 0, 0, .9);
}

.spaces-vestibule-intro .eyebrow {
  margin: 0 0 8px;
  color: rgba(149, 211, 255, .8);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.spaces-vestibule-intro h2 {
  margin: 0;
  color: var(--vestibule-ink);
  font-size: clamp(34px, 3.2vw, 46px);
  font-weight: 530;
  line-height: .98;
  letter-spacing: -.055em;
}

.spaces-vestibule-intro p:last-child {
  max-width: 300px;
  margin: 13px 0 0;
  color: var(--vestibule-muted);
  font-size: clamp(12px, 1.05vw, 14px);
  line-height: 1.45;
}

.spaces-vestibule .spaces-vestibule-list.team-space-menu {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  width: 100%;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
  transform: none;
}

.spaces-vestibule .team-space-option {
  --space-glow: 142, 190, 232;
  --label-top: 65%;
  --space-pointer-x: 50%;
  --space-pointer-y: 50%;
  position: absolute;
  isolation: isolate;
  contain: paint;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--vestibule-ink);
  background: transparent;
  box-shadow: none;
  appearance: none;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.spaces-vestibule .team-space-option-room {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background-image: url('/assets/spaces-vestibule-v1.webp');
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
  will-change: opacity;
}

.spaces-vestibule .team-space-option-room::before {
  position: absolute;
  inset: 0;
  content: '';
  pointer-events: none;
  mix-blend-mode: screen;
}

.spaces-vestibule .team-space-option-room::before {
  background:
    radial-gradient(circle at var(--space-pointer-x) var(--space-pointer-y), rgba(255, 255, 255, .16), transparent 14%),
    radial-gradient(ellipse at 50% 54%, rgba(var(--space-glow), .16), transparent 70%);
}

.spaces-vestibule .team-space-option:is(:hover, :focus-visible) .team-space-option-room {
  opacity: .72;
  animation: spaces-room-materialize .66s cubic-bezier(.16, .8, .2, 1) both;
}

@keyframes spaces-room-materialize {
  0% { opacity: 0; }
  48% { opacity: .78; }
  100% { opacity: .72; }
}

.spaces-vestibule .team-space-option[data-space-tone='personal'] { --space-glow: 255, 214, 153; }
.spaces-vestibule .team-space-option[data-space-tone='projects'] { --space-glow: 112, 207, 255; }
.spaces-vestibule .team-space-option[data-space-tone='music'] { --space-glow: 166, 137, 255; }
.spaces-vestibule .team-space-option[data-space-tone='academy'] { --space-glow: 255, 213, 132; }
.spaces-vestibule .team-space-option[data-space-tone='video'] { --space-glow: 112, 181, 255; }

.spaces-vestibule .team-space-option[data-space-slot='personal'] {
  --label-top: 65%;
  top: 4%;
  left: 29%;
  width: 49%;
  height: 43%;
  border-radius: 50%;
  clip-path: ellipse(47% 45% at 50% 49%);
}

.spaces-vestibule .team-space-option[data-space-slot='projects'] {
  --label-top: 66%;
  top: 22%;
  left: 1%;
  width: 45%;
  height: 34%;
  border-radius: 50%;
  clip-path: ellipse(48% 43% at 48% 52%);
}

.spaces-vestibule .team-space-option[data-space-slot='music'] {
  --label-top: 66%;
  top: 20%;
  left: 59%;
  width: 41%;
  height: 35%;
  border-radius: 50%;
  clip-path: ellipse(47% 42% at 52% 51%);
}

.spaces-vestibule .team-space-option[data-space-slot='academy'] {
  --label-top: 70%;
  top: 53%;
  left: 6%;
  width: 44%;
  height: 43%;
  border-radius: 50%;
  clip-path: ellipse(46% 43% at 50% 52%);
}

.spaces-vestibule .team-space-option[data-space-slot='video'] {
  --label-top: 70%;
  top: 53%;
  left: 49%;
  width: 49%;
  height: 44%;
  border-radius: 50%;
  clip-path: ellipse(47% 43% at 51% 51%);
}

.spaces-vestibule .team-space-option[data-space-slot='overflow'] {
  top: 91%;
  left: var(--space-overflow-left, 50%);
  width: min(180px, 18%);
  height: 48px;
  overflow: visible;
  clip-path: none;
  transform: translate(-50%, -50%);
}

.spaces-vestibule .team-space-option-copy {
  position: absolute;
  z-index: 2;
  top: var(--label-top);
  left: 50%;
  display: grid;
  width: min(78%, 250px);
  gap: 5px;
  padding: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: transform .24s ease;
}

.spaces-vestibule .team-space-option-copy strong,
.spaces-vestibule .team-space-option-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    0 2px 5px rgba(0, 0, 0, .95),
    0 0 18px rgba(0, 0, 0, .85);
}

.spaces-vestibule .team-space-option-copy strong {
  color: rgba(247, 248, 246, .82);
  font-size: clamp(15px, 1.45vw, 22px);
  font-weight: 570;
  line-height: 1.08;
  letter-spacing: -.03em;
  transition: color .2s ease, text-shadow .24s ease;
}

.spaces-vestibule .team-space-option-copy small {
  display: block;
  color: rgba(236, 241, 248, .72);
  font-size: clamp(9px, .85vw, 12px);
  line-height: 1.3;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .2s ease, transform .24s ease;
}

.spaces-vestibule .team-space-option:is(:hover, :focus-visible) {
  outline: none;
  box-shadow: none;
}

/* The illuminated room and brightened label are the focus indicator here.
   This selector deliberately outranks the generic rectangular focus ring so
   keyboard focus follows the portal contour instead of drawing a card box. */
.spaces-vestibule .spaces-vestibule-map .spaces-vestibule-list .team-space-option:focus-visible {
  outline: none;
  box-shadow: none;
}

.spaces-vestibule .team-space-option:is(:hover, :focus-visible) .team-space-option-copy {
  transform: translate(-50%, calc(-50% - 3px));
}

.spaces-vestibule .team-space-option:is(:hover, :focus-visible) .team-space-option-copy strong {
  color: #fff;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, .95),
    0 0 20px rgba(var(--space-glow), .88),
    0 0 38px rgba(var(--space-glow), .48);
}

.spaces-vestibule .team-space-option:is(:hover, :focus-visible) .team-space-option-copy small {
  opacity: 1;
  transform: translateY(0);
}

.spaces-vestibule .team-space-option[aria-selected='true'] .team-space-option-copy strong {
  color: #fff;
}

.spaces-vestibule .team-space-option-check {
  position: absolute;
  z-index: 2;
  top: calc(var(--label-top) + 34px);
  left: 50%;
  width: 14px;
  height: 14px;
  padding: 0;
  fill: none;
  stroke: rgb(var(--space-glow));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  filter: drop-shadow(0 0 7px rgba(var(--space-glow), .9));
  transform: translateX(-50%) scale(.76);
  transition: opacity .18s ease, transform .2s ease;
}

.spaces-vestibule .team-space-option[aria-selected='true'] .team-space-option-check {
  opacity: .88;
  transform: translateX(-50%) scale(1);
}

.spaces-vestibule-footer {
  position: absolute;
  z-index: 5;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  left: max(28px, env(safe-area-inset-left));
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.spaces-vestibule-footer > p,
.spaces-vestibule-footer > button {
  pointer-events: auto;
}

.spaces-vestibule-footer > p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: rgba(218, 227, 239, .54);
  font-size: 11px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .9);
}

.spaces-vestibule-footer > p i {
  color: rgba(150, 190, 232, .64);
  font-style: normal;
}

.spaces-vestibule-footer > button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 7px 2px 7px 0;
  border: 0;
  border-bottom: 1px solid rgba(194, 217, 241, .28);
  border-radius: 0;
  color: var(--vestibule-ink);
  text-align: left;
  background: transparent;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .9);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}

.spaces-vestibule-footer > button:hover {
  border-color: rgba(143, 211, 255, .8);
  color: #fff;
}

.spaces-vestibule-footer > button svg {
  width: 30px;
  height: 30px;
  padding: 6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.spaces-vestibule-footer > button span {
  display: grid;
  gap: 1px;
}

.spaces-vestibule-footer > button strong {
  font-size: 12px;
  font-weight: 590;
}

.spaces-vestibule-footer > button small {
  color: var(--vestibule-muted);
  font-size: 9px;
}

.spaces-vestibule :is(.spaces-vestibule-close, .spaces-vestibule-footer > button):focus-visible {
  outline: 3px solid #a7d8ff;
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .spaces-vestibule {
    overflow: auto;
  }

  .spaces-vestibule-shell {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 18px;
    min-height: 100dvh;
    height: auto;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow: visible;
  }

  .spaces-vestibule-header,
  .spaces-vestibule-intro,
  .spaces-vestibule-map,
  .spaces-vestibule-footer {
    position: relative;
    inset: auto;
  }

  .spaces-vestibule-header {
    grid-row: 1;
  }

  .spaces-vestibule-intro {
    grid-row: 2;
    width: min(360px, 100%);
    text-align: left;
  }

  .spaces-vestibule-intro h2 {
    font-size: clamp(32px, 10vw, 44px);
  }

  .spaces-vestibule-intro p:last-child {
    max-width: 340px;
  }

  .spaces-vestibule-map {
    grid-row: 3;
    left: 50%;
    width: calc(100% + 32px);
    max-width: 620px;
    transform: translateX(-50%);
  }

  .spaces-vestibule .team-space-option-copy {
    width: 82%;
    gap: 1px;
  }

  .spaces-vestibule .team-space-option-copy strong {
    font-size: clamp(10px, 3.1vw, 14px);
  }

  .spaces-vestibule .team-space-option-copy small {
    display: none;
  }

  .spaces-vestibule .team-space-option-check {
    top: calc(var(--label-top) + 18px);
    width: 10px;
    height: 10px;
  }

  .spaces-vestibule-footer {
    grid-row: 4;
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .spaces-vestibule-footer > p {
    justify-content: center;
  }

  .spaces-vestibule-footer > button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spaces-vestibule *,
  .spaces-vestibule *::before,
  .spaces-vestibule *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .spaces-vestibule,
  .spaces-vestibule-shell,
  .spaces-vestibule-map {
    color: CanvasText;
    background: Canvas;
  }

  .spaces-vestibule .team-space-option {
    outline: 2px solid ButtonText;
    outline-offset: -2px;
  }

  .spaces-vestibule .team-space-option[aria-selected='true'] {
    outline-width: 4px;
  }
}
