/* Worlds of walterwakefield v2: the galaxy map, from Figma "4. Galaxy" (node 2021:794, a 2752 x 1536 frame).
   The map (#mapWorld) is 100cqw wide with the frame's proportions, so one Figma pixel = --fx.
   Positions of each galaxy live in data.js (WOW.GALAXIES at / centre). Loaded after game.css. */

#s-map { background: #000; }
#s-map .map-back { display: none; }
.map-world { --fx: calc(100cqw / 2752); }

/* ---------- background: pixel rocks round the edge, star field through the hole in the middle ---------- */
.gx-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.gx-rocks { position: absolute; inset: 0; background: #000 url('figma/galaxy/galaxy-background-1.jpg') 0 0 / 100% 100% no-repeat; }
.gx-stars {
  position: absolute; left: 0; top: calc(6 * var(--fx)); width: 100%; height: 100%;
  background: url('figma/galaxy/galaxy-frame-bg.jpg') 0 0 / 100% 100% no-repeat;
  -webkit-mask: url('figma/galaxy/galaxy-background-2-mask.svg') calc(384.223 * var(--fx)) calc(139.5 * var(--fx)) / calc(1988.793 * var(--fx)) calc(1283.522 * var(--fx)) no-repeat;
  mask: url('figma/galaxy/galaxy-background-2-mask.svg') calc(384.223 * var(--fx)) calc(139.5 * var(--fx)) / calc(1988.793 * var(--fx)) calc(1283.522 * var(--fx)) no-repeat;
}

/* ---------- a galaxy: icon with its "World Toast" card underneath, all one button ---------- */
.gx {
  position: absolute; width: calc(340 * var(--fx)); display: flex; flex-direction: column; align-items: center;
  padding: 0; border: 0; background: none; color: #fff; text-align: center; border-radius: calc(4 * var(--fx));
}
.gx:focus-visible { outline: none; box-shadow: none; }
.gx-icon {
  display: block; width: calc(272 * var(--fx)); height: calc(272 * var(--fx)); object-fit: cover; flex: none;
  mix-blend-mode: screen;   /* the galaxy pictures are on black: screen makes the black disappear against space */
  pointer-events: none; user-select: none;
  animation: gxFloat 7s ease-in-out infinite alternate; transition: opacity .4s, filter .2s;
}
.gx:nth-child(2n) .gx-icon { animation-duration: 8.5s; animation-delay: -3s; }
.gx:nth-child(3n) .gx-icon { animation-duration: 6.2s; animation-delay: -1.5s; }
@keyframes gxFloat { from { translate: 0 calc(-6 * var(--fx)); rotate: -1.5deg; } to { translate: 0 calc(6 * var(--fx)); rotate: 1.5deg; } }
.gx:hover .gx-icon, .gx:focus-visible .gx-icon { filter: brightness(1.18); }

.gx-card {
  display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--fx)); width: 100%;
  padding: calc(24 * var(--fx)) calc(24 * var(--fx)) calc(20 * var(--fx));
  background: rgba(0, 0, 0, .75); border: 2px solid #fff; border-radius: calc(4 * var(--fx));
  overflow-wrap: break-word; transition: background .15s, box-shadow .3s, opacity .4s;
}
.gx-name { display: block; width: 100%; font-family: 'ivyora-display', var(--font-head); font-weight: 300; font-size: calc(36 * var(--fx)); line-height: 1.15; letter-spacing: 0; }
.gx-who { display: block; width: 100%; font-family: Inter, var(--font-body); font-weight: 400; font-size: max(9px, calc(16 * var(--fx))); line-height: 1.4; }
/* hover / keyboard focus: the raised panel (Figma's Branding card) */
.gx:hover .gx-card, .gx:focus-visible .gx-card { background: rgba(31, 31, 31, .85); }
.gx:focus-visible .gx-card { outline: max(2px, calc(3 * var(--fx))) solid #fff; outline-offset: max(2px, calc(4 * var(--fx))); }

/* the walterwakefield HQ: the balloon airship, its card 20px below */
.gx-hq { width: calc(541 * var(--fx)); }
.gx-hq .gx-icon { width: calc(541 * var(--fx)); height: calc(541 * var(--fx)); mix-blend-mode: normal; animation-duration: 9s; }
.gx-hq .gx-card { width: calc(355 * var(--fx)); margin-top: calc(20 * var(--fx)); }
@keyframes gxFloatHq { from { translate: 0 calc(-8 * var(--fx)); } to { translate: 0 calc(8 * var(--fx)); } }
.gx-hq .gx-icon { animation-name: gxFloatHq; }

/* zooming into a galaxy: fade the icons and cards one by one (fading their parent would break the screen blend) */
.map-world .map-labels, .map-world.zoomed .map-labels { opacity: 1; transition: visibility 0s; }
.map-world.zoomed .map-labels { visibility: hidden; transition: visibility 0s .4s; }
.map-world.zoomed .gx-icon, .map-world.zoomed .gx-card { opacity: 0; }

/* living galaxy: the rock border drifts very slowly (scaled up a touch so its edges never show), the stars twinkle faintly */
.gx-rocks { animation: gxRocks 20s ease-in-out infinite alternate; }
@keyframes gxRocks { from { transform: scale(1.03) rotate(-.25deg) translate(-.3%, .2%); } to { transform: scale(1.03) rotate(.25deg) translate(.3%, -.2%); } }
.gx-stars { animation: gxTwinkle 6s ease-in-out infinite alternate; }
@keyframes gxTwinkle { from { opacity: 1; } to { opacity: .82; } }
@media (prefers-reduced-motion: reduce) { .gx-icon, .gx-rocks, .gx-stars { animation: none; } }

/* ---------- small stages (phones): keep the galaxy names readable, drop the name lists ---------- */
@container (max-width: 760px) {
  .gx-who { display: none; }
  .gx-card { padding: 3px 4px; gap: 0; }
  .gx-name { font-size: max(9px, calc(36 * var(--fx))); line-height: 1.1; }
  .gx-card, .gx-hq .gx-card { width: auto; min-width: 100%; white-space: nowrap; }
}
/* very small stages (phones held upright): Mr Average's quote box would cover the Marketing galaxy */
@container (max-width: 500px) {
  #s-map .quote { display: none; }
}

/* ---------- the existing map overlays, made smaller so they sit below and beside the galaxy cards ---------- */
#s-map .faces { gap: .35cqw; padding: .35cqw .45cqw; bottom: 1cqw; background: rgba(0, 0, 0, .75); border: 2px solid rgba(255, 255, 255, .5); border-radius: .3cqw; }
#s-map .face { width: 3.2cqw; gap: .12cqw; }
#s-map .face .pic { width: 2.7cqw; height: 2.7cqw; border-radius: .3cqw; }
#s-map .face .initial { font-size: 1.3cqw; }
#s-map .face .nm { font-size: max(8px, .62cqw); }
#s-map .map-tip { bottom: 6.6cqw; width: 19cqw; padding: .8cqw 1cqw; font-size: var(--fs-small); background: rgba(0, 0, 0, .75); border: 2px solid #fff; border-radius: .25cqw; -webkit-backdrop-filter: none; backdrop-filter: none; }
#s-map .map-tip b { font-weight: 300; font-size: clamp(14px, 1.5cqw, 46px); }

/* v3: HQ is locked until you have met WOW.HQ_UNLOCK people (brief) */
.gx-hq.locked .gx-icon { filter: grayscale(1) brightness(.55); }
.gx-hq.locked .gx-card::after { content: 'Locked: meet 4 of us to open'; display: block; margin-top: calc(6 * var(--fx)); font-size: max(9px, calc(18 * var(--fx))); color: var(--brand-orange, #fcb24f); }

/* 3 Dec: the "Pick a galaxy" tip is Adrian talking: his face, then a speech balloon pointing at him */
#s-map .map-tip { display: flex; align-items: flex-end; gap: 1.1cqw; width: 26cqw; padding: 0; background: none; border: 0; }
#s-map .map-tip .tip-face { flex: none; width: 4.4cqw; height: 4.4cqw; border-radius: 50%; overflow: hidden; border: 2px solid #fff; background: #3b85ed; }
#s-map .map-tip .tip-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
/* BugHerd 14: with the round Figma avatar (it has its own white ring), drop the extra border and blue fill */
#s-map .face .pic:has(> img.ava) { border-radius: 50%; }
#s-map .map-tip .tip-face:has(> img.ava) { border: 0; background: none; }
#s-map .map-tip .tip-face > img.ava { object-fit: contain; object-position: 50% 50%; }
#s-map .map-tip .tip-say { position: relative; padding: .8cqw 1cqw; background: rgba(0, 0, 0, .75); border: 2px solid #fff; border-radius: .6cqw; }
#s-map .map-tip .tip-say::before { content: ''; position: absolute; left: -.75cqw; bottom: 1.2cqw; width: 1.2cqw; height: 1.2cqw; background: rgba(0, 0, 0, .9); border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }
#s-map .map-tip .tip-say b { display: block; margin-bottom: .3cqw; }
/* 3 Dec: the whole ring of galaxies sits higher, so the bottom labels are clear of the faces row */
#s-map .gx { margin-top: calc(-110 * var(--fx)); }

/* the map has the faces row along the bottom, so the "Meet the team" button is not needed (still clicked from the phone menu) */
#meetBtn { display: none; }
