/*
 * Al-Najah Hero Video
 * Tokens: Al-Najah Industrial Navy (accent #2A4269 light / #7FA2D6 dark,
 * panel ground #D6E0F0 light / #1F2A3D dark, 20px radius to match the hero row).
 */

.njh-hero {
  --njh-split: 70%;
  --njh-height: 475px;
  --njh-aside-h: 220px;
  --njh-gap: 20px;
  --njh-fit: cover;
  --njh-ratio: 16 / 9;
  --njh-panel: #D6E0F0;
  --njh-btn-size: 44px;
  --njh-btn-bg: var(--njh-accent-light, #2A4269);
  --njh-btn-ink: var(--njh-accent-ink-light, #FFFFFF);
  --njh-btn-hover: #1B3D6E;
  --njh-btn-shadow: 0 6px 18px rgba(27, 43, 59, .22);

  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--njh-gap);
  width: 100%;
}

.njh-hero__media,
.njh-hero__aside {
  position: relative;
  min-width: 0;
  height: var(--njh-height);
  overflow: hidden;
  border-radius: 20px;
  background-color: var(--njh-panel);
}

.njh-hero__media {
  flex: 0 0 auto;
  width: var(--njh-split);
}

.njh-hero__aside {
  flex: 1 1 0;
  display: block;
}

.njh-hero--solo .njh-hero__media {
  width: 100%;
}

/* The extra .njh-hero on each selector outranks the theme's `img { height: auto }`. */
.njh-hero .njh-hero__video,
.njh-hero .njh-hero__still,
.njh-hero .njh-hero__aside img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: var(--njh-fit);
  object-position: center;
}

.njh-hero__video {
  z-index: 1;
  background-color: var(--njh-panel);
}

/* The still banner covers the video whenever it is not running: before the
   first play, while paused, and once it has ended. */
.njh-hero__still {
  z-index: 2;
  opacity: 1;
  pointer-events: none;
  transition: opacity .5s ease;
}

.njh-hero.is-playing .njh-hero__still {
  opacity: 0;
}

.njh-hero__aside img {
  transition: transform .6s ease;
}

a.njh-hero__aside:hover img {
  transform: scale(1.03);
}

/* ------------------------------------------------------------- Controls */

.njh-hero__controls {
  position: absolute;
  z-index: 3;
  inset-inline-end: 16px;
  inset-block-end: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.njh-hero__media:hover .njh-hero__controls,
.njh-hero__media:focus-within .njh-hero__controls {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* No pointer to hover with: keep them on screen. */
@media (hover: none) {
  .njh-hero__controls {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

.njh-hero .njh-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--njh-btn-size);
  height: var(--njh-btn-size);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background-color: var(--njh-btn-bg);
  color: var(--njh-btn-ink);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--njh-btn-shadow);
  transition: background-color .2s ease, transform .15s ease;
}

.njh-hero .njh-hero__btn:hover {
  background-color: var(--njh-btn-hover);
}

.njh-hero .njh-hero__btn:focus-visible {
  outline: 2px solid var(--njh-btn-ink);
  outline-offset: 2px;
}

.njh-hero .njh-hero__btn:active {
  transform: scale(.94);
}

.njh-hero .njh-hero__ico {
  display: none;
  width: 45%;
  height: 45%;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.njh-hero__ico--play {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8 5.2v13.6L19 12z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8 5.2v13.6L19 12z'/></svg>");
  /* the triangle reads as off-centre when perfectly centred */
  margin-inline-start: 8%;
}

.njh-hero__ico--pause {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 5h3.2v14H7zm6.8 0H17v14h-3.2z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 5h3.2v14H7zm6.8 0H17v14h-3.2z'/></svg>");
}

.njh-hero__ico--muted {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9v6h4l5 5V4L8 9H4zm16.1 3l2.1-2.1-1.4-1.4L18.7 10.6 16.6 8.5l-1.4 1.4 2.1 2.1-2.1 2.1 1.4 1.4 2.1-2.1 2.1 2.1 1.4-1.4z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9v6h4l5 5V4L8 9H4zm16.1 3l2.1-2.1-1.4-1.4L18.7 10.6 16.6 8.5l-1.4 1.4 2.1 2.1-2.1 2.1 1.4 1.4 2.1-2.1 2.1 2.1 1.4-1.4z'/></svg>");
}

.njh-hero__ico--loud {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9v6h4l5 5V4L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 2v2a8 8 0 0 1 0 16v2a10 10 0 0 0 0-20z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9v6h4l5 5V4L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 2v2a8 8 0 0 1 0 16v2a10 10 0 0 0 0-20z'/></svg>");
}

.njh-hero.is-playing .njh-hero__ico--pause,
.njh-hero:not(.is-playing) .njh-hero__ico--play,
.njh-hero__btn--sound[aria-pressed="false"] .njh-hero__ico--muted,
.njh-hero__btn--sound[aria-pressed="true"] .njh-hero__ico--loud {
  display: block;
}

/* ------------------------------------------------------------ Dark mode */

html.evk-dark .njh-hero {
  --njh-panel: #1F2A3D;
  --njh-btn-bg: var(--njh-accent-dark, #7FA2D6);
  --njh-btn-ink: var(--njh-accent-ink-dark, #0E1623);
  --njh-btn-hover: #9DB9E4;
  --njh-btn-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}

html.evk-dark .njh-hero--dim .njh-hero__video,
html.evk-dark .njh-hero--dim .njh-hero__still,
html.evk-dark .njh-hero--dim .njh-hero__aside img {
  filter: brightness(.92);
}

/* ----------------------------------------------------------- Responsive */

@media (max-width: 1024px) {
  .njh-hero__controls {
    inset-inline-end: 12px;
    inset-block-end: 12px;
    gap: 8px;
  }

  .njh-hero {
    --njh-btn-size: 40px;
  }
}

@media (max-width: 767px) {
  .njh-hero--mobile-stack {
    flex-direction: column;
  }

  /* Stacked, the flex main axis is vertical, so flex-basis would beat height. */
  .njh-hero--mobile-stack .njh-hero__media,
  .njh-hero--mobile-stack .njh-hero__aside {
    flex: 0 0 auto;
  }

  .njh-hero--mobile-stack .njh-hero__media {
    width: 100%;
    height: auto;
    aspect-ratio: var(--njh-ratio);
  }

  .njh-hero--mobile-stack .njh-hero__aside {
    height: var(--njh-aside-h);
  }

  .njh-hero--mobile-solo .njh-hero__media {
    width: 100%;
  }

  .njh-hero--mobile-solo .njh-hero__aside {
    display: none;
  }

  .njh-hero {
    --njh-btn-size: 38px;
  }
}

/* ------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .njh-hero .njh-hero__still,
  .njh-hero .njh-hero__aside img,
  .njh-hero .njh-hero__btn,
  .njh-hero__controls {
    transition: none;
  }

  a.njh-hero__aside:hover img {
    transform: none;
  }
}
