/*
 * Player do YouTube com controles próprios. Cópia do player do workshop
 * (workshop/clube-chic/assets/css/workshop.css, seção PLAYER): ao corrigir um, corrija o outro.
 * As variáveis --ws-* ficam presas ao .cp para não mexer no resto da página.
 */

.cp {
  --ws-ouro: #C6A25C;
  --ws-ouro-claro: #E6CD8F;
  --ws-branco: #FBF8F1;
  --ws-grad-botao: linear-gradient(120deg, #8A6A2A, #E6CD8F 42%, #B98F3E 68%, #F0DFAE);
  --ws-sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ws-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  box-sizing: border-box;
}
.cp *, .cp *::before, .cp *::after { box-sizing: border-box; }
.cp [hidden] { display: none !important; }

.cp {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: #0a140e;
  color: var(--ws-branco);
  font-family: var(--ws-sans);
  isolation: isolate;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.cp:focus-visible { box-shadow: inset 0 0 0 2px var(--ws-ouro); }
.cp svg { display: block; }
.cp-pre { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cp-noscript { position: absolute; inset: auto 0 0; margin: 0; padding: 14px; text-align: center; background: rgba(10, 20, 14, 0.85); font-size: 14px; }

/* iframe maior que a área visível: as faixas de cima e de baixo (título e logo) ficam cortadas */
.cp-frame { position: absolute; left: 0; width: 100%; top: -60px; height: calc(100% + 120px); z-index: 0; pointer-events: none; }
.cp-frame iframe, .cp-alvo { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.cp-pausa {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 14, 0.5);
  -webkit-backdrop-filter: blur(8px) saturate(0.9);
  backdrop-filter: blur(8px) saturate(0.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  pointer-events: none;
}
.cp.is-pausado .cp-pausa { opacity: 1; visibility: visible; }

.cp-escudo { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.cp.is-ocioso, .cp.is-ocioso .cp-escudo { cursor: none; }

.cp-capa {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  cursor: pointer;
  transition: opacity 0.5s var(--ws-ease), visibility 0.5s;
}
.cp-capa::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(65% 65% at 50% 50%, rgba(20, 40, 27, 0.1), rgba(20, 40, 27, 0.5) 70%, rgba(20, 40, 27, 0.78)),
    linear-gradient(to top, rgba(20, 40, 27, 0.6), rgba(20, 40, 27, 0) 45%);
}
.cp-capa-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.cp.is-tocou .cp-capa { opacity: 0; visibility: hidden; pointer-events: none; }

/* primeiro clique vai direto para o iframe (iPhone e Safari recusam o play pedido de fora) */
.cp.is-passa .cp-frame { pointer-events: auto; }
.cp.is-passa .cp-capa, .cp.is-passa .cp-escudo { pointer-events: none; }

.cp-grande {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(64px, 10vw, 94px);
  height: clamp(64px, 10vw, 94px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ws-grad-botao);
  color: #17301F;
  cursor: pointer;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  transition: transform 0.45s var(--ws-ease), box-shadow 0.45s ease, opacity 0.3s ease;
}
.cp-grande svg { width: 36%; height: 36%; margin-left: 6%; }
.cp-grande::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(230, 205, 143, 0.6);
  animation: cp-onda 2.6s ease-out infinite;
  pointer-events: none;
}
/* :hover no .cp porque, com o player pronto, o mouse está sobre o iframe (a capa deixa passar) */
.cp:hover .cp-grande { transform: scale(1.06); box-shadow: 0 24px 60px rgba(198, 162, 92, 0.35); }
.cp-grande--fantasma::before { display: none; }
.cp-grande--fantasma { background: rgba(251, 248, 241, 0.14); color: var(--ws-branco); border: 1px solid rgba(251, 248, 241, 0.35); box-shadow: none; }

.cp-retomar {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(198, 162, 92, 0.5);
  background: rgba(20, 40, 27, 0.65);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ws-ouro-claro);
}

.cp-carregando {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.cp-carregando span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(230, 205, 143, 0.22);
  border-top-color: var(--ws-ouro-claro);
  animation: cp-gira 0.8s linear infinite;
}
.cp.is-carregando .cp-carregando { opacity: 1; }
.cp.is-carregando:not(.is-tocou) .cp-grande,
.cp.is-carregando:not(.is-tocou) .cp-retomar { opacity: 0; }

.cp-fim,
.cp-aviso {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(rgba(14, 28, 19, 0.8), rgba(14, 28, 19, 0.9)),
    var(--cp-capa, none) center / cover no-repeat,
    #0f1d14;
}
.cp-aviso p { margin: 0; max-width: 40ch; font-size: 15px; line-height: 1.6; color: rgba(245, 241, 232, 0.85); }
.cp-fim-repetir {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid rgba(198, 162, 92, 0.6);
  border-radius: 999px;
  background: transparent;
  color: var(--ws-ouro-claro);
  font: 400 11px var(--ws-sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}
.cp-fim-repetir:hover { background: rgba(198, 162, 92, 0.12); color: var(--ws-branco); }
.cp-fim-repetir svg { width: 18px; height: 18px; }
.cp-fim-proximo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px;
  border-radius: 999px;
  background: var(--ws-grad-botao);
  color: #17301F;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cp-fim-proximo:hover { color: #17301F; box-shadow: 0 16px 36px rgba(198, 162, 92, 0.3); }
.cp-fim-proximo svg { width: 16px; height: 16px; }
.cp-fim-msg { margin: 0; max-width: 36ch; font-size: 14px; line-height: 1.6; color: rgba(245, 241, 232, 0.75); }

/* controles */
.cp-controles {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 48px clamp(8px, 1.8vw, 18px) clamp(4px, 1vw, 10px);
  background: linear-gradient(to top, rgba(6, 13, 9, 0.9), rgba(6, 13, 9, 0.5) 50%, rgba(6, 13, 9, 0));
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  pointer-events: none;
}
.cp.is-tocou .cp-controles { opacity: 1; visibility: visible; transform: none; }
.cp.is-tocou.is-ocioso .cp-controles { opacity: 0; visibility: hidden; transform: translateY(6px); }
.cp.is-tocou .cp-progresso,
.cp.is-tocou .cp-barra { pointer-events: auto; }
.cp.is-tocou.is-ocioso .cp-progresso,
.cp.is-tocou.is-ocioso .cp-barra { pointer-events: none; }

.cp-progresso { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; margin: 0 6px; }
.cp-trilho { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(251, 248, 241, 0.2); overflow: hidden; transition: height 0.2s ease; }
.cp-progresso:hover .cp-trilho,
.cp-progresso:focus-visible .cp-trilho,
.cp.is-arrastando .cp-trilho { height: 6px; }
.cp-buffer, .cp-assistido { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); }
.cp-buffer { background: rgba(251, 248, 241, 0.28); }
.cp-assistido { background: linear-gradient(90deg, #B98F3E, #F0DFAE); }
.cp-cabeca {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #F0DFAE;
  box-shadow: 0 0 0 4px rgba(198, 162, 92, 0.28);
  transform: scale(0);
  transition: transform 0.2s ease;
  pointer-events: none;
}
.cp-progresso:hover .cp-cabeca,
.cp-progresso:focus-visible .cp-cabeca,
.cp.is-arrastando .cp-cabeca { transform: scale(1); }
.cp-dica {
  position: absolute;
  bottom: 24px;
  left: 0;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(198, 162, 92, 0.4);
  background: rgba(10, 20, 14, 0.94);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.cp-progresso.is-dica .cp-dica { opacity: 1; }

.cp-barra { display: flex; align-items: center; gap: 2px; }
.cp-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ws-branco);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.cp-btn:hover { color: var(--ws-ouro-claro); background: rgba(251, 248, 241, 0.07); }
.cp-btn:focus-visible { outline: 2px solid var(--ws-ouro); outline-offset: -2px; }
.cp-btn svg { width: 22px; height: 22px; }
.cp-btn--vel { width: auto; min-width: 48px; padding: 0 10px; font: 500 12.5px/1 var(--ws-sans); letter-spacing: 0.04em; }
.cp-volume { display: flex; align-items: center; }
.cp-vol { width: 0; opacity: 0; margin: 0; accent-color: var(--ws-ouro); transition: width 0.25s ease, opacity 0.25s ease, margin 0.25s ease; cursor: pointer; }
.cp-volume:hover .cp-vol,
.cp-vol:focus-visible { width: 78px; opacity: 1; margin: 0 6px 0 2px; }
.cp-tempo { margin-left: 8px; font-size: 12.5px; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; color: rgba(251, 248, 241, 0.86); white-space: nowrap; }
.cp-sep { margin: 0 5px; opacity: 0.45; }
.cp-espaco { flex: 1; }

/* tela cheia */
.cp:fullscreen { border-radius: 0; background: #000; aspect-ratio: auto; }
.cp:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; background: #000; }
.cp.is-tela-cheia {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
.cp.is-tela-cheia .cp-controles {
  padding-left: calc(env(safe-area-inset-left, 0px) + 14px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 14px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}
html.cp-travado, html.cp-travado body { overflow: hidden; }
html.cp-travado [data-sticky] { display: none; }

/* sem a API do YouTube: embed comum */
.cp.is-simples .cp-frame { top: 0; left: 0; width: 100%; height: 100%; pointer-events: auto; }
.cp.is-simples .cp-escudo,
.cp.is-simples .cp-capa,
.cp.is-simples .cp-controles,
.cp.is-simples .cp-pausa,
.cp.is-simples .cp-carregando { display: none; }

@media (hover: none) {
  .cp-vol { display: none; }
  .cp-cabeca { transform: scale(0.85); }
}
@media (max-width: 420px) {
  .cp-btn { width: 36px; height: 36px; }
  .cp-btn svg { width: 20px; height: 20px; }
  .cp-btn--salto { display: none; }
  .cp-btn--vel { min-width: 42px; padding: 0 6px; font-size: 12px; }
  .cp-tempo { margin-left: 4px; font-size: 11.5px; }
}

@keyframes cp-onda { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.4); opacity: 0; } }
@keyframes cp-gira { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .cp-grande::before { animation: none; }
}
