/* AudioYOO responsive & a11y overrides (safe to load after audioyoo.css)
   Estas reglas no cambian clases ni estructura. Solo mejoran responsive, accesibilidad y robustez.
   Cárgalo como /wp-content/themes/tu-child-theme/audioyoo-overrides.css con prioridad > plugin.
*/

/* 1) Variables base escalables */
:root{
  --ay-font-size: clamp(14px, 1.6vw, 16px);
  --ay-title-size: clamp(16px, 2vw, 20px);
  --ay-radius: 16px;
  --ay-gap: clamp(8px, 2vw, 16px);
  --ay-padding: clamp(12px, 3vw, 20px);
  --ay-touch: 44px; /* tamaño mínimo de objetivo táctil */
}

/* 2) Contenedor principal */
.ay-player{
  font-size: var(--ay-font-size);
  border-radius: var(--ay-radius);
  padding: var(--ay-padding);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ay-gap);
  max-width: min(100%, 720px);
  box-sizing: border-box;
}

/* 3) Carátula adaptable (cuando existe .ay-cover img o cuando se usa --ay-cover) */
.ay-player .ay-cover{
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
}
.ay-player .ay-cover img{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--ay-radius);
}

/* Cuando el diseño del plugin coloca la carátula como background con --ay-cover */
.ay-player{
  /* asegura que el background-cover (si se usa) respete radios si el CSS original lo usa */
  background-size: cover;
  background-position: center;
}

/* 4) Tipografía y truncado seguro */
.audio-title{
  font-size: var(--ay-title-size);
  line-height: 1.25;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* truncado a 2 líneas en móviles */
  -webkit-box-orient: vertical;
}
.audio-desc{
  line-height: 1.5;
  opacity: .9;
}

/* 5) Botón de control: tamaño táctil y estados accesibles */
.ay-btn{
  min-width: var(--ay-touch);
  min-height: var(--ay-touch);
  border-radius: calc(var(--ay-radius) - 4px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Estados de foco accesibles */
.ay-btn:focus-visible,
.ay-progress:focus-visible,
.ay-volume-slider:focus-visible{
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 8px;
}

/* 6) Barra de progreso: clicable y usable */
.ay-progress{
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
}
.ay-progress .ay-progress-fill{
  height: 100%;
  transition: width .12s linear;
}
.ay-progress .ay-progress-knob{
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
}

/* 7) Slider de volumen: cómodo en móvil */
.ay-volume{
  display: flex;
  align-items: center;
}
.ay-volume .ay-volume-slider{
  width: 100%;
  min-height: 32px;
  touch-action: pan-y;
}

/* 8) Layouts mayores: en pantallas anchas se puede usar dos columnas */
@media (min-width: 720px){
  .ay-player{
    grid-template-columns: minmax(240px, 320px) 1fr;
    align-items: center;
  }
  .ay-player .ay-cover{
    margin: 0;
    justify-self: start;
  }
}

/* 9) Respeto a usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce){
  *{
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 10) Modo oscuro/claro por tokens (no forzamos colores exactos aquí) */
@media (prefers-color-scheme: dark){
  .ay-player{
    /* ejemplo de ligera elevación en dark; el CSS original define colores */
    /* si el original ya añade colores, estas líneas no los pisan */
    background-clip: padding-box;
  }
}

/* 11) RTL soporte básico */
[dir="rtl"] .ay-time{
  direction: rtl;
}
[dir="rtl"] .ay-sep{
  margin-inline: .25rem;
}

/* 12) Estados utilitarios que ya usa tu JS */
.ay-player.is-playing .ay-icon-play{ display:none !important; }
.ay-player.is-playing .ay-icon-pause{ display:inline-block !important; }
.ay-player.is-scrubbing{ cursor: grabbing; }
