/*** CMP-EPISODE-HEADER.CSS v1.1
- Header chrome for the Episode detail page (premeta ribbon, identity strip,
  byline meta, feature image figure, click-to-play YouTube embed lede).
- Used by: templates/components/mc/sections/beta/episode/cmp-episode-header.html
- All selectors scoped under .mp-episode so the file is safe to load globally.
##########################
***/

/* #region # PAGE-ROW CHROME ########################## */

.mp-episode .d-header {
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-black);
}

.mp-episode .d-header > .column {
  row-gap: var(--space-md);
}

/* #endregion */

/* #region # PREMETA (form + show breadcrumb) ########################## */
/* The premeta bar is tagged `.eyebrow` in the template so its small-caps
   typography comes from mp-general.css. Only the category-link width and
   icon-hide tweaks live here. */

.mp-episode .post-premeta-category { width: fit-content; }
.mp-episode .post-premeta-category .icon { display: none; }

/* #endregion */

/* #region # IDENTITY ########################## */

.mp-episode .post-identity {
  max-width: var(--width-text);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.mp-episode .post-title {
  font-family: var(--font-serif);
  font-weight: 400;
}

.mp-episode .post-excerpt {
  font-size: var(--type-md);
  color: var(--color-night);
}

/* #endregion */

/* #region # META (byline / dates) ########################## */

.mp-episode .post-meta {
  display: flex;
  flex-flow: row wrap;
  gap: var(--space-xs) var(--space-md);
  max-width: var(--width-text);
  margin-left: auto;
  margin-right: auto;
  color: var(--color-night);
}

.mp-episode .post-meta .icon {
  height: 1em;
  width: 1em;
  margin-right: var(--space-xs);
}

.mp-episode .post-meta-author a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.mp-episode .post-meta-author a:hover {
  text-decoration: none;
}

.mp-episode .post-meta-revision {
  color: var(--color-shade);
  font-style: italic;
}

/* #endregion */

/* #region # FEATURE IMAGE (used on the figure inside .post-embed-poster) # */

.mp-episode .post-figure {
  overflow: hidden;
  width: 100%;
}

.mp-episode .post-figure-image {
  display: block;
  width: 100%;
  object-fit: cover;
}

.mp-episode .post-figure figcaption {
  color: var(--color-shade);
  font-size: var(--type-xs);
}

/* #endregion */

/* #region # YOUTUBE EMBED ########################## */
/* "Newsletter-with-video-lede" treatment: embed sits between identity and
   byline. 16:9 frame, capped by viewport so title + meta stay above the
   fold. Click-to-play poster facade swaps in the real YouTube iframe. */

.mp-episode .post-embed {
  width: 100%;
  margin: 0 auto;
  padding: 0;
  background-color: transparent;
}

.mp-episode .post-embed-frame {
  position: relative;
  /* Cap at the smaller of 95% column width OR the width that would push
     a 16:9 box past the viewport-height budget — whichever is narrower. */
  width: min(95%, calc((100vh - 28rem) * 16 / 9));
  max-height: calc(100vh - 28rem);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--color-black);
}

.mp-episode .post-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.mp-episode .post-embed-frame figcaption {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  max-width: 60%;
  padding: 0.25rem var(--space-xs);
  background-color: var(--color-overlay-strong);
  color: var(--color-theme-alpha, #fff);
  font-family: var(--font-sans);
  font-size: var(--type-2xs);
  letter-spacing: var(--track-wide);
  text-align: right;
  line-height: 1.3em;
  z-index: 1;
}

/* Click-to-play poster facade: feature image (or placeholder) acts as the
   video cover, with a centred play button. On click the button is swapped
   for the real YouTube iframe. */
.mp-episode .post-embed-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
}

.mp-episode .post-embed-poster-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mp-episode .post-embed-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.95;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.mp-episode .post-embed-poster:hover .post-embed-play,
.mp-episode .post-embed-poster:focus-visible .post-embed-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.06);
}

.mp-episode .post-embed-play svg {
  width: 68px;
  height: 48px;
  filter: drop-shadow(0 2px 6px var(--color-overlay-soft));
}

.mp-episode .post-embed-caption {
  font-family: var(--font-sans);
  font-size: var(--type-2xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--color-shade);
  padding: var(--space-xs) 0 0 0;
  margin: 0;
}

/* #endregion */
