/* =========================================================
   JAMAICA ELECTORAL ANALYTICS
   REFERENCE PAGES

   Methodology · Glossary · About

   Visual language:
   - same surface / border system as dashboard
   - restrained brand green
   - compact analytical typography
   - no oversized documentation styling
   ========================================================= */


/* =========================================================
   PAGE
   ========================================================= */

.reference-page {
    width: 100%;

    max-width: 1240px;

    margin:
        0 auto;

    padding:
        24px
        28px
        40px;
}


/* =========================================================
   HERO
   ========================================================= */

.reference-hero {
    position: relative;

    overflow: hidden;

    display: flex;

    align-items:
        flex-end;

    justify-content:
        space-between;

    gap:
        32px;

    min-height:
        150px;

    margin-bottom:
        18px;

    padding:
        24px
        26px;

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

    border-radius:
        14px;

    background:
        linear-gradient(
            135deg,
            var(--surface)
            0%,
            var(--surface)
            68%,
            var(--brand-green-soft)
            100%
        );
}


/*
 * Very subtle visual anchor.
 * Keeps the hero connected to the dashboard accent colour
 * without becoming decorative.
 */

.reference-hero::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width:
        4px;

    height:
        100%;

    background:
        var(--brand-green);
}


.reference-hero__copy {
    position: relative;
    z-index: 1;

    max-width:
        760px;
}


.reference-hero__eyebrow {
    display:
        inline-flex;

    align-items:
        center;

    gap:
        6px;

    margin-bottom:
        7px;

    color:
        var(--brand-green);

    font-size:
        0.62rem;

    font-weight:
        800;

    line-height:
        1;

    letter-spacing:
        0.08em;

    text-transform:
        uppercase;
}


.reference-hero__eyebrow::before {
    content: "";

    width:
        6px;

    height:
        6px;

    border-radius:
        50%;

    background:
        var(--brand-green);
}


.reference-hero h1 {
    margin:
        0;

    color:
        var(--text-primary);

    font-size:
        clamp(
            1.65rem,
            3vw,
            2.3rem
        );

    font-weight:
        820;

    line-height:
        1.04;

    letter-spacing:
        -0.04em;
}


.reference-hero p {
    max-width:
        700px;

    margin:
        9px
        0
        0;

    color:
        var(--text-secondary);

    font-size:
        0.76rem;

    font-weight:
        450;

    line-height:
        1.55;
}


.reference-hero__badge {
    position: relative;
    z-index: 1;

    flex:
        0 0 auto;

    display:
        inline-flex;

    align-items:
        center;

    gap:
        6px;

    padding:
        7px
        10px;

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

    border-radius:
        999px;

    color:
        var(--text-secondary);

    background:
        var(--surface);

    box-shadow:
        0 1px 2px
        rgba(0, 0, 0, 0.03);

    font-size:
        0.58rem;

    font-weight:
        700;

    white-space:
        nowrap;
}


/* =========================================================
   QUICK NAVIGATION
   ========================================================= */

.reference-jump {
    display: flex;

    align-items:
        center;

    flex-wrap:
        wrap;

    gap:
        6px;

    margin-bottom:
        20px;

    padding:
        9px
        10px;

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

    border-radius:
        10px;

    background:
        var(--surface);
}


.reference-jump a {
    display:
        inline-flex;

    align-items:
        center;

    justify-content:
        center;

    min-height:
        27px;

    padding:
        0
        9px;

    border:
        1px solid
        transparent;

    border-radius:
        6px;

    color:
        var(--text-secondary);

    background:
        transparent;

    font-size:
        0.58rem;

    font-weight:
        700;

    text-decoration:
        none;

    transition:
        color
        var(--transition-fast),
        border-color
        var(--transition-fast),
        background-color
        var(--transition-fast);
}


.reference-jump a:hover {
    color:
        var(--brand-green);

    border-color:
        var(--border);

    background:
        var(--brand-green-soft);
}


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

.reference-section {
    scroll-margin-top:
        calc(
            var(--header-height) +
            16px
        );

    margin-top:
        20px;

    padding-top:
        20px;

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


.reference-section:first-of-type {
    margin-top:
        0;
}


.reference-section__head {
    display: grid;

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

    column-gap:
        10px;

    max-width:
        820px;

    margin-bottom:
        13px;
}


.reference-section__eyebrow {
    grid-row:
        1 / span 2;

    display:
        grid;

    place-items:
        center;

    align-self:
        start;

    min-width:
        28px;

    height:
        28px;

    border-radius:
        7px;

    color:
        var(--brand-green);

    background:
        var(--brand-green-soft);

    font-size:
        0.55rem;

    font-weight:
        800;

    letter-spacing:
        0.03em;
}


.reference-section h2 {
    margin:
        0;

    color:
        var(--text-primary);

    font-size:
        0.92rem;

    font-weight:
        800;

    line-height:
        1.2;

    letter-spacing:
        -0.015em;
}


.reference-section__head p {
    margin:
        4px
        0
        0;

    color:
        var(--text-secondary);

    font-size:
        0.66rem;

    line-height:
        1.5;
}


/* =========================================================
   CARD GRID
   ========================================================= */

.reference-grid {
    display: grid;

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

    gap:
        10px;
}


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


/* =========================================================
   CARD
   ========================================================= */

.reference-card {
    position: relative;

    overflow: hidden;

    min-width:
        0;

    padding:
        13px
        14px;

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

    border-radius:
        10px;

    background:
        var(--surface);

    transition:
        transform
        var(--transition-fast),
        border-color
        var(--transition-fast),
        box-shadow
        var(--transition-fast);
}


.reference-card:hover {
    transform:
        translateY(-1px);

    border-color:
        var(--border-strong);

    box-shadow:
        0
        5px
        16px
        rgba(0, 0, 0, 0.035);
}


.reference-card__icon {
    width:
        29px;

    height:
        29px;

    margin-bottom:
        8px;

    display:
        grid;

    place-items:
        center;

    border-radius:
        7px;

    color:
        var(--brand-green);

    background:
        var(--brand-green-soft);

    font-size:
        0.65rem;

    font-weight:
        800;

    line-height:
        1;
}


.reference-card h3 {
    margin:
        0;

    color:
        var(--text-primary);

    font-size:
        0.67rem;

    font-weight:
        800;

    line-height:
        1.25;
}


.reference-card p {
    margin:
        5px
        0
        0;

    color:
        var(--text-secondary);

    font-size:
        0.61rem;

    line-height:
        1.48;
}


.reference-card a {
    display:
        inline-flex;

    margin-top:
        7px;

    color:
        var(--brand-green);

    font-size:
        0.57rem;

    font-weight:
        700;

    text-decoration:
        none;
}


.reference-card a:hover {
    text-decoration:
        underline;
}


/* =========================================================
   STRUCTURED REFERENCE ROWS
   ========================================================= */

.reference-list {
    display: grid;

    gap:
        7px;
}


.reference-row {
    position: relative;

    display: grid;

    grid-template-columns:
        minmax(
            145px,
            0.27fr
        )
        minmax(
            0,
            1fr
        );

    gap:
        18px;

    align-items:
        start;

    padding:
        10px
        12px;

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

    border-radius:
        8px;

    background:
        var(--surface);

    transition:
        border-color
        var(--transition-fast),
        background-color
        var(--transition-fast);
}


.reference-row:hover {
    border-color:
        var(--border-strong);

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


.reference-row strong {
    color:
        var(--text-primary);

    font-size:
        0.63rem;

    font-weight:
        800;

    line-height:
        1.35;
}


.reference-row p {
    margin:
        0;

    color:
        var(--text-secondary);

    font-size:
        0.61rem;

    line-height:
        1.5;
}


/* =========================================================
   IMPORTANT NOTE
   ========================================================= */

.reference-note {
    position: relative;

    overflow: hidden;

    margin-top:
        12px;

    padding:
        11px
        13px
        11px
        15px;

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

    border-radius:
        9px;

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


.reference-note::before {
    content: "";

    position:
        absolute;

    top:
        0;

    bottom:
        0;

    left:
        0;

    width:
        3px;

    background:
        var(--brand-green);
}


.reference-note strong {
    display:
        block;

    margin-bottom:
        3px;

    color:
        var(--text-primary);

    font-size:
        0.63rem;

    font-weight:
        800;
}


.reference-note p {
    margin:
        0;

    color:
        var(--text-secondary);

    font-size:
        0.61rem;

    line-height:
        1.5;
}


/* =========================================================
   GLOSSARY
   ========================================================= */

.glossary-index {
    position:
        sticky;

    top:
        calc(
            var(--header-height) +
            8px
        );

    z-index:
        5;

    display:
        flex;

    flex-wrap:
        wrap;

    gap:
        5px;

    margin-bottom:
        18px;

    padding:
        8px;

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

    border-radius:
        9px;

    background:
        color-mix(
            in srgb,
            var(--surface)
            94%,
            transparent
        );

    backdrop-filter:
        blur(8px);
}


.glossary-index a {
    width:
        27px;

    height:
        27px;

    display:
        grid;

    place-items:
        center;

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

    border-radius:
        6px;

    color:
        var(--text-secondary);

    background:
        var(--surface);

    font-size:
        0.56rem;

    font-weight:
        800;

    text-decoration:
        none;

    transition:
        color
        var(--transition-fast),
        border-color
        var(--transition-fast),
        background-color
        var(--transition-fast);
}


.glossary-index a:hover {
    color:
        var(--brand-green);

    border-color:
        var(--brand-green);

    background:
        var(--brand-green-soft);
}


.glossary-group {
    scroll-margin-top:
        calc(
            var(--header-height) +
            60px
        );

    margin-top:
        17px;
}


.glossary-group__letter {
    display:
        flex;

    align-items:
        center;

    gap:
        7px;

    margin-bottom:
        7px;

    color:
        var(--brand-green);

    font-size:
        0.7rem;

    font-weight:
        850;
}


.glossary-group__letter::after {
    content: "";

    flex:
        1;

    height:
        1px;

    background:
        var(--border);
}


/* =========================================================
   ABOUT — PRINCIPLES
   ========================================================= */

.about-principles {
    display: grid;

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

    gap:
        9px;
}


.about-principle {
    position:
        relative;

    overflow:
        hidden;

    padding:
        12px;

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

    border-radius:
        9px;

    background:
        var(--surface);
}


.about-principle::before {
    content: "";

    position:
        absolute;

    top:
        0;

    left:
        0;

    width:
        100%;

    height:
        2px;

    background:
        var(--brand-green);
}


.about-principle strong {
    display:
        block;

    margin-bottom:
        4px;

    color:
        var(--text-primary);

    font-size:
        0.64rem;

    font-weight:
        800;
}


.about-principle span {
    color:
        var(--text-secondary);

    font-size:
        0.59rem;

    line-height:
        1.45;
}


/* =========================================================
   OPTIONAL SMALL STATUS CHIP
   ========================================================= */

.reference-status {
    display:
        inline-flex;

    align-items:
        center;

    gap:
        5px;

    padding:
        4px
        7px;

    border-radius:
        999px;

    color:
        var(--brand-green);

    background:
        var(--brand-green-soft);

    font-size:
        0.54rem;

    font-weight:
        750;
}


.reference-status::before {
    content: "";

    width:
        5px;

    height:
        5px;

    border-radius:
        50%;

    background:
        currentColor;
}


/* =========================================================
   DARK MODE POLISH
   ========================================================= */

html[data-theme="dark"]
.reference-hero {
    background:
        linear-gradient(
            135deg,
            var(--surface)
            0%,
            var(--surface)
            72%,
            rgba(
                22,
                163,
                116,
                0.08
            )
            100%
        );
}


html[data-theme="dark"]
.reference-card:hover {
    box-shadow:
        0
        5px
        16px
        rgba(
            0,
            0,
            0,
            0.14
        );
}


html[data-theme="dark"]
.glossary-index {
    background:
        color-mix(
            in srgb,
            var(--surface)
            92%,
            transparent
        );
}


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

@media (max-width: 900px) {

    .reference-page {
        padding:
            22px
            20px
            34px;
    }


    .reference-grid,
    .about-principles {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );
    }


    .reference-hero {
        min-height:
            auto;

        padding:
            20px;
    }

}


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

@media (max-width: 680px) {

    .reference-page {
        padding:
            16px
            14px
            28px;
    }


    .reference-hero {
        align-items:
            flex-start;

        flex-direction:
            column;

        gap:
            12px;

        margin-bottom:
            14px;

        padding:
            18px
            17px;
    }


    .reference-hero h1 {
        font-size:
            1.55rem;
    }


    .reference-hero p {
        font-size:
            0.7rem;
    }


    .reference-jump {
        margin-bottom:
            16px;
    }


    .reference-grid,
    .reference-grid--2,
    .about-principles {
        grid-template-columns:
            1fr;
    }


    .reference-row {
        grid-template-columns:
            1fr;

        gap:
            4px;

        padding:
            10px;
    }


    .reference-section {
        margin-top:
            17px;

        padding-top:
            17px;
    }


    .reference-section__head {
        grid-template-columns:
            auto
            minmax(
                0,
                1fr
            );
    }


    .reference-hero__badge {
        align-self:
            flex-start;
    }


    .glossary-index {
        top:
            calc(
                var(--header-height) +
                4px
            );
    }

}


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

@media (max-width: 420px) {

    .reference-section__eyebrow {
        min-width:
            25px;

        height:
            25px;
    }


    .reference-card {
        padding:
            12px;
    }

}