/* Habanero 2026 — PROTOTYPE: /games-sphere
   A full-bleed WebGL stage (the draggable tile sphere) with a HUD overlaid on
   top. The canvas captures pointer drags; HUD chrome is pointer-events:none by
   default and re-enables interaction only on the actual controls so a drag that
   starts over the heading still spins the sphere. */

.hb-sphere-main {
  display: block;
  /* Bleed the stage up under the transparent sticky nav so it reads
     edge-to-edge like the home hero (the nav only frosts on scroll, and the
     /explorer page has no footer, so the stage owns the whole viewport). */
  margin-top: calc(-1 * var(--nav-h));
}

.hb-sphere {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 38%, color-mix(in oklab, var(--accent) 9%, transparent) 0%, transparent 60%),
    radial-gradient(140% 120% at 50% 120%, color-mix(in oklab, var(--bg-elev) 80%, transparent) 0%, transparent 55%),
    var(--bg);
  cursor: grab;
  touch-action: none;             /* let the script own pointer gestures */
  user-select: none;
}
.hb-sphere.is-grabbing { cursor: grabbing; }
.hb-sphere.is-hovering-tile { cursor: pointer; }

.hb-sphere__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== HUD ===== */
.hb-sphere__hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  /* Align the heading / tools to the site's centred max-width container (same
     left edge as the nav and every other page) instead of the viewport edge,
     which read as oddly far-left on wide screens. The stage now bleeds under
     the nav, so the top padding also clears the nav height. */
  padding-top: calc(var(--nav-h) + clamp(12px, 2vw, 22px));
  padding-bottom: clamp(20px, 3vw, 40px);
  padding-left: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  padding-right: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.hb-sphere__top {
  display: flex;
  align-items: flex-start;
  /* Heading removed — the Grid/Explorer toggle + count are the only top chrome,
     kept at the right edge of the centred container. */
  justify-content: flex-end;
  gap: 24px;
}

.hb-sphere__eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.hb-sphere__h1 {
  font-family: var(--font-display);
  font-weight: var(--font-display-weight);
  font-size: clamp(34px, 5.2vw, 68px);
  line-height: .98;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--fg);
  text-shadow: 0 2px 30px color-mix(in oklab, var(--bg) 70%, transparent);
}

.hb-sphere__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  text-align: right;
}

.hb-sphere__count {
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--muted);
}

/* Bottom-centred group: the "Surprise me" CTA stacked over the hint. */
.hb-sphere__foot {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Spin-to-launch CTA. Black-and-white ghost pill (white text + border on a
   frosted dark fill so it stays legible over the busy orb), inverting to a
   solid white fill on hover. Matches the site's secondary button style. */
.hb-sphere__surprise {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
  background: color-mix(in oklab, var(--bg-elev) 55%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in oklab, var(--fg) 45%, transparent);
  border-radius: var(--radius-pill);
  padding: 13px 24px;
  cursor: pointer;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease;
}
.hb-sphere__surprise:hover {
  transform: translateY(-1px);
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.hb-sphere__surprise:active { transform: translateY(0); }
.hb-sphere__surprise:disabled { opacity: .5; cursor: default; transform: none; }
.hb-sphere__surprise svg { width: 16px; height: 16px; }

.hb-sphere__hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in oklab, var(--bg-elev) 55%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  opacity: 0;                     /* faded in by the script after intro */
  transition: opacity var(--t-slow) ease;
}
.hb-sphere__hint .hb-sphere__dot { color: color-mix(in oklab, var(--fg) 35%, transparent); }


/* ===== floating hover label ===== */
.hb-sphere__label {
  position: absolute;
  /* Below the HUD chrome (z-index 3) so a tile's name can't pop over the
     "Surprise me" button or toggle; still above the canvas so it reads over
     the orb. */
  z-index: 2;
  top: 0;
  left: 0;
  transform: translate(-50%, calc(-100% - 16px));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 14px;
  max-width: 280px;
  background: color-mix(in oklab, var(--bg-elev) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px color-mix(in oklab, var(--bg) 60%, transparent);
  white-space: nowrap;
  will-change: transform, opacity;
}
.hb-sphere__label[hidden] { display: none; }
.hb-sphere__label-type {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.hb-sphere__label-name {
  font-family: var(--font-display);
  font-weight: var(--font-display-weight);
  font-size: 16px;
  color: var(--fg);
}

/* ===== empty / fallback ===== */
.hb-sphere__empty {
  position: absolute;
  z-index: 5;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  padding: 28px 34px;
  background: color-mix(in oklab, var(--bg-elev) 80%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.hb-sphere__empty strong { font-family: var(--font-display); font-size: 20px; color: var(--fg); }
.hb-sphere__empty span { color: var(--muted); font-size: 14px; }
.hb-sphere__empty a { color: var(--accent); }

/* The canvas dims out matching tiles; non-matches are dimmed in WebGL, so the
   only DOM cue we need is on small screens where the heading would crowd the
   tools. */
@media (max-width: 720px) {
  .hb-sphere__top { flex-direction: column; }
  .hb-sphere__tools { align-items: flex-start; text-align: left; }
  .hb-sphere__h1 { font-size: clamp(30px, 9vw, 44px); }

  /* Keep the bottom hint on a single line instead of wrapping per-word. */
  .hb-sphere__hint {
    font-size: 10px;
    gap: 7px;
    padding: 8px 14px;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-sphere__hint { transition: none; }
}
