/* ============================================================
   GALLERY.CSS — Premium dark UI redesign
   All classes prefixed .gallery- — zero conflicts with existing styles
   ============================================================ */

/* ── CSS custom properties ──────────────────────────────────── */
:root {
  --g-accent:        #ff6a00;
  --g-accent-red:    #c23232;
  --g-accent-mix:    #e03a00;
  --g-glow-orange:   rgba(255, 106, 0, 0.35);
  --g-glow-red:      rgba(194, 50, 50, 0.35);
  --g-card-bg:       rgba(12, 4, 2, 0.72);
  --g-card-border:   rgba(255, 255, 255, 0.07);
  --g-card-radius:   20px;
  --g-transition:    0.45s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Divider ────────────────────────────────────────────────── */
.gallery-section-divider {
  position: relative;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 106, 0, 0.15) 20%,
    rgba(255, 106, 0, 0.35) 50%,
    rgba(255, 106, 0, 0.15) 80%,
    transparent
  );
  overflow: visible;
}

.gallery-section-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(255, 106, 0, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Section background ambiance ───────────────────────────── */
#gallery {
  position: relative;
}

#gallery::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% 20%,  rgba(194, 50,  50,  0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 80%,  rgba(255, 106,  0,  0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%,  rgba(180, 30,   0,  0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#gallery > * { position: relative; z-index: 1; }

/* ── Filter Buttons ─────────────────────────────────────────── */
.gallery-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.gallery-filter-btn {
  padding: 0.5rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s, box-shadow 0.25s;
  font-family: inherit;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gallery-filter-btn:hover {
  border-color: rgba(255, 106, 0, 0.4);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 106, 0, 0.08);
}

.gallery-filter-btn.gallery-filter-active {
  background: linear-gradient(135deg, #c23232 0%, #ff6a00 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 106, 0, 0.4), 0 0 8px rgba(194, 50, 50, 0.3);
}

/* ── Grid ───────────────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.75rem;
  min-height: 100px;
}

/* ── Card base ──────────────────────────────────────────────── */
.gallery-card {
  position: relative;
  border-radius: var(--g-card-radius);
  overflow: hidden;
  background: var(--g-card-bg);
  border: 1px solid var(--g-card-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  cursor: pointer;

  opacity: 0;
  transform: translateY(32px);
  transition:
    transform var(--g-transition),
    box-shadow var(--g-transition),
    border-color 0.3s ease;

  transform-style: preserve-3d;
  will-change: transform;
}

/* Ambient glow pseudo-element — revealed on hover */
.gallery-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--g-card-radius) + 1px);
  background: linear-gradient(
    135deg,
    rgba(255, 106, 0, 0.0)  0%,
    rgba(194, 50,  50, 0.0) 100%
  );
  z-index: 0;
  transition: background 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}

.gallery-card:hover::before {
  background: linear-gradient(
    135deg,
    rgba(255, 106, 0, 0.12) 0%,
    rgba(194, 50,  50, 0.08) 100%
  );
}

/* Entrance animation */
@keyframes gallery-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-card.gallery-visible {
  animation: gallery-fade-up 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.gallery-card:hover {
  border-color: rgba(255, 106, 0, 0.3);
  box-shadow:
    0 0 0 1px rgba(255, 106, 0, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 24px 64px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(255, 106, 0, 0.08);
}

/* ── Shine sweep overlay ────────────────────────────────────── */
.gallery-card-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 6;
  background: linear-gradient(
    115deg,
    transparent 25%,
    rgba(255, 255, 255, 0.07) 45%,
    rgba(255, 200, 100, 0.05) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
}

@keyframes gallery-shine-sweep {
  to { transform: translateX(120%); }
}

.gallery-card:hover .gallery-card-shine {
  animation: gallery-shine-sweep 0.65s ease forwards;
}

/* ── App window chrome bar ──────────────────────────────────── */
.gallery-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(6, 2, 1, 0.8);
  flex-shrink: 0;
}

/* macOS-style dots bar above the image */
.gallery-card-img-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: rgba(8, 3, 2, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 3;
  backdrop-filter: blur(4px);
}

/* Three dots */
.gallery-card-img-wrap::after {
  content: '';
  position: absolute;
  top: 9px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.6);
  box-shadow:
    14px 0 0 rgba(255, 190, 50, 0.55),
    28px 0 0 rgba(80, 200, 80, 0.5);
  z-index: 4;
}

/* ── Individual slides ──────────────────────────────────────── */
.gallery-slide {
  position: absolute;
  inset: 0;
  top: 28px; /* sit below the chrome bar */
  opacity: 0;
  transition: opacity 0.75s ease;
}

.gallery-slide.gallery-slide-active {
  opacity: 1;
}

.gallery-slide.gallery-slide-error {
  display: none;
}

.gallery-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.gallery-card:hover .gallery-card-img {
  transform: scale(1.07);
}

/* ── Inner image dots ───────────────────────────────────────── */
.gallery-img-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 5;
  pointer-events: none;
}

.gallery-img-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.3s ease, background 0.3s ease;
  flex-shrink: 0;
}

.gallery-img-dot.gallery-img-dot-active {
  width: 16px;
  background: var(--g-accent);
  box-shadow: 0 0 8px rgba(255, 106, 0, 0.7);
}

/* Fallback placeholder */
.gallery-card-img-fallback {
  display: none;
  position: absolute;
  inset: 0;
  top: 28px;
  width: 100%;
  height: calc(100% - 28px);
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.015);
}

/* ── Card body ──────────────────────────────────────────────── */
.gallery-card-body {
  padding: 1.35rem 1.4rem 1.5rem;
  position: relative;
  z-index: 2;

  /* Subtle top separator */
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.gallery-card-category {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--g-accent-red), var(--g-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Corner arrow */
.gallery-card-arrow {
  font-size: 1rem;
  line-height: 1;
  color: var(--g-accent);
  opacity: 0;
  transform: translate(-5px, 5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-shadow: 0 0 12px rgba(255, 106, 0, 0.6);
}

.gallery-card:hover .gallery-card-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.gallery-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Description */
.gallery-card-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.6;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.45s ease, opacity 0.4s ease, margin 0.3s ease;
}

.gallery-card:hover .gallery-card-desc {
  max-height: 100px;
  opacity: 1;
  margin-top: 0.15rem;
}

/* ── View Project CTA ───────────────────────────────────────── */
.gallery-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 106, 0, 0.3);
  background: rgba(255, 106, 0, 0.07);
  color: var(--g-accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease 0.05s, transform 0.35s ease 0.05s,
              background 0.2s, border-color 0.2s, box-shadow 0.2s;
  pointer-events: none;
}

.gallery-card:hover .gallery-card-cta {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.gallery-card-cta:hover {
  background: rgba(255, 106, 0, 0.18);
  border-color: rgba(255, 106, 0, 0.6);
  box-shadow: 0 0 16px rgba(255, 106, 0, 0.25);
}

/* ── Page dots navigation ───────────────────────────────────── */
.gallery-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin-top: 3rem;
  min-height: 20px;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s ease, width 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

.gallery-dot:hover {
  background: rgba(255, 106, 0, 0.45);
}

.gallery-dot.gallery-dot-active {
  background: linear-gradient(90deg, #c23232, #ff6a00);
  width: 28px;
  box-shadow: 0 0 12px rgba(255, 106, 0, 0.5);
}

/* ── Lightbox ───────────────────────────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(3, 0, 0, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-lightbox.gallery-lb-open {
  opacity: 1;
  pointer-events: all;
}

.gallery-lb-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: min(92vw, 1100px);
  width: 100%;
  transform: scale(0.94) translateY(16px);
  transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.gallery-lightbox.gallery-lb-open .gallery-lb-frame {
  transform: scale(1) translateY(0);
}

.gallery-lb-img-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 2, 2, 0.6);
  box-shadow:
    0 0 0 1px rgba(255, 106, 0, 0.08),
    0 40px 80px rgba(0, 0, 0, 0.7);
  max-height: 76vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lb-img {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  transition: opacity 0.25s ease;
}

.gallery-lb-img.gallery-lb-fading {
  opacity: 0;
}

.gallery-lb-prev,
.gallery-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 2, 2, 0.75);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  padding: 0;
}

.gallery-lb-prev { left: 14px; }
.gallery-lb-next { right: 14px; }

.gallery-lb-prev:hover,
.gallery-lb-next:hover {
  background: linear-gradient(135deg, #c23232, #ff6a00);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 106, 0, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.gallery-lb-prev.gallery-lb-hidden,
.gallery-lb-next.gallery-lb-hidden {
  display: none;
}

.gallery-lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.gallery-lb-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.gallery-lb-counter {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-lb-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.gallery-lb-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.gallery-lb-dot.gallery-lb-dot-active {
  width: 20px;
  background: linear-gradient(90deg, #c23232, #ff6a00);
  box-shadow: 0 0 8px rgba(255, 106, 0, 0.5);
}

.gallery-lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 2, 2, 0.7);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
  padding: 0;
  z-index: 2;
}

.gallery-lb-close:hover {
  background: linear-gradient(135deg, #c23232, #ff6a00);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 106, 0, 0.4);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }
}

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

  .gallery-filter-btn {
    padding: 0.42rem 1rem;
    font-size: 0.7rem;
  }

  .gallery-card-body {
    padding: 1.1rem 1.1rem 1.25rem;
  }
}
