/* Video preview card (case studies). A locally hosted thumbnail with a
   centred play button; the whole card links to the video's original post in
   a new tab. Nothing is embedded or downloaded. The thumbnail keeps its own
   aspect ratio (width 100%, height auto), so it scales with the column on
   every device. Loaded on index.html and work.html (both carry the case
   study pop-ups). */

.video-card {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-md);
  background: var(--paper-ink);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(5, 5, 11, .06), 0 18px 40px -24px rgba(5, 5, 11, .45);
  transition: box-shadow .4s var(--ease), transform .4s var(--ease);
}

/* portrait thumbnails: centred at a narrower width, so the card is no taller
   than a landscape one (520px wide x 4:5 = 650px tall) */
.video-card--portrait {
  max-width: min(100%, 520px);
  margin-inline: auto;
}

.video-card__img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .7s var(--ease);
}

/* a light wash so the play button and label read on any frame */
.video-card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 5, 11, .05) 40%, rgba(5, 5, 11, .5));
  transition: opacity .35s var(--ease);
  pointer-events: none;
}

.video-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(56px, 4vw + 32px, 84px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--blue-deep);
  box-shadow: 0 10px 30px rgba(5, 5, 11, .35);
  transform: translate(-50%, -50%);
  transition: transform .35s var(--ease), background-color .35s var(--ease);
  pointer-events: none;
}
.video-card__play svg {
  width: 38%;
  height: 38%;
  margin-left: 8%; /* optical centring of the triangle */
  fill: currentColor;
}

.video-card__label {
  position: absolute;
  left: clamp(.75rem, 1.5vw, 1.1rem);
  bottom: clamp(.75rem, 1.5vw, 1.1rem);
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: rgba(5, 5, 11, .55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: clamp(.8rem, .76rem + .15vw, .9rem);
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
}
.video-card__label svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* hover / keyboard focus: a subtle zoom and the play button lifts */
.video-card:hover,
.video-card:focus-visible {
  box-shadow: 0 1px 2px rgba(5, 5, 11, .08), 0 24px 48px -22px rgba(5, 5, 11, .55);
}
.video-card:hover .video-card__img,
.video-card:focus-visible .video-card__img { transform: scale(1.04); }
.video-card:hover .video-card__shade,
.video-card:focus-visible .video-card__shade { opacity: .75; }
.video-card:hover .video-card__play,
.video-card:focus-visible .video-card__play {
  transform: translate(-50%, -50%) scale(1.08);
  background: #fff;
}
.video-card:focus-visible {
  outline: 3px solid var(--blue-deep);
  outline-offset: 3px;
}

/* ---- the video playing on the site (video-card.js) ----
   LinkedIn's official post embed, at LinkedIn's standard 504px width and
   tall enough for the whole post (header, caption, video, reactions), so
   visitors scroll the case study rather than inside a box. A post gets taller
   as the frame narrows (its text wraps more), so the height is worked out
   from the frame's width between two measured sizes, carried on each card:
     --embed-h-wide    height at ~494px wide (+30px spare)
     --embed-h-narrow  height at 320px wide (+30px spare)
     --embed-slope     how much taller per px narrower */
.video-embed {
  container-type: inline-size;
  width: min(100%, 504px);
  margin-inline: auto;
}
.video-embed iframe {
  display: block;
  width: 100%;
  height: clamp(var(--embed-h-wide), calc(var(--embed-h-wide) + (494px - 100cqw) * var(--embed-slope)), var(--embed-h-narrow));
  border: 0;
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(11, 11, 18, .08), 0 18px 40px -24px rgba(5, 5, 11, .35);
}
.video-embed__fallback {
  margin-top: .75rem;
  text-align: center;
  font-size: .85rem;
}
.video-embed__fallback a {
  color: var(--blue-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .video-card,
  .video-card__img,
  .video-card__shade,
  .video-card__play { transition: none; }
  .video-card:hover .video-card__img,
  .video-card:focus-visible .video-card__img { transform: none; }
}
