/* Photo frames: empty ones show a label until a photo is added */

.photo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border: 10px solid var(--image-border);
  border-radius: 4px;
  background: var(--paper-dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.photo-frame span {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 0;
  color: var(--sea);
  text-align: center;
}

@media (max-width: 767px) {
  .gallery-more {
    flex-direction: column;
    align-items: center;
  }

  .gallery-more-sep {
    display: none;
  }
}

/* Card buttons sit at the bottom so they line up across a row. Flex keeps the
   heading and paragraph margins apart, so the heading's is dropped to keep the old gap. */
.gallery .card {
  display: flex;
  flex-direction: column;
}

.gallery .card h2 {
  margin-bottom: 0;
}

.gallery .card .listen-cta {
  margin-top: auto;
}

.photo-frame.has-photo {
  overflow: hidden;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

a.photo-frame {
  text-decoration: none;
}

a.photo-frame:hover span,
a.photo-frame:focus-visible span {
  color: var(--sea);
  text-decoration: underline;
}

/* Interview photo as a play thumbnail. Every rule starts with .listen-photo
   so it beats the .photo-frame span styles above. */

.listen-photo {
  position: relative;
}

.listen-photo img {
  filter: blur(1px) brightness(0.82);
  transform: scale(1.03);
  transition: filter 0.3s, transform 0.3s;
}

.listen-photo .listen-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(to top, rgba(20, 18, 16, 0.55), rgba(20, 18, 16, 0) 55%);
}

.listen-photo .listen-play-lg {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  color: var(--sea);
  transition: background 0.2s, transform 0.2s;
}

.listen-photo .listen-play-lg svg {
  width: 1.9rem;
  height: 1.9rem;
  margin-left: 0.25rem;
}

.listen-photo .listen-tag {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.6);
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.listen-photo:hover img {
  filter: none;
  transform: scale(1);
}

.listen-photo:hover .listen-play-lg {
  background: #fff;
  transform: scale(1.08);
}

.listen-photo:hover .listen-tag {
  color: #fff;
  text-decoration: none;
}

/* the gallery grid of photos */
/* the clickable photo on the card */
.gallery-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  font: inherit;
  background: none;
  cursor: pointer;
}

.gallery-tag {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  color: var(--paper);
  background: rgba(43, 38, 34, 0.75);
  border-radius: 4px;
}

.gallery-trigger:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 3px;
}

/* the pop-up gallery. It keeps one size so the buttons stay put
   when photos of different shapes are shown. */
.lightbox {
  width: min(90vw, 900px);
  height: min(90vh, 760px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f1ece3;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(15, 13, 11, 0.92);
}

body:has(.lightbox[open]) {
  overflow: hidden;       /* stop the page scrolling behind it */
}

.lightbox-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: 1rem;
}

.lightbox-slide {
  display: grid;
  grid-row: 2;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  margin: 0;
}

.lightbox-slide[hidden] {
  display: none;
}

.lightbox-slide img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.lightbox-slide figcaption {
  min-height: 3em;
  margin-top: 0.75rem;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
  color: #e8e1d5;
}

.lightbox-controls {
  display: flex;
  grid-row: 3;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.lightbox-count {
  margin: 0;
  color: #cfc6b8;
  font-size: 0.95rem;
}

.lightbox button {
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}

.lightbox button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lightbox button:hover {
  background: var(--rule);
}

.lightbox button:focus-visible {
  outline: 2px solid #f1ece3;
  outline-offset: 2px;
}

.lightbox .lightbox-close {
  display: flex;
  width: fit-content;
  margin: 0 0 0.5rem auto;
}

/* Phones: full screen, like a photos app */
@media (max-width: 767px) {
  .lightbox {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    background: #0f0d0b;
  }

  .lightbox-inner {
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  }

  .lightbox-slide figcaption {
    padding-inline: 0.5rem;
    font-size: 0.95rem;
  }

  .lightbox-controls {
    padding-inline: 0.25rem;
  }

  .lightbox button,
  .lightbox button:hover {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(241, 236, 227, 0.14);
    color: #f1ece3;
    -webkit-tap-highlight-color: transparent;
  }

  .lightbox .lightbox-close {
    width: 48px;
  }

  .lightbox button:active {
    background: rgba(241, 236, 227, 0.3);
  }

  .lightbox button svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

:where(button.listen-cta) {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .listen-photo img,
  .listen-photo .listen-play-lg {
    transition: none;
  }

  .listen-photo:hover .listen-play-lg {
    transform: none;
  }
}
