/* =========================================================
   MATH RESOURCES HUB
   Raul The Tutor
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root
{
    --mr-navy: #0f172a;
    --mr-slate: #475569;
    --mr-muted: #64748b;

    --mr-border: #d7e2ec;

    --mr-white: #ffffff;
    --mr-surface: #f8fafc;

    --mr-teal: #0f766e;
    --mr-teal-bright: #159e9c;
    --mr-teal-soft: #ecfdf5;

    --mr-blue-soft: #eff6ff;
    --mr-blue: #2563eb;

    --mr-shadow:
        0 18px 45px rgba(15, 23, 42, 0.08);

    --mr-shadow-hover:
        0 22px 55px rgba(15, 23, 42, 0.13);

    --mr-shadow-small:
        0 10px 30px rgba(15, 23, 42, 0.06);
}


/* =========================================================
   BASE / ANCHOR OFFSET
   ========================================================= */

#interactive-tools,
#resource-library
{
    scroll-margin-top: 5rem;
}

.math-resource-types,
.math-tools-section,
.math-subject-section,
.math-library-section,
.math-reference-section
{
    font-family:
        Inter,
        Arial,
        sans-serif;

    color: var(--mr-slate);
}


/* =========================================================
   EYEBROW
   ========================================================= */

.math-resources-eyebrow
{
    margin:
        0
        0
        0.5rem;

    color: var(--mr-teal);

    font-size: 0.76rem;
    font-weight: 800;

    letter-spacing: 0.1em;

    line-height: 1.3;

    text-transform: uppercase;
}

header .math-resources-eyebrow
{
    color: rgba(255, 255, 255, 0.86);
}


/* =========================================================
   SHARED SECTION HEADING
   ========================================================= */

.math-resource-section-heading
{
    max-width: 52rem;

    margin-bottom:
        clamp(
            2rem,
            5vw,
            3rem
        );
}

.math-resource-section-heading h2
{
    margin-bottom: 0.85rem;

    color: var(--mr-navy);

    font-size:
        clamp(
            1.95rem,
            4vw,
            2.65rem
        );

    font-weight: 800;

    letter-spacing: -0.03em;

    line-height: 1.15;
}

.math-resource-section-heading p:not(.math-resources-eyebrow)
{
    margin-bottom: 0;

    color: var(--mr-slate);

    font-size: 1.02rem;

    line-height: 1.75;
}


/* =========================================================
   RESOURCE TYPE SECTION
   ========================================================= */

.math-resource-types
{
    padding:
        clamp(
            4.5rem,
            8vw,
            6.5rem
        )
        0;

    background: var(--mr-white);
}

.math-resource-type-grid
{
    display: grid;

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

    gap: 1.15rem;
}

.math-resource-type-card
{
    display: flex;

    gap: 1rem;

    align-items: flex-start;

    min-width: 0;
    min-height: 100%;

    padding:
        clamp(
            1.35rem,
            3vw,
            1.65rem
        );

    color: inherit;

    text-decoration: none;

    background: var(--mr-white);

    border:
        1px solid
        var(--mr-border);

    border-radius: 1.15rem;

    box-shadow: var(--mr-shadow-small);

    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.math-resource-type-card:hover
{
    color: inherit;

    text-decoration: none;

    border-color:
        rgba(
            21,
            158,
            156,
            0.42
        );

    box-shadow: var(--mr-shadow-hover);

    transform: translateY(-3px);
}

.math-resource-type-featured
{
    background:
        linear-gradient(
            135deg,
            var(--mr-teal-soft),
            var(--mr-blue-soft)
        );

    border-color:
        rgba(
            21,
            158,
            156,
            0.28
        );
}

.math-resource-type-icon
{
    display: grid;

    flex:
        0
        0
        3.1rem;

    width: 3.1rem;
    height: 3.1rem;

    place-items: center;

    color: var(--mr-teal);

    font-size: 1.2rem;

    background: var(--mr-teal-soft);

    border-radius: 0.9rem;
}

.math-resource-type-featured .math-resource-type-icon
{
    background:
        rgba(
            255,
            255,
            255,
            0.82
        );
}

.math-resource-type-label
{
    display: inline-block;

    margin-bottom: 0.35rem;

    color: var(--mr-teal);

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}

.math-resource-type-card h3
{
    margin:
        0
        0
        0.55rem;

    color: var(--mr-navy);

    font-size: 1.15rem;
    font-weight: 800;

    letter-spacing: -0.02em;

    line-height: 1.3;
}

.math-resource-type-card p
{
    margin-bottom: 0.8rem;

    color: var(--mr-slate);

    font-size: 0.9rem;

    line-height: 1.65;
}

.math-resource-type-link
{
    display: inline-flex;

    gap: 0.45rem;

    align-items: center;

    color: var(--mr-teal);

    font-size: 0.84rem;
    font-weight: 800;
}


/* =========================================================
   FEATURED TOOLS SECTION
   ========================================================= */

.math-tools-section
{
    padding:
        clamp(
            4.5rem,
            8vw,
            6.5rem
        )
        0;

    background: var(--mr-surface);
}

.math-tools-grid
{
    display: grid;

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

    gap: 1.15rem;

    margin-bottom: 1.4rem;
}

.math-tool-card
{
    display: flex;

    flex-direction: column;

    min-width: 0;
    min-height: 100%;

    padding:
        clamp(
            1.3rem,
            3vw,
            1.6rem
        );

    color: inherit;

    text-decoration: none;

    background: var(--mr-white);

    border:
        1px solid
        var(--mr-border);

    border-radius: 1.15rem;

    box-shadow: var(--mr-shadow-small);

    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.math-tool-card:hover
{
    color: inherit;

    text-decoration: none;

    border-color:
        rgba(
            21,
            158,
            156,
            0.42
        );

    box-shadow: var(--mr-shadow-hover);

    transform: translateY(-3px);
}

.math-tool-top
{
    display: flex;

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

    gap: 1rem;

    margin-bottom: 1rem;
}

.math-tool-badge
{
    display: inline-flex;

    align-items: center;

    padding:
        0.36rem
        0.62rem;

    color: var(--mr-teal);

    font-size: 0.7rem;
    font-weight: 800;

    letter-spacing: 0.06em;

    text-transform: uppercase;

    background: var(--mr-teal-soft);

    border:
        1px solid
        rgba(
            21,
            158,
            156,
            0.2
        );

    border-radius: 999px;
}

.math-tool-icon
{
    display: grid;

    flex:
        0
        0
        2.8rem;

    width: 2.8rem;
    height: 2.8rem;

    place-items: center;

    color: var(--mr-teal);

    background: var(--mr-teal-soft);

    border-radius: 0.85rem;
}

.math-tool-card h3
{
    margin:
        0
        0
        0.55rem;

    color: var(--mr-navy);

    font-size: 1.2rem;
    font-weight: 800;

    letter-spacing: -0.02em;
}

.math-tool-card p
{
    margin-bottom: 1rem;

    color: var(--mr-slate);

    font-size: 0.9rem;

    line-height: 1.68;
}

.math-tool-link
{
    display: inline-flex;

    gap: 0.45rem;

    align-items: center;

    margin-top: auto;

    color: var(--mr-teal);

    font-size: 0.84rem;
    font-weight: 800;
}


/* =========================================================
   TOOLS NOTE
   ========================================================= */

.math-tools-note
{
    display: flex;

    gap: 1rem;

    align-items: flex-start;

    padding:
        1.15rem
        1.25rem;

    background:
        linear-gradient(
            135deg,
            var(--mr-teal-soft),
            var(--mr-blue-soft)
        );

    border:
        1px solid
        rgba(
            21,
            158,
            156,
            0.2
        );

    border-radius: 1rem;
}

.math-tools-note-icon
{
    display: grid;

    flex:
        0
        0
        2.55rem;

    width: 2.55rem;
    height: 2.55rem;

    place-items: center;

    color: var(--mr-teal);

    background:
        rgba(
            255,
            255,
            255,
            0.82
        );

    border-radius: 0.75rem;
}

.math-tools-note strong
{
    display: block;

    margin-bottom: 0.25rem;

    color: var(--mr-navy);

    font-size: 0.92rem;
}

.math-tools-note p
{
    margin: 0;

    color: var(--mr-slate);

    font-size: 0.86rem;

    line-height: 1.6;
}

.math-inline-tool-tag
{
    display: inline-block;

    padding:
        0.18rem
        0.45rem;

    color: var(--mr-teal);

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.05em;

    text-transform: uppercase;

    background: var(--mr-white);

    border:
        1px solid
        rgba(
            21,
            158,
            156,
            0.22
        );

    border-radius: 999px;
}


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

.math-subject-section
{
    padding:
        clamp(
            4.5rem,
            8vw,
            6.5rem
        )
        0;

    background: var(--mr-white);
}

.math-subject-grid
{
    display: grid;

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

    gap: 1rem;
}

.math-subject-card
{
    display: flex;

    flex-direction: column;

    min-width: 0;
    min-height: 100%;

    padding: 1.3rem;

    color: inherit;

    text-decoration: none;

    background: var(--mr-white);

    border:
        1px solid
        var(--mr-border);

    border-radius: 1.1rem;

    box-shadow: var(--mr-shadow-small);

    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.math-subject-card:hover
{
    color: inherit;

    text-decoration: none;

    border-color:
        rgba(
            21,
            158,
            156,
            0.42
        );

    box-shadow: var(--mr-shadow-hover);

    transform: translateY(-3px);
}

.math-subject-number
{
    margin-bottom: 0.7rem;

    color: var(--mr-muted);

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.1em;
}

.math-subject-icon
{
    display: grid;

    width: 2.85rem;
    height: 2.85rem;

    margin-bottom: 0.9rem;

    place-items: center;

    color: var(--mr-teal);

    background: var(--mr-teal-soft);

    border-radius: 0.85rem;
}

.math-subject-card h3
{
    margin-bottom: 0.45rem;

    color: var(--mr-navy);

    font-size: 1.18rem;
    font-weight: 800;
}

.math-subject-card p
{
    margin-bottom: 0.9rem;

    color: var(--mr-slate);

    font-size: 0.88rem;

    line-height: 1.65;
}

.math-subject-tags
{
    display: flex;

    flex-wrap: wrap;

    gap: 0.4rem;

    margin-bottom: 1rem;
}

.math-subject-tags span
{
    padding:
        0.28rem
        0.55rem;

    color: var(--mr-teal);

    font-size: 0.68rem;
    font-weight: 800;

    background: var(--mr-teal-soft);

    border-radius: 999px;
}

.math-subject-link
{
    display: inline-flex;

    gap: 0.4rem;

    align-items: center;

    margin-top: auto;

    color: var(--mr-teal);

    font-size: 0.82rem;
    font-weight: 800;
}


/* =========================================================
   FULL LIBRARY SECTION
   ========================================================= */

.math-library-section
{
    padding:
        clamp(
            4.5rem,
            8vw,
            6.5rem
        )
        0;

    background: var(--mr-surface);
}

.math-library-subject
{
    padding-top:
        clamp(
            2.5rem,
            5vw,
            3.5rem
        );

    margin-top:
        clamp(
            2.5rem,
            5vw,
            3.5rem
        );

    border-top:
        1px solid
        var(--mr-border);
}

.math-library-subject:first-of-type
{
    padding-top: 0;

    margin-top: 0;

    border-top: 0;
}

.math-library-subject-header
{
    display: flex;

    gap: 1rem;

    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 1.35rem;
}

.math-library-subject-header h3
{
    margin: 0;

    color: var(--mr-navy);

    font-size:
        clamp(
            1.5rem,
            3vw,
            1.95rem
        );

    font-weight: 800;

    letter-spacing: -0.025em;
}

.math-library-hub-link
{
    display: inline-flex;

    gap: 0.4rem;

    align-items: center;

    color: var(--mr-teal);

    font-size: 0.83rem;
    font-weight: 800;

    text-decoration: none;
}

.math-library-hub-link:hover
{
    color: var(--mr-teal);

    text-decoration: underline;
}


/* =========================================================
   LIBRARY GRID / CARDS
   ========================================================= */

.math-library-grid
{
    display: grid;

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

    gap: 1rem;
}

.math-library-card
{
    display: flex;

    flex-direction: column;

    min-width: 0;
    min-height: 100%;

    padding: 1.2rem;

    background: var(--mr-white);

    border:
        1px solid
        var(--mr-border);

    border-radius: 1rem;

    box-shadow: var(--mr-shadow-small);

    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.math-library-card:hover
{
    border-color:
        rgba(
            21,
            158,
            156,
            0.36
        );

    box-shadow: var(--mr-shadow);

    transform: translateY(-2px);
}

.math-library-card-top
{
    display: flex;

    gap: 0.6rem;

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

    min-height: 1.8rem;

    margin-bottom: 0.7rem;
}

.math-library-category
{
    color: var(--mr-muted);

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.07em;

    text-transform: uppercase;
}

.math-library-tool-badge
{
    display: inline-flex;

    align-items: center;

    padding:
        0.25rem
        0.5rem;

    color: var(--mr-teal);

    font-size: 0.64rem;
    font-weight: 800;

    letter-spacing: 0.05em;

    text-transform: uppercase;

    background: var(--mr-teal-soft);

    border:
        1px solid
        rgba(
            21,
            158,
            156,
            0.2
        );

    border-radius: 999px;
}

.math-library-card h4
{
    margin:
        0
        0
        0.5rem;

    color: var(--mr-navy);

    font-size: 1.05rem;
    font-weight: 800;

    letter-spacing: -0.015em;

    line-height: 1.35;
}

.math-library-card > p
{
    margin-bottom: 1rem;

    color: var(--mr-slate);

    font-size: 0.86rem;

    line-height: 1.65;
}


/* =========================================================
   LIBRARY ACTION BUTTONS
   ========================================================= */

.math-library-actions
{
    display: flex;

    flex-wrap: wrap;

    gap: 0.6rem;

    margin-top: auto;
}

.math-library-btn
{
    display: inline-flex;

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

    min-width: 6.3rem;

    padding:
        0.68rem
        1rem;

    color: var(--mr-navy);

    font-size: 0.82rem;
    font-weight: 800;

    line-height: 1;

    text-decoration: none;

    background: var(--mr-white);

    border:
        1px solid
        var(--mr-border);

    border-radius: 0.62rem;

    transition:
        color 180ms ease,
        background 180ms ease,
        border-color 180ms ease,
        transform 180ms ease;
}

.math-library-btn:hover
{
    color: var(--mr-teal);

    text-decoration: none;

    border-color: var(--mr-teal);

    transform: translateY(-1px);
}

.math-library-btn-primary
{
    color: var(--mr-white);

    background: var(--mr-teal-bright);

    border-color: var(--mr-teal-bright);
}

.math-library-btn-primary:hover
{
    color: var(--mr-white);

    background: var(--mr-teal);

    border-color: var(--mr-teal);
}

.math-library-btn:focus
{
    outline: none;

    box-shadow:
        0 0 0 3px
        rgba(
            21,
            158,
            156,
            0.18
        );
}


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

.math-reference-section
{
    padding:
        clamp(
            4.5rem,
            8vw,
            6.5rem
        )
        0;

    background: var(--mr-white);
}

.math-reference-grid
{
    display: grid;

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

    gap: 1rem;
}

.math-reference-card
{
    display: flex;

    gap: 1rem;

    align-items: flex-start;

    min-width: 0;

    padding: 1.35rem;

    color: inherit;

    text-decoration: none;

    background:
        linear-gradient(
            135deg,
            var(--mr-teal-soft),
            var(--mr-blue-soft)
        );

    border:
        1px solid
        rgba(
            21,
            158,
            156,
            0.22
        );

    border-radius: 1rem;

    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.math-reference-card:hover
{
    color: inherit;

    text-decoration: none;

    border-color:
        rgba(
            21,
            158,
            156,
            0.45
        );

    box-shadow: var(--mr-shadow);

    transform: translateY(-2px);
}

.math-reference-icon
{
    display: grid;

    flex:
        0
        0
        2.9rem;

    width: 2.9rem;
    height: 2.9rem;

    place-items: center;

    color: var(--mr-teal);

    background:
        rgba(
            255,
            255,
            255,
            0.84
        );

    border-radius: 0.85rem;
}

.math-reference-label
{
    display: inline-block;

    margin-bottom: 0.25rem;

    color: var(--mr-teal);

    font-size: 0.68rem;
    font-weight: 800;

    letter-spacing: 0.06em;

    text-transform: uppercase;
}

.math-reference-card h3
{
    margin-bottom: 0.4rem;

    color: var(--mr-navy);

    font-size: 1.05rem;
    font-weight: 800;
}

.math-reference-card p
{
    margin: 0;

    color: var(--mr-slate);

    font-size: 0.86rem;

    line-height: 1.6;
}


/* =========================================================
   LARGE TABLET
   ========================================================= */

@media (max-width: 1199.98px)
{
    .math-resource-type-grid,
    .math-tools-grid
    {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .math-subject-grid
    {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .math-library-grid
    {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 991.98px)
{
    .math-resource-type-grid,
    .math-tools-grid
    {
        grid-template-columns: 1fr;
    }

    .math-library-subject-header
    {
        align-items: flex-start;

        flex-direction: column;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767.98px)
{
    .math-resource-types,
    .math-tools-section,
    .math-subject-section,
    .math-library-section,
    .math-reference-section
    {
        padding:
            4rem
            0;
    }

    .math-subject-grid,
    .math-library-grid,
    .math-reference-grid
    {
        grid-template-columns: 1fr;
    }

    .math-resource-type-card
    {
        padding: 1.1rem;
    }

    .math-tool-card,
    .math-subject-card,
    .math-library-card,
    .math-reference-card
    {
        padding: 1.05rem;
    }

    .math-library-actions
    {
        flex-direction: column;
    }

    .math-library-btn
    {
        width: 100%;
    }

    .math-tools-note
    {
        padding: 1rem;
    }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 479.98px)
{
    .math-resource-type-card
    {
        flex-direction: column;
    }

    .math-resource-type-icon,
    .math-reference-icon
    {
        flex-basis: auto;
    }

    .math-tool-top
    {
        align-items: flex-start;
    }

    .math-tools-note
    {
        flex-direction: column;
    }
}


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

@media (prefers-reduced-motion: reduce)
{
    .math-resource-type-card,
    .math-tool-card,
    .math-subject-card,
    .math-library-card,
    .math-library-btn,
    .math-reference-card
    {
        transition: none;
    }

    .math-resource-type-card:hover,
    .math-tool-card:hover,
    .math-subject-card:hover,
    .math-library-card:hover,
    .math-library-btn:hover,
    .math-reference-card:hover
    {
        transform: none;
    }
}


/* =========================================================
   PRINT
   ========================================================= */

@media print
{
    .math-resource-type-card,
    .math-tool-card,
    .math-subject-card,
    .math-library-card,
    .math-reference-card,
    .math-tools-note
    {
        break-inside: avoid;

        box-shadow: none;
    }
}