/* ==========================================================================
   UI-кит: Pill, Button, ToggleButton, Knob, Meter, EffectModule,
   EffectChain, Transport. Классы совпадают с именами функций в components.js.
   ========================================================================== */

/* ---------- Pill — плашка-тег ---------- */
.Pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 13px;
  white-space: nowrap;
}
.Pill--light {
  background: var(--glass);
}

/* ---------- Button / ToggleButton ---------- */
.Button,
.ToggleButton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.1s,
    background 0.2s,
    opacity 0.2s;
}
.Button:active,
.ToggleButton:active {
  transform: scale(0.95);
}
.Button:disabled {
  opacity: 0.4;
  cursor: default;
}
.Button.is-active {
  background: var(--ink);
  color: var(--paper);
}
.Button--record .Button__Icon {
  color: var(--rose-700);
}
.Button--record.is-active {
  background: var(--rose-700);
  animation: pulse 1.2s ease-in-out infinite;
}
.Button--record.is-active .Button__Icon {
  color: var(--paper);
}
.ToggleButton {
  height: 22px;
  padding: 0 var(--space-2);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.7);
}
.ToggleButton[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 8px rgba(226, 41, 90, 0.25);
  }
}

/* ---------- Knob ---------- */
.Knob {
  --accent: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
}
.Knob__Dial {
  width: 36px;
  height: 36px;
  cursor: ns-resize;
  touch-action: none;
  border-radius: 50%;
  outline: none;
}
.Knob__Dial:focus-visible {
  box-shadow: 0 0 0 2px var(--paper);
}
.Knob__Track,
.Knob__Arc {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}
.Knob__Track {
  stroke: rgba(255, 255, 255, 0.7);
}
.Knob__Arc {
  stroke: var(--accent);
}
.Knob__Cap {
  fill: var(--paper);
}
.Knob__Pointer {
  fill: var(--accent);
}
.Knob__Name,
.Knob__Value {
  margin-top: 1px;
  font-size: 10px;
  line-height: 12px;
  white-space: nowrap;
}
/* при наведении и вращении имя сменяется значением */
.Knob__Value,
.Knob:hover .Knob__Name,
.Knob.is-dragging .Knob__Name,
.Knob:focus-within .Knob__Name {
  display: none;
}
.Knob:hover .Knob__Value,
.Knob.is-dragging .Knob__Value,
.Knob:focus-within .Knob__Value {
  display: block;
}

/* ---------- Meter ---------- */
.Meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  height: 100%;
}
.Meter__Track {
  flex: 1;
  width: 12px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.Meter__Fill {
  width: 100%;
  height: 100%;
  transform: scaleY(0);
  transform-origin: bottom;
  background: linear-gradient(to top, var(--lilac-500), var(--rose-500));
}
.Meter__Name {
  font-size: 11px;
}

/* ---------- EffectChain / EffectModule ---------- */
.EffectChain {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
}
.EffectModule {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2) 0 6px;
  border-radius: var(--radius-s);
  background: var(--glass);
}
/* связка: сигнал идёт сверху вниз */
.EffectModule + .EffectModule::before {
  content: '';
  position: absolute;
  left: 15px;
  top: -6px;
  width: 3px;
  height: 6px;
  background: var(--paper);
}
.EffectModule__Header {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: 6px;
  row-gap: 4px;
}
.EffectModule__Header .ToggleButton {
  grid-column: 2;
  justify-self: start;
}
.EffectModule__Index {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  font-size: 11px;
}
.EffectModule__Name {
  font-size: 11px;
  white-space: nowrap;
}
.EffectModule__Controls {
  display: grid;
  grid-template-columns: 48px 48px;
}

/* ---------- Segmented ---------- */
.Segmented {
  display: flex;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--paper);
}
.Segmented__Option {
  min-width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
}
.Segmented__Option[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
.Segmented__Option:disabled {
  cursor: default;
}
.Segmented__Option:disabled:not([aria-pressed='true']) {
  opacity: 0.35;
}

/* ---------- Stepper ---------- */
.Stepper {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  height: 40px;
  padding: 0 var(--space-1) 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--glass);
  font-size: 13px;
}
.Stepper__Name {
  margin-right: var(--space-1);
}
.Stepper__Button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  font-size: 16px;
}
.Stepper__Value {
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* ---------- Transport ---------- */
.Transport {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: var(--border);
}
.Transport__Time {
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 800;
}
