@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ══════════════════════════════════════
   SECTION
   ══════════════════════════════════════ */
.nsglb-section {
  padding: 80px 0 100px;
  background: #ffffff;
  font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
  overflow-x: hidden;
}
.nsglb-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}
.nsglb-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #2EAA6C;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.nsglb-tag::before {
  content: '';
  width: 24px; height: 2px;
  background: #2EAA6C;
  display: block; flex-shrink: 0;
}
.nsglb-heading {
  font-family: 'Playfair Display', serif !important;
  font-size: clamp(1.8rem, 3vw, 2.8rem) !important;
  font-weight: 700 !important;
  color: #0D2B55 !important;
  line-height: 1.15 !important;
  margin: 0 0 16px 0 !important;
}
.nsglb-divider {
  width: 48px; height: 3px;
  background: linear-gradient(90deg, #2EAA6C, #1A7A6E);
  border-radius: 2px;
  margin-bottom: 40px;
}

/* ══════════════════════════════════════
   DESKTOP GRID  (>768px)
   4 equal columns × 2 rows
   Row 1: [50%] [25%] [25%]
   Row 2: [25%] [25%] [50%]
   ══════════════════════════════════════ */
.nsglb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 280px 280px;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

/* Row 1 */
.nsglb-tile:nth-child(1) { grid-column: 1 / span 2; grid-row: 1; }
.nsglb-tile:nth-child(2) { grid-column: 3;           grid-row: 1; }
.nsglb-tile:nth-child(3) { grid-column: 4;           grid-row: 1; }
/* Row 2 */
.nsglb-tile:nth-child(4) { grid-column: 1;           grid-row: 2; }
.nsglb-tile:nth-child(5) { grid-column: 2;           grid-row: 2; }
.nsglb-tile:nth-child(6) { grid-column: 3 / span 2;  grid-row: 2; }

/* ══════════════════════════════════════
   TILE BASE
   Key fix: height:100% ensures the tile
   always stretches to fill its grid cell,
   so image has something to cover fully
   ══════════════════════════════════════ */
.nsglb-tile {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  /* CRITICAL: no background — use the darkest possible fallback
     so if image is still loading it looks intentional */
  background: #0d1a2a;
  min-width: 0;
  min-height: 0;         /* let grid rows control height */
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* Ensure tile always fills its grid cell */
  width: 100%;
  height: 100%;
}
.nsglb-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.28);
}

/* ══════════════════════════════════════
   IMAGE — absolute fill, no gaps ever
   ══════════════════════════════════════ */
.nsglb-tile img {
  position: absolute;
  inset: 0;              /* top:0 right:0 bottom:0 left:0 */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Prevents any sub-pixel gap at bottom */
  vertical-align: top;
  transition: transform 0.55s cubic-bezier(0.25,0.46,0.45,0.94),
              filter 0.55s ease;
  filter: brightness(0.85) saturate(1.08);
}
.nsglb-tile:hover img {
  transform: scale(1.06);
  filter: brightness(0.70) saturate(1.12);
}

/* ══════════════════════════════════════
   LABEL GRADIENT — pure transparent fade
   NO solid box, NO hard edge
   ══════════════════════════════════════ */
.nsglb-tile-label-bg {
  position: absolute;
  inset: auto 0 0 0;     /* left:0, right:0, bottom:0 only */
  height: 110px;
  background: linear-gradient(
    to top,
    rgba(4, 10, 24, 0.85) 0%,
    rgba(4, 10, 24, 0.52) 38%,
    rgba(4, 10, 24, 0.18) 68%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
  /* Inherit border-radius from tile */
  border-radius: 0 0 16px 16px;
}

/* ── Label text ── */
.nsglb-tile-label {
  position: absolute;
  bottom: 15px;
  left: 16px;
  z-index: 2;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.93);
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
  pointer-events: none;
  line-height: 1;
}

/* ── Hover overlay ── */
.nsglb-tile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 55, 0.30);
  opacity: 0;
  transition: opacity 0.35s ease;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
  border-radius: 16px;
}
.nsglb-tile:hover .nsglb-tile-overlay { opacity: 1; }

/* Zoom icon */
.nsglb-zoom-icon {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  transform: scale(0.6) translateY(10px);
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s ease;
  box-shadow: 0 2px 0 rgba(255,255,255,0.25) inset, 0 8px 24px rgba(0,0,0,0.35);
}
.nsglb-tile:hover .nsglb-zoom-icon { transform: scale(1) translateY(0); opacity: 1; }
.nsglb-zoom-icon svg { width: 22px; height: 22px; }

/* ── Placeholder (no image yet) ── */
.nsglb-no-image {
  background: linear-gradient(135deg, #1e2d42, #2a3f5f) !important;
}
.nsglb-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: #5a7a9a; font-size: 13px;
  text-align: center; padding: 20px; box-sizing: border-box;
}
.nsglb-placeholder svg { width: 36px; height: 36px; stroke: #4a6a8a; }
.nsglb-placeholder span { color: #7a9ab8; font-weight: 500; }
.nsglb-placeholder small { font-size: 11px; opacity: 0.6; }

.nsglb-help-box {
  margin-top: 28px; background: #f0f7ff;
  border: 1px solid #c8ddf5; border-radius: 12px;
  padding: 16px 20px; font-size: 14px; color: #3a5a80;
}

/* ══════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════ */
.nsglb-lightbox {
  position: fixed; inset: 0; z-index: 9999999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  pointer-events: none;
}
.nsglb-lightbox.nsglb-open { opacity: 1; visibility: visible; pointer-events: auto; }

.nsglb-lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,10,24,0.93);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  cursor: pointer;
}
.nsglb-lb-backdrop::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 70vw; height: 70vh;
  background: radial-gradient(ellipse, rgba(46,170,108,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.nsglb-lb-inner {
  position: relative; z-index: 1;
  max-width: 90vw; max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
  transform: scale(0.86) translateY(16px); opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34,1.15,0.64,1), opacity 0.35s ease;
}
.nsglb-lightbox.nsglb-open .nsglb-lb-inner { transform: scale(1) translateY(0); opacity: 1; }

.nsglb-lb-img-wrap {
  position: relative; border-radius: 20px; overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 2px 0 0 rgba(255,255,255,0.22) inset,
    0 40px 100px rgba(0,0,0,0.7), 0 8px 30px rgba(0,0,0,0.5);
}
.nsglb-lb-img-wrap::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 38%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.07) 0%, transparent 100%);
  z-index: 1; pointer-events: none; border-radius: 20px 20px 0 0;
}
.nsglb-lb-img {
  max-width: 88vw; max-height: 80vh;
  width: auto; height: auto; display: block;
  object-fit: contain; border-radius: 20px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Close */
.nsglb-lb-close {
  position: fixed; top: 22px; right: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s, transform 0.3s; z-index: 10;
  box-shadow: 0 2px 0 rgba(255,255,255,0.2) inset, 0 8px 24px rgba(0,0,0,0.4);
}
.nsglb-lb-close:hover {
  background: linear-gradient(135deg, rgba(255,80,80,0.5), rgba(200,40,40,0.4));
  transform: rotate(90deg) scale(1.08);
}
.nsglb-lb-close svg { width: 18px; height: 18px; }

/* Arrows */
.nsglb-lb-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.20); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s, border-color 0.25s, transform 0.25s; z-index: 10;
  box-shadow: 0 2px 0 rgba(255,255,255,0.18) inset, 0 8px 28px rgba(0,0,0,0.45);
}
.nsglb-lb-arrow:hover {
  background: linear-gradient(135deg, rgba(46,170,108,0.45), rgba(26,122,110,0.35));
  border-color: rgba(46,170,108,0.55);
}
.nsglb-lb-prev { left: 20px; }
.nsglb-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.nsglb-lb-next { right: 20px; }
.nsglb-lb-next:hover { transform: translateY(-50%) translateX(2px); }
.nsglb-lb-arrow svg { width: 20px; height: 20px; }

/* Dots */
.nsglb-lb-dots {
  position: fixed; bottom: 74px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; gap: 7px; align-items: center;
}
.nsglb-lb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.30);
  border: none; cursor: pointer; padding: 0;
  transition: background 0.25s, transform 0.25s;
}
.nsglb-lb-dot.active { background: #2EAA6C; transform: scale(1.4); }

/* Caption */
.nsglb-lb-caption-bar {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 50px;
  padding: 10px 22px; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(255,255,255,0.18) inset, 0 8px 32px rgba(0,0,0,0.4);
}
.nsglb-lb-caption-text {
  color: rgba(255,255,255,0.88);
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  font-weight: 500; letter-spacing: 0.03em;
}
.nsglb-lb-caption-count {
  color: rgba(255,255,255,0.45); font-family: 'DM Sans', sans-serif; font-size: 12px;
  padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.2);
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════ */

/* 1200px — shrink rows slightly */
@media (max-width: 1200px) {
  .nsglb-grid {
    grid-template-rows: 250px 250px;
    gap: 12px;
  }
}

/* 1024px */
@media (max-width: 1024px) {
  .nsglb-grid {
    grid-template-rows: 220px 220px;
    gap: 11px;
  }
}

/* ══════════════════════════════════════
   IPAD / TABLET  769px–1024px
   Keep 3-column mosaic, shrink heights
   All 6 tiles visible
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  .nsglb-grid {
    grid-template-rows: 200px 200px;
    gap: 10px;
  }
}

/* ══════════════════════════════════════
   IPAD PORTRAIT  601px–768px
   2-col layout — all 6 tiles, 3 rows
   Row 1: full-width tile1
   Row 2: tile2 + tile3
   Row 3: tile4 + tile5
   Row 4: full-width tile6
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .nsglb-grid {
    grid-template-columns: 1fr 1fr !important;
    /* 4 rows: full / half+half / half+half / full */
    grid-template-rows: 240px 220px 220px 240px !important;
    gap: 10px;
  }

  /* Reset all desktop positioning */
  .nsglb-tile:nth-child(1),
  .nsglb-tile:nth-child(2),
  .nsglb-tile:nth-child(3),
  .nsglb-tile:nth-child(4),
  .nsglb-tile:nth-child(5),
  .nsglb-tile:nth-child(6) {
    grid-column: unset !important;
    grid-row: unset !important;
  }

  /* Re-assign explicitly so tile 6 shows */
  .nsglb-tile:nth-child(1) { grid-column: 1 / span 2 !important; grid-row: 1 !important; }
  .nsglb-tile:nth-child(2) { grid-column: 1 !important;           grid-row: 2 !important; }
  .nsglb-tile:nth-child(3) { grid-column: 2 !important;           grid-row: 2 !important; }
  .nsglb-tile:nth-child(4) { grid-column: 1 !important;           grid-row: 3 !important; }
  .nsglb-tile:nth-child(5) { grid-column: 2 !important;           grid-row: 3 !important; }
  .nsglb-tile:nth-child(6) { grid-column: 1 / span 2 !important;  grid-row: 4 !important; }

  .nsglb-lb-arrow { display: none; }
}

/* ══════════════════════════════════════
   MOBILE  ≤ 600px
   Single column, taller tiles for good visibility
   ══════════════════════════════════════ */
@media (max-width: 600px) {
  .nsglb-section { padding: 50px 0 70px; }
  .nsglb-container { padding: 0 14px; }

  .nsglb-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important; /* let auto-height work */
    gap: 10px;
  }

  /* Reset ALL column/row assignments */
  .nsglb-tile:nth-child(1),
  .nsglb-tile:nth-child(2),
  .nsglb-tile:nth-child(3),
  .nsglb-tile:nth-child(4),
  .nsglb-tile:nth-child(5),
  .nsglb-tile:nth-child(6) {
    grid-column: 1 !important;
    grid-row: auto !important;
    height: 260px !important; /* taller for better visibility */
  }

  .nsglb-tile-label { font-size: 10px; bottom: 13px; left: 14px; }
  .nsglb-lb-arrow { display: none; }
  .nsglb-lb-caption-bar {
    max-width: 90vw; white-space: normal; text-align: center;
    border-radius: 14px; flex-direction: column; gap: 2px; padding: 10px 14px;
  }
  .nsglb-lb-caption-count { padding-left: 0; border-left: none; }
  .nsglb-lb-dots { bottom: 88px; }
}

/* ══════════════════════════════════════
   SMALL MOBILE  ≤ 420px
   ══════════════════════════════════════ */
@media (max-width: 420px) {
  .nsglb-tile:nth-child(1),
  .nsglb-tile:nth-child(2),
  .nsglb-tile:nth-child(3),
  .nsglb-tile:nth-child(4),
  .nsglb-tile:nth-child(5),
  .nsglb-tile:nth-child(6) {
    height: 230px !important;
  }
  .nsglb-lb-img { max-width: 96vw; max-height: 72vh; }
  .nsglb-lb-close { top: 10px; right: 10px; width: 38px; height: 38px; }
}
