/*
 * NMRMC Videos - YouTube Shorts
 * Portrait 9:16 presentation.
 *
 * Scoped beneath .nmrmc-videos to avoid conflicts
 * with the surrounding site / Bootstrap 3.
 */

.nmrmc-videos {
  width: 100%;
}


/* ----------------------------------------
   Grid
   ---------------------------------------- */

.nmrmc-videos__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
}

.nmrmc-videos__item {
  position: relative;
  min-width: 0;
}

.nmrmc-videos__video {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}


/* ----------------------------------------
   9:16 Thumbnail
   ---------------------------------------- */

.nmrmc-videos__thumbnail {
  position: relative;
  display: block;
  width: 100%;

  /* 9:16 portrait ratio */
  padding-top: 177.7778%;

  overflow: hidden;
  background: #111;
}

.nmrmc-videos__thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ----------------------------------------
   Play Button
   ---------------------------------------- */

.nmrmc-videos__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  margin: -24px 0 0 -34px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .75);
  transition:
    background-color .2s ease,
    transform .2s ease;
}

.nmrmc-videos__play-triangle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  margin-top: -10px;
  margin-left: -6px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid #fff;
}

.nmrmc-videos__video:hover .nmrmc-videos__play,
.nmrmc-videos__video:focus .nmrmc-videos__play {
  background: #f00;
  transform: scale(1.08);
}

.nmrmc-videos__video:focus {
  outline: 2px solid #337ab7;
  outline-offset: 4px;
}


/* ----------------------------------------
   Title
   ---------------------------------------- */

.nmrmc-videos__title {
  display: block;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}


/* ----------------------------------------
   Hidden Item Preview
   ---------------------------------------- */

.nmrmc-videos__item--hidden {
  opacity: .6;
}

.nmrmc-videos__hidden-label {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 4px 7px;
  background: #b52b27;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}


/* ----------------------------------------
   Modal
   ---------------------------------------- */

.nmrmc-videos__modal {
  position: fixed;
  z-index: 10000;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 30px;
}

.nmrmc-videos__modal.is-open {
  display: flex;
}

.nmrmc-videos__backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, .85);
}


/*
 * Shorts modal:
 *
 * Keep the player narrow enough that a 9:16 video
 * fits comfortably within the viewport.
 */

.nmrmc-videos__dialog {
  position: relative;
  z-index: 1;

  width: auto;

  /*
   * At 90vh tall, a 9:16 player should be roughly
   * half that measurement in width.
   */
  height: 85vh;
  max-height: 900px;

  aspect-ratio: 9 / 16;

  background: #000;
}


/* ----------------------------------------
   9:16 Player
   ---------------------------------------- */

.nmrmc-videos__player {
  position: relative;
  width: 100%;
  height: 100%;
}

.nmrmc-videos__player iframe {
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  border: 0;
}


/* ----------------------------------------
   Close Button
   ---------------------------------------- */

.nmrmc-videos__close {
  position: absolute;
  z-index: 2;
  top: -42px;
  right: 0;

  width: 38px;
  height: 38px;

  padding: 0;
  border: 0;

  background: transparent;
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 38px;
  font-weight: normal;
  line-height: 38px;

  cursor: pointer;
}

body.nmrmc-video-modal-open {
  overflow: hidden;
}


/* ----------------------------------------
   Tablet
   ---------------------------------------- */

@media (max-width: 991px) {

  .nmrmc-videos__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}


/* ----------------------------------------
   Small Tablet
   ---------------------------------------- */

@media (max-width: 767px) {

  .nmrmc-videos__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

}


/* ----------------------------------------
   Phone
   ---------------------------------------- */

@media (max-width: 480px) {

  .nmrmc-videos__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
  }

  .nmrmc-videos__title {
    font-size: 16px;
  }

  .nmrmc-videos__modal {
    padding: 15px;
  }

  .nmrmc-videos__dialog {
    height: 80vh;
    max-width: calc(100vw - 30px);
  }

}