@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.qg-wrapper {
  font-family: 'Cairo', sans-serif;
  box-sizing: border-box;
  --qg-h:   480px;
  --qg-gap: 10px;
  --qg-radius: 12px;
}

.qg-wrapper *,
.qg-wrapper *::before,
.qg-wrapper *::after {
  box-sizing: inherit;
}

/* ── Carousel ────────────────────────────────────────────────────────────── */
.qg-carousel {
  position: relative;
  width: 100%;
}

/* ── Slide ───────────────────────────────────────────────────────────────── */
.qg-slide {
  display: none;
  width: 100%;
  height: var(--qg-h);
  gap: var(--qg-gap);
}

.qg-slide.qg-active {
  display: grid;
  animation: qg-reveal 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes qg-reveal {
  from { opacity: 0; transform: scale(1.018); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Mosaic layouts ──────────────────────────────────────────────────────── */

/* 4 images: tall-left | 2-stacked-middle | tall-right */
.qg-slide[data-count="4"] {
  grid-template-columns: 1fr 0.88fr 1.08fr;
  grid-template-rows: 1fr 1fr;
}
.qg-slide[data-count="4"] .qg-si:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
.qg-slide[data-count="4"] .qg-si:nth-child(2) { grid-column: 2; grid-row: 1; }
.qg-slide[data-count="4"] .qg-si:nth-child(3) { grid-column: 2; grid-row: 2; }
.qg-slide[data-count="4"] .qg-si:nth-child(4) { grid-column: 3; grid-row: 1 / 3; }

/* 3 images: tall-left | 2-stacked-right */
.qg-slide[data-count="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.qg-slide[data-count="3"] .qg-si:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
.qg-slide[data-count="3"] .qg-si:nth-child(2) { grid-column: 2; grid-row: 1; }
.qg-slide[data-count="3"] .qg-si:nth-child(3) { grid-column: 2; grid-row: 2; }

/* 2 images: side by side */
.qg-slide[data-count="2"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

/* 1 image: full width */
.qg-slide[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

/* ── Image cell ──────────────────────────────────────────────────────────── */
.qg-si {
  position: relative;
  overflow: hidden;
  border-radius: var(--qg-radius);
  cursor: pointer;
  background: #e8e8e8;
}

.qg-si img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.qg-si:hover img {
  transform: scale(1.07);
}

/* Hover overlay */
.qg-si-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.qg-si:hover .qg-si-overlay {
  background: rgba(0, 0, 0, 0.22);
}

.qg-si-overlay svg {
  width: 38px;
  height: 38px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.28s ease, transform 0.28s ease;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.qg-si:hover .qg-si-overlay svg {
  opacity: 1;
  transform: scale(1);
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.qg-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
}

.qg-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.22s, border-color 0.22s, transform 0.22s, box-shadow 0.22s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  color: inherit;
}

.qg-nav-btn:hover,
.qg-nav-btn:focus {
  background: #85724d !important;
  border-color: #85724d !important;
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(133,114,77,0.35);
  color: inherit;
}

.qg-nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: #555;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.22s;
}

.qg-nav-btn:hover svg {
  stroke: #fff;
}

/* Dots */
.qg-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d0d0d0;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.22s, transform 0.22s;
}

.qg-dot:hover {
  background: #a08c60;
}

.qg-dot.qg-dot-active {
  background: #85724d;
  transform: scale(1.45);
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.qg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  font-family: 'Cairo', sans-serif;
}

.qg-lightbox.qg-lb-active {
  opacity: 1;
  pointer-events: all;
}

.qg-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.94);
  backdrop-filter: blur(6px);
}

.qg-lb-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(92vw, 1140px);
  padding: 0 16px;
}

.qg-lb-img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 30px 90px rgba(0,0,0,0.65);
}

.qg-lb-img.qg-lb-loaded {
  opacity: 1;
  transform: scale(1);
}

.qg-lb-caption {
  padding: 18px 0 0;
  text-align: center;
  max-width: 640px;
  width: 100%;
}

.qg-lb-title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 5px;
  line-height: 1.35;
}

.qg-lb-desc {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  margin: 0 0 10px;
  line-height: 1.6;
}

.qg-lb-counter {
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.qg-lb-prev,
.qg-lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
}

.qg-lb-prev { left: 20px; }
.qg-lb-next { right: 20px; }

.qg-lb-prev:hover {
  background: rgba(133,114,77,0.75);
  transform: translateY(-50%) translateX(-2px);
}
.qg-lb-next:hover {
  background: rgba(133,114,77,0.75);
  transform: translateY(-50%) translateX(2px);
}

.qg-lb-prev svg,
.qg-lb-next svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qg-lb-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.3s;
  backdrop-filter: blur(8px);
}

.qg-lb-close:hover {
  background: rgba(255,255,255,0.22);
  transform: rotate(90deg);
}

.qg-lb-close svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qg-no-results {
  color: #888;
  font-size: 15px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .qg-slide[data-count="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .qg-slide[data-count="4"] .qg-si:nth-child(1) { grid-column: 1; grid-row: 1; }
  .qg-slide[data-count="4"] .qg-si:nth-child(2) { grid-column: 2; grid-row: 1; }
  .qg-slide[data-count="4"] .qg-si:nth-child(3) { grid-column: 1; grid-row: 2; }
  .qg-slide[data-count="4"] .qg-si:nth-child(4) { grid-column: 2; grid-row: 2; }

  .qg-slide[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .qg-slide[data-count="3"] .qg-si:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .qg-slide[data-count="3"] .qg-si:nth-child(2) { grid-column: 1; grid-row: 2; }
  .qg-slide[data-count="3"] .qg-si:nth-child(3) { grid-column: 2; grid-row: 2; }

  .qg-lb-prev { left: 10px; }
  .qg-lb-next { right: 10px; }
}

@media (max-width: 480px) {
  .qg-slide {
    height: calc(var(--qg-h) * 0.7) !important;
  }
  .qg-slide[data-count="4"],
  .qg-slide[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  /* Reset all column/row overrides to simple 2×2 grid */
  .qg-slide .qg-si:nth-child(1) { grid-column: 1; grid-row: 1; }
  .qg-slide .qg-si:nth-child(2) { grid-column: 2; grid-row: 1; }
  .qg-slide .qg-si:nth-child(3) { grid-column: 1; grid-row: 2; }
  .qg-slide .qg-si:nth-child(4) { grid-column: 2; grid-row: 2; }
}
