/*
 * squishy-matter_v3b: the grey page and the glass ball UI from sphere-ui_v2b.
 * Unlayered, so it wins over base.css and style.css (both in cascade layers).
 */
@font-face {
  font-family: "Cygnito Mono";
  src: url("assets/cygnito-mono.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #e3e3e3;
  --ball: 200px;       /* set from ball.js */
}

html, body { background: var(--bg); }

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

.ball {
  position: fixed;
  /* As sphere-ui_v4b: sits on the page in from the corner (ball.js sets
     --pan-x/--pan-y, kept on screen). No drop-in intro here. */
  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; }

/* v3b: info card and letter badges (info.js). Overlays only — pointer-events
   off, so drags go straight through to the objects underneath. */
.info-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9; /* above the canvas, under the ball */
}
.info-card {
  position: fixed;
  left: 0;
  top: 0;
  opacity: 0;
  transform: rotate(var(--tilt, 0deg)) scale(0.92);
  transition: opacity 160ms ease-out, transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
  filter: drop-shadow(0 10px 24px rgb(0 0 0 / 0.18));
}
.info-card.is-on { opacity: 1; transform: rotate(var(--tilt, 0deg)) scale(1); }
.info-card canvas { display: block; }

/* Rings with letters (Figma node 529:29740) — black here, white on the sphere. */
.info-badge {
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  gap: 0;                   /* touching, as Figma 529:29850 */
  opacity: 0;
  transition: opacity 120ms ease-out;
}
.info-badge.is-on { opacity: 1; }
.info-badge span {
  box-sizing: border-box;
  width: 22.234px;
  height: 22.234px;
  border: 2px solid #000;     /* Figma 529:29850: a 2px ring inside the circle */
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #000;
  font: 600 14px/1 "SNS Badge", "Helvetica Neue", sans-serif;
}

/* v3b: the category tag on each filter box's top-left corner, styled like the
   ball's filter tags (solid colour, Cygnito Mono 14px caps). */
.info-box-tag {
  position: fixed;
  left: 0;
  top: 0;
  padding: 0 7px;
  height: 22px;
  line-height: 22px;
  font: 14px/22px "Cygnito Mono", ui-monospace, monospace;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 160ms ease-out;
}
.info-box-tag.is-on { opacity: 1; }

/* The ball's shadow on the page (placed by ball.js), as sphere-ui_v4b. */
.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);
}
