/**
 * Furpsy homepage categories
 *
 * Figma desktop: 7790:2200
 * Figma mobile: 7789:241
 * Figma components: 7789:1822
 */

/* =========================================
   SECTION
========================================= */

.categories-section {
    position: relative;
    width: 100%;
    margin-top: 32px;
    padding: 0;
    overflow: hidden;
}

.categories-section__inner {
    position: relative;
    width: 100%;
}

/* =========================================
   HORIZONTAL TRACK
========================================= */

.categories-section .category-card-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    width: 100%;
    margin: 0;
    padding: 0 0 0 100px;

    list-style: none;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.categories-section .category-card-container::-webkit-scrollbar {
    display: none;
}

/* =========================================
   CATEGORY CARD — DESKTOP
========================================= */

.categories-section .category-card {
    position: relative;

    flex: 0 0 400px;

    width: 400px;
    height: 400px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.categories-section .category-card__link {
    position: relative;

    display: block;

    width: 100%;
    height: 100%;

    overflow: hidden;

    background: var(--furpsy-color-grey-10);

    color: var(--furpsy-color-grey-100);
    text-decoration: none;

    cursor: pointer;
    box-sizing: border-box;
}

/* =========================================
   CATEGORY IMAGES
========================================= */

.categories-section .category-card__media {
    position: absolute;
    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    overflow: hidden;
    pointer-events: none;
}

.categories-section .category-card__image {
    position: absolute;
    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    max-width: none;
    margin: 0;

    object-fit: cover;
    object-position: center;

    border: 0;
    border-radius: 0;
}

.categories-section .category-card__image--default {
    opacity: 1;
}

.categories-section .category-card__image--hover {
    opacity: 0;
}

/* =========================================
   GRADIENT
========================================= */

.categories-section .category-card__gradient {
    position: absolute;

    left: 0;
    bottom: 0;

    width: 100%;
    height: 100px;

    z-index: 1;

    pointer-events: none;

    background: linear-gradient(
        to bottom,
        rgba(208, 208, 208, 0),
        rgba(208, 208, 208, 0.6)
    );
}

/* =========================================
   CATEGORY BUTTON
========================================= */

.categories-section .category-card__button {
    position: absolute;

    left: 24px;
    bottom: 24px;

    z-index: 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    width: max-content;
    max-width: calc(100% - 48px);
    height: 56px;

    padding: 8px 16px 8px 24px;

    box-sizing: border-box;

    background: var(--furpsy-color-opacity-white-100);

    border-radius: 56px;
}

.categories-section .category-card__title {
    display: block;

    min-width: 0;

    font-family: var(--furpsy-font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    letter-spacing: 0;

    color: var(--furpsy-color-grey-100);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================
   BUTTON ARROW
========================================= */

.categories-section .category-card__arrow {
    display: block;

    flex: 0 0 24px;

    width: 24px;
    height: 24px;

    background-color: var(--furpsy-color-primary-50);

    -webkit-mask:
        url("../../icons/button-arrow.svg")
        center / 24px 24px no-repeat;

    mask:
        url("../../icons/button-arrow.svg")
        center / 24px 24px no-repeat;

    transform: scaleY(-1);
    transition: transform 0.3s ease;
}

/* =========================================
   HOVER
========================================= */

@media (hover: hover) and (pointer: fine) {

    .categories-section
    .category-card__link:hover:not(:focus-visible)
    .category-card__arrow {
        transform: rotate(45deg) scaleY(-1);
    }

    .categories-section
    .category-card--has-hover
    .category-card__link:hover:not(:focus-visible)
    .category-card__image--default {
        opacity: 0;
    }

    .categories-section
    .category-card__link:hover:not(:focus-visible)
    .category-card__image--hover {
        opacity: 1;
    }

    .categories-section
    .category-card__link:hover:not(:focus-visible)
    .category-card__gradient::after {
        opacity: 1;
    }

    .categories-section
    .category-card__link:hover:not(:focus-visible)
    .category-card__title {
        color: var(--furpsy-color-primary-50);
    }
}

/* =========================================
   FOCUSED — KEYBOARD NAVIGATION
========================================= */

.categories-section .category-card__link:focus {
    outline: none;
}

.categories-section .category-card__link:focus-visible {
    outline: none;
}

/* Figma 2px focused border */

.categories-section .category-card__link:focus-visible::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 3;

    box-shadow: inset 0 0 0 2px
        var(--furpsy-color-primary-30);

    pointer-events: none;
}

/* Focused state retains the default image */

.categories-section
.category-card__link:focus-visible
.category-card__image--default {
    opacity: 1;
}

.categories-section
.category-card__link:focus-visible
.category-card__image--hover {
    opacity: 0;
}

/* =========================================
   SLIDER NAVIGATION
   Appearance is managed by the shared
   Furpsy Arrow component.
========================================= */

.categories-section__navigation {
    position: absolute;
    top: 180px;
    right: 100px;
    z-index: 5;

    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hide navigation until the slider is initialized. */
.categories-section:not(.categories-section--ready)
.categories-section__navigation {
    display: none;
}

.categories-section .categories-section__nav[hidden] {
    display: none;
}

/* =========================================
   MOBILE — UP TO 500px
========================================= */

@media (max-width: 500px) {

    .categories-section {
        margin-top: 0;
    }

    .categories-section .category-card-container {
        gap: 8px;
        padding-left: 0;
    }

    .categories-section .category-card {
        flex-basis: 228px;

        width: 228px;
        height: 285px;
    }

    .categories-section .category-card__button {
        left: 50%;
        bottom: 24px;

        transform: translateX(-50%);
    }

    .categories-section .category-card__title {
        font-size: 18px;
        line-height: 26px;
    }

    .categories-section__navigation {
        display: none;
    }
}
/* =========================================
   CATEGORY TRANSITIONS
========================================= */

.categories-section .category-card__image {
    transition: opacity 200ms ease;
}

.categories-section .category-card__title {
    transition: color 200ms ease;
}

.categories-section .category-card__gradient::after {
    content: "";
    position: absolute;
    inset: 0;

    background: linear-gradient(
        to bottom,
        rgba(22, 22, 22, 0),
        var(--furpsy-color-opacity-black-30)
    );

    opacity: 0;
    transition: opacity 200ms ease;
}



/* =========================================
   REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {
    .categories-section .category-card__image,
    .categories-section .category-card__arrow,
    .categories-section .category-card__title,
    .categories-section .category-card__gradient::after {
        transition: none;
    }
}
