/* ==========================================================================
   MONTEIRO & QUINTÃO ADVOCACIA — REPRODUTOR DE ÁUDIO EDITORIAL
   Barra Linear Quiet Luxury em Marinho, Marfim e Ouro
   Design unificado, sem redundância e com tipografia nobre
   ========================================================================== */

.article-audio-wrapper {
  max-width: 74rem;
  margin: 1.5rem auto 2.2rem;
  padding: 0 2rem;
}

.editorial-audio-card {
  background: #FAF8F2;
  border: 1px solid #DCD5C5;
  border-left: 3px solid #B38E5D;
  box-shadow: 0 4px 16px -6px rgba(44, 52, 65, 0.08);
  padding: 0.85rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  border-radius: 999px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editorial-audio-card:hover {
  border-color: #C8C0AC;
  box-shadow: 0 6px 20px -8px rgba(44, 52, 65, 0.14);
}

.btn-play-pause {
  width: 44px;
  height: 44px;
  background: #2C3441;
  color: #FAF8F2;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 10px rgba(44, 52, 65, 0.2);
}

.btn-play-pause:hover {
  background: #B38E5D;
  color: #FAF8F2;
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(179, 142, 93, 0.35);
}

.btn-play-pause svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.audio-track-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.audio-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.audio-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #2C3441;
  letter-spacing: 0.02em;
}

.audio-time-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #6C7482;
  font-family: 'Source Sans 3', monospace, sans-serif;
  font-weight: 600;
}

/* R4: trilho desenhado com ::before (5px) e área de toque de 25px no
   elemento transparente — visível e alinhado nos dois temas, sem depender de
   background-clip no shorthand do dark. */
.audio-progress-bar {
  width: 100%;
  height: 25px;
  background: transparent;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.audio-progress-bar::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 5px;
  background: #E5DFD1;
  border-radius: 3px;
  pointer-events: none;
}

[data-theme="dark"] .audio-progress-bar::before {
  background: rgba(243, 239, 230, 0.18);
}

.audio-progress-bar:focus-visible {
  outline: 2px solid var(--marinho, #2C3441);
  outline-offset: 0;
  border-radius: 3px;
}

.audio-progress-fill {
  position: absolute;
  top: 10px;
  left: 0;
  height: 5px;
  background: #2C3441;
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
}

[data-theme="dark"] .audio-progress-fill {
  background: #C5A059;
}

.audio-progress-thumb {
  position: absolute;
  top: 50%;
  right: -5px;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  background: #B38E5D;
  border: 2px solid #FAF8F2;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.btn-speed-toggle {
  background: #FAF8F2;
  border: 1px solid #C8C0AC;
  color: #2C3441;
  padding: 0.35rem 0.65rem;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-speed-toggle:hover {
  background: #2C3441;
  color: #FAF8F2;
  border-color: #2C3441;
}

/* O mesmo conjunto de controles acompanha a leitura, abaixo da marginália. */
.audio-player-home-empty {
  visibility: hidden;
  pointer-events: none;
}

.audio-player-dock[hidden],
.audio-player-sidebar-slot[hidden] {
  display: none;
}

.editorial-marginalia.audio-player-sidebar-active {
  top: var(--audio-sidebar-top, 90px);
  transform: translateY(var(--audio-sidebar-offset, 0px));
}

.audio-player-dock {
  box-sizing: border-box;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  gap: 0;
  box-shadow: 0 8px 28px -8px rgba(27, 33, 43, 0.25);
}

.audio-player-dock .desk-audio-controls {
  width: 100%;
  min-width: 0;
  gap: 0.75rem;
}

.audio-player-dock .audio-track-info {
  order: 0;
  width: auto;
  flex: 1;
}

.audio-player-dock .audio-meta-row {
  flex-wrap: wrap;
  row-gap: 0.1rem;
}

.audio-player-dock .audio-label {
  font-size: 1rem;
}

.audio-player-dock .btn-speed-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0.3rem;
}

.audio-player-dock--fixed {
  position: fixed;
  z-index: 150;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(340px, calc(100% - 32px));
}

body.editorial-page.has-floating-audio {
  padding-bottom: calc(var(--floating-audio-height, 100px) + 32px + env(safe-area-inset-bottom));
}

@media (max-width: 680px) {
  .editorial-audio-card {
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    flex-wrap: wrap;
    gap: 0.85rem;
  }
  .audio-track-info {
    order: 3;
    width: 100%;
    flex: none;
  }
}

/* Celulares estreitos (≤414px): rótulo e tempo podem quebrar linha, para que
   estados longos ("Áudio indisponível", "Carregando...") não estourem o card. */
@media (max-width: 414px) {
  .audio-meta-row,
  .desk-audio-label-row {
    flex-wrap: wrap;
    row-gap: 0.1rem;
  }
  .audio-track-info,
  .desk-audio-body,
  .desk-audio-controls {
    min-width: 0;
  }
  .audio-label {
    font-size: 1rem;
    overflow-wrap: anywhere;
  }
  .audio-time-row {
    flex-wrap: wrap;
    white-space: normal;
  }
  .audio-time-row > span {
    white-space: nowrap;
  }
}
