/*---*\
Image Buttons
Image cards linking to category or application pages.

KEY FEATURES:
- White or navy section backgrounds
- Desktop grid (3 columns) or slider (3 slides)
- Tablet and mobile always use a slider (1 centered slide)
- Hover overlay, description, and Learn More tab on desktop (linked cards)
- Cards without a link show title and description with no CTA or hover
- Focused slider card shows description by default

IMPLEMENTATION NOTES:
- Uses fx_slick for slider layouts
- CTA tab slant is clip-path, not an extra asset
- Card images use .object-fit from trumps.css
- .image-button--static is used when no link is set
- Image scale is clipped on .image-button__media so the CTA slant
  can extend past the card edge without a hairline seam
\*---*/

/* Clip image scale on the card only -- overflow on the section clips the
   GSAP shell transform and can make the whole slider look like it vanished. */
.image-button {
    overflow: hidden;
}

.image-buttons__inner {
    width: 100%;
}

.image-buttons__header {
    max-width: 880px;
    margin-right: auto;
    margin-left: auto;
    margin-bottom: var(--space-inner);
    text-align: center;
}

.image-buttons__header  > p {
    justify-content: center; 
}

.image-buttons__header > * {
    margin-top: 0;
    margin-bottom: var(--space-paragraph);
}

.image-buttons__header > :last-child {
    margin-bottom: 0;
}

.image-buttons__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-right: calc(-1 * var(--container-padding));
    margin-left: calc(-1 * var(--container-padding));
    width: calc(100% + (2 * var(--container-padding)));
}

.image-buttons__item {
    flex: 0 0 auto;
    width: 264px;
    max-width: 264px;
    overflow: visible;
}

.image-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 150px;
    padding: 40px 20px 60px;
    overflow: visible;
    color: var(--color-text-inverse);
    text-decoration: none;
}

.image-button:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

.image-button__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.image-button__img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    transform: scale(1);
    transition: transform 0.45s ease;
}

.image-button__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: var(--color-primary-70);
}

.image-button__content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.image-button__title {
    margin: 0;
    max-width: 100%;
    min-width: 0;
    font-family: var(--font-heading);
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-heading);
    color: var(--color-text-inverse);
    text-transform: uppercase;
}

.image-button__description {
    display: none;
    max-width: 100%;
    min-width: 0;
    max-height: 56px;
    overflow-x: hidden;
    overflow-y: hidden;
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-body);
    color: var(--color-text-inverse);
    scrollbar-width: none;
}

.image-button__description::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.image-button__description--scrollable {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-secondary) transparent;
}

.image-button__description--scrollable::-webkit-scrollbar {
    width: 4px;
    height: auto;
}

.image-button__description--scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.image-button__description--scrollable::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: var(--radius-pill);
}

.image-button--static .image-button__description {
    display: block;
}

.image-button__cta {
    position: absolute;
    right: -2px;
    bottom: -2px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--button-gap);
    height: 42px;
    padding: 10px 14px 10px 25px;
    overflow: hidden;
    color: var(--color-primary);
    background-color: var(--color-secondary);
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 0 100%);
}

.image-button__cta-label {
    display: none;
    font-family: var(--font-button);
    font-size: var(--button-font-size);
    font-weight: var(--font-weight-bold);
    line-height: var(--button-line-height);
    color: var(--color-primary);
    text-transform: uppercase;
    white-space: nowrap;
}

.image-buttons .slick-center .image-button__cta-label {
    display: inline;
}

.image-button__cta .icon-double-arrows {
    display: inline-block;
    font-size: 19px;
    transition: transform 0.25s ease;
}

.image-buttons__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-top: var(--space-inner);
}

.image-buttons__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 39px;
    padding: 0;
    color: var(--color-primary);
    background-color: var(--color-white);
    border: 2px solid var(--color-secondary);
    cursor: pointer;
    transition: color 0.25s ease, background-color 0.25s ease;
}

.image-buttons.bg-dark .image-buttons__arrow {
    color: var(--color-white);
    background-color: transparent;
}

.image-buttons__arrow:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

.image-buttons__arrow--prev .icon-double-arrows {
    display: inline-block;
    transform: scaleX(-1);
}

.image-buttons__arrow .icon-double-arrows {
    display: inline-block;
    font-size: 16px;
    transition: transform 0.25s ease;
}

.image-buttons .slick-list {
    overflow: hidden;
}

.image-buttons .slick-track {
    display: flex;
    align-items: center;
}

.image-buttons .slick-slide {
    float: none;
    width: 264px;
    max-width: 264px;
    min-width: 0;
    height: auto;
    margin-right: 10px;
    margin-left: 10px;
}

@media (min-width: 768px) {
    .image-buttons__list {
        gap: 32px;
    }

    .image-buttons__item {
        width: 432px;
        max-width: 432px;
    }

    .image-buttons .slick-slide {
        width: 432px;
        max-width: 432px;
        margin-right: 16px;
        margin-left: 16px;
    }

    .image-button {
        height: 280px;
        padding: 40px 20px 50px;
    }

    .image-button__overlay {
        background-color: transparent;
        background-image: linear-gradient(to bottom, rgba(0, 40, 86, 0) 15%, var(--color-primary-70) 100%);
    }

    .image-button__cta {
        height: 48px;
        padding: 10px 14px 10px 27px;
        clip-path: polygon(17px 0, 100% 0, 100% 100%, 0 100%);
    }

    .image-buttons__arrow {
        width: 44px;
        height: 44px;
    }

    .image-buttons__arrow .icon-double-arrows {
        font-size: 18px;
    }

    .image-buttons .slick-center .image-button {
        height: 330px;
    }

    .image-buttons .slick-center .image-button__overlay {
        background-image: linear-gradient(to bottom, var(--color-primary-40), var(--color-primary-80));
    }

    .image-button--static .image-button__overlay {
        background-image: linear-gradient(to bottom, var(--color-primary-40), var(--color-primary-80));
    }

    .image-button__description {
        max-height: 100px;
    }

    .image-buttons .slick-center .image-button__description {
        display: block;
    }

    .image-button__title {
        font-size: 23px;
    }
}

@media (min-width: 1200px) {
    .image-button__description {
        max-height: 140px;
    }

    .image-buttons--grid .image-buttons__list {
        margin-right: 0;
        margin-left: 0;
        width: 100%;
    }

    .image-buttons--grid .image-buttons__item {
        flex: 1 1 calc((100% - 64px) / 3);
        width: auto;
        max-width: 576px;
    }

    .image-buttons--grid .slick-slide {
        width: auto;
        max-width: none;
    }

    .image-buttons--grid .image-button {
        height: 340px;
        padding: 40px 40px 46px;
    }

    .image-buttons--grid .image-button--link:hover,
    .image-buttons--grid .image-button--link:focus-visible {
        padding-bottom: 70px;
    }

    .image-button--static {
        padding: 40px 40px 46px!important;
    }

    .image-buttons--grid .image-buttons__nav {
        display: none;
    }

    /* Equal thirds so slidesToShow: 3 fills the track (Slick sets width).
       Use padding for gaps -- margins are ignored by Slick width math and
       clip the left card on first paint. */
    .image-buttons--slider .image-buttons__item,
    .image-buttons--slider .slick-slide {
        width: auto;
        max-width: none;
        margin-right: 0;
        margin-left: 0;
        padding-right: 16px;
        padding-left: 16px;
        box-sizing: border-box;
    }

    .image-buttons--slider .image-button {
        height: 340px;
        padding: 40px 40px 46px;
    }

    /* Same width as siblings: center width changes make Slick bounce. */
    .image-buttons--slider .slick-center .image-button {
        height: 390px;
    }

    .image-buttons__arrow {
        width: 52px;
        height: 52px;
    }

    .image-buttons__arrow .icon-double-arrows {
        font-size: 20px;
    }

    .image-buttons__arrow:hover,
    .image-buttons.bg-dark .image-buttons__arrow:hover {
        color: var(--color-primary);
        background-color: var(--color-secondary);
        border-color: var(--color-secondary);
    }

    .image-buttons__arrow:hover .icon-double-arrows {
        transform: translateX(3px);
    }

    .image-buttons__arrow--prev:hover .icon-double-arrows {
        transform: scaleX(-1) translateX(3px);
    }

    .image-buttons--grid .image-button__overlay::after {
        position: absolute;
        inset: 0;
        background-image: linear-gradient(to bottom, var(--color-primary-40), var(--color-primary-80));
        opacity: 0;
        transition: opacity 0.35s ease;
        content: "";
    }

    .image-buttons--grid .image-button__description {
        display: block;
        max-height: 0;
        margin-top: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, margin-top 0.35s ease;
    }

    .image-buttons--grid .image-button--static .image-button__overlay::after {
        opacity: 1;
    }

    .image-buttons--grid .image-button--static .image-button__description {
        max-height: 140px;
        margin-top: 12px;
        overflow-x: hidden;
        overflow-y: hidden;
        opacity: 1;
        transform: none;
        transition: none;
    }

    .image-buttons--grid .image-button--static .image-button__description--scrollable {
        overflow-y: auto;
    }

    .image-buttons--grid .image-button__cta-label {
        display: inline-block;
        max-width: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-width 0.35s ease, opacity 0.25s ease;
    }
}

@media( min-width : 1600px ) {
    .image-button__title {
        font-size: var(--font-size-h4);
    }
}

@media (min-width: 1200px) and (hover: hover) {
    .image-button--link:hover .image-button__img,
    .image-button--link:focus-visible .image-button__img {
        transform: scale(1.06);
    }

    .image-button--link:hover .image-button__cta .icon-double-arrows,
    .image-button--link:focus-visible .image-button__cta .icon-double-arrows {
        transform: translateX(4px);
    }

    .image-buttons--grid .image-button--link:hover .image-button__overlay::after,
    .image-buttons--grid .image-button--link:focus-visible .image-button__overlay::after {
        opacity: 1;
    }

    .image-buttons--grid .image-button--link:hover .image-button__description,
    .image-buttons--grid .image-button--link:focus-visible .image-button__description {
        max-height: 140px;
        margin-top: 12px;
        overflow-x: hidden;
        overflow-y: hidden;
        opacity: 1;
        transform: translateY(0);
    }

    .image-buttons--grid .image-button--link:hover .image-button__description--scrollable,
    .image-buttons--grid .image-button--link:focus-visible .image-button__description--scrollable {
        overflow-y: auto;
    }

    .image-buttons--grid .image-button--link:hover .image-button__cta-label,
    .image-buttons--grid .image-button--link:focus-visible .image-button__cta-label {
        max-width: 15em;
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .image-button,
    .image-button__img,
    .image-button__overlay,
    .image-button__overlay::after,
    .image-button__description,
    .image-button__cta,
    .image-button__cta-label,
    .image-buttons__arrow {
        transition-duration: 0.01ms;
    }

    .image-button--link:hover .image-button__img,
    .image-button--link:focus-visible .image-button__img {
        transform: none;
    }
}
