/* academic-resources.css — hover behaviour for the homepage resource cards.
 *
 * Page-scoped and pushed from components/uowa/index/academic-resources.blade.php,
 * so one file serves both locales. The card's layout and resting state still
 * live in style.css / en.css; this file only replaces what happens on hover,
 * which is why every rule below is written to out-specify its counterpart there
 * rather than to restate the whole card.
 *
 * What it replaces: `transition: all .4s ease` plus a ::before that grew from
 * 0 to 120% of the card on hover — a gold wash expanding out of the centre. Two
 * problems with it. `all` transitions every property the card has, including
 * the ones being changed for layout reasons, and the wash reads as a ripple
 * effect from a different design era. The lift was 3px, which at this card size
 * is below the threshold where it registers as deliberate.
 *
 * What it does instead: the card lifts properly and casts a real shadow, a gold
 * rule draws across its foot from the reading-start edge, the icon fills navy,
 * and the arrow steps toward the edge it points at. Four things, all moving in
 * the same direction, over the same easing.
 */

.ul-resource-item {
    --rs-ease: cubic-bezier(.22, 1, .36, 1);

    /* Named properties, not `all`. */
    transition:
        transform .42s var(--rs-ease),
        box-shadow .42s var(--rs-ease),
        border-color .42s var(--rs-ease);
}

/* The old wash. Killed rather than removed, because the ::before is declared in
   both locale sheets and deleting it there means the same edit twice. */
.ul-resource-item::before {
    display: none;
}

/* The gold rule along the foot of the card. Uses ::after, which the card does
   not otherwise use. */
.ul-resource-item::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inset-inline-start: 0;
    z-index: 2;
    width: 0;
    height: 3px;
    background: var(--ul-c3);
    transition: width .45s var(--rs-ease);
}

.ul-resource-item:hover,
.ul-resource-item:focus-within {
    /* 6px, not 3px. Below about 5px a lift on a card this size reads as the
       page having shifted rather than as a response. */
    transform: translateY(-6px);
    box-shadow: 0 22px 40px -24px rgba(4, 28, 51, .55);
    border-color: rgba(254, 190, 53, .45);
}

.ul-resource-item:hover::after,
.ul-resource-item:focus-within::after {
    width: 100%;
}

/* The icon circle: the site's gold (--ul-c3) at rest and on hover, so it never
   switches to navy. On hover it only scales and gains a soft gold halo. */
.ul-resource-item .ul-resource-icon {
    background-color: var(--ul-c3);
    box-shadow: 0 0 0 0 rgba(254, 190, 53, 0);
    transition:
        box-shadow .42s var(--rs-ease),
        transform .42s var(--rs-ease);
}

.ul-resource-item .ul-resource-icon i {
    color: var(--ul-primary);
}

.ul-resource-item .ul-resource-icon img {
    filter: none;
}

.ul-resource-item:hover .ul-resource-icon {
    background-color: var(--ul-c3);
    box-shadow: 0 0 0 6px rgba(254, 190, 53, .22);
    transform: scale(1.08);
}

.ul-resource-item:hover .ul-resource-icon i {
    color: var(--ul-primary);
}

/* Card text: a slightly larger title and a darker, more open description than
   the 13px grey the base sheets give it. */
.ul-resource-item .ul-resource-title {
    /* size and leading: card role, typography.css */
    color: var(--ul-primary);
}

.ul-resource-item .ul-resource-description {
    /* size and leading: body role, typography.css */
    color: #4a5568;
}

/* Start the description under the title, not under the icon: indent it by the
   icon's width plus the header gap (both from .ul-resource-header/-icon in the
   locale sheets). Logical property, so it is the right edge in Arabic and the
   left in English. Not below 768px, where the header stacks and centres. */
@media screen and (min-width: 768px) {
    .ul-resource-item .ul-resource-description {
        padding-inline-start: calc(clamp(50px, 3.5vw, 65px) + clamp(12px, 1vw, 16px));
    }

    .ul-resource-item .ul-resource-link {
        margin-inline-start: calc(clamp(50px, 3.5vw, 65px) + clamp(12px, 1vw, 16px));
    }
}

.ul-resource-item .ul-resource-link {
    font-size: 14px;
    font-weight: 700;
}

/* icon_forward() already returns fa-chevron-left in Arabic and -right in
   English, so the glyph must not be mirrored here — only the direction it
   travels has to invert. */
.ul-resource-item .ul-resource-link i {
    transition: transform .35s var(--rs-ease);
}

.ul-resource-item:hover .ul-resource-link i {
    transform: translateX(-6px);
}

[dir="ltr"] .ul-resource-item:hover .ul-resource-link i {
    transform: translateX(6px);
}

/* Touch fires :hover on tap and leaves it stuck until you tap elsewhere, so a
   tapped card would sit lifted and shadowed over its neighbours while the next
   page loads. */
@media (hover: none) {
    .ul-resource-item:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(4, 28, 51, .06);
    }

    .ul-resource-item:hover::after {
        width: 0;
    }
}

/* THE CARD GROWS WITH ITS TEXT. style.css/en.css pin it at 220px, and on a
   wide screen — where the padding and icon scale up — a two-line description
   was squeezed into one line's room and its second line cut off (both
   locales). The 220px stays as the least height; the description no longer
   shrinks, and the cards of a row stay level. */
.ul-resources-slider .ul-resource-item {
    height: 100% !important;
    min-height: 220px;
    max-height: none;
}

.ul-resources-slider .swiper-slide {
    height: auto;
}

.ul-resource-item .ul-resource-description {
    flex-shrink: 0;
}
