/*
 * Level 4 (single sermon) styles.
 *
 * Loads ALONGSIDE browse.css, never instead of it — the design tokens
 * (--ch-brand-red etc.) and the shared .ch-sm-crumbs / .ch-sm-episode
 * rules live there, and Level 4 reuses both rather than restating them.
 * That reuse is the point: the "More from" list is the level-3 episode
 * row renderer verbatim (D34), so it must inherit the identical styling
 * or the two levels drift.
 *
 * Everything stays scoped under .ch-sm for the same reason browse.css
 * does — Divi is aggressive about global styles.
 */

/* -- page shell --------------------------------------------------------- */

.ch-sm-sermon-page {
  padding: 8px 0 48px;
}

/* -- player ------------------------------------------------------------- */

.ch-sm-sermon-player {
  margin: 0 0 22px;
  border-radius: var(--ch-radius);
  overflow: hidden;
  background: #000;
  line-height: 0; /* kills the descender gap under the <video> */
}

.ch-sm-sermon-player video,
.ch-sm-sermon-player .plyr {
  width: 100%;
  display: block;
  border-radius: var(--ch-radius);
}

/* -- header: title block left, actions right ---------------------------- */

.ch-sm-sermon-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin: 0 0 26px;
}

.ch-sm-sermon-head-main {
  min-width: 0; /* lets long titles wrap instead of shoving the actions off */
  flex: 1 1 auto;
}

/* Series eyebrow above the title — same typographic treatment as the
   "MORE FROM <series>" heading further down the page, deliberately, so
   the series reads as one recurring visual element rather than two
   unrelated bits of text. */
.ch-sm-sermon-series-link {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ch-sm-sermon-series-link a {
  color: var(--ch-brand-red);
  text-decoration: none;
}

.ch-sm-sermon-series-link a:hover {
  text-decoration: underline;
}

.ch-sm-sermon-title {
  margin: 0 0 4px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ch-text-primary);
}

.ch-sm-sermon-subtitle {
  margin: 0 0 14px;
  font-size: 19px;
  line-height: 1.3;
  font-weight: 400;
  color: var(--ch-text-secondary);
}

.ch-sm-sermon-meta {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--ch-text-secondary);
}

.ch-sm-sermon-code {
  margin: 0;
  font-size: 13px;
  color: var(--ch-text-secondary);
}

/* -- Share / Download actions ------------------------------------------- */

.ch-sm-sermon-actions {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.ch-sm-action {
  /* Reset, because these are <button>s and Divi styles buttons heavily. */
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 62px;
  color: var(--ch-text-secondary);
  transition: color 0.15s ease;
}

.ch-sm-action:hover,
.ch-sm-action:focus-visible {
  color: var(--ch-brand-red);
  background: none;
}

.ch-sm-action[aria-disabled="true"] {
  cursor: default;
  opacity: 0.75;
}

.ch-sm-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.ch-sm-action-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.ch-sm-action-label {
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

/* Progress track sits under the label, only while a download is running.
   `hidden` is honoured explicitly because display:flex on the parent
   would otherwise override the UA's [hidden] rule. */
.ch-sm-action-progress {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--ch-surface-muted);
  overflow: hidden;
}

.ch-sm-action-progress[hidden] {
  display: none;
}

.ch-sm-action-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ch-brand-red);
  transition: width 0.2s ease;
}

/* Indeterminate: used when the server sends no Content-Length, so a real
   percentage is genuinely unknowable rather than merely unmeasured. */
.ch-sm-action-progress--indeterminate .ch-sm-action-progress-bar {
  width: 40%;
  transition: none;
  animation: ch-sm-indeterminate 1.1s ease-in-out infinite;
}

@keyframes ch-sm-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .ch-sm-action-progress--indeterminate .ch-sm-action-progress-bar {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }
  .ch-sm-action-progress-bar {
    transition: none;
  }
}

/* -- description --------------------------------------------------------- */

.ch-sm-sermon-description {
  margin: 0 0 34px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ch-text-primary);
  max-width: 72ch;
}

.ch-sm-sermon-description p {
  margin: 0 0 12px;
}

.ch-sm-sermon-description p:last-child {
  margin-bottom: 0;
}

/* -- "More from <series>" ------------------------------------------------ */

.ch-sm-more-from {
  margin: 0 0 30px;
}

.ch-sm-more-from h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ch-text-secondary);
}

.ch-sm-more-from-series {
  color: var(--ch-brand-red);
}

.ch-sm-more-from .ch-sm-episodes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ch-sm-more-from-all {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ch-brand-red);
  text-decoration: none;
}

.ch-sm-more-from-all:hover {
  text-decoration: underline;
}

/* -- prev / next --------------------------------------------------------- */

.ch-sm-sermon-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--ch-surface-muted);
  padding-top: 20px;
}

.ch-sm-sermon-nav-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 46%;
  text-decoration: none;
  color: var(--ch-text-primary);
}

.ch-sm-sermon-nav-link--next {
  text-align: right;
  margin-left: auto;
}

.ch-sm-sermon-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ch-text-secondary);
}

.ch-sm-sermon-nav-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.ch-sm-sermon-nav-link:hover .ch-sm-sermon-nav-title {
  color: var(--ch-brand-red);
}

.ch-sm-sermon-nav-date {
  font-size: 13px;
  color: var(--ch-text-secondary);
}

.ch-sm-sermon-nav-empty {
  display: block;
}

/* -- narrow screens ------------------------------------------------------ */

@media (max-width: 640px) {
  .ch-sm-sermon-head {
    flex-direction: column;
    gap: 18px;
  }

  /* Actions move below the title block and go left-aligned rather than
     staying pinned right, where they'd sit alone on a wide empty row. */
  .ch-sm-sermon-actions {
    gap: 30px;
    padding-top: 0;
  }

  .ch-sm-sermon-title {
    font-size: 24px;
  }

  .ch-sm-sermon-subtitle {
    font-size: 17px;
  }
}

/* -- poster overlay (reference: title + meta over the hero frame) --------
   Visible only before playback starts. The .is-playing class is added by
   player.js on the first `play` event and never removed — reappearing
   over a paused video would cover the frame the viewer just paused to
   look at. */

.ch-sm-sermon-player {
  position: relative;
}

.ch-sm-player-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #fff;

  /* FULL-BLEED AND CLICKABLE, adopted from the latest_sermon shortcode:
     clicking anywhere on the frame starts playback, rather than making
     people hit the play button exactly. The earlier version of this rule
     covered only the top strip and set pointer-events:none precisely so
     it could NOT swallow the play click; making the whole thing a click
     target is only safe because player.js now handles that click and
     starts playback itself. */
  cursor: pointer;

  transition: opacity 0.25s ease;
}

/* The scrim is a pseudo-element now, not the overlay's own background:
   the overlay covers the entire frame in order to be a click target, and
   a full-frame gradient would dim the whole poster. This keeps the
   darkening across the top where the text is. */
.ch-sm-player-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 46%;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.62) 0%,
    rgba(0, 0, 0, 0.34) 55%,
    rgba(0, 0, 0, 0) 100%
  );
}

.ch-sm-player-overlay-text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 20px;
  /* Text itself must not eat the click; the parent handles it. */
  pointer-events: none;
}

.ch-sm-sermon-player.is-playing .ch-sm-player-overlay {
  opacity: 0;
  visibility: hidden;
}

.ch-sm-player-overlay-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.ch-sm-player-overlay-meta {
  font-size: 13px;
  opacity: 0.93;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

@media (max-width: 640px) {
  .ch-sm-player-overlay-text {
    padding: 12px 14px;
  }
  .ch-sm-player-overlay-title {
    font-size: 15px;
  }
  .ch-sm-player-overlay-meta {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ch-sm-player-overlay {
    transition: none;
  }
}
