/* =========================================================
   RK Natural Exports — Gallery Page Styles
   Premium Export Business Design
   ========================================================= */

/* ===== GALLERY HERO BANNER ===== */
.gallery-hero {
  position: relative;
  min-height: 65vh;
  display: grid;
  place-items: center;
  background: 
    linear-gradient(135deg, rgba(36, 58, 42, 0.88) 0%, rgba(26, 20, 16, 0.82) 100%),
    url('https://raw.githubusercontent.com/rknaturalexports-ai/RK-Website-Images/main/Background%20Images/CfeHpBg.avif') center/cover no-repeat;
  background-attachment: fixed;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.gallery-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(56, 90, 58, 0.15), transparent 60%);
  animation: heroGlow 8s ease-in-out infinite alternate;
  width: 100%;
}

@keyframes heroGlow {
  from { opacity: 0.6; transform: scale(1); }
  to { opacity: 1; transform: scale(1.05); }
}

.gallery-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(36, 58, 42, 0.25) 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

.gallery-hero__content {
  position: relative;
  text-align: center;
  color: #fff;
  padding: 60px 40px;
  animation: fadeInUp 1s ease-out both;
  width: 100%;
  max-width: 100%;
}

.gallery-hero h1 {
  color: #fff;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-family: "Playfair Display", serif;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: fadeInUp 1s ease-out 0.2s both;
  word-wrap: break-word;
  max-width: 100%;
}

.gallery-hero__subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: #f0f0f0;
  max-width: 60ch;
  margin: 0 auto;
  line-height: 1.6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 1s ease-out 0.4s both;
  word-wrap: break-word;
  padding: 0 10px;
}

/* ===== STICKY NAVIGATION ===== */
.gallery-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(56, 90, 58, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.gallery-nav.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Remove placeholder - not needed anymore */
.gallery-nav-placeholder {
  display: none;
}

.gallery-nav__items {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .gallery-nav__items {
    padding: 14px 40px;
  }
}

.gallery-nav__link {
  position: relative;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 28px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}

/* Hover state */
.gallery-nav__link:hover {
  color: var(--accent);
  background: rgba(56, 90, 58, 0.04);
  border-color: rgba(56, 90, 58, 0.1);
  transform: translateY(-1px);
}

/* Active state with animated underline */
.gallery-nav__link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #4d9b54 100%);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(56, 90, 58, 0.25),
              0 2px 4px rgba(56, 90, 58, 0.15);
  transform: translateY(-1px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Active state glow effect */
.gallery-nav__link.active::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #4d9b54);
  opacity: 0.15;
  z-index: -1;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 0.15;
    transform: scale(1);
  }
  50% {
    opacity: 0.25;
    transform: scale(1.05);
  }
}

/* Divider between items */
.gallery-nav__link:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: rgba(56, 90, 58, 0.15);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.gallery-nav__link.active::after,
.gallery-nav__link:hover::after {
  opacity: 0;
}

/* Remove divider after active item */
.gallery-nav__link.active + .gallery-nav__link::after {
  opacity: 0;
}

/* ===== GALLERY SECTIONS ===== */
.gallery-section {
  padding: 96px 0;
  position: relative;
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.gallery-section:nth-child(even) {
  background: linear-gradient(135deg, #fdfcfa 0%, #f9f6f1 50%, #fdfcfa 100%);
}

.gallery-section::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -80px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(56, 90, 58, 0.03), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  max-width: 100%;
}

.gallery-section__header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 64px;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out both;
  padding: 0 40px;
}

@media (max-width: 960px) {
  .gallery-section {
    padding: 80px 0;
  }
  
  .gallery-section__header {
    margin-bottom: 60px;
    padding: 0 40px;
  }
}

.gallery-section__header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-family: "Playfair Display", serif;
  color: var(--deep);
  margin: 0 0 12px;
  position: relative;
  display: inline-block;
}

.gallery-section__header h2::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 2px;
}

.gallery-section__header p {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 20px 0 0;
}

/* ===== GALLERY GRID ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 36px;
  margin-top: 56px;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 36px;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}

@media (min-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 36px;
  }
}

/* ===== GALLERY CARDS ===== */
.gallery-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              box-shadow 0.4s ease;
  opacity: 0;
  animation: scaleIn 0.6s ease-out both;
  cursor: pointer;
}

.gallery-card:nth-child(1) { animation-delay: 0.1s; }
.gallery-card:nth-child(2) { animation-delay: 0.15s; }
.gallery-card:nth-child(3) { animation-delay: 0.2s; }
.gallery-card:nth-child(4) { animation-delay: 0.25s; }
.gallery-card:nth-child(5) { animation-delay: 0.3s; }
.gallery-card:nth-child(6) { animation-delay: 0.35s; }
.gallery-card:nth-child(7) { animation-delay: 0.4s; }
.gallery-card:nth-child(8) { animation-delay: 0.45s; }

.gallery-card__image {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--beige);
}

.gallery-card__image img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
              filter 0.4s ease;
  display: block;
}

.gallery-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14),
              0 4px 12px rgba(56, 90, 58, 0.08);
  z-index: 10;
}

.gallery-card:hover .gallery-card__image img {
  transform: scale(1.08);
  filter: brightness(1.05) saturate(1.1);
}

/* ===== GALLERY OVERLAY ===== */
.gallery-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(36, 58, 42, 0.92) 0%,
    rgba(36, 58, 42, 0.6) 40%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-card:hover .gallery-card__overlay {
  opacity: 1;
}

.gallery-card__overlay h4 {
  color: #fff;
  font-size: 1.2rem;
  font-family: "Playfair Display", serif;
  margin: 0 0 8px;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.05s;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.gallery-card:hover .gallery-card__overlay h4 {
  transform: translateY(0);
}

.gallery-card__overlay p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.gallery-card:hover .gallery-card__overlay p {
  transform: translateY(0);
}

/* ===== SCROLL TO TOP BUTTON (Optional Enhancement) ===== */
.scroll-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(56, 90, 58, 0.3);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.scroll-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(56, 90, 58, 0.4);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 980px) {
  .gallery-hero {
    min-height: 50vh;
    margin-top: 0;
    background-attachment: scroll;
  }

  .gallery-hero h1 {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
    padding: 0 40px;
  }

  .gallery-hero__subtitle {
    font-size: 1.05rem;
    padding: 0 40px;
  }

  .gallery-hero__content {
    padding: 60px 40px;
  }

  .gallery-nav {
    top: 0;
  }

  .gallery-nav__items {
    gap: 8px;
    padding: 14px 40px;
    flex-wrap: nowrap;
    justify-content: center;
    max-width: 100%;
  }

  .gallery-nav__link {
    padding: 10px 20px;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
  }

  .gallery-nav__link:not(:last-child)::after {
    height: 14px;
  }

  .gallery-section {
    padding: 80px 0;
  }

  .gallery-section__header {
    margin-bottom: 60px;
    padding: 0 40px;
  }

  .gallery-section__header h2 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .gallery-card:hover {
    transform: translateY(-4px);
  }

  .gallery-card:hover .gallery-card__image img {
    transform: scale(1.05);
  }
}

@media (max-width: 640px) {
  .gallery-hero {
    min-height: 45vh;
  }

  .gallery-hero h1 {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
    margin-bottom: 12px;
    padding: 0 40px;
  }

  .gallery-hero__subtitle {
    font-size: 0.95rem;
    padding: 0 40px;
  }

  .gallery-hero__content {
    padding: 60px 40px;
  }

  .gallery-nav__items {
    justify-content: space-between;
    padding: 14px 40px;
    gap: 6px;
  }

  .gallery-nav__link {
    padding: 10px 18px;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }

  .gallery-nav__link:not(:last-child)::after {
    display: none;
  }

  .gallery-section {
    padding: 80px 0;
  }

  .gallery-section__header {
    margin-bottom: 60px;
    padding: 0 40px;
  }

  .gallery-section__header h2 {
    font-size: clamp(1.6rem, 7vw, 2rem);
  }

  .gallery-section__header p {
    font-size: 1rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 40px;
  }
}

/* ===== SMOOTH SCROLL ===== */
html {
  scroll-behavior: smooth;
}

/* Optimize scroll performance */
.gallery-nav {
  will-change: box-shadow, background;
}

.gallery-nav__link {
  will-change: transform, background, color;
}

.gallery-card {
  will-change: transform;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .gallery-nav,
  .site-header,
  .site-footer {
    display: none;
  }

  .gallery-card {
    break-inside: avoid;
  }
}

/* =========================================================
   LIGHTBOX MODAL - Premium Export Business Design
   ========================================================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

/* Dark overlay with subtle transparency */
.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 22, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

/* Close button - top right */
.lightbox__close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10002;
  display: grid;
  place-items: center;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Navigation arrows */
.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 10002;
  display: grid;
  place-items: center;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.lightbox__prev {
  left: 32px;
}

.lightbox__next {
  right: 32px;
}

.lightbox__prev:hover,
.lightbox__next:hover {
  transform: translateY(-50%) scale(1.15);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.lightbox__prev:active,
.lightbox__next:active {
  transform: translateY(-50%) scale(0.95);
}

/* Content container */
.lightbox__content {
  position: relative;
  z-index: 10001;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: lightboxZoomIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  padding: 0 40px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .lightbox__content {
    padding: 0 20px;
    max-width: 100vw;
    width: 100%;
  }
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Main image */
.lightbox__image {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 8px 24px rgba(0, 0, 0, 0.3);
  object-fit: contain;
  transition: opacity 0.3s ease;
  display: block;
  margin: 0 auto;
}

.lightbox__image.transitioning {
  opacity: 0;
}

/* Caption below image */
.lightbox__caption {
  margin-top: 28px;
  text-align: center;
  color: #fff;
  max-width: 600px;
  padding: 0 40px;
  opacity: 0;
  animation: fadeInUp 0.4s ease-out 0.2s forwards;
}

@media (max-width: 640px) {
  .lightbox__caption {
    margin-top: 24px;
    padding: 0 40px;
  }
}

.lightbox__title {
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  margin: 0 0 8px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.lightbox__description {
  font-size: 1rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 980px) {
  .lightbox__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  .lightbox__prev,
  .lightbox__next {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }

  .lightbox__prev {
    left: 4px;
  }

  .lightbox__next {
    right: 4px;
  }

  .lightbox__content {
    max-width: 92vw;
    max-height: 80vh;
    padding: 0 50px;
    width: 100%;
    margin: 0 auto;
  }

  .lightbox__image {
    max-height: 70vh;
    max-width: 100%;
    width: auto;
    border-radius: 8px;
  }

  .lightbox__caption {
    margin-top: 16px;
    padding: 0 16px;
    max-width: 100%;
  }

  .lightbox__title {
    font-size: 1.2rem;
  }

  .lightbox__description {
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .lightbox__prev,
  .lightbox__next {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .lightbox__prev {
    left: 2px;
  }

  .lightbox__next {
    right: 2px;
  }

  .lightbox__close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .lightbox__content {
    max-width: 100vw;
    width: 100vw;
    padding: 0 48px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lightbox__image {
    max-height: 70vh;
    max-width: calc(100vw - 96px);
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .lightbox__caption {
    margin-top: 12px;
    padding: 0 12px;
  }

  .lightbox__title {
    font-size: 1.1rem;
  }

  .lightbox__description {
    font-size: 0.85rem;
  }
}

/* ===== ACCESSIBILITY ===== */
.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 4px;
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
  overflow: hidden;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
