
.categories__container {
  /* Browsers without color-mix() (Safari < 16.2, Chrome < 111) drop the whole
     gradient and leave white text on white, so they get the fixed one first. */
  background: linear-gradient(180deg, var(--color-blue-200) 0%, #112048 100%);
  background: linear-gradient(180deg, var(--color-blue-200) 0%, color-mix(in srgb, var(--color-blue-200) 79%, #000) 100%);
}

.categories__wrapper {
    color: var(--color-white);
    padding: 2rem 0;
}

.categories._custom-block .categories__wrapper {
    padding: 40px;
}

.categories__layout {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    gap: clamp(2rem, 4vw, 4rem);
}

.categories__layout .categories-list,
.faculty-categories .categories-list {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0;
    align-content: start;
}

.categories-list__item {
    flex: 1 1 calc(33.333% - 16px);
    min-width: 250px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    color: var(--color-white) !important;
    text-decoration: none !important;
    min-height: 85px;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-sizing: border-box;

    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}

.categories-list__title {
    font-family: "Roboto", sans-serif;
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.4;
    padding-right: 15px;
}

.categories-list__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    transform: translateX(0);
}

.categories-list__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.categories-list__inner::after {
    content: "";
    display: block;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255, 255, 255, 0.3)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3Cpolyline points='12 5 19 12 12 19'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: all 0.3s ease;
    transform: translateX(0);
}

/*
 * Hover effects stay behind a hover query: on a touch screen the browser keeps
 * :hover on the last tapped element, so a card would sit lifted and glowing
 * until something else is tapped.
 */
@media (hover: hover) {
    .categories-list__item:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.4);
        transform: translateY(-4px);

        box-shadow:
            0 15px 35px rgba(0, 0, 0, 0.2),
            0 0 20px rgba(255, 255, 255, 0.1);
    }

    .categories-list__item:hover .categories-list__icon {
        color: var(--color-white);
        transform: translateX(5px) scale(1.1);
        filter: drop-shadow(0 0 8px rgba(255,255,255, 0.5));
    }

    .categories-list__item:hover .categories-list__inner::after {
        background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3Cpolyline points='12 5 19 12 12 19'%3E%3C/polyline%3E%3C/svg%3E");
        transform: translateX(5px);
    }
}

/* Touch gets a pressed state instead, so a tap still feels answered. */
@media (hover: none) {
    .categories-list__item:active {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.25);
    }
}

/*
 * A tile whose page is not filled in yet (empty or "#" link) is not a link, so it
 * must not look like one: no arrow, no lift or glow, a quieter title. The resets
 * repeat the base values because the hover rules above are more specific.
 */
.categories-list__item--static {
    cursor: default;
}

.categories-list__item--static .categories-list__title {
    opacity: 0.6;
}

.categories-list__item--static .categories-list__inner::after {
    display: none;
}

.categories-list__item--static:hover,
.categories-list__item--static:active {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: translate3d(0, 0, 0);
}

.categories__layout .categories-logos {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 0;
    gap: 16px;
}

.categories-logos__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-decoration: none !important;
    border-top: 2px solid var(--color-white);
    padding: 10px 24px;
} 

.categories-logos__btn img {
    width: 100%;
    height: 100%;
    max-height: 120px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .categories-logos__btn:hover {
        transform: translateY(-3px);
        z-index: 2;
    }

    .categories-logos__btn:hover img {
        transform: scale(1.05);
    }
}

@media (max-width: 1200px) {
    .categories-list__item {
        flex: 1 1 calc(50% - 16px);
    }
}

@media (max-width: 1150px) {
    /*
     * No horizontal padding of its own here: the wrapper sits inside a
     * ._container that already insets it by --wrap, and doubling that pushed
     * the cards further from the screen edge than the neighbouring sections.
     */
    .categories__wrapper {
        padding: 2rem 0;
    }

    .categories__layout {
        flex-direction: column;
        gap: 30px;
    }

    .categories__layout .categories-logos {
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: row;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding-left: 0;
        padding-top: 30px;
    }
}

/*
 * Below 900px the header stylesheet zeroes .categories__container padding with
 * an !important, so the container stops insetting anything and the wrapper has
 * to carry the gutter itself. It uses the same --wrap as every other section,
 * which is the point: the cards line up with the news and events above.
 */
@media (max-width: 899px) {
    .categories__wrapper {
        padding-left: var(--wrap);
        padding-right: var(--wrap);
    }
}

@media (max-width: 600px) {
    .categories__wrapper {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .categories__layout {
        gap: 20px;
    }

    .categories__layout .categories-list,
    .faculty-categories .categories-list {
        gap: 10px;
    }
    
    .categories-list__item {
        flex: 1 1 calc(50% - 10px);
        min-width: 120px;
    }

    .categories-list__item {
        min-height: 60px;
        padding: 16px 10px;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        border-radius: 0;
    }

    .categories-list__title {
        font-size: 0.9rem;
        padding-right: 0;
        line-height: 1.25;
        text-align: center;
    }

    .categories-list__inner {
        justify-content: center;
    }

    .categories-list__inner::after,
    .categories-list__icon {
        display: none;
    }

    .categories__layout .categories-logos {
        flex-direction: row;
        gap: 10px;
        padding-top: 15px;
    }

    .categories-logos__btn {
        height: 65px;
        padding: 0;
        flex: 1;
        border-radius: 0;
        justify-content: center;
    }

    .categories-logos__btn img {
        max-height: 100%;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
}

.categories-list__link {
    display: block;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .categories-list__link:hover {
        transform: scale(1.1);
    }
}

.categories-list__link img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.categories-list__logo {
    max-width: 150px;
    height: auto;
    display: block;
    background-color: white;
    margin: 0 auto;
    transition: filter 0.3s ease, transform 0.3s ease;
}
