/* Homepage globe, followed by the portfolio in normal document flow. */

.games-opening {
  --opening-hero-height: max(700px, calc(100vh - 104px));
  --opening-hero-height: max(700px, calc(100svh - 104px));
  position: relative;
  background: #000;
}

#portfolio-showcase { scroll-margin-top: var(--sticky-header-height, 80px); }

.games-hero {
  position: relative;
  isolation: isolate;
  height: var(--opening-hero-height);
  overflow: hidden;
  overflow: clip;
  background: #000;
  color: #fff;
  touch-action: pan-y;
}

.games-hero-copy {
  position: absolute;
  z-index: 2;
  top: clamp(50px, 7vh, 100px);
  left: 50%;
  width: min(1200px, calc(100% - 60px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#games-hero-title {
  display: grid;
  margin: 0;
  font-size: clamp(42px, 6.6vw, 96px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.06em;
}

.games-hero-phrase {
  grid-area: 1 / 1;
  align-self: center;
  opacity: 0;
}

.games-hero-phrase:first-child { opacity: 1; }

@keyframes games-hero-phrase {
  0%, 20%, 100% { opacity: 0; }
  2.5%, 17.5% { opacity: 1; }
}

.games-hero-description {
  margin: 22px 0 0;
  font-size: clamp(19px, 2.2vw, 32px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.035em;
}

.games-globe,
.games-globe-fallback {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.games-globe canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 400ms ease;
}

.games-globe.is-ready canvas { opacity: 1; }
.games-globe.is-ready .games-globe-fallback { visibility: hidden; }

.games-globe-fallback-earth {
  position: absolute;
  top: 45%;
  left: 50%;
  width: 112%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #0055c7 url('assets/game-hero/earth-clouds.webp') 55% 35% / 200% 100%;
  box-shadow: inset -35px -20px 90px #001f74, inset 0 12px 25px #93e9ff, 0 -2px 14px #55b7ed;
}

.globe-fallback-icon {
  position: absolute;
  top: 60%;
  left: 30%;
  width: clamp(50px, 7vw, 110px);
  height: auto;
  border-radius: 24%;
  transform: rotate(-15deg);
}
.globe-fallback-icon--two { top: 48%; left: 66%; transform: rotate(15deg); }
.globe-fallback-icon--three { top: 80%; left: 79%; transform: rotate(22deg); }

.games-hero-scroll {
  position: absolute;
  z-index: 3;
  bottom: 23px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 4px 16px;
  border-radius: 24px;
  transform: translateX(-50%);
  color: #fff;
  background: rgb(0 12 35 / 55%);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  white-space: nowrap;
  text-decoration: none;
}
.games-hero-scroll span:last-child { font-size: 19px; }

.games-hero-credit {
  position: absolute;
  z-index: 2;
  bottom: 39px;
  left: 5vw;
  color: #fff;
  font-size: 10px;
  letter-spacing: .035em;
}

.games-globe-toggle {
  position: absolute;
  z-index: 3;
  right: 4vw;
  bottom: 23px;
  min-height: 44px;
  border: 0;
  border-radius: 24px;
  padding: 8px 16px;
  background: rgb(0 12 35 / 55%);
  color: #fff;
  font: 500 10px / 1.5 'Manrope', sans-serif;
  cursor: pointer;
}
.games-globe-toggle[hidden] { display: none; }
.games-hero :where(a, button):focus-visible { outline: 2px solid #9dd8ff; outline-offset: 5px; }

@media (prefers-reduced-motion: no-preference) {
  .games-hero-phrase { animation: games-hero-phrase 15s linear infinite; }
  .games-hero-phrase:nth-child(1) { animation-delay: -.375s; }
  .games-hero-phrase:nth-child(2) { animation-delay: 2.625s; }
  .games-hero-phrase:nth-child(3) { animation-delay: 5.625s; }
  .games-hero-phrase:nth-child(4) { animation-delay: 8.625s; }
  .games-hero-phrase:nth-child(5) { animation-delay: 11.625s; }
}

@media (max-width: 1100px) and (min-width: 721px) {
  .games-hero-copy { top: 70px; }
}

@media (max-width: 720px) {
  .games-opening {
    --opening-hero-height: max(660px, calc(100vh - 72px));
    --opening-hero-height: max(660px, calc(100svh - 72px));
  }
  .games-hero-copy { top: 60px; width: calc(100% - 32px); }
  #games-hero-title { font-size: clamp(43px, 12.5vw, 76px); line-height: 1.07; }
  .games-hero-phrase > span { display: block; }
  .games-hero-description { margin-top: 18px; font-size: clamp(15px, 4.3vw, 22px); }
  .games-globe-fallback-earth { width: 170%; }
  .globe-fallback-icon { width: 55px; left: 17%; }
  .globe-fallback-icon--two { left: 69%; }
  .globe-fallback-icon--three { left: 85%; }
  .games-hero-scroll { bottom: 13px; left: 18px; transform: none; font-size: 9px; padding-inline: 12px; }
  .games-globe-toggle { right: 18px; bottom: 13px; font-size: 9px; padding-inline: 12px; }
  .games-hero-credit { display: none; }
}

@media (min-width: 721px) and (max-height: 800px) {
  .games-hero-copy { top: clamp(36px, 7vh, 70px); }
  #games-hero-title { font-size: clamp(42px, min(6.6vw, 11.3vh), 96px); }
  .games-hero-description { margin-top: min(22px, 3vh); font-size: clamp(16px, 2.2vw, 3.5vh); }
}

@media (max-height: 540px) and (orientation: landscape) {
  .games-hero-copy { top: 24px; }
  #games-hero-title { font-size: clamp(32px, 11vh, 56px); }
  .games-hero-phrase > span { display: inline; }
  .games-hero-description { margin-top: 10px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .games-globe canvas { transition: none; }
}
