/*
|--------------------------------------------------------------------------
| ToolVerse - Popular Tools
|--------------------------------------------------------------------------
|
| Scope:
| - ONLY .tv-popular-tools
| - No CSS leak into other sections/pages
| - Fully responsive
| - Lightweight hover effects only
| - No unnecessary animation
|
|--------------------------------------------------------------------------
*/


/* ==========================================================================
   SECTION
   ========================================================================== */

.tv-popular-tools {
    position: relative;
    width: 100%;
    overflow: hidden;

    padding:
        76px
        0
        82px;

    background:
        linear-gradient(
            180deg,
            #f8faff 0%,
            #ffffff 100%
        );
}


/* ==========================================================================
   SECTION HEADER
   ========================================================================== */

.tv-popular-tools__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 36px;

    margin-bottom: 34px;
}

.tv-popular-tools__heading-group {
    width: 100%;
    max-width: 670px;
}


/* ==========================================================================
   EYEBROW
   ========================================================================== */

.tv-popular-tools__eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 30px;

    padding:
        0
        11px;

    border:
        1px solid
        rgba(99, 91, 255, 0.13);

    border-radius: 999px;

    background:
        var(--tv-color-primary-soft);

    color:
        var(--tv-color-primary-dark);

    font-size: 10px;
    font-weight: 750;

    line-height: 1;

    letter-spacing: 0.2px;
}


/* ==========================================================================
   TITLE
   ========================================================================== */

.tv-popular-tools__title {
    max-width: 640px;

    margin:
        14px
        0
        0;

    color:
        var(--tv-color-heading);

    font-size:
        clamp(
            29px,
            3.2vw,
            42px
        );

    font-weight: 820;

    line-height: 1.12;

    letter-spacing: -1.45px;
}


/* ==========================================================================
   DESCRIPTION
   ========================================================================== */

.tv-popular-tools__description {
    max-width: 610px;

    margin:
        13px
        0
        0;

    color:
        var(--tv-color-muted);

    font-size: 14px;
    font-weight: 400;

    line-height: 1.7;
}


/* ==========================================================================
   VIEW / FIND ALL LINK
   ========================================================================== */

.tv-popular-tools__all-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex:
        0
        0
        auto;

    gap: 8px;

    min-height: 42px;

    padding:
        0
        15px;

    border:
        1px solid
        var(--tv-color-border);

    border-radius: 999px;

    background:
        #ffffff;

    color:
        var(--tv-color-heading);

    font-size: 11px;
    font-weight: 720;

    line-height: 1;

    box-shadow:
        0 3px 10px
        rgba(16, 24, 40, 0.035);

    transition:
        color 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.tv-popular-tools__all-link > span {
    display: inline-block;

    color:
        var(--tv-color-primary);

    font-size: 15px;

    line-height: 1;

    transition:
        transform 180ms ease;
}

.tv-popular-tools__all-link:hover {
    border-color:
        rgba(99, 91, 255, 0.18);

    background:
        var(--tv-color-primary-soft);

    color:
        var(--tv-color-primary-dark);

    transform:
        translateY(-1px);

    box-shadow:
        0 7px 16px
        rgba(16, 24, 40, 0.055);
}

.tv-popular-tools__all-link:hover > span {
    transform:
        translateX(3px);
}


/* ==========================================================================
   GRID
   ========================================================================== */

.tv-popular-tools__grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 16px;
}


/* ==========================================================================
   TOOL CARD
   ========================================================================== */

.tv-popular-tools__card {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 250px;

    padding: 21px;

    overflow: hidden;

    border:
        1px solid
        rgba(222, 227, 235, 0.96);

    border-radius: 20px;

    background:
        #ffffff;

    color:
        inherit;

    box-shadow:
        0 6px 20px
        rgba(16, 24, 40, 0.045);

    transition:
        transform 200ms ease,
        border-color 200ms ease,
        box-shadow 200ms ease;
}


/*
|--------------------------------------------------------------------------
| Subtle card glow
|--------------------------------------------------------------------------
*/

.tv-popular-tools__card::before {
    content: "";

    position: absolute;

    top: -90px;
    right: -90px;

    width: 190px;
    height: 190px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(99, 91, 255, 0.07),
            transparent 70%
        );

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 200ms ease;
}


/*
|--------------------------------------------------------------------------
| Top accent line
|--------------------------------------------------------------------------
*/

.tv-popular-tools__card::after {
    content: "";

    position: absolute;

    top: 0;
    left: 20px;
    right: 20px;

    height: 2px;

    border-radius:
        0
        0
        999px
        999px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(99, 91, 255, 0.62),
            transparent
        );

    opacity: 0;

    transform:
        scaleX(0.5);

    transition:
        opacity 200ms ease,
        transform 200ms ease;
}


.tv-popular-tools__card:hover {
    border-color:
        rgba(99, 91, 255, 0.20);

    transform:
        translateY(-4px);

    box-shadow:
        0 16px 34px
        rgba(16, 24, 40, 0.085);
}

.tv-popular-tools__card:hover::before {
    opacity: 1;
}

.tv-popular-tools__card:hover::after {
    opacity: 1;

    transform:
        scaleX(1);
}


/* ==========================================================================
   CARD TOP
   ========================================================================== */

.tv-popular-tools__card-top {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;
}


/* ==========================================================================
   ICON
   ========================================================================== */

.tv-popular-tools__icon {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    flex:
        0
        0
        46px;

    border-radius: 14px;
}

.tv-popular-tools__icon svg {
    display: block;

    width: 22px;
    height: 22px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.75;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Finance */

.tv-popular-tools__icon--finance {
    background:
        #efeeff;

    color:
        #5f56e8;
}


/* Investment */

.tv-popular-tools__icon--investment {
    background:
        #eaf9f4;

    color:
        #078467;
}


/* Tax */

.tv-popular-tools__icon--tax {
    background:
        #fff5e8;

    color:
        #b76a08;
}


/* Everyday */

.tv-popular-tools__icon--everyday {
    background:
        #edf6ff;

    color:
        #2876bd;
}


/* Math */

.tv-popular-tools__icon--math {
    background:
        #f6edff;

    color:
        #8148bd;
}


/* Shopping */

.tv-popular-tools__icon--shopping {
    background:
        #fff0f3;

    color:
        #bd5267;
}

/* ==========================================================================
   Health
   ========================================================================== */

.tv-popular-tools__icon--health {
    background:
        #edf9f2;

    color:
        #16805c;
}


/* ==========================================================================
   Currency
   ========================================================================== */

.tv-popular-tools__icon--currency {
    background:
        #eef4ff;

    color:
        #4169c1;
}


/* ==========================================================================
   CATEGORY BADGE
   ========================================================================== */

.tv-popular-tools__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 25px;

    padding:
        0
        9px;

    border:
        1px solid
        var(--tv-color-border);

    border-radius: 999px;

    background:
        #fafbfc;

    color:
        #778294;

    font-size: 8px;
    font-weight: 760;

    line-height: 1;

    letter-spacing: 0.35px;

    text-transform: uppercase;
}


/* ==========================================================================
   CARD BODY
   ========================================================================== */

.tv-popular-tools__card-body {
    position: relative;
    z-index: 2;

    margin-top: 21px;
}


/* ==========================================================================
   CARD TITLE
   ========================================================================== */

.tv-popular-tools__card-title {
    margin: 0;

    color:
        var(--tv-color-heading);

    font-size: 17px;
    font-weight: 780;

    line-height: 1.3;

    letter-spacing: -0.35px;

    transition:
        color 180ms ease;
}

.tv-popular-tools__card:hover
.tv-popular-tools__card-title {
    color:
        var(--tv-color-primary-dark);
}


/* ==========================================================================
   CARD DESCRIPTION
   ========================================================================== */

.tv-popular-tools__card-description {
    margin:
        8px
        0
        0;

    color:
        var(--tv-color-muted);

    font-size: 11px;
    font-weight: 400;

    line-height: 1.65;
}


/* ==========================================================================
   OPEN TOOL
   ========================================================================== */

.tv-popular-tools__open {
    position: relative;
    z-index: 2;

    display: inline-flex;
    align-items: center;

    width: fit-content;

    gap: 7px;

    margin-top: auto;

    padding-top: 22px;

    color:
        var(--tv-color-primary);

    font-size: 10px;
    font-weight: 750;

    line-height: 1;
}

.tv-popular-tools__open > span {
    display: inline-block;

    font-size: 14px;

    line-height: 1;

    transition:
        transform 180ms ease;
}

.tv-popular-tools__card:hover
.tv-popular-tools__open > span {
    transform:
        translateX(3px);
}


/* ==========================================================================
   KEYBOARD FOCUS
   ========================================================================== */

.tv-popular-tools__card:focus-visible,
.tv-popular-tools__all-link:focus-visible {
    outline:
        3px solid
        rgba(99, 91, 255, 0.20);

    outline-offset: 3px;
}


/* ==========================================================================
   LARGE TABLET
   ========================================================================== */

@media (max-width: 1024px) {

    .tv-popular-tools {
        padding:
            68px
            0
            74px;
    }

    .tv-popular-tools__grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 15px;
    }

    .tv-popular-tools__card {
        min-height: 235px;
    }
}


/* ==========================================================================
   TABLET
   ========================================================================== */

@media (max-width: 768px) {

    .tv-popular-tools {
        padding:
            58px
            0
            64px;
    }

    .tv-popular-tools__head {
        align-items: flex-start;

        gap: 24px;

        margin-bottom: 28px;
    }

    .tv-popular-tools__title {
        font-size:
            clamp(
                27px,
                5.4vw,
                36px
            );
    }

    .tv-popular-tools__description {
        font-size: 13px;
    }
}


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 640px) {

    .tv-popular-tools {
        padding:
            50px
            0
            56px;
    }

    .tv-popular-tools__head {
        flex-direction: column;

        align-items: stretch;

        gap: 19px;

        margin-bottom: 24px;
    }

    .tv-popular-tools__heading-group {
        max-width: 100%;
    }

    .tv-popular-tools__eyebrow {
        min-height: 28px;

        font-size: 9px;
    }

    .tv-popular-tools__title {
        margin-top: 12px;

        font-size:
            clamp(
                25px,
                7.5vw,
                32px
            );

        letter-spacing: -1px;
    }

    .tv-popular-tools__description {
        margin-top: 10px;

        font-size: 12px;

        line-height: 1.65;
    }

    .tv-popular-tools__all-link {
        width: fit-content;

        min-height: 39px;

        padding:
            0
            13px;
    }

    .tv-popular-tools__grid {
        grid-template-columns: 1fr;

        gap: 12px;
    }

    .tv-popular-tools__card {
        min-height: 215px;

        padding: 18px;

        border-radius: 17px;
    }

    .tv-popular-tools__icon {
        width: 43px;
        height: 43px;

        flex-basis: 43px;

        border-radius: 13px;
    }

    .tv-popular-tools__icon svg {
        width: 21px;
        height: 21px;
    }

    .tv-popular-tools__card-body {
        margin-top: 18px;
    }

    .tv-popular-tools__card-title {
        font-size: 16px;
    }

    .tv-popular-tools__open {
        padding-top: 18px;
    }
}


/* ==========================================================================
   SMALL MOBILE
   ========================================================================== */

@media (max-width: 400px) {

    .tv-popular-tools {
        padding:
            45px
            0
            50px;
    }

    .tv-popular-tools__title {
        font-size: 25px;
    }

    .tv-popular-tools__card {
        min-height: 205px;

        padding: 16px;
    }

    .tv-popular-tools__badge {
        min-height: 23px;

        padding:
            0
            8px;

        font-size: 7px;
    }

    .tv-popular-tools__card-description {
        font-size: 10px;
    }
}


/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .tv-popular-tools__all-link,
    .tv-popular-tools__all-link > span,
    .tv-popular-tools__card,
    .tv-popular-tools__card::before,
    .tv-popular-tools__card::after,
    .tv-popular-tools__card-title,
    .tv-popular-tools__open > span {
        transition: none;
    }

    .tv-popular-tools__all-link:hover,
    .tv-popular-tools__card:hover {
        transform: none;
    }
}