/* =============================================
   AUDIO AMBIENT TOGGLE — Etapa 5
   Botón flotante bottom-right.
   3 estados: off (default) · low (10%) · med (25%).
   Tint dorado granadero cuando activo.
   ============================================= */

.audio-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
}

/* ─── Cuando convive con .fab-ticket (solo en index.html):
       lo apilamos arriba del FAB con un gap chico,
       alineado al mismo right edge. ─── */
.audio-toggle.audio-toggle--with-fab {
  /* 2rem (FAB bottom) + 56px (FAB diámetro) + 12px gap */
  bottom: calc(2rem + 68px);
  right: 2rem;
}

.audio-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  opacity: 0.7;

  transition:
    transform   var(--dur-fast) var(--ease-out-expo),
    background  var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    opacity     var(--dur-fast) ease,
    box-shadow  var(--dur-fast) ease;
}

.audio-toggle:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: var(--depth-3);
}

.audio-toggle:focus-visible {
  outline: 2px solid var(--c-granadero);
  outline-offset: 3px;
}

/* ─── Off: muted ─── */
.audio-toggle--off       { opacity: 0.55; }
.audio-toggle--off:hover { opacity: 0.9; }

/* ─── Active states: tint dorado granadero ─── */
.audio-toggle--low,
.audio-toggle--med {
  background: rgba(212, 160, 23, 0.18);
  border-color: rgba(212, 160, 23, 0.4);
}
.audio-toggle--low:hover,
.audio-toggle--med:hover {
  background: rgba(212, 160, 23, 0.26);
}

/* ─── Icon (3 bars, bottom-anchored) ─── */
.audio-toggle__icon {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 16px;
  width: 18px;
  position: relative;
}

.audio-toggle__bar {
  width: 3px;
  height: 16px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: bottom center;
  transition: transform var(--dur-base) var(--ease-out-expo);
}

/* Off: barras chiquitas + slash diagonal */
.audio-toggle--off .audio-toggle__bar { transform: scaleY(0.4); }

.audio-toggle--off::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 1px;
  transform: rotate(-45deg);
  pointer-events: none;
}

/* Low: barras estáticas chicas */
.audio-toggle--low .audio-toggle__bar:nth-child(1) { transform: scaleY(0.35); }
.audio-toggle--low .audio-toggle__bar:nth-child(2) { transform: scaleY(0.6); }
.audio-toggle--low .audio-toggle__bar:nth-child(3) { transform: scaleY(0.35); }

/* Med: barras animadas */
.audio-toggle--med .audio-toggle__bar {
  animation: audioToggleBar 0.9s ease-in-out infinite alternate;
}
.audio-toggle--med .audio-toggle__bar:nth-child(1) { animation-delay: 0s;    }
.audio-toggle--med .audio-toggle__bar:nth-child(2) { animation-delay: 0.2s;  }
.audio-toggle--med .audio-toggle__bar:nth-child(3) { animation-delay: 0.45s; }

@keyframes audioToggleBar {
  0%   { transform: scaleY(0.35); }
  50%  { transform: scaleY(1.0);  }
  100% { transform: scaleY(0.55); }
}

/* Mobile */
@media (max-width: 600px) {
  .audio-toggle {
    bottom: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
  }
  /* FAB en mobile = 54px (padding 13px). Mantengo alineación. */
  .audio-toggle.audio-toggle--with-fab {
    bottom: calc(2rem + 64px);
    right: 2rem;
  }
}

/* Reduced motion: sin animación en med */
@media (prefers-reduced-motion: reduce) {
  .audio-toggle--med .audio-toggle__bar {
    animation: none;
    transform: scaleY(0.7);
  }
}
