@font-face {
  font-family: "Cygnito Mono";
  src: url("assets/cygnito-mono.woff2") format("woff2");
  font-display: swap;
}

/* grid-v2b's stage, plus the glass ball. */
:root {
  --bg: #e3e3e3;
  --ball: 200px;       /* set from ball.js */
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.stage {
  position: fixed;
  inset: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 500ms ease;
}
.stage.is-ready canvas { opacity: 1; }

/* ---- The ball ------------------------------------------------------------- */

.ball {
  position: fixed;
  /* v4a: rides on the page — starts in from the corner, then moves as the
     page is dragged (ball.js sets --pan-x/--pan-y, kept on screen). v2c,
     after Figma, hung it ~0.34 R off the left and ~0.28 R off the bottom. */
  /* Until ball.js takes over it waits past the bottom-left corner, ready to
     spin in. */
  --pan-x: -100vw;
  --pan-y: 100vh;
  left: calc(32px + var(--pan-x, 0px));
  bottom: calc(32px - var(--pan-y, 0px));
  width: var(--ball);
  height: var(--ball);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  z-index: 10;
}
.ball.is-dragging { cursor: grabbing; }

.ball:focus-visible { outline: 2px solid rgb(0 0 0 / 0.4); outline-offset: 4px; }

/* Glass: frosted fallback first; Chromium also understands the SVG lens and
   replaces it with real refraction (other browsers drop that declaration). */
.ball-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backdrop-filter: blur(1.5px) saturate(1.15);
  -webkit-backdrop-filter: blur(1.5px) saturate(1.15);
}
.ball-glass.has-lens { backdrop-filter: url(#lens); }

.ball-canvas {
  /* The Figma ball is turned 5.63° (its shading and the logo with it). */
  transform: rotate(5.63deg);
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Direction hints: four small chevrons that appear on hover. */
.ball-hint {
  position: absolute;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid rgb(0 0 0 / 0.5);
  border-left: 1.5px solid rgb(0 0 0 / 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.ball:hover .ball-hint, .ball:focus-visible .ball-hint { opacity: 1; }
.ball.is-dragging .ball-hint { opacity: 0; }
.ball-hint--up    { top: -14px;  left: 50%; transform: translateX(-50%) rotate(45deg); }
.ball-hint--down  { bottom: -14px; left: 50%; transform: translateX(-50%) rotate(225deg); }
.ball-hint--left  { left: -14px; top: 50%; transform: translateY(-50%) rotate(-45deg); }
.ball-hint--right { right: -14px; top: 50%; transform: translateY(-50%) rotate(135deg); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}



/* Sub-page tags curved round the ball (tags.js). */
.ball-tags {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  overflow: visible;
  text-transform: uppercase;
}

/* The 8-ball face is clickable (shake it). */
.ball.is-lucky:not(.is-dragging) { cursor: pointer; }

/* v4a: the ball's shadow on the page (placed by ball.js). */
.ball-shadow {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9;
  background: radial-gradient(closest-side, rgb(0 0 0 / 0.38), rgb(0 0 0 / 0.18) 62%, transparent);
  filter: blur(12px);
}

/* v4a: secondary menu (menu.js), Figma node 578:30280, restyled to match the
   glass ball — a frosted pill lit from the top left like the ball, with a
   tiny glass ball for the switch's knob. */
.menu2 {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 40px;
  padding: 0 18px 0 20px;
  border-radius: 999px;
  font: 12px/1 "Cygnito Mono", ui-monospace, monospace;
  text-transform: uppercase;
  color: #010103;
  user-select: none;
  -webkit-user-select: none;
  /* Glass: frosted, a little brighter at the top where the light catches it. */
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0.22) 55%, rgb(255 255 255 / 0.32));
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),          /* lit top rim */
    inset 0 -1px 0 rgb(0 0 0 / 0.08),               /* shaded underside */
    inset 0 0 0 1px rgb(255 255 255 / 0.35),
    0 1px 2px rgb(0 0 0 / 0.08),
    6px 12px 26px rgb(0 0 0 / 0.14);                /* on the page, down-right like the ball's */
}
.menu2-mode { display: flex; align-items: center; gap: 12px; }
.menu2-label { cursor: pointer; transition: opacity 200ms; }
.menu2[data-mode="stickers"] .menu2-label[data-mode="blobs"],
.menu2[data-mode="blobs"] .menu2-label[data-mode="stickers"] { opacity: 0.4; }

/* The switch: a groove pressed into the glass, a little glass ball in it. */
.menu2-switch {
  position: relative;
  width: 36px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: rgb(0 0 0 / 0.06);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.22), inset 0 -1px 0 rgb(255 255 255 / 0.8);
}
.menu2-switch:focus-visible { outline: 2px solid rgb(0 0 0 / 0.4); outline-offset: 3px; }
.menu2-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #fff 0 12%, rgb(255 255 255 / 0) 34%),
    radial-gradient(circle at 50% 60%, #f4f5f7, #c9ccd2 70%, #9ea2aa);
  box-shadow: inset 0 -1px 2px rgb(0 0 0 / 0.18), 1px 2px 3px rgb(0 0 0 / 0.25);
  /* Rolls across with a little overshoot, like the ball's own rolls. */
  transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.menu2[data-mode="blobs"] .menu2-knob { transform: translateX(16px) rotate(180deg); }

.menu2-rule { width: 1px; height: 16px; background: rgb(0 0 0 / 0.18); }
.menu2-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.menu2-social { display: flex; gap: 8px; }
.menu2-social a { display: block; width: 16px; height: 16px; opacity: 0.85; transition: opacity 150ms, transform 150ms; }
.menu2-social a:hover { opacity: 1; transform: translateY(-1px); }
.menu2-social img { display: block; width: 100%; height: 100%; }
