/**
 * @file
 * Photo carousel styles with thumbnail navigation.
 */

/* ============================================
   Main Carousel Container
   ============================================ */

.photo-carousel {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 2rem;
  background: #000;
  border-radius: 0.5rem;
  overflow: hidden;
}

/* ============================================
   Main Slider Area
   ============================================ */

.photo-carousel__main {
  position: relative;
  background: #000;
}

.photo-carousel__track {
  overflow: hidden;
}

.photo-carousel__slides {
  display: flex;
  transition: transform 0.4s ease-in-out;
}

.photo-carousel__slide {
  min-width: 100%;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  aspect-ratio: 16/10;
}

.photo-carousel__slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ============================================
   Navigation Arrows
   ============================================ */

.photo-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  z-index: 10;
}

.photo-carousel__nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.photo-carousel__nav--prev {
  left: 1rem;
}

.photo-carousel__nav--next {
  right: 1rem;
}

.photo-carousel__nav svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   Slide Counter
   ============================================ */

.photo-carousel__counter {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10;
}

/* ============================================
   Caption Area
   ============================================ */

.photo-carousel__caption-area {
  background: #1a1a1a;
  padding: 1rem 1.25rem;
  min-height: 60px;
}

.photo-carousel__caption-item {
  display: none;
}

.photo-carousel__caption-item.is-active {
  display: block;
}

.photo-carousel__caption-text {
  color: #fff;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}

.photo-carousel__caption-credit {
  display: block;
  color: #999;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

/* ============================================
   Thumbnail Navigation
   ============================================ */

.photo-carousel__thumbnails-wrapper {
  position: relative;
  background: #111;
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
}

.photo-carousel__thumbnails {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 0.5rem;
}

.photo-carousel__thumbnails::-webkit-scrollbar {
  display: none;
}

.photo-carousel__thumbnails-track {
  display: flex;
  gap: 0.5rem;
}

.photo-carousel__thumbnail {
  flex: 0 0 auto;
  width: 80px;
  height: 60px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.25rem;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
  background: #222;
}

.photo-carousel__thumbnail:hover {
  opacity: 0.8;
}

.photo-carousel__thumbnail.is-active {
  opacity: 1;
  border-color: #b91c1c;
}

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

/* Thumbnail Navigation Arrows */
.photo-carousel__thumb-nav {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  margin: 0 0.5rem;
}

.photo-carousel__thumb-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-carousel__thumb-nav.is-hidden {
  opacity: 0.3;
  pointer-events: none;
}

.photo-carousel__thumb-nav svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Accessibility
   ============================================ */

.carousel-live-region,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
  .photo-carousel {
    border-radius: 0;
    margin: 0 -1rem 1.5rem;
    max-width: calc(100% + 2rem);
  }

  .photo-carousel__slide {
    aspect-ratio: 4/3;
  }

  .photo-carousel__nav {
    width: 40px;
    height: 40px;
  }

  .photo-carousel__nav--prev {
    left: 0.5rem;
  }

  .photo-carousel__nav--next {
    right: 0.5rem;
  }

  .photo-carousel__nav svg {
    width: 20px;
    height: 20px;
  }

  .photo-carousel__counter {
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .photo-carousel__caption-area {
    padding: 0.875rem 1rem;
    min-height: auto;
  }

  .photo-carousel__caption-text {
    font-size: 0.875rem;
  }

  .photo-carousel__thumbnail {
    width: 64px;
    height: 48px;
  }

  .photo-carousel__thumb-nav {
    width: 28px;
    height: 28px;
    margin: 0 0.25rem;
  }
}

@media (max-width: 480px) {
  .photo-carousel__nav {
    width: 36px;
    height: 36px;
  }

  .photo-carousel__thumbnail {
    width: 56px;
    height: 42px;
  }
}

/* ============================================
   Node Image Gallery Page Styles
   ============================================ */

.node--image-gallery {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.node--image-gallery .page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 1.5rem;
  line-height: 1.3;
}

/* Gallery Layout with Sidebar */
.gallery-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

.gallery-layout__main {
  min-width: 0;
}

.gallery-layout__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Recent Galleries Section */
.recent-galleries {
  background: #f9f9f9;
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.recent-galleries__title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #b91c1c;
}

.recent-galleries__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Recent Gallery Card */
.recent-gallery-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem;
  background: #fff;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
}

.recent-gallery-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.recent-gallery-card__image {
  flex: 0 0 80px;
  width: 80px;
  height: 60px;
  border-radius: 0.25rem;
  overflow: hidden;
  position: relative;
  background: #e5e5e5;
}

.recent-gallery-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-gallery-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.recent-gallery-card__count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  gap: 3px;
}

.recent-gallery-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.recent-gallery-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-gallery-card:hover .recent-gallery-card__title {
  color: #b91c1c;
}

.recent-gallery-card__date {
  font-size: 0.75rem;
  color: #666;
}

/* View All Link */
.recent-galleries__more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #b91c1c;
  text-decoration: none;
  transition: gap 0.2s;
}

.recent-galleries__more-link:hover {
  gap: 0.5rem;
}

/* Submit Photos CTA - matches /slideshows page styling */
.gallery-layout__sidebar .submit-photos-cta {
  background: rgba(166, 44, 0, 0.05);
  border: 1px solid rgba(166, 44, 0, 0.2);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.gallery-layout__sidebar .submit-photos-cta__icon {
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(166, 44, 0, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: #A62C00;
}

.gallery-layout__sidebar .submit-photos-cta__title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
}

.gallery-layout__sidebar .submit-photos-cta__description {
  font-size: 0.875rem;
  color: #666;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.gallery-layout__sidebar .submit-photos-cta .btn--sm {
  display: inline-block;
  padding: 0.450rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: #A62C00;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  text-decoration: none;
  transition: background 0.2s;
}

.gallery-layout__sidebar .submit-photos-cta .btn--sm:hover {
  background: #8a2400;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .gallery-layout {
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .node--image-gallery {
    padding: 0;
  }

  .node--image-gallery .page-title {
    font-size: 1.375rem;
    padding: 0 1rem;
    margin-bottom: 1rem;
  }

  .gallery-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .gallery-layout__sidebar {
    padding: 0 1rem;
  }

  .recent-galleries__list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .recent-gallery-card {
    flex-direction: column;
    padding: 0;
    background: transparent;
  }

  .recent-gallery-card__image {
    flex: none;
    width: 100%;
    height: 80px;
  }

  .recent-gallery-card__content {
    padding: 0.5rem 0;
  }

  .recent-gallery-card__title {
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
  }

  .recent-gallery-card__date {
    font-size: 0.6875rem;
  }
}

@media (max-width: 480px) {
  .recent-galleries__list {
    grid-template-columns: 1fr;
  }

  .recent-gallery-card {
    flex-direction: row;
    padding: 0.5rem;
    background: #fff;
  }

  .recent-gallery-card__image {
    width: 80px;
    height: 60px;
  }
}

/* ============================================
   Lightbox Modal
   ============================================ */

.photo-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none;
}

.photo-lightbox.is-open {
  display: block;
}

.photo-lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

.photo-lightbox__content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.photo-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-lightbox__image-container {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.25rem;
}

.photo-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.photo-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-lightbox__nav--prev {
  left: 1.5rem;
}

.photo-lightbox__nav--next {
  right: 1.5rem;
}

.photo-lightbox__caption {
  position: absolute;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 1rem;
  text-align: center;
  max-width: 80%;
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 0.5rem;
}

.photo-lightbox__caption:empty {
  display: none;
}

.photo-lightbox__counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Lightbox Responsive */
@media (max-width: 768px) {
  .photo-lightbox__close {
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
  }

  .photo-lightbox__nav {
    width: 44px;
    height: 44px;
  }

  .photo-lightbox__nav--prev {
    left: 0.5rem;
  }

  .photo-lightbox__nav--next {
    right: 0.5rem;
  }

  .photo-lightbox__nav svg {
    width: 24px;
    height: 24px;
  }

  .photo-lightbox__caption {
    bottom: 5rem;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    max-width: 90%;
  }

  .photo-lightbox__image-container {
    max-width: 95vw;
    max-height: 70vh;
  }

  .photo-lightbox__image {
    max-height: 70vh;
  }
}

/* ============================================
   Gallery Page Layout
   ============================================ */

.gallery-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.gallery-layout__main {
  min-width: 0;
}

.gallery-layout__main .page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.gallery-layout__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================
   Recent Galleries Section
   ============================================ */

.recent-galleries {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.recent-galleries__title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #A62C00;
}

.recent-galleries__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-gallery-card {
  display: flex;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
}

.recent-gallery-card:hover {
  background: #f5f5f5;
}

.recent-gallery-card__image {
  width: 80px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 0.375rem;
  overflow: hidden;
  background: #e5e5e5;
  position: relative;
}

.recent-gallery-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-gallery-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.recent-gallery-card__count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.recent-gallery-card__count svg {
  width: 10px;
  height: 10px;
}

.recent-gallery-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.recent-gallery-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-gallery-card__date {
  font-size: 0.75rem;
  color: #666;
}

.recent-galleries__more-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1rem;
  padding: 0.625rem 1rem;
  background: #f5f5f5;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #A62C00;
  text-decoration: none;
  transition: background 0.2s;
}

.recent-galleries__more-link:hover {
  background: #eee;
}

/* ============================================
   Submit Photos CTA
   ============================================ */

.submit-photos-cta {
  background: linear-gradient(135deg, #A62C00 0%, #8a2400 100%);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  color: #fff;
}

.submit-photos-cta__icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.submit-photos-cta__icon svg {
  width: 24px;
  height: 24px;
}

.submit-photos-cta__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.submit-photos-cta__description {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.submit-photos-cta .btn--primary {
  background: #fff;
  color: #A62C00;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-block;
  text-decoration: none;
}

.submit-photos-cta .btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Gallery Layout Responsive
   ============================================ */

@media (max-width: 1024px) {
  .gallery-layout {
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .gallery-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .gallery-layout__sidebar {
    order: 2;
  }

  .gallery-layout__main .page-title {
    font-size: 1.5rem;
  }
}
