/* ══ DESKTOP: hide beyond 13th tile ══ */
.modula-items .modula-item:nth-child(n+14) {
  display: none !important;
}
.modula-items .modula-item:nth-child(13) {
  position: relative !important;
}

/* ══ OVERLAY shared styles ══ */
.modula-item-overlay-custom {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  z-index: 10;
  border-radius: inherit;
}
.modula-item-overlay-custom span.count {
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.modula-item-overlay-custom span.label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 400;
}

/* ══ MOBILE: hide Modula's broken absolute layout ══ */
@media (max-width: 768px) {
  .modula-items {
    display: none !important;
  }
}

/* ══ MOBILE: custom clean grid ══ */
.mobile-gallery-grid {
  display: none;
}
@media (max-width: 768px) {
  .mobile-gallery-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 240px 120px;
    gap: 4px;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
  }
  .mobile-gallery-grid .mg-hero {
    grid-column: 1 / -1;
    grid-row: 1;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
  }
  .mobile-gallery-grid .mg-thumb {
    overflow: hidden;
    position: relative;
  }
  .mobile-gallery-grid .mg-thumb:first-of-type {
    border-radius: 0 0 0 6px;
  }
  .mobile-gallery-grid .mg-thumb:last-of-type {
    border-radius: 0 0 6px 0;
  }
  .mobile-gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .mg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
  }
  .mg-overlay span.mg-count {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
  }
  .mg-overlay span.mg-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
  }
}
