/* =====================================================
   VAN LOI - MODULE 03
   LUXURY MOTORSPORT COLLECTION V1.1

   01. Design System
   02. Full Width Background
   03. Section Header
   04. Adaptive Grid
   05. Category Cards
   06. Product Visual
   07. Motorsport Effects
   08. Interactions
   09. Responsive
===================================================== */

/* 01. DESIGN SYSTEM */

.vl-collection {
    --vl-red: #C8102E;
    --vl-red-light: #FF526F;
    --vl-carbon: #141414;
    --vl-panel: #20232A;
    --vl-white: #FFFFFF;
    --vl-muted: #C4C9D2;
    --vl-border: rgba(255,255,255,.12);
    --vl-title: Montserrat, Arial, sans-serif;
    --vl-body: "Noto Sans", Arial, sans-serif;

    position: relative;
    isolation: isolate;

    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 76px 0;

    color: var(--vl-white);
    font-family: var(--vl-body);
}

.vl-collection,
.vl-collection *,
.vl-collection *::before,
.vl-collection *::after {
    box-sizing: border-box;
}

.vl-collection a {
    text-decoration: none;
}

.vl-collection :focus-visible {
    outline: 3px solid var(--vl-red-light);
    outline-offset: 4px;
}

/* 02. FULL WIDTH DARK BACKGROUND */

.vl-collection::before {
    content: "";
    position: absolute;
    z-index: -2;
    top: 0;
    bottom: 0;
    left: 50%;

    width: 100vw;

    transform: translateX(-50%);

    background:
        radial-gradient(
            ellipse at 90% 0%,
            rgba(200,16,46,.14),
            transparent 45%
        ),
        radial-gradient(
            ellipse at 0% 100%,
            rgba(200,16,46,.07),
            transparent 45%
        ),
        linear-gradient(
            135deg,
            #111317,
            #181A20 55%,
            #101216
        );
}

.vl-collection::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;

    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(255,255,255,.02) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255,255,255,.02) 1px,
            transparent 1px
        );

    background-size: 56px 56px;

    mask-image: linear-gradient(
        180deg,
        #000,
        transparent 85%
    );
}

/* 03. SECTION HEADER */

.vl-collection-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 30px;
    margin-bottom: 36px;
}

.vl-collection-heading {
    max-width: 820px;
}

.vl-collection-kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 16px;

    color: var(--vl-red-light);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.vl-collection-kicker::before {
    content: "";
    width: 30px;
    height: 2px;
    background: var(--vl-red);
}

.vl-collection-heading h2 {
    margin: 0 0 14px;

    color: #FFFFFF !important;

    font-family: var(--vl-title);
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -.04em;
    text-transform: none;
}

.vl-collection-heading h2 span {
    color: var(--vl-red-light);
}

.vl-collection-heading p {
    max-width: 680px;
    margin: 0;

    color: var(--vl-muted);
    font-size: 15px;
    line-height: 1.8;
}

/* View all */

.vl-collection .vl-collection-view-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    gap: 20px;

    min-height: 50px;
    padding: 12px 22px;

    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 8px;

    color: #FFFFFF !important;
    font-size: 14px;
    font-weight: 600;
    text-transform: none;

    transition:
        background .25s ease,
        border-color .25s ease;
}

.vl-collection-view-all span {
    font-size: 21px;
    font-weight: 400;
}

.vl-collection .vl-collection-view-all:hover {
    background: var(--vl-red);
    border-color: var(--vl-red);
}

/* 04. ADAPTIVE GRID */

.vl-collection-grid {
    display: grid;

    grid-template-columns:
        repeat(12, minmax(0,1fr));

    grid-auto-rows: 1fr;

    gap: 18px;
}

/* Default: 3 columns */

.vl-collection-grid > .vl-collection-card {
    grid-column: span 4;
}

/* One category */

.vl-collection-card:only-child {
    grid-column: span 12;
}

/* Two categories */

.vl-collection-card:first-child:nth-last-child(2),
.vl-collection-card:first-child:nth-last-child(2)
~ .vl-collection-card {
    grid-column: span 6;
}

/* Four categories: 2 + 2 */

.vl-collection-card:first-child:nth-last-child(4),
.vl-collection-card:first-child:nth-last-child(4)
~ .vl-collection-card {
    grid-column: span 6;
}

/* Five categories: 3 + 2
   Eight categories: 3 + 3 + 2
   Eleven categories: 3 + 3 + 3 + 2 */

.vl-collection-card:nth-child(3n + 1):nth-last-child(2),
.vl-collection-card:nth-child(3n + 1):nth-last-child(2)
~ .vl-collection-card {
    grid-column: span 6;
}

/* Seven categories: 3 + 4 */

.vl-collection-card:nth-child(4):nth-last-child(4),
.vl-collection-card:nth-child(4):nth-last-child(4)
~ .vl-collection-card {
    grid-column: span 3;
}

/* Ten categories: 3 + 3 + 4 */

.vl-collection-card:nth-child(7):nth-last-child(4),
.vl-collection-card:nth-child(7):nth-last-child(4)
~ .vl-collection-card {
    grid-column: span 3;
}

/* 05. PREMIUM CATEGORY CARD */

.vl-collection .vl-collection-card {
    --vl-light-x: 75%;
    --vl-light-y: 55%;
    --vl-index: 0;

    position: relative;
    isolation: isolate;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 320px;
    padding: 24px;

    overflow: hidden;

    background:
        linear-gradient(
            145deg,
            #262930,
            #202229 65%,
            #191B21
        );

    border: 1px solid var(--vl-border);
    border-radius: 14px;

    color: #FFFFFF;

    box-shadow:
        0 10px 28px rgba(0,0,0,.18);

    transition:
        border-color .3s ease,
        box-shadow .3s ease,
        transform .3s ease;
}

/* Carbon texture */

.vl-collection-card::before {
    content: "";
    position: absolute;
    inset: 0;

    z-index: -1;
    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(255,255,255,.025) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255,255,255,.025) 1px,
            transparent 1px
        );

    background-size: 34px 34px;

    mask-image:
        linear-gradient(
            145deg,
            transparent,
            #000
        );
}

/* Racing stripe */

.vl-collection-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;

    width: 55px;
    height: 3px;

    background: var(--vl-red);
    border-radius: 0 0 3px 3px;

    transition: width .35s ease;
}

/* Number */

.vl-collection-number {
    position: absolute;
    top: 8px;
    right: 18px;

    z-index: -1;

    color: rgba(255,255,255,.055);
    font-family: var(--vl-title);
    font-size: clamp(64px,7vw,105px);
    font-weight: 900;
    font-style: italic;
    line-height: 1;

    pointer-events: none;
}

/* Lighting */

.vl-collection-light {
    position: absolute;
    inset: 0;
    z-index: -1;

    pointer-events: none;

    background:
        radial-gradient(
            ellipse at
            var(--vl-light-x)
            var(--vl-light-y),
            rgba(200,16,46,.25),
            rgba(200,16,46,.06) 40%,
            transparent 70%
        );

    opacity: .85;
    transition: opacity .3s ease;
}

/* Track */

.vl-collection-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 58px;
    height: 70px;

    z-index: -1;

    pointer-events: none;

    background:
        linear-gradient(
            0deg,
            transparent,
            rgba(255,255,255,.03)
        );

    border-top:
        1px solid rgba(255,255,255,.05);

    transform: skewY(-3deg);
}

/* Category information */

.vl-collection-info {
    position: relative;
    z-index: 3;

    min-width: 0;
    min-height: 76px;
    max-width: 100%;
}

.vl-collection-count {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;
    margin-bottom: 10px;

    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 5px;

    color: #D9DDE5 !important;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    text-transform: none;
}

.vl-collection-info h3 {
    margin: 0 0 7px;

    color: #FFFFFF !important;
    font-family: var(--vl-title);
    font-size: clamp(19px,2vw,25px);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.035em;
    text-transform: none;

    overflow-wrap: anywhere;
}

.vl-collection-info p {
    margin: 0;

    color: #C4C9D2 !important;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.7;
}

/* 06. PRODUCT VISUAL */

.vl-collection-visual {
    position: relative;
    z-index: 1;

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

    flex: 1;

    min-height: 180px;
    margin: 10px -5px 0;
}

.vl-collection-drive {
    position: relative;

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

    width: 100%;

    transform: translateX(0);
}

.vl-collection .vl-collection-vehicle {
    display: block;

    width: 100%;
    max-width: 520px;

    height: 210px;
    max-height: 100%;

    object-fit: contain;
    object-position: center;

    filter:
        drop-shadow(
            0 18px 14px rgba(0,0,0,.4)
        );

    transform: translateX(0) scale(1);

    transition:
        transform .5s cubic-bezier(.2,.75,.25,1),
        filter .35s ease;
}

.vl-collection-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 180px;
    color: rgba(255,255,255,.18);
}

/* Footer */

.vl-collection-footer {
    position: relative;
    z-index: 3;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-top: auto;
    padding-top: 14px;

    border-top:
        1px solid rgba(255,255,255,.14);

    color: #FFFFFF !important;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
}

.vl-collection-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 38px;
    width: 38px;
    height: 38px;

    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 8px;

    color: #FFFFFF;

    font-size: 22px;
    font-weight: 400;

    transition:
        background .25s ease,
        border-color .25s ease,
        transform .25s ease;
}

/* 07. MOTORSPORT SPEED TRAILS */

.vl-collection-speed {
    position: absolute;
    inset: 0;
    z-index: 0;

    overflow: hidden;
    pointer-events: none;
    opacity: 0;
}

.vl-collection-speed::before,
.vl-collection-speed::after {
    content: "";
    position: absolute;

    left: -20%;
    width: 140%;

    transform: skewX(-25deg);

    background:
        linear-gradient(
            90deg,
            transparent 10%,
            rgba(200,16,46,.15) 30%,
            #E91C42 55%,
            rgba(255,255,255,.5) 58%,
            transparent 90%
        );
}

.vl-collection-speed::before {
    top: 55%;
    height: 3px;

    box-shadow:
        0 0 20px #C8102E;
}

.vl-collection-speed::after {
    top: 67%;
    height: 1px;
    opacity: .6;
}

/* Drive in */

.vl-collection-card.vl-motion-ready
.vl-collection-drive {
    opacity: 0;
    transform: translateX(-125%);
}

.vl-collection-card.vl-motion-ready.vl-entered
.vl-collection-drive {
    animation:
        vlCollectionDriveIn
        .95s
        cubic-bezier(.16,.78,.24,1)
        both;

    animation-delay:
        calc(var(--vl-index) * 85ms);
}

.vl-collection-card.vl-motion-ready.vl-entered
.vl-collection-speed {
    animation:
        vlCollectionSpeedTrail
        .8s ease-out both;

    animation-delay:
        calc(var(--vl-index) * 85ms);
}

@keyframes vlCollectionDriveIn {

    0% {
        opacity: 0;
        transform: translateX(-125%);
        filter: blur(5px);
    }

    12% {
        opacity: 1;
    }

    65% {
        opacity: 1;
        transform: translateX(3%);
        filter: blur(0);
    }

    84% {
        transform: translateX(-.8%);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes vlCollectionSpeedTrail {

    0% {
        opacity: 0;
        transform: translateX(-110%);
    }

    25% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(120%);
    }
}

/* 08. DESKTOP INTERACTIONS */

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

    .vl-collection .vl-collection-card:hover {
        transform: translateY(-5px);

        border-color:
            rgba(200,16,46,.8);

        box-shadow:
            0 16px 38px rgba(0,0,0,.28),
            0 0 22px rgba(200,16,46,.08);
    }

    .vl-collection-card:hover::after {
        width: 120px;
    }

    .vl-collection-card:hover
    .vl-collection-light {
        opacity: 1;
    }

    .vl-collection-card:hover
    .vl-collection-vehicle {
        transform:
            translateX(4%)
            scale(1.06);

        filter:
            drop-shadow(
                0 24px 18px rgba(0,0,0,.5)
            )
            brightness(1.09);
    }

    .vl-collection-card:hover
    .vl-collection-arrow {
        background: var(--vl-red);
        border-color: var(--vl-red);
        transform: translate(2px,-2px);
    }
}

/* 09. RESPONSIVE */

/* Laptop */

@media (max-width: 1200px) {

    .vl-collection {
        padding: 60px 0;
    }

    .vl-collection .vl-collection-card {
        padding: 20px;
    }

    .vl-collection .vl-collection-vehicle {
        height: 190px;
    }
}

/* Tablet */

@media (max-width: 1024px) {

    .vl-collection {
        padding: 48px 0;
    }

    .vl-collection-grid {
        gap: 14px;
    }

    .vl-collection-grid > .vl-collection-card {
        grid-column: span 6;
    }

    .vl-collection-grid >
    .vl-collection-card:last-child:nth-child(odd) {
        grid-column: span 12;
    }

    .vl-collection .vl-collection-card {
        min-height: 300px;
    }

    .vl-collection-info h3 {
        font-size: 22px;
    }

    .vl-collection .vl-collection-vehicle {
        height: 190px;
    }
}

/* Mobile */

@media (max-width: 760px) {

    .vl-collection {
        padding: 38px 0;
    }

    .vl-collection-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;

        margin-bottom: 24px;
    }

    .vl-collection-heading h2 {
        font-size: 30px;
    }

    .vl-collection-heading p {
        font-size: 14px;
    }

    .vl-collection-kicker {
        font-size: 10px;
    }

    .vl-collection .vl-collection-view-all {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .vl-collection-grid {
        grid-template-columns: minmax(0,1fr);
        grid-auto-rows: auto;
        gap: 14px;
    }

    .vl-collection-grid > .vl-collection-card,
    .vl-collection-grid >
    .vl-collection-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .vl-collection .vl-collection-card {
        padding: 22px;
        min-height: 300px;
        border-radius: 12px;
    }

    .vl-collection-info {
        min-height: 70px;
    }

    .vl-collection-info h3 {
        font-size: 23px;
    }

    .vl-collection-number {
        font-size: 85px;
    }

    .vl-collection-visual {
        min-height: 170px;
    }

    .vl-collection .vl-collection-vehicle {
        height: 190px;
    }

    .vl-collection-footer {
        font-size: 13px;
    }

    .vl-collection-arrow {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {

    .vl-collection *,
    .vl-collection *::before,
    .vl-collection *::after {
        animation: none !important;
        transition: none !important;
    }

    .vl-collection .vl-collection-drive {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .vl-collection .vl-collection-speed {
        display: none;
    }

    .vl-collection .vl-collection-card:hover,
    .vl-collection-card:hover
    .vl-collection-vehicle {
        transform: none;
    }
}

/* =====================================================
   VAN LOI - MODULE 03 V1.2
   DYNAMIC MOTORSPORT EXPERIENCE
===================================================== */

.vl-collection .vl-collection-card {
    --vl-rotate-x: 0deg;
    --vl-rotate-y: 0deg;
    --vl-lift: 0px;
    --vl-product-x: 0px;
    --vl-product-y: 0px;
    --vl-product-scale: 1;

    transform:
        perspective(1100px)
        translateY(var(--vl-lift))
        rotateX(var(--vl-rotate-x))
        rotateY(var(--vl-rotate-y));

    transition:
        transform .25s ease-out,
        border-color .35s ease,
        box-shadow .35s ease;
}

/* =========================================
   01. CONTINUOUS PRODUCT FLOATING
========================================= */

.vl-collection-card.vl-entered
.vl-collection-vehicle {
    animation:
        vlProductFloating 4.5s
        ease-in-out infinite;

    animation-delay:
        calc(var(--vl-index) * -420ms);
}

@keyframes vlProductFloating {

    0%, 100% {
        transform:
            translate3d(
                var(--vl-product-x),
                var(--vl-product-y),
                0
            )
            scale(var(--vl-product-scale));
    }

    50% {
        transform:
            translate3d(
                var(--vl-product-x),
                calc(var(--vl-product-y) - 10px),
                0
            )
            scale(var(--vl-product-scale));
    }
}

/* =========================================
   02. DYNAMIC SHADOW
========================================= */

.vl-collection-visual::after {
    content: "";
    position: absolute;

    bottom: 5px;
    left: 50%;

    width: 54%;
    height: 20px;

    background: #000000;
    border-radius: 50%;

    filter: blur(12px);
    opacity: .32;

    transform: translateX(-50%);

    pointer-events: none;
    z-index: -1;
}

.vl-collection-card.vl-entered
.vl-collection-visual::after {
    animation:
        vlProductShadow
        4.5s ease-in-out infinite;

    animation-delay:
        calc(var(--vl-index) * -420ms);
}

@keyframes vlProductShadow {

    0%, 100% {
        opacity: .35;

        transform:
            translateX(-50%)
            scaleX(1);
    }

    50% {
        opacity: .18;

        transform:
            translateX(-50%)
            scaleX(.8);
    }
}

/* =========================================
   03. RACING LIGHT SWEEP
========================================= */

.vl-collection-sweep {
    position: absolute;
    inset: 0;

    overflow: hidden;
    pointer-events: none;

    z-index: 0;
}

.vl-collection-sweep::before {
    content: "";

    position: absolute;

    top: -20%;
    bottom: -20%;
    left: -50%;
    width: 30%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(200,16,46,.12),
            rgba(255,100,125,.09),
            transparent
        );

    transform: skewX(-25deg);
}

.vl-collection-card.vl-entered
.vl-collection-sweep::before {
    animation:
        vlRacingSweep
        7s linear infinite;

    animation-delay:
        calc(var(--vl-index) * -650ms);
}

@keyframes vlRacingSweep {

    0% {
        left: -50%;
        opacity: 0;
    }

    8% {
        opacity: 1;
    }

    24% {
        left: 135%;
        opacity: 0;
    }

    100% {
        left: 135%;
        opacity: 0;
    }
}

/* =========================================
   04. DYNAMIC RED LIGHT
========================================= */

.vl-collection-card.vl-entered
.vl-collection-light {
    animation:
        vlCollectionLightPulse
        5s ease-in-out infinite;

    animation-delay:
        calc(var(--vl-index) * -500ms);
}

@keyframes vlCollectionLightPulse {

    0%, 100% {
        opacity: .60;
    }

    50% {
        opacity: 1;
    }
}

/* =========================================
   05. HOVER SPORT MODE
========================================= */

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

    .vl-collection .vl-collection-card:hover {

        --vl-lift: -7px;
        --vl-product-scale: 1.08;

        transform:
            perspective(1100px)
            translateY(var(--vl-lift))
            rotateX(var(--vl-rotate-x))
            rotateY(var(--vl-rotate-y));

        border-color: #C8102E;

        box-shadow:
            0 22px 40px rgba(0,0,0,.35),
            0 0 25px rgba(200,16,46,.14);
    }

    .vl-collection-card:hover
    .vl-collection-vehicle {

        filter:
            drop-shadow(
                0 25px 20px rgba(0,0,0,.50)
            )
            brightness(1.10)
            contrast(1.03);
    }

    .vl-collection-card:hover::after {
        width: calc(100% - 48px);

        box-shadow:
            0 0 12px #C8102E;
    }

    .vl-collection-card:hover
    .vl-collection-arrow {

        background: #C8102E;
        border-color: #C8102E;

        transform:
            translate(3px,-3px);

        box-shadow:
            0 0 18px rgba(200,16,46,.35);
    }

    .vl-collection-card:hover
    .vl-collection-number {
        color: rgba(255,255,255,.09);
    }

    .vl-collection-card:hover
    .vl-collection-footer {
        border-top-color:
            rgba(200,16,46,.5);
    }
}

.vl-collection-number,
.vl-collection-footer {
    transition:
        color .3s ease,
        border-color .3s ease;
}

/* =========================================
   06. IMPROVED RACING ENTRANCE
========================================= */

.vl-collection-card.vl-motion-ready.vl-entered
.vl-collection-drive {

    animation:
        vlCollectionRaceIn
        .85s
        cubic-bezier(.16,.8,.22,1)
        both;

    animation-delay:
        calc(var(--vl-index) * 80ms);
}

@keyframes vlCollectionRaceIn {

    0% {
        opacity: 0;

        transform:
            translateX(-135%)
            scale(.88);

        filter: blur(6px);
    }

    15% {
        opacity: 1;
    }

    65% {
        opacity: 1;

        transform:
            translateX(4%)
            scale(1.025);

        filter: blur(0);
    }

    85% {
        transform:
            translateX(-1%)
            scale(1);
    }

    100% {
        opacity: 1;

        transform:
            translateX(0)
            scale(1);

        filter: blur(0);
    }
}

/* =========================================
   07. PAUSE OFFSCREEN
========================================= */

.vl-collection-card.vl-paused
.vl-collection-vehicle,

.vl-collection-card.vl-paused
.vl-collection-light,

.vl-collection-card.vl-paused
.vl-collection-sweep::before,

.vl-collection-card.vl-paused
.vl-collection-visual::after {

    animation-play-state:
        paused !important;
}

/* =========================================
   08. MOBILE
========================================= */

@media (max-width: 760px) {

    .vl-collection .vl-collection-card {
        transform: none;
    }

    .vl-collection-card.vl-entered
    .vl-collection-vehicle {
        animation-duration: 5.5s;
    }

    .vl-collection-card.vl-entered
    .vl-collection-sweep::before {
        animation-duration: 10s;
    }
}

/* =========================================
   09. ACCESSIBILITY
========================================= */

@media (prefers-reduced-motion: reduce) {

    .vl-collection *,
    .vl-collection *::before,
    .vl-collection *::after {

        animation: none !important;
        transition: none !important;
    }

    .vl-collection .vl-collection-card,

    .vl-collection .vl-collection-drive,

    .vl-collection .vl-collection-vehicle {

        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .vl-collection-sweep {
        display: none;
    }
}

