/* extras.css (Cultivated Fitness)
   Styles for the editable parts: photo cropping, the swipe gallery, and
   layouts that close up neatly when a photo is removed.
   Loaded after styles.css. */

/* ---- Photos always fill their frame; the editor picks which part stays in view ---- */
.infoCard--image img,
.coachCard__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.focus-top { object-position: 50% 12%; }
.focus-center { object-position: 50% 50%; }
.focus-bottom { object-position: 50% 88%; }

/* ---- No photo in "You've tried everything": the text card takes the full width, and on
        larger screens the bullets flow into two columns so the card never looks half empty ---- */
@media (min-width: 900px) {
  #tried .cardGrid:not(.cardGrid--two) .list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(32px, 5vw, 64px);
  }
}

/* ---- No photo in "Meet your coach": text uses the full width ---- */
.coachCard--noimage {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ---- Photo gallery: a row you swipe through ---- */
#gallery[hidden] { display: none; }

.gallery {
  position: relative;
}

.gallery__track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 14px;
}

.gallery__track::-webkit-scrollbar { display: none; }

.gallery__track:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: var(--card-radius);
}

.gallery__slide {
  flex: 0 0 min(82%, 400px);
  margin: 0;
  scroll-snap-align: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--card-surface);
  box-shadow: var(--shadow-soft);
}

/* Every photo gets the same frame, so mixed shapes still line up. */
.gallery__slide img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.gallery__slide figcaption {
  padding: 12px 16px 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

/* Arrow buttons (hidden on phones and when there is nothing to scroll to) */
.gallery__nav {
  position: absolute;
  top: calc(50% - 22px);
  z-index: 2;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  padding: 0 0 4px;
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  background: rgba(7, 7, 13, 0.82);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.gallery__nav:hover:not(:disabled) { background: var(--gold-soft); }
.gallery__nav:disabled { opacity: 0.3; cursor: default; }
.gallery__nav--prev { left: -8px; }
.gallery__nav--next { right: -8px; }

@media (hover: hover) and (pointer: fine) {
  .gallery[data-scrollable] .gallery__nav { display: grid; }
}

/* On larger screens show several photos at once. With only one or two,
   they grow to fill the row so there is never an empty gap. */
@media (min-width: 760px) {
  .gallery__slide {
    flex-basis: calc((100% - 32px) / 3);
    scroll-snap-align: start;
  }

  .gallery[data-count="1"] .gallery__slide {
    flex-basis: min(100%, 560px);
    margin-inline: auto;
  }

  .gallery[data-count="1"] .gallery__slide img { aspect-ratio: 4 / 3; }

  .gallery[data-count="2"] .gallery__slide {
    flex-basis: calc((100% - 16px) / 2);
  }

  .gallery[data-count="2"] .gallery__slide img { aspect-ratio: 1 / 1; }
}
