/* ── Image Card Row ─────────────────────────────────────────
   Values below are fallbacks; the Elementor style controls
   override them per widget via the custom properties.        */

.icr {
    --icr-height: 540px;
    --icr-gap: 12px;
    --icr-radius: 16px;
    --icr-pad: 28px;
    --icr-expand: 1.8;
    --icr-shade: rgba(0, 0, 0, 0.55);
    --icr-hover: rgba(13, 79, 92, 0.85);
    --icr-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    display: flex;
    gap: var(--icr-gap);
    width: 100%;
    height: var(--icr-height);
}

/* Card */
.icr .icr__card {
    position: relative;
    isolation: isolate;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    border-radius: var(--icr-radius);
    color: #fff;
    text-decoration: none;
    outline: none;
    transition: flex-grow 0.6s var(--icr-ease);
}

/* Image fills the card */
.icr .icr__img {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    border-radius: 0;
    transition: transform 0.9s var(--icr-ease);
}

/* Resting shade: bottom fade behind the title */
.icr .icr__card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, var(--icr-shade) 0%, transparent 55%);
}

/* Hover tint */
.icr .icr__card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--icr-hover);
    opacity: 0;
    transition: opacity 0.5s var(--icr-ease);
}

/* Text */
.icr .icr__content {
    width: 100%;
    padding: var(--icr-pad);
}

.icr .icr__title {
    max-width: 22ch;
    margin: 0;
    color: #fff;
    font-size: clamp(1.125rem, 1.5vw, 1.5rem);
    font-weight: 600;
    line-height: 1.2;
}

/* Hidden text opens with a height transition (0fr to 1fr) */
.icr .icr__more {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s var(--icr-ease);
}

.icr .icr__more-inner {
    min-height: 0;
    overflow: hidden;
}

.icr .icr__detail {
    max-width: 40ch;
    margin: 0.875rem 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9375rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.5s var(--icr-ease);
}

/* ── Open state (mouse hover or keyboard focus) ───────────── */
.icr .icr__card:hover,
.icr .icr__card:focus-visible {
    flex-grow: var(--icr-expand);
}

.icr .icr__card:hover::after,
.icr .icr__card:focus-visible::after {
    opacity: 1;
}

.icr .icr__card:hover .icr__img,
.icr .icr__card:focus-visible .icr__img {
    transform: scale(1.03);
}

.icr .icr__card:hover .icr__more,
.icr .icr__card:focus-visible .icr__more {
    grid-template-rows: 1fr;
}

.icr .icr__card:hover .icr__detail,
.icr .icr__card:focus-visible .icr__detail {
    opacity: 1;
    transform: none;
    transition-delay: 0.15s;
}

.icr .icr__card:focus-visible {
    box-shadow: inset 0 0 0 2px #fff;
}

/* ── Touch screens: no hover, so show the text up front ──── */
@media (hover: none) {
    .icr .icr__more { grid-template-rows: 1fr; }
    .icr .icr__detail { opacity: 1; transform: none; }
    .icr .icr__card::before {
        background: linear-gradient(to top, var(--icr-shade) 0%, var(--icr-shade) 25%, transparent 75%);
    }
}

/* ── Tablet: 2 x 2 grid ──────────────────────────────────── */
@media (max-width: 1024px) {
    .icr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        height: auto;
    }
    .icr .icr__card { height: var(--icr-height); }
}

/* ── Mobile: swipeable row ───────────────────────────────── */
@media (max-width: 767px) {
    .icr {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .icr::-webkit-scrollbar { display: none; }
    .icr .icr__card {
        flex: 0 0 82%;
        scroll-snap-align: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .icr .icr__card,
    .icr .icr__img,
    .icr .icr__card::after,
    .icr .icr__more,
    .icr .icr__detail {
        transition: none;
    }
}
