/* ---------- play along (interactive drums) ----------
   Appended after the main rules. Every drum is built from CSS only,
   drawn from the real ones in the photos: painted shells with rawhide
   heads, a wood frame drum, a rope-wrapped djembe, a painted gourd rattle.
   The stage is a circle of eight chairs with the logo in the middle. */

:root {
  --ink-night: #141b45;
  --cream-line: rgba(247, 233, 207, 0.22);
}

.section.section-ink {
  background: var(--ink-night);
  color: var(--night-text);
}

.section.section-ink h2 {
  color: var(--cream);
}

.section.section-ink a {
  color: var(--night-link);
}

.section-ink :focus-visible {
  outline-color: var(--night-link);
}

/* ---------- layout ---------- */

.play-grid {
  display: grid;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}

.play-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
  margin-top: 1.75rem;
}

html:not(.js) .play-controls {
  display: none;
}

/* .btn was written for links; as a real <button> it needs these three resets. */
.play-controls button.btn {
  border: 0;
  font-family: var(--font-sans);
  cursor: pointer;
}

.tempo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--night-muted);
  font-size: 1rem;
}

.tempo input[type='range'] {
  width: 140px;
  min-height: 44px;
  margin: 0;
  accent-color: var(--night-link);
  cursor: pointer;
}

.tempo output {
  min-width: 6ch;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}

.play-note {
  margin-top: 1.25rem;
  color: var(--night-muted);
  font-size: 1rem;
}

/* ---------- the circle ---------- */

.stage-wrap {
  min-width: 0;
}

.stage {
  --key: 26px;
  position: relative;
  width: min(100%, 540px);
  aspect-ratio: 1;
  margin-inline: auto;
}

.stage-ring {
  position: absolute;
  inset: 4%;
  border: 1px dashed var(--cream-line);
  border-radius: 50%;
  transition: border-color 200ms ease;
}

.stage.is-playing .stage-ring {
  border-color: rgba(247, 233, 207, 0.36);
}

.seat {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--cream-line);
  box-shadow: 0 0 0 0 rgba(127, 207, 182, 0);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.seat.is-on {
  background: var(--night-link);
  box-shadow: 0 0 0 6px rgba(127, 207, 182, 0.2);
}

.seat-0 { left: 50%;   top: 4%; }
.seat-1 { left: 82.5%; top: 17.5%; }
.seat-2 { left: 96%;   top: 50%; }
.seat-3 { left: 82.5%; top: 82.5%; }
.seat-4 { left: 50%;   top: 96%; }
.seat-5 { left: 17.5%; top: 82.5%; }
.seat-6 { left: 4%;    top: 50%; }
.seat-7 { left: 17.5%; top: 17.5%; }

.stage-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 19%;
  margin: -9.5% 0 0 -9.5%;
}

.stage-center img {
  width: 100%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(247, 233, 207, 0.3), 0 8px 16px -6px rgba(0, 0, 0, 0.55);
}

/* ---------- pads ---------- */

.pad {
  position: absolute;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font: inherit;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html:not(.js) .pad {
  cursor: default;
}

.pad:focus-visible {
  outline: 3px solid var(--night-link);
  outline-offset: 6px;
  border-radius: 50%;
}

.pad-gathering { left: 31%; top: 31%; width: 31%; }
.pad-frame     { left: 69%; top: 31%; width: 27%; }
.pad-djembe    { left: 69%; top: 69%; width: 25%; }
.pad-shaker    { left: 31%; top: 69%; width: 17%; }

.pad-head {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 9px 14px -7px rgba(0, 0, 0, 0.65);
  transition: transform 90ms ease-out;
}

.pad-head::before,
.pad-head::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.pad.is-hit .pad-head {
  transform: scale(0.955);
}

/* Gathering drum: painted shell rim, rawhide head. The paint runs in a
   repeating hand-painted run of ember, black outline, gold, green and blue. */

.pad-gathering .pad-head {
  background:
    repeating-conic-gradient(
      from 8deg,
      #b8501f 0 17deg,
      #231a2e 17deg 20deg,
      #e2a62f 20deg 36deg,
      #1e8a72 36deg 52deg,
      #231a2e 52deg 55deg,
      #2c3d8f 55deg 72deg
    );
  box-shadow:
    0 9px 14px -7px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(20, 10, 5, 0.5);
}

.pad-gathering .pad-head::before {
  inset: 9%;
  background:
    radial-gradient(circle at 66% 62%, rgba(140, 100, 55, 0.16) 0, transparent 20%),
    radial-gradient(circle at 28% 72%, rgba(140, 100, 55, 0.12) 0, transparent 16%),
    radial-gradient(circle at 60% 24%, rgba(150, 115, 70, 0.09) 0, transparent 14%),
    radial-gradient(circle at 34% 28%, #fbf3e0 0%, #f0e0be 52%, #dcc496 100%);
  box-shadow:
    0 0 0 1.5px rgba(60, 38, 18, 0.6),
    inset 3px 4px 8px -3px rgba(90, 60, 25, 0.45),
    inset -2px -3px 6px -3px rgba(255, 255, 255, 0.3);
}

.pad-gathering .pad-head::after {
  inset: 0;
  background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.16), transparent 40%);
}

/* Frame drum: thin dark wood hoop, lighter rawhide head. */

.pad-frame .pad-head {
  background: conic-gradient(
    from 30deg,
    #7a5636,
    #63452b 16%,
    #82593a 34%,
    #5e4128 54%,
    #77532f 74%,
    #6b4a2e 88%,
    #7a5636
  );
  box-shadow:
    0 9px 14px -7px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(25, 14, 6, 0.55),
    inset 1px 2px 0 rgba(255, 220, 170, 0.18);
}

.pad-frame .pad-head::before {
  inset: 5%;
  background:
    radial-gradient(circle at 64% 66%, rgba(150, 110, 60, 0.14) 0, transparent 22%),
    radial-gradient(circle at 26% 62%, rgba(150, 110, 60, 0.1) 0, transparent 15%),
    radial-gradient(circle at 36% 30%, #f7ecd2 0%, #ecdab4 56%, #d8bf90 100%);
  box-shadow:
    0 0 0 1px rgba(40, 24, 10, 0.55),
    inset 2px 3px 6px -2px rgba(90, 60, 25, 0.4),
    inset -2px -2px 5px -2px rgba(255, 255, 255, 0.28);
}

.pad-frame .pad-head::after {
  inset: 0;
  background: radial-gradient(circle at 30% 24%, rgba(255, 245, 225, 0.14), transparent 42%);
}

/* Djembe: twisted red rope tension rim, smooth off-white head. 52 slices of
   6.9231 degrees fit the circle exactly, so no seam shows at the top. */

.pad-djembe .pad-head {
  background: repeating-conic-gradient(
    #b8361a 0 3.4615deg,
    #7f2210 3.4615deg 6.9231deg
  );
  box-shadow:
    0 9px 14px -7px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(30, 6, 2, 0.5);
}

.pad-djembe .pad-head::before {
  inset: 10%;
  background: radial-gradient(circle at 34% 28%, #fcf9f1 0%, #f0eadc 58%, #ddd5c3 100%);
  box-shadow:
    0 0 0 2px rgba(40, 8, 4, 0.55),
    inset 3px 4px 8px -3px rgba(80, 70, 50, 0.4),
    inset -2px -3px 6px -3px rgba(255, 255, 255, 0.5);
}

.pad-djembe .pad-head::after {
  inset: 0;
  background: radial-gradient(
    circle closest-side,
    transparent 0 79%,
    rgba(0, 0, 0, 0.3) 80.5%,
    rgba(255, 190, 160, 0.12) 90%,
    rgba(0, 0, 0, 0.32) 100%
  );
}

/* Shaker: a small painted gourd, drawn as a little globe. */

.pad-shaker .pad-head {
  background:
    radial-gradient(ellipse 25% 15% at 40% 33%, #3f9350 0 88%, transparent 100%),
    radial-gradient(ellipse 12% 19% at 29% 50%, #3b8b4a 0 88%, transparent 100%),
    radial-gradient(ellipse 20% 10% at 62% 58%, #4a9a4c 0 88%, transparent 100%),
    radial-gradient(ellipse 13% 8% at 71% 73%, #86a64d 0 88%, transparent 100%),
    radial-gradient(circle at 32% 26%, #7cc0e6 0%, #3f8fd0 38%, #245c9e 78%, #183f78 100%);
  box-shadow:
    0 8px 12px -6px rgba(0, 0, 0, 0.65),
    inset -5px -7px 12px -4px rgba(8, 20, 60, 0.5),
    inset 2px 3px 6px -2px rgba(255, 255, 255, 0.22);
}

/* ---------- key badges ---------- */

.pad-key {
  position: absolute;
  left: var(--kx, 67%);
  top: var(--ky, 97%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--key);
  height: var(--key);
  margin: calc(var(--key) / -2) 0 0 calc(var(--key) / -2);
  border-radius: 50%;
  background: var(--ink-night);
  color: var(--cream);
  box-shadow: 0 0 0 1px rgba(247, 233, 207, 0.4);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  pointer-events: none;
}

.pad-shaker .pad-key {
  --kx: 95%;
  --ky: 95%;
}

/* ---------- hit ripple ---------- */

.ripple {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(247, 233, 207, 0.7);
  border-radius: 50%;
  pointer-events: none;
  animation: play-ripple 700ms cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}

@keyframes play-ripple {
  from {
    transform: scale(0.92);
    opacity: 0.9;
  }
  to {
    transform: scale(1.55);
    opacity: 0;
  }
}

/* ---------- legend ---------- */

.pad-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  width: min(100%, 540px);
  margin: 1.25rem auto 0;
  padding: 0;
  list-style: none;
  color: var(--night-muted);
  font-size: 0.98rem;
}

.pad-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pad-legend kbd {
  padding: 0.1em 0.5em;
  border: 1px solid rgba(247, 233, 207, 0.3);
  border-radius: 4px;
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 0.8em;
  line-height: 1.35;
}

/* ---------- larger screens ---------- */

@media (min-width: 900px) {
  .play-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .stage {
    --key: 22px;
  }

  .pad-key {
    font-size: 0.78rem;
  }

  .pad-legend {
    gap: 0.4rem 1rem;
    font-size: 0.95rem;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .ripple {
    display: none;
  }

  .pad.is-hit .pad-head {
    transform: none;
    filter: brightness(1.12);
  }
}
