/* =====================================================================
   Shared video component + the two content blocks that use it
   ---------------------------------------------------------------------
   1. .qm-video             template-parts/shared/video.php
   2. .home-agents__promo   templates/home/agents-promo.php - the QA Agent
                            System's "Video banner" (replaces the two product
                            cards when chosen)
   3. .home-videoblock      templates/home/video.php - the Video block

   ONE FILE FOR EVERY SURFACE. The homepage's styles are scoped to body.home
   (css/home.css) and the Services' copies to body.service-v2
   (assets/styles/service-v2.css). These blocks are new, so instead of a third
   copy they are scoped by their own class names and loaded on both (see
   qm_video_enqueue_for_page()). Selectors carry one extra class or attribute
   where a generic rule from those files (`body.home .site-homepage h3`,
   `... img`) would otherwise win.

   Measurements for (2) come from the design mock-up at 1200px: 65px padding,
   60px radius, a 550px 16:9 video with a 30px radius (side padding trimmed to
   fit the 1162px container, see below).

   Plain ASCII only.
   ===================================================================== */

/* ---------------------------------------------------------------- 1 -- */
.qm-video[data-qm-video] {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--qm-video-radius, 24px);
  background: #120f1c;
  color: #ffffff;
}
@supports not (aspect-ratio: 1 / 1) {
  .qm-video[data-qm-video]::before { content: ""; display: block; padding-top: 56.25%; }
}
.qm-video[data-qm-video] .qm-video__media,
.qm-video[data-qm-video] .qm-video__poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border: 0;
}
.qm-video[data-qm-video] .qm-video__media { object-fit: cover; background: #000000; }
.qm-video[data-qm-video] .qm-video__poster {
  z-index: 1;
  object-fit: cover;
  transition: opacity 0.3s ease, visibility 0.3s;
}
.qm-video[data-qm-video].is-playing .qm-video__poster { opacity: 0; visibility: hidden; }
/* The native player letterboxes rather than crops once it has controls. */
.qm-video--file[data-qm-video].is-playing .qm-video__media { object-fit: contain; }

/* The whole frame is the play control; the icon sits in the middle. */
.qm-video[data-qm-video] .qm-video__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  background: radial-gradient(closest-side, rgba(8, 7, 14, 0.28), rgba(8, 7, 14, 0));
}
.qm-video[data-qm-video] .qm-video__icon {
  width: 48px;
  height: 54px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.qm-video[data-qm-video] .qm-video__play:hover { color: #ffffff; }
.qm-video[data-qm-video] .qm-video__play:hover .qm-video__icon { transform: scale(1.08); }
.qm-video[data-qm-video] .qm-video__play:focus { outline: none; }
/* Inset, because the frame clips anything drawn outside it. */
.qm-video[data-qm-video] .qm-video__play:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: -6px;
}
.qm-video[data-qm-video] .qm-video__media:focus-visible { outline: 3px solid #ffffff; outline-offset: -3px; }

/* Hover tint (qm_video_tint()). A round glow fitted to the design's hover
   state, measured against the un-hovered poster: ~0.93 in the middle, fading at
   nearly the same rate across and down (0.80 / 0.82 at 60px, 0.62 at 140px,
   0.23 at 260px on a 550px frame), indigo turning dark teal-blue at the rim.
   Rendered over the same poster it is within 8.5/255 per channel of the design
   (the un-tinted poster is 56 away). Also used by the homepage testimonial
   cards (css/home.css reads --tint-layer). */
.qm-tint {
  --tint-a: 104, 84, 224;
  --tint-b: 95, 94, 205;
  --tint-c: 60, 108, 170;
  --tint-d: 24, 104, 124;
  /* Wider than the fitted 52% 125% and half strength (--tint-k) - both the
     user's call after seeing it live; same shape and stops. */
  --tint-k: 0.5;
  --tint-layer: radial-gradient(ellipse 80% 110% at 50% 52%,
    rgba(var(--tint-a), calc(0.93 * var(--tint-k))) 0%,
    rgba(var(--tint-a), calc(0.81 * var(--tint-k))) 22%,
    rgba(var(--tint-b), calc(0.72 * var(--tint-k))) 36%,
    rgba(var(--tint-b), calc(0.62 * var(--tint-k))) 51%,
    rgba(var(--tint-c), calc(0.46 * var(--tint-k))) 65%,
    rgba(var(--tint-c), calc(0.33 * var(--tint-k))) 80%,
    rgba(var(--tint-d), calc(0.23 * var(--tint-k))) 95%,
    rgba(var(--tint-d), calc(0.18 * var(--tint-k))) 110%);
}
.qm-tint--green {
  --tint-a: 0, 184, 150;
  --tint-b: 8, 160, 140;
  --tint-c: 36, 104, 160;
  --tint-d: 45, 40, 130;
}
/* One editor colour, same fade. --tint-rgb is set inline. */
.qm-tint--custom {
  --tint-a: var(--tint-rgb);
  --tint-b: var(--tint-rgb);
  --tint-c: var(--tint-rgb);
  --tint-d: var(--tint-rgb);
}
.qm-tint-none { --tint-layer: none; }

.qm-video[data-qm-video] .qm-video__play::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--tint-layer, none);
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
@media (hover: hover) {
  .qm-video[data-qm-video] .qm-video__play:hover::before { opacity: 1; }
}
.qm-video[data-qm-video] .qm-video__play:focus-visible::before { opacity: 1; }
.qm-video[data-qm-video] .qm-video__icon { position: relative; z-index: 1; }

/* Ambient loop: pause / play toggle. */
.qm-video[data-qm-video] .qm-video__toggle {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(8, 7, 14, 0.6);
  color: #ffffff;
  cursor: pointer;
}
.qm-video[data-qm-video] .qm-video__toggle[hidden] { display: none; }
.qm-video[data-qm-video] .qm-video__toggle:hover { background: rgba(8, 7, 14, 0.85); }
.qm-video[data-qm-video] .qm-video__toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.qm-video[data-qm-video] .qm-video__toggle-play { display: none; }
.qm-video[data-qm-video].is-paused .qm-video__toggle-play { display: block; }
.qm-video[data-qm-video].is-paused .qm-video__toggle-pause { display: none; }

/* Framed variant used by both blocks: the design's teal -> purple hairline. */
.home-agents__video[data-qm-video],
.home-videoblock__video[data-qm-video] {
  --qm-video-radius: 30px;
  background: #1a1530;
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.6);
}
.home-agents__video[data-qm-video]::after,
.home-videoblock__video[data-qm-video]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(90deg, #048372 0%, #1d6a81 50%, #2d2182 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 2 -- */
.home-agents .home-agents__promo {
  --promo-accent: #00cca6;
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
  align-items: center;
  /* The mock-up's card is 1200px wide; the live container is 1162px. The 38px
     comes out of the side padding, the gap and 10px of video, so the copy column
     keeps the mock-up's line breaks (its longest line is 468px at 18px). */
  gap: 40px;
  margin-top: 56px;
  padding: 65px 52px;
  border-radius: 60px;
  /* The supplied artwork stretched to the card puts the glow where the mock-up
     has it: dark top, teal bottom-left, purple bottom-right. */
  background:
    url("../../images/cta-banner-teal.webp") center / 100% 100% no-repeat,
    radial-gradient(60% 70% at 10% 110%, rgba(22, 190, 150, 0.42), transparent 62%),
    radial-gradient(50% 70% at 95% 100%, rgba(110, 62, 222, 0.38), transparent 66%),
    #111113;
  box-shadow: 0 30px 80px -34px rgba(0, 204, 166, 0.55), 0 30px 80px -40px rgba(83, 54, 161, 0.6);
  color: #ffffff;
  text-align: left;
}
.home-agents .home-agents__promo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(90deg, #048372 0%, #1d6a81 50%, #2d2182 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.home-agents .home-agents__promo-body { min-width: 0; }
.home-agents .home-agents__promo-media { min-width: 0; }

.home-agents .home-agents__promo .home-agents__promo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.home-agents .home-agents__promo .home-agents__promo-tag {
  margin: 0;
  padding: 6px 16px;
  border: 1px solid rgba(0, 204, 166, 0.6);
  border-radius: 999px;
  color: var(--promo-accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
}
.home-agents .home-agents__promo .home-agents__promo-tag::before { content: none; }

.home-section.home-agents .home-agents__promo-title {
  margin: 0 0 16px;
  color: #ffffff;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.375;
  letter-spacing: 0;
}
.home-agents .home-agents__promo .home-agents__promo-accent { color: var(--promo-accent); }
.home-section.home-agents .home-agents__promo-text {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1.4;
}

.home-agents .home-agents__promo .home-agents__promo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 34px;
}
.home-agents .home-agents__promo .home-agents__promo-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.home-agents .home-agents__promo .home-agents__promo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 17px 32px;
  border-radius: 999px;
  background: var(--promo-accent);
  color: #0b1f1a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  /* THE HERO'S HOVER (QA, 2026-10-07): "Start Free Trial" answers like the
     homepage hero's "Talk to a QA Expert" (css/home.css, .home-btn--green):
     the label/arrow gap opens and the hero's light-teal sheen, brightest at
     the arrow end, fades in. No brightness filter, no lift.
     QA tuning: a shorter stretch than the hero's +16px (gap 10 -> 18px), to
     the RIGHT only - the left edge and the label stay still - and SMOOTHER:
     0.6s on a soft ease-out (fast start, long gentle settle) shared by the
     stretch and the arrow, with the sheen fading in alongside (0.6s, 0.08s
     delay) instead of popping in after. The -8px right margin absorbs the
     growth, so the note under the button and "Book a Demo" stay put. */
  --promo-btn-ease: 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 0;
  overflow: hidden;
  transition: gap var(--promo-btn-ease), margin-right var(--promo-btn-ease);
}
.home-agents .home-agents__promo .home-agents__promo-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(to right, rgba(69, 230, 186, 0) 35%, rgba(69, 230, 186, 0.95) 100%);
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
  pointer-events: none;
}
.home-agents .home-agents__promo .home-agents__promo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.home-agents .home-agents__promo .home-agents__promo-btn svg,
.home-agents .home-agents__promo .home-agents__promo-link svg {
  flex: none;
  transition: transform 0.2s ease;
}
.home-agents .home-agents__promo .home-agents__promo-btn svg { transition: transform var(--promo-btn-ease); }
@media (hover: hover) {
  .home-agents .home-agents__promo .home-agents__promo-btn:hover { gap: 18px; margin-right: -8px; color: #0b1f1a; }
  .home-agents .home-agents__promo .home-agents__promo-btn:hover::after { opacity: 1; }
  .home-agents .home-agents__promo .home-agents__promo-btn:hover svg { transform: translateX(2px); }
  .home-agents .home-agents__promo .home-agents__promo-link:hover { color: var(--promo-accent); }
  .home-agents .home-agents__promo .home-agents__promo-link:hover svg { transform: translateX(3px); }
}
.home-agents .home-agents__promo .home-agents__promo-btn:focus-visible,
.home-agents .home-agents__promo .home-agents__promo-link:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}
.home-agents .home-agents__promo .home-agents__promo-note {
  color: var(--promo-accent);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}

@media (max-width: 1180px) {
  .home-agents .home-agents__promo { gap: 36px; padding: 48px; border-radius: 48px; }
  .home-section.home-agents .home-agents__promo-title { font-size: 28px; }
}
/* Stacked: copy, then the video at full width. */
@media (max-width: 900px) {
  .home-agents .home-agents__promo {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    margin-top: 40px;
    padding: 40px;
    border-radius: 40px;
  }
}
@media (max-width: 600px) {
  .home-agents .home-agents__promo { gap: 24px; padding: 28px 20px; border-radius: 28px; }
  .home-section.home-agents .home-agents__promo-title { font-size: 24px; line-height: 1.3; margin-bottom: 12px; }
  .home-section.home-agents .home-agents__promo-text { font-size: 16px; margin-bottom: 20px; }
  .home-agents .home-agents__promo .home-agents__promo-actions { gap: 4px 24px; }
  .home-agents .home-agents__promo .home-agents__promo-btn { padding: 15px 26px; font-size: 16px; min-height: 50px; }
  .home-agents .home-agents__promo .home-agents__promo-link { min-height: 50px; }
  .home-agents__video[data-qm-video] { --qm-video-radius: 20px; }
}

/* ---------------------------------------------------------------- 3 -- */
.home-videoblock .home-videoblock__video[data-qm-video] {
  max-width: 1000px;
  margin-inline: auto;
}
@media (max-width: 600px) {
  .home-videoblock .home-videoblock__video[data-qm-video] { --qm-video-radius: 20px; }
}

/* With a button: text left, button right, both over the video's width - the
   Blog section's head pattern. Four classes so it beats the centred head on
   Services (`body.service-v2 .home-section .home-section__head`, 0-3-1). */
.home-section.home-videoblock .home-section__head.home-videoblock__head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  max-width: 1000px;
  text-align: left;
}
.home-videoblock .home-videoblock__head-text { min-width: 0; max-width: 680px; }
.home-videoblock .home-videoblock__btn { flex: none; }
@media (max-width: 768px) {
  .home-section.home-videoblock .home-section__head.home-videoblock__head--split {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qm-video[data-qm-video] .qm-video__poster,
  .qm-video[data-qm-video] .qm-video__icon,
  .qm-video[data-qm-video] .qm-video__play::before,
  .home-agents .home-agents__promo .home-agents__promo-btn,
  .home-agents .home-agents__promo .home-agents__promo-btn::after,
  .home-agents .home-agents__promo .home-agents__promo-btn svg,
  .home-agents .home-agents__promo .home-agents__promo-link svg { transition: none; }
}
