/* Cardiol Video Gate: player (75%) + agenda (25%), stacked on narrow screens */

.cvg {
  --cvg-accent: #1a5fb4;     /* active chapter + focus ring; change to the client's brand color */
  --cvg-bg: #fff;            /* agenda background (also behind the sticky heading) */
  --cvg-border: rgba(0, 0, 0, 0.12);
  --cvg-hover: rgba(0, 0, 0, 0.04);
  --cvg-active-bg: rgba(26, 95, 180, 0.08);
  --cvg-muted: rgba(0, 0, 0, 0.6);

  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: stretch;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 0 0 2rem;
}

/* The player is injected inside Gravity Forms' confirmation wrappers, which some
   themes shrink-to-fit. Make every wrapper around the player span the full width. */
.cvg-gate,
.cvg-gate :has(.cvg):not(dialog) {
  display: block;
  width: 100%;
  max-width: none;
  float: none;
  box-sizing: border-box;
}

/* Player: aspect ratio comes from the PHP (4:3 per Vimeo's embed code). */
.cvg__player {
  position: relative;
  aspect-ratio: var(--cvg-aspect, 16 / 9);
  background: #000;
  scroll-margin-top: 100px; /* room for a sticky site header when we scroll to it */
}
.cvg__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Agenda: the inner box is pinned to the player's height and scrolls on its own. */
.cvg__toc {
  position: relative;
  min-height: 0;
}
.cvg__toc-inner {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cvg-bg);
  border: 1px solid var(--cvg-border);
  border-radius: 6px;
}

.cvg .cvg__toc-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--cvg-bg);
  border-bottom: 1px solid var(--cvg-border);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.cvg .cvg__toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cvg .cvg__toc-item {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--cvg-border);
}
.cvg .cvg__toc-item:last-child {
  border-bottom: 0;
}

/* Chapter buttons: reset whatever the theme does to <button>. */
.cvg .cvg__toc-btn {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0.75rem 1rem 0.75rem calc(1rem - 3px);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: normal;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cvg .cvg__toc-btn:hover {
  background: var(--cvg-hover);
  color: inherit;
}
.cvg .cvg__toc-btn:focus {
  outline: none;
}
.cvg .cvg__toc-btn:focus-visible {
  outline: 2px solid var(--cvg-accent);
  outline-offset: -2px;
}
.cvg .cvg__toc-btn[aria-current="true"] {
  background: var(--cvg-active-bg);
  border-left-color: var(--cvg-accent);
}

.cvg__time {
  flex: 0 0 auto;
  min-width: 3.6em;
  padding-top: 0.1em;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--cvg-muted);
}
.cvg__toc-btn[aria-current="true"] .cvg__time {
  color: var(--cvg-accent);
  font-weight: 600;
}

.cvg__body {
  display: block;
  min-width: 0;
}
.cvg__title {
  display: block;
  font-weight: 600;
}
.cvg__speakers {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.cvg__speaker {
  display: block;
}
.cvg__speaker + .cvg__speaker {
  margin-top: 0.35rem;
}
.cvg__name {
  display: block;
  font-weight: 500;
}
.cvg__role {
  display: block;
  color: var(--cvg-muted);
}

/* Stack on tablets/phones: full-width player, agenda below at its natural height. */
@media (max-width: 900px) {
  .cvg {
    grid-template-columns: minmax(0, 1fr);
  }
  .cvg__toc-inner {
    position: static;
    overflow: visible;
  }
  .cvg .cvg__toc-heading {
    position: static;
  }
}

/* ------------------------------------------------------------------
   Locked teaser: the same layout, blurred, behind the popup
   ------------------------------------------------------------------ */

.cvg--teaser .cvg__player {
  overflow: hidden;
}
.cvg-teaser__poster {
  position: absolute;
  inset: 0;
  filter: blur(14px);
  transform: scale(1.08); /* hides the soft edges the blur creates */
  pointer-events: none;
  user-select: none;
}
.cvg-teaser__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cvg-teaser__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background:
    radial-gradient(ellipse at 30% 35%, rgba(70, 110, 160, 0.55), transparent 60%),
    radial-gradient(ellipse at 75% 70%, rgba(40, 70, 110, 0.6), transparent 55%),
    #12202f;
  color: #fff;
}
.cvg-teaser__play {
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}
.cvg-teaser__caption {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  padding: 0 10%;
}

/* Agenda in the teaser: blurred and not interactive. */
.cvg--teaser .cvg__toc {
  overflow: hidden;
  border-radius: 6px;
}
.cvg--teaser .cvg__toc-inner {
  overflow: hidden;
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

/* "Watch the replay" button, centered on the locked video; reopens the popup. */
.cvg .cvg-teaser__unlock {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.85rem 1.5rem;
  min-height: 0;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #12202f;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.2;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cvg .cvg-teaser__unlock:hover {
  background: #fff;
  color: #12202f;
  transform: translate(-50%, -50%) scale(1.04);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.cvg .cvg-teaser__unlock:focus-visible {
  outline: 3px solid var(--cvg-accent);
  outline-offset: 3px;
}

/* After unlocking: the real player sharpens into place. */
@keyframes cvg-reveal {
  from { filter: blur(10px); opacity: 0.4; }
  to   { filter: none; opacity: 1; }
}
.cvg--reveal {
  animation: cvg-reveal 0.7s ease-out;
}

@media (max-width: 900px) {
  .cvg--teaser .cvg__toc-inner {
    max-height: 320px;
  }
}

/* ------------------------------------------------------------------
   Popup (native <dialog>, so no extra lightbox plugin is needed)
   ------------------------------------------------------------------ */

/* Width is set with plain, separate declarations (and !important) so theme styles
   and CSS minifiers can't shrink it: 560px wide, but never wider than the screen. */
dialog.cvg-dialog {
  position: fixed;
  width: 560px !important;
  min-width: 0 !important;
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 2.25rem 2rem 1.75rem;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #222;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}
.cvg-dialog[open] {
  animation: cvg-pop 0.2s ease-out;
}
.cvg-dialog:focus {
  outline: none;
}
@media (max-width: 600px) {
  dialog.cvg-dialog {
    padding: 2.25rem 1.25rem 1.25rem;
  }
}

/* Make the form fit the popup, whatever widths the theme or Gravity Forms set. */
.cvg-dialog *,
.cvg-dialog *::before,
.cvg-dialog *::after {
  box-sizing: border-box;
}
.cvg-dialog .gform_wrapper,
.cvg-dialog form,
.cvg-dialog .gform_body,
.cvg-dialog .gform_fields,
.cvg-dialog .gfield,
.cvg-dialog .ginput_container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.cvg-dialog .gfield {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* Gravity Forms' 12-column field grid can widen past the popup to fit its contents
   (seen in Firefox). Every field is full width in the popup, so stack them as blocks. */
.cvg-dialog .gform_fields {
  display: block !important;
}
.cvg-dialog .gform_fields > .gfield:not(:first-child) {
  margin-top: 1rem !important;
}
.cvg-dialog input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
.cvg-dialog select,
.cvg-dialog textarea {
  box-sizing: border-box !important; /* padding/border stay inside the 100% width */
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
.cvg-dialog legend {
  padding-left: 0;
  padding-right: 0;
}

/* Name field (First / Last): side by side when there's room, stacked when there isn't.
   auto-fit decides this from the popup's own width, so no breakpoints are needed. */
.cvg-dialog .ginput_complex {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 0.75rem 1rem;
}
.cvg-dialog .ginput_complex > span,
.cvg-dialog .ginput_complex > div {
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  flex: none !important;
}
.cvg-dialog .ginput_complex::before,
.cvg-dialog .ginput_complex::after {
  display: none !important; /* old clearfix pseudo-elements would become grid items */
}

.cvg-dialog::backdrop {
  background: rgba(15, 22, 30, 0.55);
}
@keyframes cvg-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Stop the page scrolling behind the open popup. */
html:has(.cvg-dialog[open]) {
  overflow: hidden;
}

.cvg-dialog .cvg-dialog__close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #555;
  box-shadow: none;
  cursor: pointer;
}
.cvg-dialog .cvg-dialog__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #111;
}
.cvg-dialog .cvg-dialog__close:focus {
  outline: none;
}
.cvg-dialog .cvg-dialog__close:focus-visible {
  outline: 2px solid #1a5fb4;
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .cvg--reveal,
  .cvg-dialog[open] {
    animation: none;
  }
}

/* The gate form: keep the form itself a readable width. */
.cvg-gate form {
  max-width: 640px;
}

/* Space between the form description (intro text) and the first field. */
.cvg-gate .gform_wrapper .gform_heading {
  margin-bottom: 1.5rem;
}
