/* Shared pieces: tokens, page frame, fade layer, health and safety screen, pointer, focus, reduced motion */

:root {
  --font: 'Asap', sans-serif;
  --cyan: #34beed;
  --glow: drop-shadow(0 0 6px rgba(95, 208, 255, 0.9));
  --ease-zoom: cubic-bezier(0.3, 0, 0.2, 1);
  --vh: 1vh;          /* 1% of the visible height; use instead of vh */
  --screen-h: 100vh;
  --z-fader: 999999999;
  --z-safety: 1000000000;
  --z-pointer: 2147483647;
}

/* mobile browsers: 100vh can sit under the toolbars, the dynamic height doesn't */
@supports (height: 100dvh) {
  :root { --vh: 1dvh; --screen-h: 100dvh; }
}

html, body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: black;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* every button is drawn from images, so start from nothing */
button {
  all: unset;
}

#stage {
  position: relative;
  display: block;
  width: 100vw;
  height: var(--screen-h);
  overflow: hidden;
  background: black;
}

/* black layer faded over view changes and the Start button */
.fader {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--z-fader);
  width: 100vw;
  height: var(--screen-h);
  background: black;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms;
}

.fader.is-slow { transition-duration: 600ms; }
.fader.is-on { opacity: 1; pointer-events: auto; }

/* ---------- health and safety ---------- */

.safety {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--z-safety);
  box-sizing: border-box;
  width: 100vw;
  height: var(--screen-h);
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: black;
  color: white;
  font-family: var(--font);
  text-align: center;
  transition: opacity 700ms 500ms, visibility 0s 1200ms;
}

.safety > * { transition: opacity 500ms; }

.safety-notice {
  max-width: 980px;
  animation: fade-in 600ms ease-out both;
}

.safety-notice h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  margin: 0 0 5vmin;
  font-size: clamp(22px, 5.4vmin, 52px);
  font-weight: 500;
  text-transform: uppercase;
}

.safety-sign {
  flex: none;
  width: 1.25em;
}

.safety-notice p {
  margin: 0;
  font-size: clamp(15px, 3.4vmin, 32px);
  line-height: 1.45;
  text-transform: uppercase;
}

.safety-notice .safety-fine {
  margin-top: 4vmin;
  color: #9a9a9a;
  font-size: clamp(12px, 2.4vmin, 22px);
  text-transform: none;
}

.safety-prompt {
  position: absolute;
  bottom: calc(11 * var(--vh));
  left: 0;
  right: 0;
  margin: 0;
  font-size: clamp(16px, 3.6vmin, 34px);
  opacity: 0;
  animation: fade-in 500ms 1.5s forwards, pulse 1.6s ease-in-out 2s infinite;
}

.a-glyph {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
}

.for-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
  .for-touch { display: inline; }
  .for-mouse { display: none; }
}

@media (max-width: 600px) {
  .safety-notice h1 { flex-direction: column; }
  .safety-sign { width: 1.6em; }
}

/* dismissed: the words fade first, then the black lifts off the menu */
.safety.is-done { opacity: 0; visibility: hidden; }
.safety.is-done > * { opacity: 0 !important; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ---------- pointer hand (js/cursor.js) ---------- */

/* hand.png is 86x122 with the fingertip at (27, 2); the box is shifted so the fingertip
   sits on its transform origin, which is what the script moves to the mouse */
.has-hand, .has-hand * { cursor: none !important; }

.hand {
  --w: clamp(52px, 7.5vmin, 86px);
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-pointer);
  width: var(--w);
  height: calc(var(--w) * 122 / 86);
  margin: calc(var(--w) * -2 / 86) 0 0 calc(var(--w) * -27 / 86);
  transform-origin: calc(var(--w) * 27 / 86) calc(var(--w) * 2 / 86);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
  will-change: transform;
}

.hand.is-shown { opacity: 1; }

.hand-squash {
  width: 100%;
  height: 100%;
  transform-origin: inherit;
  transition: transform 80ms ease-out;
}

.hand-squash.is-pressed { transform: scale(0.92); }

.hand img {
  display: block;
  width: 100%;
  height: 100%;
}

.ripple {
  position: fixed;
  z-index: var(--z-pointer);
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(52, 190, 237, 0.6);
  pointer-events: none;
  opacity: 0;
  animation: ripple 300ms ease-out;
}

@keyframes ripple {
  from { transform: scale(0); opacity: 0.6; }
  to { transform: scale(1); opacity: 0; }
}

/* ---------- focus and motion ---------- */

:focus-visible {
  outline: 4px solid var(--cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 1ms !important;
  }

  .safety-prompt { opacity: 1; }
}
