/* Photo carousel of the park and attraction pages, with the photo credits */

.photo-carousel {
  min-width: 0;
}

.photo-carousel-stage {
  position: relative;
}

/* A strip that scrolls sideways, one photo at a time. */
.photo-carousel-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  border-radius: var(--radius-md);
}

.photo-carousel.is-ready .photo-carousel-track {
  scrollbar-width: none;
}

.photo-carousel.is-ready .photo-carousel-track::-webkit-scrollbar {
  display: none;
}

.photo-carousel-track:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.photo-carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}

.photo-carousel-figure {
  margin: 0;
}

.photo-carousel-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-brown);
}

.photo-carousel-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* A portrait photo is shown whole rather than cut. */
.photo-carousel-frame.is-portrait img {
  object-fit: contain;
}

.photo-carousel-tag,
.photo-carousel-count {
  position: absolute;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-brown) 85%, transparent);
  color: var(--color-cream-alt);
  font-size: 0.8rem;
  line-height: 1.3;
}

.photo-carousel-tag {
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: calc(100% - 1.5rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Laid over the photo frame: same width, same ratio. */
.photo-carousel-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  pointer-events: none;
}

.photo-carousel-controls[hidden] {
  display: none;
}

.photo-carousel-count {
  top: 0.75rem;
  right: 0.75rem;
}

.photo-carousel-arrow {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-cream-alt) 92%, transparent);
  color: var(--color-text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--color-brown) 25%, transparent);
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
}

.photo-carousel-arrow:hover {
  background: var(--color-cream-alt);
}

.photo-carousel-arrow:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.photo-carousel-arrow.is-prev {
  left: 0.75rem;
}

.photo-carousel-arrow.is-next {
  right: 0.75rem;
}

/* Credit: the short line, and the full credit of a Commons photo. */
.photo-credit {
  margin-top: 0.5rem;
  color: var(--color-brown-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.photo-credit-short {
  font-style: italic;
}

.photo-credit-details summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  cursor: pointer;
}

.photo-credit-details summary::-webkit-details-marker {
  display: none;
}

.photo-credit-details summary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.photo-credit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 32px;
  padding: 0 0.65rem;
  border: 1px solid var(--color-border-warm);
  border-radius: var(--radius-round);
  background: var(--color-cream-alt);
  color: var(--color-text);
  font-size: 0.75rem;
  font-style: normal;
}

.photo-credit-toggle-close,
.photo-credit-details[open] .photo-credit-toggle-open {
  display: none;
}

.photo-credit-details[open] .photo-credit-toggle-close {
  display: inline;
}

.photo-credit-full {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border-warm);
  border-radius: var(--radius-sm);
  background: var(--color-cream-alt);
  color: var(--color-text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.photo-credit-full a {
  color: var(--color-green-dark);
}

/* Thumbnails: one per photo, the current one outlined. */
.photo-carousel-thumbs {
  position: relative;
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-bottom: 2px;
  overflow-x: auto;
}

.photo-carousel-thumb {
  flex: 0 0 72px;
  height: 48px;
  overflow: hidden;
  border: 2px solid var(--color-transparent);
  border-radius: var(--radius-sm);
  background: var(--color-brown);
  opacity: 0.72;
}

.photo-carousel-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-carousel-thumb:hover,
.photo-carousel-thumb[aria-current="true"] {
  opacity: 1;
}

.photo-carousel-thumb[aria-current="true"] {
  border-color: var(--color-text);
}

.photo-carousel-thumb:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Invitation to send a photo, on a page that has none. */
.photo-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md) var(--space-lg);
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border-warm);
  border-radius: var(--radius-md);
  background: var(--color-cream-alt);
  color: var(--color-text);
}

.photo-invite-text {
  flex: 1 1 220px;
  min-width: 0;
}

.photo-invite-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.photo-invite-lead {
  margin: 0.15rem 0 0;
  color: var(--color-brown-muted);
  font-size: 0.85rem;
}

.photo-invite-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--radius-round);
  background: var(--color-accent);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.photo-invite-btn:hover {
  background: color-mix(in srgb, var(--color-accent) 85%, var(--color-brown) 15%);
}

.photo-invite-btn:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 2px;
}

/* Park page header: the carousel takes the place of the fixed image. */
.park-header-inner.has-photos {
  grid-template-columns: minmax(320px, 600px) minmax(0, 1fr);
}

.park-header-photos,
.park-header-media {
  min-width: 0;
}

@media (max-width: 760px) {
  .park-header-inner.has-photos {
    grid-template-columns: 1fr;
  }
}

/* Attraction window: the close button sits top right, so the count moves left. */
.attraction-popup-photos {
  margin-bottom: var(--space-lg);
}

.attraction-popup-photos .photo-carousel-count {
  right: auto;
  left: 0.75rem;
}

/* In the window, a lower photo and no thumbnails: the arrows and the count
   are enough for the few photos of an attraction. */
.attraction-popup-photos .photo-carousel-frame,
.attraction-popup-photos .photo-carousel-controls {
  aspect-ratio: 21 / 9;
}

.attraction-popup-photos .photo-carousel-thumbs {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .photo-carousel-track {
    scroll-behavior: auto;
  }
}
