/* ============================================================
 * MW Post Loop Item Widget
 * For use inside Elementor Loop Grid
 *
 * CSS custom properties with neutral defaults — mirrors the
 * post-carousel-widget.css values so loop-grid cards match
 * carousel cards pixel-for-pixel.
 * ============================================================ */

/* ── Custom Properties ── */
.mw-post-loop-item {
    --mw-pli-card-bg: #ffffff;

    --mw-pli-cat-color: #2F31FC;
    --mw-pli-cat-font-size: 18px;

    --mw-pli-heading-color: #1a1a1a;
    --mw-pli-heading-hover-color: #2F31FC;
    --mw-pli-heading-font-size: 24px;
    --mw-pli-heading-line-height: 1.2;

    --mw-pli-excerpt-color: #555555;
    --mw-pli-excerpt-font-size: 0.875rem;
    --mw-pli-excerpt-line-height: 1.55;

    --mw-pli-cta-color: #2F31FC;
    --mw-pli-cta-font-size: 18px;
    --mw-pli-cta-hover-color: #2F31FC;

    --mw-pli-body-padding: 1.25rem;
    --mw-pli-transition-speed: 0.25s;
}

/* ── Equal-height Loop Grid support ── */
.elementor-loop-container .elementor-element,
.elementor-loop-container .elementor-widget,
.elementor-loop-container .elementor-widget-container {
    height: 100%;
}

/* ── Card ── */
.mw-post-loop-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--mw-pli-card-bg);
    overflow: hidden;
}

/* ── Image link ── */
.mw-post-loop-item__image-link,
.mw-post-loop-item__image-link:visited,
.mw-post-loop-item__image-link:focus {
    display: block;
    flex-shrink: 0;
    text-decoration: none;
    font-size: 0;
    line-height: 0;
    background: transparent;
}

/* ── Image wrap (16 : 9 enforced) ── */
.mw-post-loop-item__image-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 9 / 16 = 0.5625 */
    overflow: hidden;
    background: #f0f0f0;
}

/* ── Image ── */
.mw-post-loop-item__image {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform var(--mw-pli-transition-speed) ease;
}

.mw-post-loop-item:hover .mw-post-loop-item__image {
    transform: scale(1.03);
}

/* ── Image placeholder (editor) ── */
.mw-post-loop-item__image-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ── Body ── */
.mw-post-loop-item__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--mw-pli-body-padding);
}

/* ── Category ── */
.mw-post-loop-item__category {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 0.75rem;
    font-size: var(--mw-pli-cat-font-size);
    font-weight: 400;
    line-height: 1.5;
    color: var(--mw-pli-cat-color);
    text-transform: none;
}

.mw-post-loop-item__category a {
    color: inherit;
    text-decoration: none;
}

/* ── Title / Heading ── */
.mw-post-loop-item__title {
    margin: 0 0 1.25rem;
    font-size: var(--mw-pli-heading-font-size);
    font-weight: 400;
    font-family: inherit;
    line-height: var(--mw-pli-heading-line-height);
    color: var(--mw-pli-heading-color);
}

.mw-post-loop-item__title a,
.mw-post-loop-item__title a:visited,
.mw-post-loop-item__title a:focus {
    color: inherit;
    text-decoration: none;
    background: transparent;
    transition: color var(--mw-pli-transition-speed) ease;
}

.mw-post-loop-item__title a:hover,
.mw-post-loop-item__title a:focus-visible {
    color: var(--mw-pli-heading-hover-color);
    text-decoration: none;
    background: transparent;
}

/* ── Date ── */
.mw-post-loop-item__date {
    color: #666666;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* ── Excerpt ── */
.mw-post-loop-item__excerpt {
    margin: 0 0 1rem;
    font-size: var(--mw-pli-excerpt-font-size);
    line-height: var(--mw-pli-excerpt-line-height);
    color: var(--mw-pli-excerpt-color);
    flex: 1;
}

/* ── CTA ── */
.mw-post-loop-item__cta,
.mw-post-loop-item__cta:visited,
.mw-post-loop-item__cta:focus {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    margin-top: auto;
    font-size: var(--mw-pli-cta-font-size);
    font-weight: 400;
    color: var(--mw-pli-cta-color);
    text-decoration: none;
    background: transparent;
    transition: color var(--mw-pli-transition-speed) ease;
}

.mw-post-loop-item__cta:hover,
.mw-post-loop-item__cta:focus-visible {
    color: var(--mw-pli-cta-hover-color);
    background: transparent;
}

.mw-post-loop-item__cta-arrow {
    flex-shrink: 0;
    transition: transform var(--mw-pli-transition-speed) ease;
}

.mw-post-loop-item__cta:hover .mw-post-loop-item__cta-arrow {
    transform: translateX(3px);
}

/* ── Placeholder styling for editor ── */
.mw-post-loop-item--placeholder {
    background-color: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 4px;
}
