body {
  background-color: #9fc4e9;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  box-sizing: border-box;
}

.media-main {
  width: min(1100px, calc(100% - 2rem));
  margin-top: 7rem;
  margin-bottom: 12em;
  text-align: center;
}

.media-section + .media-section {
  margin-top: 3.5rem;
}

.media-section__title {
  margin: 0 0 1.5rem;
  font-family: "Nunito Sans", sans-serif;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
  justify-items: center;
  padding: 1em;
}

.media-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 280px;
}

.media-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 0.5em;
  border: 1px solid black;
  overflow: hidden;
  box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.4);
  background: #000;
}

.media-embed video,
.media-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.media-embed video {
  display: block;
  object-fit: contain;
  background: #000;
}

.media-facade {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #000;
}

.media-facade__play {
  position: relative;
  z-index: 1;
  font-size: 2.5rem;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.media-facade:hover .media-facade__play,
.media-facade:focus-visible .media-facade__play {
  transform: scale(1.08);
}

.media-facade:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.media-item-heading {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
}

.media-caption {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.media-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  text-decoration: none;
  color: inherit;
  background-color: #ffffffb6;
  border-radius: 0.2em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 1px 1px 0 rgba(26, 26, 26, 0.85);
  transition: transform 0.15s ease, background 0.15s ease;
}

.media-download__icon {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
}

.media-download:hover {
  background: #eeeeee;
  transform: scale(1.03);
}

.media-download:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

html.dark-mode .media-download {
  color: #e1e1e1;
  background-color: #1f252c;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

html.dark-mode .media-download:hover {
  background-color: #2a323c;
}

.media-download--busy {
  cursor: wait;
  opacity: 0.85;
  pointer-events: none;
}

.media-photo {
  width: 100%;
  border-radius: 0.5em;
  border: 1px solid black;
  overflow: hidden;
  box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.4);
  background: #000;
}

.media-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.media-item--photo {
  max-width: none;
}

.media-grid--photos {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: min(640px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.media-item--bio {
  max-width: none;
  min-width: 0;
  gap: 0.5rem;
}

.media-bio-icon {
  display: block;
  width: clamp(2.75rem, 10vw, 4rem);
  height: auto;
}

.media-grid--bios {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(960px, 100%);
  margin-left: auto;
  margin-right: auto;
}

/* 3 per row; incomplete last rows stay centered thanks to flex */
.media-grid--bios .media-item--bio {
  flex: 0 0 auto;
  width: calc((100% - 2 * 1.25rem) / 3);
}

.media-item-heading--bio {
  width: 100%;
  justify-content: center;
  gap: 0.3rem;
}

.media-item--bio .media-caption {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: clamp(0.65rem, 2.5vw, 0.85rem);
  line-height: 1.25;
  word-break: break-word;
  text-align: left;
}

@media screen and (min-width: 768px) {
  .media-main {
    margin-top: 9rem;
  }

  .media-grid--photos {
    max-width: min(720px, 100%);
  }
}

@media screen and (max-width: 900px) {
  .media-grid:not(.media-grid--photos):not(.media-grid--bios) {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }
}
