/* =========================================
   Media Page Styles
   ========================================= */

/* Hero Section */
.hero {
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.hero__inner {
  display: grid;
  gap: var(--space-48);
  align-items: center;
}

@media (min-width: 768px) {
  .hero__inner {
    grid-template-columns: 1fr 1fr;
  }
}

.hero__content {
  --stack-space: var(--space-20);
}

.hero__content h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--fs-4xl), 5vw, var(--fs-5xl));
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text);
}

.hero__content .heading-accent {
  color: var(--color-primary);
  display: block;
}

.hero__media {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero__media img {
  width: 100%;
  height: auto;
  display: block;
}

/* Gallery Filters */
.filters {
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-32);
}

.filter-btn {
  padding: var(--space-8) var(--space-16);
  border: 1px solid var(--border-color);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
}

.filter-btn:hover {
  background: var(--color-elevated);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.filter-btn.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-20);
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-24);
  }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-standard);
}

.gallery-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.gallery-item.hidden {
  display: none;
}

.gallery-item__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
}

.gallery-item__btn img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.gallery-item__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0) 100%);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-standard);
}

.gallery-item__btn:hover .gallery-item__overlay,
.gallery-item__btn:focus-visible .gallery-item__overlay {
  opacity: 1;
}

.gallery-item__title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gallery-item__category {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-item__btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
}

.lightbox__content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__content img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.lightbox__close {
  position: absolute;
  top: var(--space-16);
  right: var(--space-16);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  z-index: 2;
}

.lightbox__close:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.1);
}

.lightbox__close:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-16);
  pointer-events: none;
  z-index: 2;
}

.lightbox__nav-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  pointer-events: all;
}

.lightbox__nav-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.1);
}

.lightbox__nav-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.lightbox__nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox__nav-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--border-color);
  transform: none;
}

/* Download Section */
.download-section {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-elevated) 100%);
}

.download-box {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-48);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
}

.download-box h2 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-16);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.download-box p {
  margin-bottom: var(--space-24);
}

/* Utility Classes */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-space, var(--space-16));
}

.inline-flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-md {
  gap: var(--space-16);
}

.gap-sm {
  gap: var(--space-8);
}

.flex-wrap {
  flex-wrap: wrap;
}

.muted {
  color: var(--color-text-muted);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item {
  animation: slideUp 0.4s var(--ease-standard) backwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }

.lightbox {
  animation: fadeIn 0.3s var(--ease-standard);
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .hero__cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__cta .btn {
    width: 100%;
    text-align: center;
  }

  .filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .download-box {
    padding: var(--space-32);
  }

  .lightbox__nav {
    padding: 0 var(--space-8);
  }

  .lightbox__nav-btn {
    width: 40px;
    height: 40px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gallery-item {
    border: 2px solid var(--color-text);
  }

  .filter-btn {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .lightbox,
  .filter-btn,
  .lightbox__close,
  .lightbox__nav-btn {
    animation: none;
    transition: none;
  }
}
