/* DigiShopfa v9 hotfix (SAFE)
   - Only menu underline + hero white-flash prevention
   - No global font overrides, no overflow-x overrides
*/

/* Thick underline hover (3-4px) for header nav links */
.dg-header .dg-nav a,
.dg-header .dg-nav-link,
.dg-header a.dg-nav-link,
.jf-header .jf-nav-link {
  position: relative;
}

.dg-header .dg-nav a::after,
.dg-header .dg-nav-link::after,
.dg-header a.dg-nav-link::after,
.jf-header .jf-nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 4px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .18s ease;
  opacity: .95;
  pointer-events: none;
}

.dg-header .dg-nav a:hover::after,
.dg-header .dg-nav-link:hover::after,
.dg-header a.dg-nav-link:hover::after,
.jf-header .jf-nav-link:hover::after {
  transform: scaleX(1);
}

/* Prevent white flash while slide image loads */
.dg-hero-slide, .jf-hero-slide { background: #f3f4f6; }
.dg-hero-slide img, .jf-hero-slide img { opacity: 0; transition: opacity .18s ease; }
.dg-hero-slide.dg-ready img, .jf-hero-slide.dg-ready img,
.dg-hero-slide.is-active img, .jf-hero-slide.is-active img { opacity: 1; }

/* v15: shop/product basic grid for digi_shopfa */
.dg-grid-products{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
@media (max-width:1100px){.dg-grid-products{grid-template-columns:repeat(3,1fr)}}
@media (max-width:820px){.dg-grid-products{grid-template-columns:repeat(2,1fr)}}
@media (max-width:460px){.dg-grid-products{grid-template-columns:repeat(1,1fr)}}

.dg-product-wrap{display:grid;grid-template-columns:1.05fr .95fr;gap:18px;align-items:start}
.dg-product-main{width:100%;border-radius:18px;display:block;aspect-ratio:1/1;object-fit:cover;background:#f1f5f9}
.dg-product-thumbs{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.dg-product-thumbs img{width:72px;height:72px;object-fit:cover;border-radius:14px;background:#f1f5f9;border:1px solid rgba(148,163,184,.4)}
.dg-product-info{position:sticky;top:14px}
@media (max-width:900px){
  .dg-product-wrap{grid-template-columns:1fr}
  .dg-product-info{position:static}
}

/* v15: top notice bar (مثل دیجی‌کالا) */
.dg-topnotice{background:#ed8753;color:#fff;font-weight:900;font-size:14px;line-height:1.2}
.dg-topnotice .dg-topnotice-inner{padding:10px 12px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (max-width:640px){
  .dg-topnotice .dg-topnotice-inner{white-space:normal;font-size:13px;line-height:1.6}
}

/* =========================================================
   Stories Viewer (Modal) – UX fixes
   - Close on backdrop click (handled in JS)
   - Glass background + fullscreen
   - Center media
   - Title above media, link below
========================================================= */

/* Glassy fullscreen backdrop (only when open) */
.dg-story-view.open{
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: transparent !important;
}

/* Fullscreen glass layer (behind everything) */
.dg-story-view.open::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(15,23,42,.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 0;
  pointer-events: none; /* never block clicks (close button, nav, etc.) */
}

/* Ensure all modal UI stays above the glass layer */
.dg-story-stage,
.dg-story-nav,
.dg-story-progress,
.dg-story-title,
.dg-story-link{
  position: relative;
  z-index: 5 !important;
}

/* Close button must always be on top and clickable */
.dg-story-close{
  position: absolute !important;
  z-index: 20 !important;
  pointer-events: auto !important;
}

/* Column layout */
.dg-story-stage{
  display:flex !important;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:56px 16px 24px;
}

/* Title above content */
.dg-story-title{
  position:static !important;
  inset:auto !important;
  margin:0;
  max-width:min(560px,100%);
  text-align:center;
  font-size:16px;
}

/* Media centered */
.dg-story-stage img,
.dg-story-stage video{
  width:auto;
  height:auto;
  max-width:min(560px,100%);
  max-height:min(78vh,680px);
  object-fit:contain;
  border-radius:18px;
  background:rgba(0,0,0,.12);
}

/* CTA below content */
.dg-story-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:14px;
  background:rgba(255,255,255,.14);
  color:#fff;
  text-decoration:none;
  font-weight:900;
  max-width:min(560px,100%);
}

.dg-story-link[hidden]{display:none !important;}
