/* Responsive post grid and native, swipeable scroll-snap carousel. */
.md-custom-post-loop{display:grid;grid-template-columns:repeat(var(--md-columns,3),minmax(0,1fr));column-gap:var(--md-column-gap,20px);row-gap:var(--md-row-gap,20px)}
.md-custom-post-loop__item{min-width:0}
.md-custom-post-loop--slider{display:flex;gap:var(--md-column-gap,20px);overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-behavior:smooth;scrollbar-width:none;-webkit-overflow-scrolling:touch;grid-template-columns:none;align-items:stretch}
.md-custom-post-loop--slider::-webkit-scrollbar{display:none}
.md-custom-post-loop--slider>.md-custom-post-loop__item{flex:0 0 calc((100% - (var(--md-slides,3) - 1)*var(--md-column-gap,20px))/var(--md-slides,3));scroll-snap-align:start;box-sizing:border-box}
.md-custom-post-loop__carousel{min-width:0;position:relative;display:flex;flex-direction:column}
.md-custom-post-loop__arrows{display:flex;justify-content:flex-end;gap:10px;margin-top:12px}
.md-custom-post-loop__arrow{cursor:pointer;background:transparent;border:1px solid currentColor;border-radius:4px;color:inherit;min-width:36px;min-height:36px;line-height:1;padding:6px;font-size:18px}
.md-custom-post-loop__arrow:disabled{cursor:default;opacity:.35}
.md-custom-post-loop__dots{display:flex;justify-content:center;gap:8px;margin-top:12px}
.md-custom-post-loop__dot{width:9px;height:9px;border-radius:50%;border:0;background:currentColor;opacity:.3;cursor:pointer;padding:0}
.md-custom-post-loop__dot[aria-current=true]{opacity:1}
.md-custom-post-loop__pagination ul{list-style:none;display:flex;flex-wrap:wrap;gap:10px;padding:0;margin:24px 0 0}
.md-custom-post-loop__pagination a,.md-custom-post-loop__pagination span{display:inline-block;padding:6px 10px}
@media(max-width:1024px){.md-custom-post-loop:not(.md-custom-post-loop--slider){grid-template-columns:repeat(var(--md-columns,2),minmax(0,1fr))}}
@media(max-width:767px){.md-custom-post-loop:not(.md-custom-post-loop--slider){grid-template-columns:repeat(var(--md-columns,1),minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){.md-custom-post-loop--slider{scroll-behavior:auto}}

.md-custom-post-loop__item{box-sizing:border-box}
.md-custom-post-loop__arrow{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;pointer-events:auto}

/* The offset defaults to zero and is activated only in the On Sides mode. */
.md-custom-post-loop__arrows [data-loop-prev]{transform:translateX(calc(-1 * var(--md-effective-side-offset,0px)))}
.md-custom-post-loop__arrows [data-loop-next]{transform:translateX(var(--md-effective-side-offset,0px))}

/* Equal-height cards: align slider items and stretch the Elementor Loop Item template. */
.md-custom-post-loop--slider.md-custom-post-loop--equal-height{align-items:stretch}
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item{display:flex;flex-direction:column;align-self:stretch;height:auto}
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item>.elementor{display:flex;flex-direction:column;flex:1;min-width:0}
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item>.elementor>.e-con,
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item>.elementor>.elementor-section-wrap{flex:1}
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item>.elementor>.elementor-section-wrap{display:flex;flex-direction:column}
.md-custom-post-loop--slider.md-custom-post-loop--equal-height>.md-custom-post-loop__item>.elementor>.elementor-section-wrap>.elementor-section{flex:1}

/* Term loop cards use the same slide sizing while keeping their term-specific template context. */
.md-term-loop-shared-slider .md-custom-post-loop__item>.med-item{min-width:0;width:100%;height:100%;box-sizing:border-box}
.md-term-loop-shared-slider.md-custom-post-loop__carousel{position:relative}
.md-term-loop-shared-slider .md-custom-post-loop--equal-height>.md-custom-post-loop__item>.med-item{display:flex;flex-direction:column;flex:1}
.md-term-loop-shared-slider .md-custom-post-loop--equal-height>.md-custom-post-loop__item>.med-item>.elementor{flex:1;display:flex;flex-direction:column}

/* Term Loop: keep Elementor's container/image backgrounds and corner radii authoritative.
   Equal-height sizing stretches structural wrappers only, not nested widgets. */
.md-term-loop-shared-slider .md-custom-post-loop__item > .med-item > .elementor {min-width:0; width:100%;}
.md-term-loop-shared-slider .md-custom-post-loop--equal-height > .md-custom-post-loop__item > .med-item > .elementor > .e-con {flex:1; min-width:0;}

/* Pagination layout and button states */
.md-custom-post-loop__pagination{margin-top:24px}
.md-custom-post-loop__pagination ul,.md-custom-post-loop__pagination .md-pagination-links{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px;list-style:none;margin:0;padding:0}
.md-custom-post-loop__pagination ul li{padding:0;margin:0;list-style:none}
.md-custom-post-loop__pagination .page-numbers:not(ul):not(.dots){box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-width:34px;min-height:34px;padding:6px 10px;text-decoration:none;border:1px solid transparent;transition:background-color .18s,color .18s,border-color .18s}
.md-custom-post-loop__pagination .page-numbers.current{font-weight:600}
.md-custom-post-loop__pagination .page-numbers.dots{display:inline-flex;padding:6px}

/* Create scrollable clearance around cards, so their shadows are not clipped.
   Keep overflow-x:auto for touch swiping; offset the outer track footprint
   while retaining its content width and existing scroll-snap geometry. */
.md-custom-post-loop--slider{
    --md-shadow-clearance:18px;
    padding:var(--md-shadow-clearance);
    margin:calc(-1 * var(--md-shadow-clearance));
    scroll-padding-inline:var(--md-shadow-clearance);
    box-sizing:border-box;
}
.md-custom-post-loop__carousel{overflow:visible}

/* Prevent global theme link underlines from leaking into Elementor Loop Item cards.
   :where() keeps specificity low so deliberate Elementor link styles can override.
   Does not affect pagination or links outside the Custom Post Loop. */
.md-custom-post-loop__item :where(a:not(.elementor-button)),
.md-custom-post-loop__item :where(a:not(.elementor-button):hover),
.md-custom-post-loop__item :where(a:not(.elementor-button):focus) {
    text-decoration: none;
}

/* Safety net for title widgets inside repeated items. Elementor and themes may
   hide `.elementor-page-title` / `h1.entry-title` on ordinary pages. The loop
   must not inherit that page-only hiding rule. Scope to rendered loop items. */
body .md-custom-post-loop .md-custom-post-loop__item h1.entry-title,
body .md-custom-post-loop .md-custom-post-loop__item .elementor-page-title {
    display: block !important;
}

/* Equal-height grid: all rows use the tallest item's height. Only structural wrappers stretch;
   preserve typography, image styling, and inner Elementor layout choices. */
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider){grid-auto-rows:minmax(0,1fr);align-items:stretch}
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider)>.md-custom-post-loop__item{display:flex;flex-direction:column;min-height:0}
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider)>.md-custom-post-loop__item>.elementor{display:flex;flex-direction:column;flex:1;min-width:0;width:100%}
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider)>.md-custom-post-loop__item>.elementor>.e-con,
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider)>.md-custom-post-loop__item>.elementor>.elementor-section-wrap{flex:1;min-width:0}
.md-custom-post-loop--grid-equal-height:not(.md-custom-post-loop--slider)>.md-custom-post-loop__item>.elementor>.elementor-section-wrap{display:flex;flex-direction:column}
