/* Fairground wheel engine (bq-wh-). Uses the site tokens from brook.css. */

.bq-wh {
  container-type: inline-size;
  width: 100%;
  max-width: 980px;
}

.bq-wh-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--bq-s4);
  align-items: center;
  justify-items: center;
}

.bq-wh-stage {
  position: relative;
  width: min(100%, 500px);
}

.bq-wh-svg {
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}

.bq-wh-stand { fill: #3b2410; stroke: #ffcf5a; stroke-width: 3; stroke-linejoin: round; }
.bq-wh-halo { fill: none; stroke: rgba(255, 207, 90, 0.18); stroke-width: 10; }
.bq-wh-well { fill: #2a1a08; }
.bq-wh-seg { stroke: none; }
.bq-wh-rib { stroke: rgba(255, 236, 190, 0.55); stroke-width: 1.6; }
.bq-wh-peg { fill: #fff3c4; stroke: #8a5a16; stroke-width: 1.4; }

.bq-wh-label {
  font-family: var(--bq-font-display);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.18);
  stroke-width: 2px;
}

.bq-wh-label.is-zero { font-size: 21px; font-weight: 800; stroke: none; }

/* Bulbs: a slow twinkle at rest, a quick chase while turning, a flash on a hit */
.bq-wh-bulb {
  fill: #fff3c4;
  stroke: rgba(255, 207, 90, 0.45);
  stroke-width: 4;
  animation: bq-wh-twinkle 1.8s ease-in-out infinite alternate;
}

.bq-wh-bulb.is-b { animation-delay: -0.9s; }
.bq-wh.is-spinning .bq-wh-bulb { animation-duration: 0.22s; }
.bq-wh.is-hit .bq-wh-bulb { animation: bq-wh-flash 0.18s linear 8 alternate; }

@keyframes bq-wh-twinkle {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@keyframes bq-wh-flash {
  from { opacity: 1; }
  to { opacity: 0.2; }
}

/* The landing segment */
.bq-wh-glow {
  fill: #fffbe8;
  opacity: 0;
  stroke: #ffcf5a;
  stroke-width: 0;
  pointer-events: none;
}

.bq-wh.is-hit .bq-wh-glow {
  stroke-width: 5;
  animation: bq-wh-pulse 0.9s var(--bq-ease-out) 3 alternate both;
}

.bq-wh.is-miss .bq-wh-glow { opacity: 0.14; stroke-width: 3; stroke: rgba(255, 255, 255, 0.4); }

@keyframes bq-wh-pulse {
  from { opacity: 0.1; }
  to { opacity: 0.42; }
}

/* Hub */
.bq-wh-hubring { fill: #2a1a08; stroke: #ffcf5a; stroke-width: 4; }
.bq-wh-hub { stroke: rgba(255, 255, 255, 0.35); stroke-width: 2; }
.bq-wh-hub.is-pop { animation: bq-wh-pop 420ms var(--bq-ease-out); }

@keyframes bq-wh-pop {
  0% { transform: scale(0.94); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.bq-wh-hubtext,
.bq-wh-hubsub {
  font-family: var(--bq-font-display);
  text-anchor: middle;
  dominant-baseline: central;
  fill: var(--bq-on-coral);
  pointer-events: none;
}

.bq-wh-hubtext { font-size: 30px; font-weight: 900; letter-spacing: -0.01em; }
.bq-wh-hubsub { font-size: 15px; font-weight: 800; fill: #3b1206; }
.bq-wh.is-hit .bq-wh-hubtext { transform: translateY(-8px); }

/* Pointer */
.bq-wh-flap { stroke: #8a5a16; stroke-width: 2; stroke-linejoin: round; }
.bq-wh-cap { fill: #ff7b5c; stroke: #fff1c4; stroke-width: 3; }
.bq-wh-spark { pointer-events: none; }

/* Legend */
.bq-wh-legend {
  width: min(100%, 560px);
  padding: var(--bq-s3) var(--bq-s4);
  border-radius: var(--bq-r);
  background: rgba(6, 23, 25, 0.72);
  border: 1px solid var(--bq-line-2);
  backdrop-filter: blur(6px);
}

.bq-wh-legend__title {
  margin: 0 0 var(--bq-s2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bq-faint);
}

.bq-wh-legend__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--bq-s2);
}

.bq-wh-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: var(--bq-r-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--bq-muted);
  transition: transform var(--bq-fast) var(--bq-ease-out), border-color var(--bq-fast) var(--bq-ease-out),
    background-color var(--bq-fast) var(--bq-ease-out);
}

.bq-wh-legend__item.is-lit {
  border-color: var(--bq-gold);
  background: rgba(255, 207, 90, 0.12);
  color: var(--bq-ink);
  transform: scale(1.04);
}

.bq-wh-chip {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--bq-r-pill);
  background: var(--chip);
  color: var(--chip-ink);
  font-family: var(--bq-font-display);
  font-weight: 900;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.bq-wh-legend__item.is-none .bq-wh-chip { box-shadow: inset 0 0 0 1px var(--bq-line-2); }

.bq-wh-legend__note {
  margin: var(--bq-s2) 0 0;
  font-size: 12.5px;
  color: var(--bq-faint);
}

/* Wide stages: the legend sits beside the wheel as a column */
@container (min-width: 760px) {
  .bq-wh-in {
    grid-template-columns: minmax(0, 1fr) 230px;
    justify-items: stretch;
    gap: var(--bq-s6);
  }
  .bq-wh-stage { justify-self: end; }
  .bq-wh-legend { position: static; width: 100%; }
  .bq-wh-legend__list { flex-direction: column; }
  .bq-wh-legend__item { padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .bq-wh-bulb,
  .bq-wh.is-spinning .bq-wh-bulb,
  .bq-wh.is-hit .bq-wh-bulb { animation: none; opacity: 0.9; }
  .bq-wh.is-hit .bq-wh-glow { animation: none; opacity: 0.32; }
  .bq-wh-hub.is-pop { animation: none; }
}

/* Narrow stages: a compact legend so the wheel keeps the room */
@container (max-width: 520px) {
  .bq-wh-legend { padding: var(--bq-s2) var(--bq-s3); }
  .bq-wh-legend__title { font-size: 11px; margin-bottom: 6px; }
  .bq-wh-legend__list { gap: 6px; }
  .bq-wh-legend__item { font-size: 12px; padding: 2px 8px 2px 2px; gap: 4px; }
  .bq-wh-chip { min-width: 38px; height: 22px; font-size: 12.5px; padding: 0 6px; }
  .bq-wh-legend__note { font-size: 11.5px; margin-top: 6px; }
}

