.samaneh-category-grid{
  --samaneh-cat-columns:4;
  --samaneh-cat-gap:18px;
  --samaneh-cat-scroll-width:260px;
  --samaneh-cat-radius:20px;
  --samaneh-cat-image-radius:16px;
  --samaneh-cat-card-bg:#fff;
  --samaneh-cat-card-hover-bg:var(--samaneh-cat-card-bg);
  --samaneh-cat-overlay-start:rgba(8,12,20,.72);
  --samaneh-cat-overlay-end:rgba(8,12,20,0);
  --samaneh-cat-zoom:1.05;
  --samaneh-cat-speed:280ms;
  --samaneh-cat-featured-title:#fff;
  --samaneh-cat-featured-description:rgba(255,255,255,.9);
  display:grid;
  grid-template-columns:repeat(var(--samaneh-cat-columns),minmax(0,1fr));
  gap:var(--samaneh-cat-gap);
  width:100%;
  min-width:0;
}

.samaneh-category-card{
  position:relative;
  display:flex;
  flex-direction:column;
  min-width:0;
  overflow:hidden;
  color:inherit;
  text-decoration:none!important;
  background:var(--samaneh-cat-card-bg);
  border-radius:var(--samaneh-cat-radius);
  isolation:isolate;
  transition:transform var(--samaneh-cat-speed) ease,box-shadow var(--samaneh-cat-speed) ease,background-color var(--samaneh-cat-speed) ease,border-color var(--samaneh-cat-speed) ease;
  -webkit-tap-highlight-color:transparent;
}
.samaneh-category-card:hover{background:var(--samaneh-cat-card-hover-bg)}
.samaneh-category-card:focus-visible{outline:3px solid rgba(37,99,235,.28);outline-offset:3px}

.samaneh-category-media{
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:1/1;
  overflow:hidden;
  background:#f3f4f6;
  border-radius:var(--samaneh-cat-image-radius);
}
.samaneh-category-media img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  transition:transform var(--samaneh-cat-speed) ease;
  will-change:transform;
}
.samaneh-category-overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(to top,var(--samaneh-cat-overlay-start),var(--samaneh-cat-overlay-end));
  opacity:0;
  transition:opacity var(--samaneh-cat-speed) ease;
}

.samaneh-category-content{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:14px 4px 4px;
  min-width:0;
}
.samaneh-category-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}
.samaneh-category-title{min-width:0;flex:1 1 auto;font-size:16px;line-height:1.55;font-weight:750;color:#111827;transition:color var(--samaneh-cat-speed) ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.samaneh-category-count{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#f3f4f6;color:#6b7280;font-size:11px;line-height:1.2;white-space:nowrap}
.samaneh-category-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:#6b7280;font-size:13px;line-height:1.75}
.samaneh-category-arrow{position:absolute;left:10px;top:-48px;display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:50%;background:rgba(255,255,255,.88);color:#111827;box-shadow:0 8px 24px rgba(15,23,42,.12);backdrop-filter:blur(8px);transform:translateY(4px);opacity:0;transition:opacity var(--samaneh-cat-speed) ease,transform var(--samaneh-cat-speed) ease}
.samaneh-category-card:hover .samaneh-category-arrow{opacity:1;transform:translateY(0)}

.samaneh-cat-hover-lift .samaneh-category-card:hover{transform:translateY(-5px)}
.samaneh-cat-hover-zoom .samaneh-category-card:hover img,
.samaneh-cat-hover-lift .samaneh-category-card:hover img{transform:scale(var(--samaneh-cat-zoom))}
.samaneh-cat-hover-shadow .samaneh-category-card:hover{box-shadow:0 18px 50px rgba(15,23,42,.14)}

/* Horizontal scroll mode: supports both saved grid class and Elementor live wrapper class. */
.samaneh-cat-layout-scroll,
.samaneh-cat-layout-live-scroll .samaneh-category-grid{
  display:grid;
  grid-auto-flow:column;
  grid-template-columns:none;
  grid-auto-columns:var(--samaneh-cat-scroll-width,260px);
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scroll-snap-type:x proximity;
  padding-bottom:8px;
  scrollbar-width:thin;
}
.samaneh-cat-layout-scroll .samaneh-category-card,
.samaneh-cat-layout-live-scroll .samaneh-category-card{scroll-snap-align:start}
.samaneh-cat-layout-scroll::-webkit-scrollbar,
.samaneh-cat-layout-live-scroll .samaneh-category-grid::-webkit-scrollbar{height:6px}
.samaneh-cat-layout-scroll::-webkit-scrollbar-thumb,
.samaneh-cat-layout-live-scroll .samaneh-category-grid::-webkit-scrollbar-thumb{background:rgba(100,116,139,.28);border-radius:999px}
.samaneh-cat-layout-scroll::-webkit-scrollbar-track,
.samaneh-cat-layout-live-scroll .samaneh-category-grid::-webkit-scrollbar-track{background:transparent}

/* Editorial mode. No fixed image height/color overrides: Elementor controls stay authoritative. */
.samaneh-cat-layout-editorial .samaneh-category-card.is-first,
.samaneh-cat-layout-live-editorial .samaneh-category-card.is-first{grid-column:span 2;grid-row:span 2}
.samaneh-cat-layout-editorial .samaneh-category-card.is-first .samaneh-category-content,
.samaneh-cat-layout-live-editorial .samaneh-category-card.is-first .samaneh-category-content{
  position:absolute;
  inset:auto 0 0;
  z-index:3;
  padding:24px;
  background:linear-gradient(to top,var(--samaneh-cat-overlay-start),var(--samaneh-cat-overlay-end));
}
.samaneh-cat-layout-editorial .samaneh-category-card.is-first .samaneh-category-title,
.samaneh-cat-layout-live-editorial .samaneh-category-card.is-first .samaneh-category-title{color:var(--samaneh-cat-featured-title)}
.samaneh-cat-layout-editorial .samaneh-category-card.is-first .samaneh-category-description,
.samaneh-cat-layout-live-editorial .samaneh-category-card.is-first .samaneh-category-description{color:var(--samaneh-cat-featured-description)}
.samaneh-cat-layout-editorial .samaneh-category-card.is-first .samaneh-category-arrow,
.samaneh-cat-layout-live-editorial .samaneh-category-card.is-first .samaneh-category-arrow{top:auto;bottom:20px;left:20px;opacity:1}

.samaneh-category-empty{padding:18px;border:1px dashed #cbd5e1;border-radius:14px;color:#64748b;text-align:center;background:#f8fafc}

@media (max-width:1024px){
  .samaneh-cat-layout-editorial .samaneh-category-card.is-first,
  .samaneh-cat-layout-live-editorial .samaneh-category-card.is-first{grid-column:span 2;grid-row:auto}
}

@media (max-width:767px){
  .samaneh-category-content{gap:6px;padding-top:10px}
  .samaneh-category-title{font-size:14px}
  .samaneh-category-count{font-size:10px;padding:3px 6px}
  .samaneh-category-description{font-size:12px}
  .samaneh-category-arrow{opacity:1;transform:none;left:7px;top:-41px;box-shadow:0 5px 16px rgba(15,23,42,.1)}

  .samaneh-cat-layout-editorial .samaneh-category-card.is-first,
  .samaneh-cat-layout-live-editorial .samaneh-category-card.is-first{grid-column:1/-1}

  .samaneh-cat-mobile-scroll,
  .samaneh-cat-mobile-scroll-live-yes .samaneh-category-grid{
    display:grid;
    grid-auto-flow:column;
    grid-template-columns:none;
    grid-auto-columns:var(--samaneh-cat-scroll-width,72%);
    overflow-x:auto;
    scroll-snap-type:x mandatory;
    overscroll-behavior-inline:contain;
    padding-bottom:8px;
  }
  .samaneh-cat-mobile-scroll .samaneh-category-card,
  .samaneh-cat-mobile-scroll-live-yes .samaneh-category-card{scroll-snap-align:start}
}

@media (prefers-reduced-motion:reduce){
  .samaneh-category-card,
  .samaneh-category-media img,
  .samaneh-category-arrow{transition:none!important}
}
