/* Final UX corrections discovered through isolated viewport review. */

.s5-video-embed {
  background: transparent !important;
  overflow: visible !important;
}

.s5-video-embed__watch {
  display: block;
  margin: .65rem 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

/* Remove artificial vertical gaps while preserving a clear reading rhythm. */
.s5-home-hero {
  padding: clamp(3.25rem, 6vw, 5.5rem) 0 clamp(2.4rem, 4vw, 3.6rem) !important;
}

.s5-entry-grid {
  margin-bottom: clamp(3.2rem, 6vw, 5.2rem) !important;
}

.s5-section {
  margin: clamp(3.5rem, 6.5vw, 6rem) 0 !important;
}

.s5-page-intro {
  padding: clamp(3.4rem, 6.5vw, 5.8rem) 0 clamp(2.2rem, 4vw, 3.2rem) !important;
}

.s5-about {
  padding: clamp(3.5rem, 6.5vw, 6rem) 0 !important;
}

.md-typeset h2 {
  margin-top: 3.4rem;
}

/* Visual hub: one clear starting point, then spacious secondary choices. */
.s5-video-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--s5-line);
}

.s5-video-feature__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--s5-surface);
}

.s5-video-feature h2 {
  margin: .55rem 0 1rem;
  padding: 0;
  border: 0;
  font-size: clamp(2rem, 4vw, 3.65rem);
  line-height: .98;
}

.s5-video-feature p {
  margin: 0;
  color: var(--s5-muted);
}

.s5-video-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2.5rem, 5vw, 5rem);
  row-gap: clamp(2.4rem, 4vw, 4rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.s5-video-secondary-grid .s5-media-card__meta {
  margin-top: .9rem;
}

/* Home secondary visuals become a calm list instead of a compressed card wall. */
.s5-media-stack {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--s5-line);
}

.s5-media-stack .s5-media-card {
  display: grid;
  grid-template-columns: minmax(210px, 320px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--s5-line);
}

.s5-media-stack .s5-media-card__image {
  grid-row: 1 / span 2;
}

.s5-media-stack .s5-media-card__meta {
  align-self: end;
  margin: 0 0 .35rem;
}

.s5-media-stack .s5-media-card__title {
  align-self: start;
  max-width: 34ch;
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  line-height: 1.08;
}

/* Mobile rows must remain readable; metadata can never collapse letter by letter. */
@media (max-width: 800px) {
  .s5-home-hero {
    padding: 2.7rem 0 2.2rem !important;
  }

  .s5-entry-grid {
    margin-bottom: 2.8rem !important;
  }

  .s5-section {
    margin: 3.2rem 0 !important;
  }

  .s5-page-intro {
    padding: 2.8rem 0 2rem !important;
  }

  .s5-about {
    padding: 2.8rem 0 !important;
  }

  .s5-video-feature,
  .s5-video-secondary-grid,
  .s5-media-stack .s5-media-card {
    grid-template-columns: 1fr !important;
  }

  .s5-video-feature {
    gap: 1.5rem;
    padding-bottom: 2.2rem;
  }

  .s5-video-secondary-grid {
    gap: 2.6rem;
    margin-top: 2.4rem;
  }

  .s5-media-stack .s5-media-card {
    grid-template-rows: auto;
    gap: 0;
    padding: 1.35rem 0 1.6rem;
  }

  .s5-media-stack .s5-media-card__image {
    grid-row: auto;
  }

  .s5-media-stack .s5-media-card__meta {
    margin-top: .75rem;
  }

  .s5-media-stack .s5-media-card__title {
    font-size: 1.2rem;
  }

  .s5-list-row,
  .md-typeset .s5-list-row {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    grid-template-areas:
      "number title"
      ". description"
      ". metadata" !important;
    column-gap: .75rem !important;
    row-gap: .45rem !important;
    align-items: start !important;
    padding: 1.1rem 0 !important;
  }

  .s5-list-row__n {
    grid-area: number;
    white-space: nowrap;
  }

  .s5-list-row__title {
    grid-area: title;
    min-width: 0;
  }

  .s5-list-row__desc {
    grid-area: description;
    min-width: 0;
  }

  .s5-list-row__meta {
    grid-area: metadata;
    justify-self: start;
    min-width: max-content;
    margin-top: .1rem;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
  }

  .s5-series-row,
  .md-typeset .s5-series-row {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) !important;
    grid-template-areas:
      "number field"
      "number title"
      "number description"
      "number chapters" !important;
    column-gap: 1rem !important;
    row-gap: .45rem !important;
    align-items: start !important;
    min-height: 0 !important;
    padding: 1.35rem 0 !important;
  }

  .s5-series-row.is-primary,
  .md-typeset .s5-series-row.is-primary {
    margin: 0 !important;
    padding: 1.35rem 1rem !important;
  }

  .s5-series-row > *,
  .md-typeset .s5-series-row > * {
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
  }

  .s5-series-row__n {
    grid-area: number;
    align-self: start;
    font-size: clamp(2.8rem, 16vw, 4rem) !important;
    line-height: .82 !important;
    letter-spacing: -.07em !important;
  }

  .s5-series-row__field { grid-area: field; padding-top: .1rem; }
  .s5-series-row__title { grid-area: title; font-size: clamp(1.35rem, 7vw, 1.8rem) !important; line-height: 1.02 !important; letter-spacing: -.035em !important; }
  .s5-series-row__desc { grid-area: description; margin-top: .25rem; font-size: .84rem !important; line-height: 1.55 !important; }
  .s5-series-row__chapters { grid-area: chapters; justify-self: start !important; margin-top: .35rem; }
}