/* =========================================================
   بوعليم جونيور — Bank Hapoalim Junior campaign page (/hapoalim)
   Scoped under .hapoalim (page wrapper) + main:has(.hapoalim) (page backdrop)
   ========================================================= */

.hapoalim {
    --hp-red: #ED2027;
    --hp-ink: #1d1d1f;
    --hp-muted: #5f6368;
    --hp-card-shade: 43, 31, 26;          /* warm dark brown behind card text */
    --hp-radius: 16px;
    position: relative;
    padding-bottom: 3rem;
}

/* Page backdrop: light grey, faint tiled logo watermark, red swoosh bottom-left */
main:has(.hapoalim) {
    background-color: #f4f4f5;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 220'%3E%3Cpath d='M0 40 C 90 70, 190 140, 300 220 L0 220 Z' fill='%23ED2027'/%3E%3C/svg%3E"),
        url("/images/hapoalim/watermark-tile.png");
    background-repeat: no-repeat, repeat;
    background-position: left bottom, center top;
    background-size: clamp(140px, 18vw, 300px) auto, 330px 220px;
}

.hapoalim .breadcrumb {
    background: rgba(255, 255, 255, .7);
    border-radius: 8px;
}

/* ---------------- Hero ---------------- */
.hapoalim .hp-hero {
    position: relative;
    container-type: inline-size;
    margin: 1rem 0 2.5rem;
    border-radius: 20px;
    overflow: hidden;
    background: var(--hp-red);
    box-shadow: 0 10px 30px rgba(237, 32, 39, .18);
}

.hapoalim .hp-hero-media img {
    display: block;
    width: 100%;
    height: auto;
}

.hapoalim .hp-hero-brand {
    position: absolute;
    top: 50%;
    right: 6%;
    width: 36%;
    transform: translateY(-50%);
    text-align: center;
    color: #fff;
}

.hapoalim .hp-hero-logo {
    margin: 0 auto;
    width: 210px;              /* fallback */
    width: 16cqw;              /* sized to the banner height, not the column */
    line-height: 0;
}

.hapoalim .hp-hero-logo img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .12));
}

.hapoalim .hp-hero-tagline {
    margin: .6em 0 0;
    font-size: 22px;
    font-size: clamp(14px, 2.3cqw, 30px);
    font-weight: 800;
    line-height: 1.35;
    color: #fff;
}

.hapoalim .hp-hero-swoosh {
    display: block;
    width: 26%;
    height: auto;
    margin: .5em auto 0;
}

/* Mobile hero — compact horizontal strip (~2:1): logo + tagline on the right,
   family cut-out on the left, both on the same red. */
@media (max-width: 767.98px) {
    .hapoalim .hp-hero {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        border-radius: 14px;
        margin: .75rem 0 1.75rem;
    }

    .hapoalim .hp-hero-brand {
        position: static;
        order: -1;                      /* first in RTL = right side */
        flex: 0 0 54%;
        width: auto;
        transform: none;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: .75rem .5rem;
    }

    .hapoalim .hp-hero-logo {
        width: 62%;
        max-width: 190px;
    }

    .hapoalim .hp-hero-tagline {
        margin-top: .45em;
        font-size: clamp(12px, 3.5vw, 17px);
        line-height: 1.3;
    }

    .hapoalim .hp-hero-swoosh {
        width: 32%;
        max-width: 90px;
        margin-top: .3em;
    }

    .hapoalim .hp-hero-media {
        flex: 0 0 46%;
        display: flex;
        align-items: flex-end;          /* family stands on the bottom edge */
    }

    .hapoalim .hp-hero-media img {
        width: 100%;
        height: auto;
    }
}

/* ---------------- Section header ---------------- */
.hapoalim .hp-section-head {
    margin: 0 0 1.75rem;
    padding-inline-start: 1rem;
    border-inline-start: 7px solid var(--hp-red);
}

.hapoalim .hp-section-head h2 {
    margin: 0 0 .35rem;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 800;
    color: var(--hp-ink);
    line-height: 1.2;
}

.hapoalim .hp-section-head p {
    margin: 0;
    font-size: clamp(14px, 1.4vw, 17px);
    color: var(--hp-muted);
}

/* ---------------- Card grid ----------------
   mobile: 1 col · tablet: 2 cols · desktop: repeating row of 3 then row of 2 */
.hapoalim .hp-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.hapoalim .hp-card {
    aspect-ratio: 1 / 1.05;
}

@media (min-width: 576px) {
    .hapoalim .hp-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hapoalim .hp-card {
        aspect-ratio: 1 / 1.1;
    }

    /* odd card out spans the full row */
    .hapoalim .hp-card:nth-child(odd):last-child {
        grid-column: 1 / -1;
        aspect-ratio: 16 / 8;
    }
}

@media (min-width: 992px) {
    .hapoalim .hp-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 18px;
    }

    .hapoalim .hp-card,
    .hapoalim .hp-card:nth-child(odd):last-child {
        grid-column: span 2;
        aspect-ratio: 304 / 343;
    }

    .hapoalim .hp-card:nth-child(5n+4),
    .hapoalim .hp-card:nth-child(5n+5) {
        grid-column: span 3;
        aspect-ratio: 466 / 318;
    }

    /* incomplete last rows: never leave a hole */
    .hapoalim .hp-card:nth-child(5n+1):last-child,
    .hapoalim .hp-card:nth-child(5n+4):last-child {
        grid-column: 1 / -1;
        aspect-ratio: 1296 / 420;
    }

    .hapoalim .hp-card:nth-child(5n+1):nth-last-child(2),
    .hapoalim .hp-card:nth-child(5n+2):last-child {
        grid-column: span 3;
        aspect-ratio: 466 / 318;
    }
}

/* ---------------- Card ---------------- */
.hapoalim .hp-card {
    position: relative;
    margin: 0;
    border-radius: var(--hp-radius);
    overflow: hidden;
    background: rgb(var(--hp-card-shade));
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
    transition: transform .25s ease, box-shadow .25s ease;
}

.hapoalim .hp-card > a {
    position: absolute;
    inset: 0;
    display: block;
    color: #fff;
    text-decoration: none;
}

.hapoalim .hp-card .image-container {
    position: absolute;
    inset: 0;
    margin: 0;
    height: 100%;
}

.hapoalim .hp-card .image-container img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transition: transform .5s ease;
}

.hapoalim .hp-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to top,
        rgba(var(--hp-card-shade), .96) 0%,
        rgba(var(--hp-card-shade), .88) 30%,
        rgba(var(--hp-card-shade), .35) 55%,
        rgba(var(--hp-card-shade), 0) 72%);
}

.hapoalim .hp-card-body {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 2;
    padding: 0 1.25rem 1.1rem;
    text-align: center;
}

.hapoalim .hp-card-body h3 {
    margin: 0 0 .45rem;
    font-size: clamp(18px, 1.75vw, 25px);
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hapoalim .hp-card-body p {
    margin: 0 auto;
    max-width: 34em;
    font-size: 14.5px;
    line-height: 1.55;
    color: rgba(255, 255, 255, .9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hapoalim .hp-line {
    display: block;
    width: 48px;
    height: 3px;
    margin: .8rem auto .6rem;
    border-radius: 3px;
    background: var(--hp-red);
}

.hapoalim .hp-cta {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.hapoalim .is-video .hp-cta::after {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5.5px 0 5.5px 9px;   /* ▶ — sits after the text (left side in RTL), as in the design */
    border-color: transparent transparent transparent #fff;
}

/* top-left badge: play (video) / document (article) */
.hapoalim .hp-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .28) center / 100% 100% no-repeat;
    backdrop-filter: blur(2px);
}

.hapoalim .is-video .hp-badge {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='17.5' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Cpath d='M16 12.5 L28 20 L16 27.5 Z' fill='%23fff'/%3E%3C/svg%3E");
}

.hapoalim .is-article .hp-badge {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='17.5' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Crect x='13' y='11.5' width='14' height='17' rx='2.5' fill='none' stroke='%23fff' stroke-width='2.2'/%3E%3Cpath d='M16.5 16.5h7M16.5 20h7M16.5 23.5h4.5' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* hover / focus */
.hapoalim .hp-card:hover,
.hapoalim .hp-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .2);
}

.hapoalim .hp-card:hover .image-container img,
.hapoalim .hp-card:focus-within .image-container img {
    transform: scale(1.05);
}

.hapoalim .hp-card > a:focus-visible {
    outline: 3px solid var(--hp-red);
    outline-offset: -3px;
    border-radius: var(--hp-radius);
}

/* empty state */
.hapoalim .hp-empty {
    grid-column: 1 / -1;
    padding: 3rem 1rem;
    border-radius: var(--hp-radius);
    background: rgba(255, 255, 255, .85);
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--hp-muted);
}

@media (prefers-reduced-motion: reduce) {
    .hapoalim .hp-card,
    .hapoalim .hp-card .image-container img {
        transition: none;
    }
}
