/**
 * Image Gallery Styles for MkDocs
 *
 * Ensures photo blocks from landing pages render properly in documentation.
 * Mirrors video-player.css structure with green/blue photo theme.
 */

/* Photo block container */
.photo-block {
  margin: 2rem auto;
  max-width: 100%;
}

.photo-block img {
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
  display: block;
  background: #f0f0f0;
}

[data-md-color-scheme="slate"] .photo-block img {
  background: #1b2838;
}

/* Photo caption */
.photo-caption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: rgba(0, 0, 0, 0.6);
  text-align: center;
  font-style: italic;
}

[data-md-color-scheme="slate"] .photo-caption {
  color: rgba(255, 255, 255, 0.6);
}

/* Photo card block */
.photo-card-block {
  margin: 2rem auto;
  max-width: 480px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-card-block:hover {
  transform: translateY(-2px);
}

.photo-card-block a {
  text-decoration: none !important;
  color: inherit !important;
}

/* Photo card gallery button */
.photo-card-gallery-btn:active {
  transform: scale(0.96);
}

/* Photo album block */
.photo-album-block {
  margin: 2rem auto;
  max-width: 900px;
}

.photo-album-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: inherit;
}

/* Photo album grid */
.photo-album-grid {
  display: grid;
  gap: 8px;
}

.photo-album-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.photo-album-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.photo-album-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Photo album cell */
.photo-album-cell {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #f0f0f0;
  aspect-ratio: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-album-cell:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-md-color-scheme="slate"] .photo-album-cell {
  background: #1b2838;
}

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

.photo-album-cell a {
  display: block;
  width: 100%;
  height: 100%;
}

/* Album "View full album" link */
.photo-album-footer {
  text-align: center;
  margin-top: 1rem;
}

.photo-album-footer a {
  color: #43cea2;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.photo-album-footer a:hover {
  text-decoration: underline;
}

[data-md-color-scheme="slate"] .photo-album-footer a {
  color: #43cea2;
}

/* Loading state */
.photo-loading {
  padding: 2.5rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.875rem;
}

[data-md-color-scheme="slate"] .photo-loading {
  color: rgba(255, 255, 255, 0.45);
}

/* Error state */
.photo-error {
  padding: 2.5rem;
  text-align: center;
  background: #fff3f3;
  border: 1px solid #ffccc7;
  border-radius: 8px;
  color: #cf1322;
}

[data-md-color-scheme="slate"] .photo-error {
  background: rgba(207, 19, 34, 0.1);
  border-color: rgba(207, 19, 34, 0.3);
}

.photo-error svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
}

.photo-error p {
  margin: 0;
  font-weight: 600;
}

/* Photo placeholder (shown during GrapesJS export before hydration) */
.photo-placeholder {
  aspect-ratio: 3/2;
  background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 1.5rem;
  text-align: center;
}

.photo-placeholder svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.photo-placeholder p {
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .photo-block,
  .photo-card-block,
  .photo-album-block {
    margin: 1.5rem auto;
  }

  .photo-block img {
    border-radius: 4px;
  }

  .photo-card-block {
    max-width: 100%;
  }

  .photo-album-grid.cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }

  .photo-album-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .photo-album-grid.cols-4,
  .photo-album-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Photo Album Carousel ─────────────────────────────────────────── */

.photo-album-carousel {
  margin: 2rem auto;
  max-width: 900px;
  position: relative;
  outline: none;
}

.carousel-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #f0f0f0;
}

[data-md-color-scheme="slate"] .carousel-viewport {
  background: #1b2838;
}

.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
}

.carousel-slide a {
  display: block;
  width: 100%;
  text-decoration: none;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  display: block;
  background: #000;
}

/* Navigation arrows */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.carousel-viewport:hover .carousel-btn {
  opacity: 1;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

.carousel-btn-prev {
  left: 12px;
}

.carousel-btn-next {
  right: 12px;
}

/* Dot indicators */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot:hover {
  background: rgba(0, 0, 0, 0.4);
}

.carousel-dot.active {
  background: #43cea2;
  transform: scale(1.2);
}

[data-md-color-scheme="slate"] .carousel-dot {
  background: rgba(255, 255, 255, 0.2);
}

[data-md-color-scheme="slate"] .carousel-dot:hover {
  background: rgba(255, 255, 255, 0.4);
}

[data-md-color-scheme="slate"] .carousel-dot.active {
  background: #43cea2;
}

/* Responsive: arrows always visible on mobile (no hover) */
@media (max-width: 768px) {
  .carousel-btn {
    opacity: 1;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .carousel-btn-prev {
    left: 8px;
  }

  .carousel-btn-next {
    right: 8px;
  }

  .carousel-slide img {
    max-height: 400px;
  }

  .photo-album-carousel {
    margin: 1.5rem auto;
  }
}

@media (max-width: 480px) {
  .carousel-slide img {
    max-height: 300px;
  }

  .carousel-dots {
    gap: 6px;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
  }
}

/* Ensure photos respect content width in Material theme */
.md-content .photo-block,
.md-content .photo-card-block,
.md-content .photo-album-block,
.md-content .photo-album-carousel {
  max-width: 100%;
}

/* Accessibility: Focus styles */
.photo-album-cell a:focus,
.photo-card-block a:focus {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: 2px;
}

.carousel-btn:focus-visible {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: 2px;
  opacity: 1;
}

.carousel-dot:focus-visible {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: 2px;
}

.carousel-slide a:focus-visible {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: -2px;
}
