/* assets/styles/pages/learn/learn-measure-builder.css */
/* Interactive measure-builder and pattern-choice visuals. */

.learn-section-body .beat-boxes,
.learn-shell .beat-boxes,
.learn-lesson-page .beat-boxes {
  --measure-line-y: 50%;
  direction: ltr;
  unicode-bidi: isolate;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  min-width: 0;
  min-height: 120px;
  margin: 22px 0;
  padding: 24px 16px 22px 76px;
  border-radius: 22px;
  border: 1px solid rgba(255,224,138,.24);
  background:
    linear-gradient(to bottom, transparent calc(var(--measure-line-y) - 1px), rgba(255,224,138,.72) var(--measure-line-y), rgba(255,224,138,.72) calc(var(--measure-line-y) + 2px), transparent calc(var(--measure-line-y) + 3px)),
    radial-gradient(circle at 22% 8%, rgba(255,224,138,.08), transparent 16rem),
    rgba(9,9,11,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
}

.learn-section-body .beat-boxes::before,
.learn-shell .beat-boxes::before,
.learn-lesson-page .beat-boxes::before {
  content: '4\A 4';
  direction: ltr;
  unicode-bidi: isolate;
  white-space: pre;
  position: absolute;
  left: 22px;
  top: calc(var(--measure-line-y) - 25px);
  color: #fff0ad;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.92rem;
  font-weight: 900;
  line-height: .82;
  text-align: center;
  text-shadow: 0 0 12px rgba(255,224,138,.16);
}

.learn-section-body .beat-boxes::after,
.learn-shell .beat-boxes::after,
.learn-lesson-page .beat-boxes::after {
  content: '';
  position: absolute;
  left: 62px;
  top: 24px;
  bottom: 34px;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,224,138,.72);
}

.learn-section-body .beat-box,
.learn-shell .beat-box,
.learn-lesson-page .beat-box {
  direction: rtl;
  unicode-bidi: isolate;
  position: relative;
  min-width: 0;
  min-height: 78px;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.learn-section-body .beat-box::after,
.learn-shell .beat-box::after,
.learn-lesson-page .beat-box::after {
  content: '';
  position: absolute;
  right: 0;
  top: 24px;
  bottom: 34px;
  width: 2px;
  border-radius: 999px;
  background: rgba(255,224,138,.46);
}

.learn-section-body .beat-box:first-child::before,
.learn-shell .beat-box:first-child::before,
.learn-lesson-page .beat-box:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 24px;
  bottom: 34px;
  width: 2px;
  border-radius: 999px;
  background: rgba(255,224,138,.46);
}

.learn-section-body .beat-box.selected,
.learn-section-body .beat-box.is-correct,
.learn-section-body .beat-box.is-wrong,
.learn-shell .beat-box.selected,
.learn-shell .beat-box.is-correct,
.learn-shell .beat-box.is-wrong,
.learn-lesson-page .beat-box.selected,
.learn-lesson-page .beat-box.is-correct,
.learn-lesson-page .beat-box.is-wrong {
  outline: none;
}

.learn-section-body .clickable-beats .beat-box,
.learn-shell .clickable-beats .beat-box,
.learn-lesson-page .clickable-beats .beat-box {
  cursor: pointer;
  border-radius: 18px;
}

.learn-section-body .clickable-beats .beat-box:hover,
.learn-section-body .clickable-beats .beat-box:focus-visible,
.learn-shell .clickable-beats .beat-box:hover,
.learn-shell .clickable-beats .beat-box:focus-visible,
.learn-lesson-page .clickable-beats .beat-box:hover,
.learn-lesson-page .clickable-beats .beat-box:focus-visible {
  background: rgba(255,224,138,.075);
  outline: 2px solid rgba(255,224,138,.38);
  outline-offset: -2px;
}

.learn-section-body .beat-box.selected,
.learn-shell .beat-box.selected,
.learn-lesson-page .beat-box.selected { background: rgba(255,224,138,.10); }

.learn-section-body .beat-box.is-correct,
.learn-shell .beat-box.is-correct,
.learn-lesson-page .beat-box.is-correct { background: rgba(126,207,160,.13); }

.learn-section-body .beat-box.is-wrong,
.learn-shell .beat-box.is-wrong,
.learn-lesson-page .beat-box.is-wrong { background: rgba(255,143,177,.12); }

.learn-section-body .beat-content,
.learn-shell .beat-content,
.learn-lesson-page .beat-content {
  position: absolute;
  inset: 0;
  display: block;
  color: transparent;
  font-size: 0;
  line-height: 1;
  text-align: center;
}

.learn-section-body .beat-content::before,
.learn-section-body .beat-content::after,
.learn-shell .beat-content::before,
.learn-shell .beat-content::after,
.learn-lesson-page .beat-content::before,
.learn-lesson-page .beat-content::after { content: none; }

.learn-section-body .beat-box[data-kind='sound'] .beat-content::before,
.learn-shell .beat-box[data-kind='sound'] .beat-content::before,
.learn-lesson-page .beat-box[data-kind='sound'] .beat-content::before {
  content: '';
  position: absolute;
  left: 50%;
  top: var(--measure-line-y);
  width: 24px;
  height: 17px;
  border-radius: 50%;
  background: #fff0ad;
  box-shadow: 0 0 12px rgba(255,224,138,.22);
  transform: translate(-50%, -50%) rotate(-12deg);
}

.learn-section-body .beat-box[data-kind='sound'] .beat-content::after,
.learn-shell .beat-box[data-kind='sound'] .beat-content::after,
.learn-lesson-page .beat-box[data-kind='sound'] .beat-content::after {
  content: '';
  position: absolute;
  left: calc(50% + 9px);
  top: calc(var(--measure-line-y) - 43px);
  width: 3px;
  height: 45px;
  border-radius: 999px;
  background: #fff0ad;
  box-shadow: 0 0 12px rgba(255,224,138,.14);
}

.learn-section-body .beat-box[data-kind='silence'] .beat-content::before,
.learn-shell .beat-box[data-kind='silence'] .beat-content::before,
.learn-lesson-page .beat-box[data-kind='silence'] .beat-content::before {
  content: '𝄽';
  position: absolute;
  left: 50%;
  top: calc(var(--measure-line-y) - 22px);
  display: block;
  color: #fff0ad;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(255,224,138,.22);
  transform: translateX(-50%);
}

.learn-section-body .beat-box:not([data-kind]) .beat-content,
.learn-shell .beat-box:not([data-kind]) .beat-content,
.learn-lesson-page .beat-box:not([data-kind]) .beat-content { display: none; }

.learn-section-body .beat-number,
.learn-shell .beat-number,
.learn-lesson-page .beat-number {
  direction: ltr;
  unicode-bidi: isolate;
  position: absolute;
  left: 50%;
  bottom: 4px;
  z-index: 2;
  min-width: 28px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.74);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 900;
  transform: translateX(-50%);
}

.learn-section-body .pattern-option,
.learn-shell .pattern-option,
.learn-lesson-page .pattern-option {
  border-radius: 24px;
  padding: 12px;
  background: rgba(255,255,255,.035);
}

.learn-section-body .pattern-option .beat-boxes,
.learn-shell .pattern-option .beat-boxes,
.learn-lesson-page .pattern-option .beat-boxes { margin: 0; }

.learn-section-body .beat-boxes.has-center-play,
.learn-section-body .measure-builder.has-center-play,
.learn-shell .beat-boxes.has-center-play,
.learn-shell .measure-builder.has-center-play,
.learn-lesson-page .beat-boxes.has-center-play,
.learn-lesson-page .measure-builder.has-center-play { position: relative; }

.learn-measure-play-btn {
  direction: rtl;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,224,138,.55);
  background: linear-gradient(135deg, rgba(255,224,138,.96), rgba(255,184,108,.96) 48%, rgba(255,143,177,.94));
  color: #16120b;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 14px 34px rgba(0,0,0,.28), 0 0 24px rgba(255,224,138,.16);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

@media (max-width: 640px) {
  .learn-section-body .beat-boxes,
  .learn-shell .beat-boxes,
  .learn-lesson-page .beat-boxes {
    display: grid;
    grid-template-columns: repeat(4, minmax(42px, 1fr));
    min-height: 110px;
    padding: 22px 8px 20px 56px;
    overflow: hidden;
  }

  .learn-section-body .beat-boxes::before,
  .learn-shell .beat-boxes::before,
  .learn-lesson-page .beat-boxes::before {
    left: 15px;
    top: calc(var(--measure-line-y) - 21px);
    font-size: 1.55rem;
  }

  .learn-section-body .beat-boxes::after,
  .learn-shell .beat-boxes::after,
  .learn-lesson-page .beat-boxes::after {
    left: 46px;
    top: 22px;
    bottom: 31px;
  }

  .learn-section-body .beat-box,
  .learn-shell .beat-box,
  .learn-lesson-page .beat-box { min-height: 74px; }

  .learn-section-body .beat-box::after,
  .learn-section-body .beat-box:first-child::before,
  .learn-shell .beat-box::after,
  .learn-shell .beat-box:first-child::before,
  .learn-lesson-page .beat-box::after,
  .learn-lesson-page .beat-box:first-child::before {
    top: 22px;
    bottom: 31px;
  }

  .learn-section-body .beat-box[data-kind='sound'] .beat-content::before,
  .learn-shell .beat-box[data-kind='sound'] .beat-content::before,
  .learn-lesson-page .beat-box[data-kind='sound'] .beat-content::before {
    width: 21px;
    height: 15px;
  }

  .learn-section-body .beat-box[data-kind='sound'] .beat-content::after,
  .learn-shell .beat-box[data-kind='sound'] .beat-content::after,
  .learn-lesson-page .beat-box[data-kind='sound'] .beat-content::after {
    left: calc(50% + 8px);
    top: calc(var(--measure-line-y) - 38px);
    height: 40px;
  }

  .learn-section-body .beat-box[data-kind='silence'] .beat-content::before,
  .learn-shell .beat-box[data-kind='silence'] .beat-content::before,
  .learn-lesson-page .beat-box[data-kind='silence'] .beat-content::before {
    top: calc(var(--measure-line-y) - 22px);
    font-size: 2.45rem;
  }

  .learn-section-body .beat-number,
  .learn-shell .beat-number,
  .learn-lesson-page .beat-number {
    bottom: 3px;
    font-size: .9rem;
  }
}
