/* video_embed — sizes and colours follow the RetailSonar design system:
   --radius-box 20px, --radius-tab 8px, --shadow-box 0 3px 4px rgba(0,0,0,.2),
   no borders, Nunito, no grey text, white text on red only in bold,
   10 % red tint (#FF2645) as the highlight instead of grey.
   Selectors below the player start with .video-embed so they beat the blog
   template's .blog-post__body a / p / li / ol rules (grey, 400, underlined, padded). */
.video-embed {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  container-type: inline-size; /* the side-by-side layout follows the module's own width */
}

.video-embed__intro {
  margin-bottom: 24px;
}

/* Heading: the key phrase between *stars* (module.html) is red. */
.video-embed .video-embed__heading-key {
  color: #FF2645;
}

/* On pages the module is dropped in a full-width dnd row, and every module there
   brings its own frame. Use the same frame as two-column-box: 1140px max, 20px
   sides, centred. In blog posts the post body already frames it. */
.dnd-module .video-embed {
  max-width: 1140px;
  margin: 0 auto;
  padding: 50px 20px;
}

/* On pages the heading follows the site's section titles
   (feature-listing-slider, two-column-box): 50px Bold, key phrase red.
   Base colour is the design system's ink #000 (those modules use #1E1E1E). */
.dnd-module .video-embed .video-embed__heading {
  margin: 0 0 45px;
  color: #000000;
  font-size: 50px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

@media (max-width: 767px) {
  .dnd-module .video-embed .video-embed__heading {
    margin-bottom: 24px;
    font-size: 35px;
  }
}

/* In a blog post the video sits between body blocks (often right under a form):
   give it room above and below. */
.blog-post__body > .video-embed {
  margin: 48px 0 0;
}

/* In a blog post the heading matches the post's other block titles (e.g. the form title):
   34px Bold black, key phrase red. The theme colours a bare post h2 red. */
.blog-post__body .video-embed .video-embed__heading,
.blog-post__body .video-embed .video-embed__intro {
  color: #000000;
}

.video-embed__player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate; /* keeps the rounded clip on the iframe in Safari */
  scroll-margin-top: 120px; /* chapter clicks scroll here; clears the sticky site header */
  border-radius: 20px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.2);
  background: #000000;
}

@supports not (aspect-ratio: 16 / 9) {
  .video-embed__player {
    height: 0;
    padding-top: 56.25%;
  }
}

.video-embed__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ---------- "In this video" chapters ----------
   A white panel (radius-box + shadow-box).
   Narrow: below the player, collapsed to one bar until tapped.
   Wide: next to the player at the player's height, always open, scrolls inside. */
.video-embed .video-embed__side {
  margin-top: 16px;
}

.video-embed .video-embed__chapters {
  padding: 0 8px;
  border-radius: 20px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.2);
  background: #FFFFFF;
}

.video-embed .video-embed__chapters-heading {
  margin: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1.3;
}

/* The bar: a real <button> (theme button styles reset with all: unset). */
.video-embed button.video-embed__chapters-toggle {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 16px 10px;
  cursor: pointer;
  font: inherit;
  color: #000000;
  -webkit-tap-highlight-color: transparent;
}

.video-embed button.video-embed__chapters-toggle:focus-visible {
  outline: 2px solid #FF2645;
  outline-offset: -2px;
  border-radius: 12px;
}

.video-embed .video-embed__chapters-label {
  font-weight: 800;
}

.video-embed .video-embed__chapters-count {
  font-size: 14px;
  font-weight: 400;
  color: #000000;
}

/* chevron, points down when collapsed, up when open */
.video-embed button.video-embed__chapters-toggle::after {
  content: "";
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 3px solid #FF2645;
  border-bottom: 3px solid #FF2645;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.2s ease;
}

.video-embed .video-embed__chapters:not(.is-collapsed) button.video-embed__chapters-toggle::after {
  transform: translateY(2px) rotate(-135deg);
}

/* Collapse animation: grid-template-rows 0fr <-> 1fr animates to the list's real height. */
.video-embed .video-embed__chapter-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s ease;
}

.video-embed .video-embed__chapters.is-collapsed .video-embed__chapter-body {
  grid-template-rows: 0fr;
}

.video-embed .video-embed__chapter-list {
  list-style: none;
  margin: 0;
  padding: 0; /* bottom space sits on the last chapter, so it collapses with the list */
  min-height: 0;
  overflow: hidden;
  visibility: visible;
  transition: visibility 0s;
}

.video-embed .video-embed__chapters.is-collapsed .video-embed__chapter-list {
  visibility: hidden; /* hidden links can't be tabbed into */
  transition: visibility 0s 0.3s;
}

.video-embed .video-embed__chapter {
  margin: 0;
  padding: 0;
  color: #000000;
  font-size: 15px;
  line-height: 1.4;
}

.video-embed .video-embed__chapter:last-child {
  padding-bottom: 8px;
}

.video-embed .video-embed__chapter::before,
.video-embed .video-embed__chapter::marker {
  content: none;
}

/* The whole chapter block is one link. */
.video-embed .video-embed__chapter-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  color: #000000;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease;
}

.video-embed .video-embed__chapter-link--static {
  cursor: default;
}

.video-embed a.video-embed__chapter-link:focus-visible,
.video-embed a.video-embed__chapter-link.is-active {
  background: rgba(255, 38, 69, 0.1);
  color: #000000;
  text-decoration: none;
}

.video-embed a.video-embed__chapter-link:focus-visible {
  outline: 2px solid #FF2645;
  outline-offset: -2px;
}

.video-embed .video-embed__time {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #FF2645;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease;
}

.video-embed a.video-embed__chapter-link.is-active .video-embed__time {
  background: #FF7508;
}

.video-embed .video-embed__chapter-text {
  flex: 1 1 auto;
  min-width: 0;
}

.video-embed .video-embed__chapter-title {
  display: block;
  color: #000000;
  font-weight: 800;
}

/* The quote: collapsed; opens for the clicked (playing) chapter and keyboard focus. */
.video-embed .video-embed__chapter-desc {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  color: #000000;
  font-weight: 400;
  transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
}

.video-embed .video-embed__chapter-desc-inner {
  display: block;
  overflow: hidden;
  min-height: 0;
}

.video-embed a.video-embed__chapter-link:focus-visible .video-embed__chapter-desc,
.video-embed a.video-embed__chapter-link.is-active .video-embed__chapter-desc,
.video-embed .video-embed__chapter-link--static .video-embed__chapter-desc {
  grid-template-rows: 1fr;
  opacity: 1;
}

.video-embed a.video-embed__chapter-link.is-active .video-embed__chapter-desc-inner {
  padding-top: 4px;
}

/* Hover only where there is a real pointer, so a tap on a phone
   doesn't leave a stuck hover state on another chapter. */
@media (hover: hover) and (pointer: fine) {
  .video-embed a.video-embed__chapter-link:hover {
    background: rgba(255, 38, 69, 0.1);
    color: #000000;
    text-decoration: none;
  }

  .video-embed a.video-embed__chapter-link:hover .video-embed__time {
    background: #FF7508;
  }
  /* Hover only highlights; the quote opens on click (.is-active), so the
     list doesn't jump around while the mouse moves over it. */
}

@media (prefers-reduced-motion: reduce) {
  .video-embed .video-embed__chapter-desc,
  .video-embed .video-embed__chapter-body,
  .video-embed .video-embed__chapter-link,
  .video-embed .video-embed__time,
  .video-embed button.video-embed__chapters-toggle::after {
    transition: none;
  }
}

/* Wide: player left, chapters panel right at the player's height, always open. */
@container (min-width: 760px) {
  .video-embed--with-chapters .video-embed__body {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
  }

  .video-embed .video-embed__side {
    position: relative;
    margin-top: 0;
  }

  /* As tall as its chapters, at most the player's height (then it scrolls),
     so a short list doesn't leave an empty white box. */
  .video-embed .video-embed__chapters {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #FF2645 transparent;
  }

  .video-embed .video-embed__chapters-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #FFFFFF;
  }

  .video-embed button.video-embed__chapters-toggle {
    cursor: default;
    padding-bottom: 8px;
  }

  .video-embed button.video-embed__chapters-toggle::after {
    display: none;
  }

  .video-embed .video-embed__chapters.is-collapsed .video-embed__chapter-body {
    grid-template-rows: 1fr;
  }

  .video-embed .video-embed__chapters.is-collapsed .video-embed__chapter-list {
    visibility: visible;
    transition: none;
  }
}

/* Editor-only notice (never rendered on the live page) */
.video-embed.video-embed--notice {
  padding: 20px 24px;
  margin-top: 16px;
  border-radius: 20px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.2);
  background: #FFFFFF;
  font-family: Nunito, "Nunito Fallback", Calibri, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #000000;
}

.video-embed.video-embed--notice p {
  margin: 0;
  color: #000000;
}

.video-embed.video-embed--notice .video-embed__notice-title {
  margin-bottom: 4px;
  font-weight: 800;
  color: #FF2645;
}
