/* ─── WORKS DETAIL INMERSIVO (/works/{slug}) ─────────────────────────────── */

/* Body fullscreen: sin scroll, negro puro */
body.body--works-detail {
  overflow: hidden;
  height: 100svh;
  background: #000;
}
/* Ocultar el splash screen en páginas de work */
body.body--works-detail .splash { display: none !important; }

/* Escena raíz */
.wd-scene {
  position: fixed;
  inset: 0;
}

/* ── Layer 0: Video / imagen de fondo ── */
.wd-video-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
}

/* Override para video-player en modo fullscreen */
body.body--works-detail .video-player,
body.body--works-detail .video-player.vp-ready {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: #000;
}
body.body--works-detail .vp-inner {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: unset !important;
  overflow: hidden;
  cursor: default;
}
body.body--works-detail .vp-media {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
/* YT: el iframe está dentro de un div generado por la API */
body.body--works-detail .vp-media > div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
body.body--works-detail .vp-media iframe {
  width: 100% !important;
  height: 100% !important;
  pointer-events: none; /* el control lo ejerce works-detail.js */
}
body.body--works-detail .vp-video {
  object-fit: cover;
}
body.body--works-detail .vp-controls { display: none !important; }
body.body--works-detail .vp-poster   { display: none !important; }

/* Imagen de fondo (cuando no hay video) */
.wd-bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.wd-bg-placeholder {
  position: absolute;
  inset: 0;
}
.wd-bg-texture {
  position: absolute;
  inset: 0;
  opacity: .2;
}

/* Gradiente sutil sobre el video para legibilidad de overlays */
.wd-scene::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.45) 0%, transparent 25%),
    linear-gradient(to top,    rgba(0,0,0,.55) 0%, transparent 35%),
    linear-gradient(to right,  rgba(0,0,0,.35) 0%, transparent 30%),
    linear-gradient(to left,   rgba(0,0,0,.35) 0%, transparent 30%);
  pointer-events: none;
}

/* ── Layer 1: Botón play central ── */
.wd-play-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, .3);
 backdrop-filter: blur(10px) saturate(0);
  -webkit-backdrop-filter: blur(10px) saturate(0);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .35s ease, background .2s, border-color .2s, transform .15s ease;
  outline: none;
}
.wd-play-btn:hover {
  background: rgba(130, 49, 255, .55);
  border-color: rgba(130, 49, 255, .6);
  transform: translate(-50%, -50%) scale(1.08);
}
.wd-play-btn:focus-visible {
  outline: 2px solid #8231ff;
  outline-offset: 4px;
}
.wd-play-btn.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Iconos del botón play: tres estados superpuestos */
.wd-icon {
  position: absolute;
  transition: opacity .2s ease, transform .2s ease;
  display: block;
}
/* Idle: A visible */
.wd-icon-a     { opacity: 1;  transform: scale(1);   }
.wd-icon-play  { opacity: 0;  transform: scale(.75); }
.wd-icon-pause { opacity: 0;  transform: scale(.75); }

/* Hover: A → play */
.wd-play-btn:hover .wd-icon-a    { opacity: 0; transform: scale(.75); }
.wd-play-btn:hover .wd-icon-play { opacity: 1; transform: scale(1);   }

/* Playing: muestra pause */
.wd-play-btn.is-playing .wd-icon-a     { opacity: 0; transform: scale(.75); }
.wd-play-btn.is-playing .wd-icon-play  { opacity: 0; transform: scale(.75); }
.wd-play-btn.is-playing .wd-icon-pause { opacity: 1; transform: scale(1);   }

/* Playing + hover: mantiene pause */
.wd-play-btn.is-playing:hover .wd-icon-play  { opacity: 0; }
.wd-play-btn.is-playing:hover .wd-icon-pause { opacity: 1; }

/* ── Layer 2: Overlays (auto-hide) ── */
.wd-overlays {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none; /* los hijos activan su propio pointer-events */
  transition: opacity .4s ease;
}
.wd-overlays.is-hidden {
  opacity: 0;
}

/* Ficha técnica — esquina superior izquierda */
.wd-meta {
  position: absolute;
  top: 28px;
  left: 32px;
  pointer-events: auto;
  max-width: 260px;
}
.wd-meta-cat {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
  display: block;
  margin-bottom: 5px;
}
.wd-meta-title {
  font-family: var(--f-disp);
  font-size: clamp(15px, 1.8vw, 21px);
  font-weight: 400;
  font-style: italic;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.wd-meta-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
}
.wd-meta-table dt {
  font-family: var(--f-mono);
  font-size: 8px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  padding-top: 2px;
  white-space: nowrap;
}
.wd-meta-table dd {
  font-size: 11px;
  color: rgba(255, 255, 255, .8);
  margin: 0;
}

/* Cuando el vídeo es de YouTube, bajar la ficha técnica para no chocar
   con el título que YouTube reinyecta en la parte superior al hacer hover. */
body.wd-has-youtube .wd-meta { top: 72px; }

/* Botón cerrar — esquina superior derecha */
.wd-close {
  position: absolute;
  top: 24px;
  right: 28px;
  pointer-events: auto;
  color: rgba(255, 255, 255, .55);
  text-decoration: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .1);
  transition: color .2s, background .2s, border-color .2s;
}
.wd-close:hover {
  color: #fff;
  background: rgba(0, 0, 0, .45);
  border-color: rgba(255, 255, 255, .25);
}

/* Strip inferior central: nombre del proyecto + botón créditos */
.wd-info-strip {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  text-align: center;
  white-space: nowrap;
}
.wd-strip-title {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .8);
  margin: 0;
}
.wd-credits-btn {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color .2s;
  outline: none;
}
.wd-credits-btn:hover { color: rgba(255, 255, 255, .85); }
.wd-credits-btn:focus-visible { outline: 1px dashed rgba(255,255,255,.4); outline-offset: 4px; }

/* Flechas de navegación prev / next */
.wd-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .35);
  text-decoration: none;
  padding: 28px 20px;
  transition: color .25s, transform .2s ease;
}
.wd-nav-arrow:hover { color: rgba(255, 255, 255, .9); }
.wd-nav-arrow--prev { left: 0;  }
.wd-nav-arrow--next { right: 0; }
.wd-nav-arrow--prev:hover { transform: translateY(-50%) translateX(-3px); }
.wd-nav-arrow--next:hover { transform: translateY(-50%) translateX(3px);  }

/* Barra de player minimalista (bottom, debajo del strip) */
.wd-player-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 25px 80px;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.wd-time {
  font-family: var(--f-mono);
  font-size: 10px;
  color: rgba(255, 255, 255, .45);
  white-space: nowrap;
  min-width: 36px;
}
.wd-time-current { text-align: right; }
.wd-progress-track {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, .15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height .15s;
}
.wd-progress-track:hover { height: 3px; }
.wd-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  pointer-events: none;
  width: 0%;
  transition: width .15s linear;
}
.wd-btn-mute {
  background: none;
  border: none;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .2s;
  outline: none;
}
.wd-btn-mute:hover { color: rgba(255, 255, 255, .85); }
.wd-btn-mute:focus-visible { outline: 1px dashed rgba(255,255,255,.4); outline-offset: 4px; }

/* Botón CC (subtítulos) — mismo patrón que .wd-btn-mute */
.wd-btn-cc {
  position: relative;
  background: none;
  border: none;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  padding: 4px 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .15em;
  font-weight: 600;
  display: none; /* se muestra cuando hay pistas */
  align-items: center;
  transition: color .2s;
  outline: none;
}
.wd-btn-cc.is-available { display: flex; }
.wd-btn-cc.is-active { color: #fff; }
.wd-btn-cc:hover { color: rgba(255, 255, 255, .85); }
.wd-btn-cc:focus-visible { outline: 1px dashed rgba(255,255,255,.4); outline-offset: 4px; }

/* Menú popover de pistas de subtítulos */
.wd-cc-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  padding: 4px 0;
  display: none;
  z-index: 5;
}
.wd-cc-menu.is-open { display: block; }
.wd-cc-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255, 255, 255, .7);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.wd-cc-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.wd-cc-item.is-active { color: #fff; }
.wd-cc-item.is-active::before { content: '✓ '; }

/* ── Modal de créditos ── */
.wd-credits-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .85);
}
/* Oculto por defecto (antes de [open]) */
.wd-credits-modal:not([open]) { display: none; }

.wd-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 90vh;
  overflow-y: auto;
  padding: 48px 32px;
  width: 100%;
  max-width: 640px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.wd-modal-inner::-webkit-scrollbar { width: 4px; }
.wd-modal-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.wd-modal-header {
  text-align: center;
  margin-bottom: 40px;
}
.wd-modal-subtitle {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  margin: 0 0 10px;
}
.wd-modal-title {
  font-family: var(--f-disp);
  font-style: italic;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 400;
  color: #fff;
  margin: 0 0 20px;
  letter-spacing: -.015em;
}
.wd-modal-close {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  transition: color .2s;
  outline: none;
}
.wd-modal-close:hover { color: rgba(255,255,255,.85); }
.wd-modal-close:focus-visible { outline: 1px dashed rgba(255,255,255,.4); outline-offset: 4px; }

/* Lista de créditos al estilo CANADA: rol ── nombre */
.wd-credits-list {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 40px;
  row-gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 0 40px;
}
.wd-credit-role {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  text-align: right;
  padding-top: 2px;
  white-space: nowrap;
}
.wd-credit-name {
  font-size: 13px;
  color: rgba(255, 255, 255, .8);
  margin: 0;
}
.wd-credit-name a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.2);
  transition: border-color .2s, color .2s;
}
.wd-credit-name a:hover {
  color: #fff;
  border-color: rgba(255,255,255,.6);
}

/* Contenido WordPress dentro del modal */
.wd-modal-content {
  width: 100%;
  max-width: 560px;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, .7);
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 32px;
  margin-top: 4px;
}
/* Reutilizar estilos pd-content para headings/párrafos dentro del modal */
.wd-modal-content h2 {
  font-family: var(--f-disp);
  font-style: italic;
  font-size: clamp(17px, 2vw, 22px);
  color: #fff;
  margin: 32px 0 12px;
}
.wd-modal-content h3 {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin: 24px 0 8px;
}
.wd-modal-content p { margin-bottom: 16px; }
.wd-modal-content a { color: rgba(255,255,255,.85); text-underline-offset: 3px; }
.wd-modal-content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
  margin: 20px 0;
}

/* Proyecto no encontrado */
.wd-not-found {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
}
.wd-nf-label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.wd-nf-link {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--b1);
  padding-bottom: 2px;
  transition: border-color .2s;
}
.wd-nf-link:hover { border-color: var(--fg); }

/* ── Responsive móvil ── */
@media (max-width: 768px) {
  .wd-meta {
    top: 20px;
    left: 20px;
    max-width: 200px;
  }
  .wd-meta-title { font-size: clamp(13px, 4vw, 17px); }
  .wd-close { top: 16px; right: 16px; }
  .wd-info-strip {
    bottom: 48px;
    white-space: normal;
    max-width: calc(100% - 100px);
  }
  .wd-strip-title { font-size: 9px; }
  .wd-nav-arrow { padding: 20px 14px; }
  .wd-player-bar { padding: 0 56px 14px; }
  .wd-credits-list {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
  .wd-credit-role { text-align: left; margin-top: 8px; }
  .wd-credit-name { padding-left: 8px; }
}

/* ── Accesibilidad: sin animaciones ── */
@media (prefers-reduced-motion: reduce) {
  .wd-overlays,
  .wd-play-btn,
  .wd-icon,
  .wd-nav-arrow,
  .wd-close,
  .wd-progress-fill { transition: none; }
}
