/* Homepage video player */
.hero-visual { margin: 56px 0 0; }
.videocard {
  position: relative;
}
.vid-screen {
  position: relative;
  background: color-mix(in srgb, var(--accent) 13%, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.vid-picture { position: relative; background: #000; }
.videocard .vid {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.videocard:not(.teaser) .vid { aspect-ratio: auto; object-fit: contain; }
.vid-loading {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 11px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(20,18,16,.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  transition: opacity .45s ease;
}
.videocard.ready .vid-loading { opacity: 0; pointer-events: none; }
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.vid-toolbar {
  position: relative;
  display: grid;
  grid-template-rows: 1fr;
  margin-top: 10px;
  opacity: 1;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), margin-top .3s cubic-bezier(.4,0,.2,1), opacity .3s cubic-bezier(.4,0,.2,1);
}
.vid-toolbar-clip { min-height: 0; overflow: hidden; }
.vid-controls {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  transition: opacity .3s cubic-bezier(.4,0,.2,1);
}
.vid-view-controls { display: flex; flex: 0 0 auto; gap: inherit; margin-inline-start: auto; }
.vid-controls .vid-btn,
.vid-chapter-pills .vid-btn {
  height: 36px;
  min-height: 36px;
  color: var(--ink);
  border-color: var(--line-2);
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.vid-controls .vid-btn:hover, .vid-chapter-pills .vid-btn:hover { background: var(--line); }
.vid-controls .vid-btn:focus-visible, .vid-chapter-pills .vid-btn:focus-visible { outline-color: var(--ink); }
.vid-chapter-toggle {
  display: flex;
  max-width: 110px;
  overflow: hidden;
  margin-inline: 0;
  opacity: 1;
  visibility: visible;
  transition: max-width .3s cubic-bezier(.4,0,.2,1), margin .3s cubic-bezier(.4,0,.2,1), opacity .3s cubic-bezier(.4,0,.2,1), visibility .3s cubic-bezier(.4,0,.2,1);
}
.vid-chapter-toggle .vid-btn { flex-shrink: 0; }
.chapter-pills-visible .vid-chapter-toggle { max-width: 0; margin-inline: -4px; opacity: 0; visibility: hidden; pointer-events: none; }
.vid-chapters {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), margin-top .3s cubic-bezier(.4,0,.2,1), opacity .3s cubic-bezier(.4,0,.2,1), visibility .3s cubic-bezier(.4,0,.2,1);
}
.vid-chapters-clip { min-height: 0; overflow: hidden; }
.vid-chapters-label { margin: 0 0 8px; color: var(--ink-2); font-size: 11px; font-weight: 600; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; }
.vid-chapter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.has-video-chapters > .vid-chapters,
.chapter-pills-visible > .vid-chapters { grid-template-rows: 1fr; margin-top: 22px; opacity: 1; visibility: visible; }
.has-docked-video { position: relative; }
.has-docked-video > .vid-chapters { position: absolute; left: 0; right: 0; bottom: 0; }
.vid-chapter-pills .vid-chapter-pill {
  height: 28px;
  min-height: 28px;
  padding: 5px 9px;
  gap: 5px;
  font-size: 11.5px;
  text-align: left;
  line-height: 1.25;
  color: color-mix(in srgb, var(--accent) 78%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--paper));
}
.vid-chapter-pills .vid-chapter-pill:hover { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.vid-chapter-pill svg { flex-shrink: 0; }
.vid-chapter-pills .vid-chapter-pill[aria-current] { background: color-mix(in srgb, var(--accent) 13%, var(--paper)); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.vid-measuring-inline .vid-chapters, .vid-measuring-inline .vid-chapter-toggle { transition: none; }
.vid-btn[hidden] { display: none; }
.vid-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(20,18,16,.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 13px;
  line-height: 1;
  transition: background .14s ease, border-color .14s ease, opacity .14s ease;
}
.vid-btn:hover { background: rgba(20,18,16,.84); }
.vid-btn svg { display: block; }
.vid-btn.cc-off { opacity: .48; }
.vid-btn .ic-sound { display: none; }
.videocard.sound-on .vid-btn .ic-muted { display: none; }
.videocard.sound-on .vid-btn .ic-sound { display: block; }
.vid-btn .ic-play { display: none; }
.videocard.paused .vid-btn .ic-pause { display: none; }
.videocard.paused .vid-btn .ic-play { display: block; }
/* Seek buttons use compact spacing. */
.vid-btn.seek { padding: 8px 9px; }
.vid-btn.seek svg text { stroke: none; font-weight: 600; }
.videocard.chapters-open #chapBtn { background: rgba(20,18,16,.9); border-color: rgba(255,255,255,.32); }

/* Chapters dropdown: a scrollable list floating above the control bar.
   Populated from the chapters[] list in the player script. */
.vid-chapmenu {
  position: absolute;
  right: 14px;
  bottom: 60px;
  z-index: 6;
  width: 264px;
  max-height: 264px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(20,18,16,.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.videocard.chapters-open .vid-chapmenu { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.videocard.teaser .vid-chapmenu { opacity: 0 !important; pointer-events: none; }
.vid-chap {
  display: flex;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}
.vid-chap:hover { background: rgba(255,255,255,.12); }
.vid-chap.active { background: rgba(255,255,255,.16); }
.vid-chap .t {
  min-width: 38px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.vid-chap.active .t { color: #fff; }

/* Teaser: a short muted loop stacked on top of the main video until
   the visitor presses play. */
.vid-teaser {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.videocard.teaser .vid-teaser { opacity: 1; }
.videocard.teaser .vid-loading,
.videocard.teaser .vid-caption { opacity: 0; pointer-events: none; }
.videocard.teaser .vid-toolbar { grid-template-rows: 0fr; margin-top: 0; opacity: 0; pointer-events: none; }
.videocard.teaser .vid-play { display: flex; }

/* The fullscreen card contains the screen and its separate control row. */
.videocard:is(:fullscreen, :-webkit-full-screen) { display: flex; flex-direction: column; background: #000; padding: 12px; }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; border: 0; border-radius: 0; }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-picture { flex: 1; min-height: 0; }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid { width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }

@media (max-width: 560px) {
  .vid-btn .lbl { display: none; }
  /* The 9-button bar overflows a phone; the chapters menu already covers
     navigation there, so drop the chapter-skip buttons and keep +/-10s. */
  .vid-controls { gap: 6px; }
  #prevChapBtn, #nextChapBtn { display: none; }
  /* The inline video card is short on a phone; pin the menu between the top
     and the control bar so it can never overhang and clip against the card. */
  .vid-chapmenu {
    top: 8px;
    bottom: 50px;
    right: 10px;
    width: 210px;
    max-height: none;
  }
  .vid-chap { padding: 5px 9px; font-size: 12px; }
  .vid-chap .t { min-width: 32px; font-size: 11px; }
}

.vid-caption {
  --vid-caption-height: 2.9em;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: var(--vid-caption-height);
  padding: 0 16px;
  overflow: hidden;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 13%, var(--paper));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 18%, var(--line));
  text-align: center;
  font-size: 15px;
  font-weight: 450;
  line-height: 1.45;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: height .3s cubic-bezier(.4,0,.2,1), font-size .3s cubic-bezier(.4,0,.2,1), padding .3s cubic-bezier(.4,0,.2,1), opacity .3s cubic-bezier(.4,0,.2,1), visibility .3s cubic-bezier(.4,0,.2,1);
}
.videocard.teaser .vid-caption { height: 0; padding-block: 0; visibility: hidden; }
.vid-caption span {
  display: block;
  width: 100%;
  color: inherit;
}
.vid-caption.cc-hidden { opacity: 0; visibility: hidden; }

.vid-play {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(20,18,16,.3);
  cursor: pointer;
  z-index: 2;
  border: 0;
  width: 100%;
  font-family: var(--font);
}
.videocard.needs-play .vid-play { display: flex; }
.vid-play span {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
  transition: transform .18s ease;
}
.vid-play:hover span { transform: scale(1.06); }
.vid-play em {
  font-style: normal;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: rgba(20,18,16,.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 7px 14px;
}

.vid-play:focus-visible, .vid-btn:focus-visible, .vid-chap:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}
.videocard.video-error .spinner { display: none; }
.videocard.video-error .vid-loading { z-index: 3; bottom: auto; top: 14px; max-width: calc(100% - 72px); }
.vid-collapse {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}
.vid-toolbar .vid-chapmenu { top: auto; right: 0; bottom: calc(100% + 8px); max-height: min(264px, 60vh); }
/* Scroll progress moves the existing screen and controls into a compact row. */
html.has-homepage-dock { scroll-padding-top: var(--homepage-dock-height); }
.videocard.is-scroll-docked {
  position: fixed;
  z-index: 50;
  left: var(--dock-left);
  top: var(--dock-top);
  width: var(--dock-width);
  height: var(--dock-height);
  isolation: isolate;
}
.videocard.is-scroll-docked::before {
  content: '';
  position: absolute;
  inset: -12px;
  z-index: -1;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: 0 6px 20px rgb(27 24 21 / 10%);
  opacity: var(--dock-progress);
}
.videocard.is-scroll-docked .vid-screen { width: var(--dock-video-width); }
.videocard.is-scroll-docked .vid-toolbar {
  position: absolute;
  left: var(--dock-toolbar-left);
  top: var(--dock-toolbar-top);
  width: var(--dock-toolbar-width);
  margin-top: 0;
  opacity: var(--dock-toolbar-opacity);
  transition: none;
}
.videocard.is-scroll-docked .vid-screen > .vid-caption {
  height: calc(var(--vid-caption-height) * (1 - var(--dock-caption-progress, 0)));
  opacity: calc(1 - var(--dock-caption-progress, 0));
  transition: none;
}
.videocard.is-scroll-docked .vid-toolbar .vid-caption {
  height: 4.35em;
  margin-top: 10px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  justify-content: flex-start;
  text-align: left;
  font-size: 14px;
}
.videocard.is-scroll-docked .vid-toolbar .vid-chapmenu {
  top: calc(100% + 8px);
  bottom: auto;
  width: min(260px, calc(100vw - 32px));
  max-height: min(264px, calc(100dvh - var(--dock-top) - var(--dock-toolbar-top) - var(--dock-toolbar-height) - 24px));
}
.videocard.is-scroll-docked.chapters-open #chapBtn { background: var(--line); border-color: var(--line-2); }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-controls .vid-btn { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-controls .vid-btn:hover { background: rgba(255,255,255,.2); }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-controls .vid-btn:focus-visible { outline-color: #fff; }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-caption { font-size: clamp(18px, min(2.5vw, 3.5vh), 44px); }
.videocard:is(:fullscreen, :-webkit-full-screen) .vid-chapters { grid-template-rows: 0fr; margin-top: 0; opacity: 0; visibility: hidden; }
@media (max-width: 560px) {
  .homepage-small-video .vid-controls { gap: 3px; }
  .homepage-small-video .vid-btn { padding: 8px 9px; min-height: 40px; }
  .homepage-small-video .vid-collapse { width: 40px; height: 40px; padding: 0; }
  .vid-caption { --vid-caption-height: 5.8em; font-size: 14px; }
  .videocard.is-scroll-docked .vid-toolbar .vid-caption { height: 8.7em; }
  .chapter-pills-visible .vid-chapter-toggle { margin-inline: -1.5px; }
  .vid-chapter-pills { gap: 6px; }
  .homepage-small-video .vid-chapter-pill { min-height: 32px; padding: 5px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .videocard.teaser .vid-teaser { visibility: hidden; }
  .vid-teaser, .vid-loading, .vid-play span, .vid-controls, .vid-toolbar, .vid-chapters, .vid-chapter-toggle, .vid-caption, .home-next .homepage-small-video { transition: none; }
  .spinner { animation: none; }
}

