/* ============================================================
   Creative Home Nursery — Gallery Plugin Styles v2.2
   ============================================================ */

:root {
  --chn-orange:  #FC800A;
  --chn-navy:    #171E45;
  --chn-cream:   #FBF1E3;
  --chn-white:   #FFFFFF;
  --chn-muted:   #6B7280;
  --chn-border:  #EAD9C6;
  --chn-tag-bg:  #FFE8CC;
  --chn-tag-fg:  #B85A00;
}

/* ── Wrapper ── */
.chn-gallery-wrap {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 0 0 48px 0 !important;
  margin: 0 !important;
  overflow: visible;
  background: #FBF1E3;
  width: 100%;
  box-sizing: border-box;
}

/* ── Tabs bar ── */
.chn-tabs-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 16px 16px 0 !important;
  margin-bottom: 16px !important;
}
.chn-tabs-wrapper::-webkit-scrollbar { display: none; }

.chn-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 3px solid var(--chn-border);
  padding: 0;
  width: max-content;
  min-width: 100%;
}

.chn-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 30px;
  margin-bottom: 8px;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #333 !important;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  line-height: 1;
  letter-spacing: .01em;
}
.chn-tab-btn:hover {
  background: #fff4ea;
  border-color: var(--chn-orange);
  color: var(--chn-orange) !important;
}
.chn-tab-btn:focus-visible {
  outline: 2px solid var(--chn-orange);
  outline-offset: 2px;
}
.chn-tab-btn.active {
  background: var(--chn-orange) !important;
  border-color: var(--chn-orange) !important;
  color: #fff !important;
}

.chn-count {
  display: inline-block;
  background: rgba(0,0,0,0.12);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  transition: background .2s, color .2s;
}
.chn-tab-btn.active .chn-count {
  background: rgba(255,255,255,0.3);
  color: #fff;
}

/* ── Panels ── */
.chn-gallery-panel { display: none; }
.chn-gallery-panel.active { display: block; }

.chn-empty {
  text-align: center;
  color: var(--chn-muted);
  font-style: italic;
  padding: 48px 20px;
}

/* ── Grid — CSS grid ── */
.chn-grid {
  padding: 0 16px 0 !important;
  margin: 0 0 40px 0 !important;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  background: transparent;
  align-items: start;
  justify-items: stretch;
  box-sizing: border-box;
  width: 100%;
}
.chn-cols-2 { grid-template-columns: repeat(2, 1fr); }
.chn-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Cards — theme reset + fill ── */
.chn-card {
  position: relative !important;
  display: block !important;
  overflow: hidden !important;
  cursor: pointer;
  border-radius: 5px !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  aspect-ratio: 1 / 1;
  background: #222 !important;
}
.chn-card:hover { opacity: .92; }
.chn-card:focus-visible { outline: 3px solid var(--chn-orange) !important; outline-offset: 2px; }

/* Images fill the card — override any theme img styles */
.chn-card img,
.chn-card img:first-child {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  min-height: 100% !important;
  display: block !important;
  object-fit: cover !important;
  object-position: center !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 5px !important;
  vertical-align: top !important;
}

.chn-no-thumb {
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chn-no-thumb svg {
  width: 48px;
  height: 48px;
}

/* Video badge */
.chn-vid-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--chn-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 6px;
  pointer-events: none;
}

/* Play button */
.chn-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,.90);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  pointer-events: none;
}
.chn-play-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--chn-orange);
  margin-left: 3px;
}

/* ── Lightbox ── */
.chn-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.88);
  padding: 16px;
}
.chn-lightbox[hidden] { display: none; }

/* No separate backdrop div needed — lightbox itself is the dark bg */
.chn-lb-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.chn-lb-inner {
  position: relative;
  z-index: 1;
  max-width: 960px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Media container — no black box, transparent */
.chn-lb-media {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* Spinner shown while image loads */
.chn-lb-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--chn-orange);
  border-radius: 50%;
  animation: chn-spin .7s linear infinite;
  display: none;
}
.chn-lb-spinner.visible { display: block; }
@keyframes chn-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.chn-lb-img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  transition: opacity .15s;
}
.chn-lb-img[hidden] { display: none; }
.chn-lb-img.loading { opacity: 0; }

.chn-lb-video {
  max-width: 100%;
  max-height: 85vh;
  display: block;
  border-radius: 8px;
  background: transparent;
}
.chn-lb-video[hidden] { display: none; }

/* No caption shown */
.chn-lb-caption { display: none; }

/* Close button */
.chn-lb-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: var(--chn-orange);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background .2s;
}
.chn-lb-close:hover { background: var(--chn-navy); }

/* Prev / Next */
.chn-lb-prev,
.chn-lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  z-index: 10;
}
.chn-lb-prev:hover,
.chn-lb-next:hover { background: var(--chn-orange); }
.chn-lb-prev { left: 12px; }
.chn-lb-next { right: 12px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .chn-grid { grid-template-columns: repeat(3, 1fr); }
  .chn-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .chn-grid,
  .chn-cols-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .chn-cols-2 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 480px) {
  .chn-grid,
  .chn-cols-2,
  .chn-cols-4 { grid-template-columns: 1fr; gap: 10px; }
  .chn-tab-btn { font-size: 13px; padding: 8px 14px; }
  .chn-lightbox { padding: 8px; }
}