/* Category Grid Manager PRO — Frontend (brand-friendly + fast) */

.cgm-grid { margin: 18px 0; }

.cgm-list{
  list-style: none;
  padding: 0;
  margin: 0;

  display: grid;
  gap: var(--gap, 20px);
  grid-template-columns: repeat(var(--cols-d, 3), minmax(0, 1fr));
}

@media (max-width: 900px){
  .cgm-list{ grid-template-columns: repeat(var(--cols-t, 2), minmax(0, 1fr)); }
}
@media (max-width: 560px){
  .cgm-list{ grid-template-columns: repeat(var(--cols-m, 1), minmax(0, 1fr)); }
}

.cgm-entry{
  list-style: none;
  padding: 0;
  margin: 0;
}

.cgm-entry > .cgm-item{
  height: 100%;
}

/* Masonry via CSS columns (simple + lightweight) */
.cgm-layout-masonry .cgm-list{
  display: block;
  column-count: var(--cols-d, 3);
  column-gap: var(--gap, 20px);
}

.cgm-layout-masonry .cgm-entry{
  display: inline-block;
  width: 100%;
  margin: 0 0 var(--gap, 20px);
}

.cgm-layout-masonry .cgm-item{
  display: block;
}

@media (max-width: 900px){
  .cgm-layout-masonry .cgm-list{ column-count: var(--cols-t, 2); }
}
@media (max-width: 560px){
  .cgm-layout-masonry .cgm-list{ column-count: var(--cols-m, 1); }
}

/* Featured (first item spans on desktop) */
.cgm-layout-featured .cgm-list{ grid-auto-flow: dense; }
.cgm-layout-featured .cgm-entry:first-child{
  grid-column: span 2;
  grid-row: span 2;
}
@media (max-width: 900px){
  .cgm-layout-featured .cgm-entry:first-child{ grid-column: span 1; grid-row: span 1; }
}

.cgm-item{
  position: relative;
  display: block;
  border-radius: var(--radius, 14px);
  overflow: hidden;
  text-decoration: none;
  background: #f3f4f6;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease;
}

.cgm-media{ position: relative; }

.cgm-img{
  width: 100%;
  height: var(--img-h, 220px);
  object-fit: cover;
  display: block;
  transform: scale(1);
  transition: transform .35s ease;
}

.cgm-img--placeholder{
  height: var(--img-h, 220px);
  background: linear-gradient(135deg, rgba(20,73,101,.20), rgba(95,151,182,.20));
}

.cgm-grid[data-imgmode="auto"] .cgm-img{
  height: auto;
  object-fit: cover;
}
.cgm-grid[data-imgmode="auto"] .cgm-img--placeholder{
  height: 220px;
}

.cgm-overlay{
  position:absolute;
  inset:0;
  background: var(--overlay, rgba(0,0,0,.35));
  transition: opacity .25s ease, background .25s ease;
  opacity: 1;
}

.cgm-content{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  color: var(--text, #fff);
  padding: 16px;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  gap: 6px;
}

.cgm-grid[data-textpos="center"] .cgm-content{
  justify-content:center;
  align-items:center;
  text-align:center;
}
.cgm-grid[data-textpos="bottom-center"] .cgm-content{
  justify-content:flex-end;
  align-items:center;
  text-align:center;
}
.cgm-grid[data-textpos="top-left"] .cgm-content{
  justify-content:flex-start;
  align-items:flex-start;
  text-align:left;
}

.cgm-title{
  margin:0;
  font-size: clamp(15px, 1.8vw, 20px);
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.cgm-sub{
  font-size: 12px;
  opacity: .85;
  text-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.cgm-badge{
  display:inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--badge-bg, #EDE8D9);
  color: var(--badge-text, #144965);
  font-size: 12px;
  font-weight: 800;
}

/* Button */
.cgm-more{ text-align:center; margin-top: calc(var(--gap, 20px) + 6px); }
.cgm-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 32px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration:none;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}
.cgm-btn--filled{
  background: #144965;
  color: #fff;
}
.cgm-btn--filled:hover{ transform: translateY(-1px); background: #0e364b; color:#fff; }
.cgm-btn--outline{
  background: transparent;
  border: 2px solid #144965;
  color: #144965;
}
.cgm-btn--outline:hover{ background:#144965; color:#fff; transform: translateY(-1px); }
.cgm-btn--link{
  padding: 0;
  border-radius: 0;
  color: #144965;
  text-decoration: underline;
}
.cgm-btn--link:hover{ transform:none; }

/* Hover behaviors */
.cgm-hover-none .cgm-item:hover{ transform:none; box-shadow: 0 10px 26px rgba(0,0,0,.08); }
.cgm-hover-lift .cgm-item:hover{ transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.12); }
.cgm-hover-zoom .cgm-item:hover .cgm-img{ transform: scale(1.05); }
.cgm-hover-darken .cgm-item:hover .cgm-overlay{ opacity: 1; background: rgba(0,0,0,.48); }
.cgm-hover-zoom-darken .cgm-item:hover .cgm-img{ transform: scale(1.05); }
.cgm-hover-zoom-darken .cgm-item:hover .cgm-overlay{ background: rgba(0,0,0,.48); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .cgm-item, .cgm-img, .cgm-overlay, .cgm-btn { transition: none !important; }
}


/* Optional grid heading */
.cgm-heading-wrap{
  margin: 0 0 18px;
  padding: 20px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(237,232,217,0.88));
  border: 1px solid rgba(20,73,101,0.08);
  box-shadow: 0 16px 40px rgba(20,73,101,0.08);
}
.cgm-heading-kicker{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:0 12px;
  margin-bottom:12px;
  border-radius:999px;
  background: rgba(20,73,101,.08);
  color:#144965;
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.cgm-grid-heading{
  margin:0;
  color:#144965;
  letter-spacing:-.02em;
  line-height:1.08;
  font-weight:800;
}
.cgm-grid-heading--h1{ font-size: clamp(32px, 4vw, 54px); }
.cgm-grid-heading--h2{ font-size: clamp(28px, 3.2vw, 42px); }
.cgm-grid-heading--h3{ font-size: clamp(24px, 2.6vw, 32px); }
.cgm-grid-heading--div,
.cgm-grid-heading--p{ font-size: clamp(22px, 2.4vw, 30px); }
@media (max-width: 767px){
  .cgm-heading-wrap{ padding:16px; border-radius:18px; margin-bottom:14px; }
  .cgm-heading-kicker{ font-size:11px; min-height:30px; margin-bottom:10px; }
}
