/* =====================================================================
   Podcast con transcripción sincronizada (estilo Spotify) y hero de video.
   Se carga solo en la vista del post.
   ===================================================================== */

/* --- Video protagonista: rompe el ancho del artículo --------------- */
.post-video-stage {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 2.5rem;
    padding: 0 1rem;
}
.post-video-stage .ratio {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
}

/* Facade de YouTube: miniatura + boton play hasta que el usuario reproduce */
.yt-facade {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    background-color: #000;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.yt-facade::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease;
}
.yt-facade:hover::before { background: rgba(0, 0, 0, 0.05); }
.yt-facade:focus-visible { outline: 3px solid var(--color-principal, #6c5ce7); outline-offset: -3px; }
/* Boton play estilo YouTube */
.yt-facade__play {
    position: relative;
    width: 68px;
    height: 48px;
    background: rgba(20, 20, 20, 0.8);
    border-radius: 14px;
    transition: background 0.2s ease;
}
.yt-facade:hover .yt-facade__play { background: #f00; }
.yt-facade__play::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 19px;
    border-color: transparent transparent transparent #fff;
}

/* .post-container usa margin-top negativo para trepar sobre el hero en los
   posts normales. Con el video delante, ese margen metia el contenido (y la
   sidebar semi-transparente) por debajo del reproductor. Cuando hay video,
   el contenido arranca limpio bajo el, respetando el margen del stage. */
.post-video-stage + .post-container {
    margin-top: 0;
}

/* --- Transcripción de podcast -------------------------------------- */
.podcast-transcript {
    margin-bottom: 3rem;
}

/* Reproductor arriba del panel de transcripción */
.podcast-transcript__player {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: rgba(10, 12, 24, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}
.podcast-transcript__player audio {
    display: block;
    width: 100%;
}

/* Controles enriquecidos (±15s, velocidad, tiempos) */
.podcast-controls {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.podcast-controls__btn,
.podcast-controls__speed {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}
.podcast-controls__btn:hover,
.podcast-controls__speed:hover { background: rgba(255, 255, 255, 0.13); }
.podcast-controls__btn:focus-visible,
.podcast-controls__speed:focus-visible {
    outline: 2px solid var(--color-principal, #6c5ce7);
    outline-offset: 2px;
}
.podcast-controls__speed { min-width: 3.1rem; justify-content: center; }
.podcast-controls__time {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Lista de líneas: altura acotada con scroll interno, para no alargar la página */
.podcast-transcript__lines {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain; /* el scroll no se "escapa" a la página al llegar al borde */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.015);
    /* Difuminado sutil arriba y abajo para insinuar que hay más contenido */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
}
/* Barra de scroll discreta */
.podcast-transcript__lines::-webkit-scrollbar { width: 8px; }
.podcast-transcript__lines::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
.podcast-transcript__lines::-webkit-scrollbar-track { background: transparent; }

.podcast-transcript__line {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.5rem 0.9rem;
    margin: 0.15rem 0;
    border-radius: 0.55rem;
    color: rgba(255, 255, 255, 0.42);
    font-size: 1.15rem;
    line-height: 1.6;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    /* Difiere el render de las líneas fuera de vista: en transcripciones largas
       (cientos de líneas) esto acelera mucho la carga. contain-intrinsic-size
       reserva la altura estimada para que el scroll no salte. */
    content-visibility: auto;
    contain-intrinsic-size: auto 2.6rem;
}
/* Timestamp: informa y sugiere que la línea es clicable (como YouTube/Spotify) */
.podcast-transcript__ts {
    flex-shrink: 0;
    min-width: 2.8rem;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.32);
    transition: color 0.2s ease;
}
.podcast-transcript__line:hover .podcast-transcript__ts,
.podcast-transcript__line.is-active .podcast-transcript__ts {
    color: var(--color-principal, #6c5ce7);
}
.podcast-transcript__text { flex: 1; }
.podcast-transcript__line:hover {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.04);
}
.podcast-transcript__line:focus-visible {
    outline: 2px solid var(--color-principal, #6c5ce7);
    outline-offset: 2px;
}

/* Ya reproducidas: legibles pero secundarias */
.podcast-transcript__line.is-past {
    color: rgba(255, 255, 255, 0.55);
}

/* Línea activa: protagonista */
.podcast-transcript__line.is-active {
    color: #fff;
    background: rgba(108, 92, 231, 0.16);
    font-weight: 600;
    transform: translateX(2px);
}

/* Buscador de la transcripción */
.podcast-transcript__search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.7rem;
}
.podcast-transcript__search .bi-search { color: rgba(255, 255, 255, 0.4); }
.podcast-transcript__search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 0.95rem;
}
.podcast-transcript__count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.podcast-transcript__nav {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 0.3rem;
}
.podcast-transcript__nav:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.podcast-transcript__download {
    margin-left: 0.15rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0 0.3rem 0.3rem 0;
}

/* Coincidencias de búsqueda */
.podcast-transcript__text mark {
    background: rgba(255, 214, 10, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}
.podcast-transcript__line.is-match-current {
    background: rgba(255, 214, 10, 0.12);
}

/* Notas del episodio, con preview visible y "leer más" debajo de la transcripción */
.post-notes {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.75rem;
}
.post-notes__title {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    margin-bottom: 0.85rem;
}
.post-notes__body {
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.75;
}

/* Colapsado: la clase la pone el JS solo si el contenido desborda el preview.
   Sin JS, el cuerpo se muestra completo (no queda texto inaccesible). */
.post-notes.is-collapsible .post-notes__body {
    position: relative;
    max-height: 7.5rem;   /* ~ 3-4 líneas de preview */
    overflow: hidden;
    transition: max-height 0.45s ease;
}
.post-notes.is-collapsible.is-expanded .post-notes__body {
    max-height: 200rem;   /* holgado; las notas nunca son tan largas */
}
/* Desvanecido inferior que insinúa que hay más texto */
.post-notes.is-collapsible:not(.is-expanded) .post-notes__body::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3.5rem;
    background: linear-gradient(rgba(15, 15, 20, 0), rgba(15, 15, 20, 0.95));
    pointer-events: none;
}

.post-notes__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-principal, #6c5ce7);
    font-weight: 600;
    cursor: pointer;
}
.post-notes__toggle:hover { text-decoration: underline; }
.post-notes__toggle .bi { transition: transform 0.3s ease; }
.post-notes.is-expanded .post-notes__toggle .bi { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
    .post-notes.is-collapsible .post-notes__body { transition: none; }
    .post-notes__toggle .bi { transition: none; }
}

@media (max-width: 575.98px) {
    .podcast-transcript__line { font-size: 1.02rem; }
    .post-video-stage { padding: 0; }
}

/* Respeta a quien pide menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .podcast-transcript__line { transition: color 0.15s ease, background-color 0.15s ease; transform: none; }
    .podcast-transcript__line.is-active { transform: none; }
}
