/* ==========================================================
   CGiS MOBILE V12
   Definitive mobile layout override
   ========================================================== */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}


/* ==========================================================
   MOBILE <= 760px
   ========================================================== */

@media (max-width: 760px) {

    /* ------------------------------------------------------
       HEADER
    ------------------------------------------------------ */

    .header {
        width: 100%;
    }

    .nav {
        width: min(
            calc(100% - 28px),
            var(--container)
        );

        min-height: 76px !important;

        gap: 12px;
    }

    .brand-logo {
        height: 55px !important;
        width: auto;
    }

    .nav-actions {
        margin-left: auto;

        gap: 8px;
    }

    .language-switch {
        min-width: 67px;

        height: 36px;
    }

    .menu {
        width: 40px;
        height: 40px;

        display: grid !important;
        place-items: center;

        padding: 0;

        border-radius: 12px;
    }


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

    .v5-hero {
        width: 100%;

        min-height: 0 !important;

        padding: 0 !important;

        overflow: hidden;

        background:
            linear-gradient(
                180deg,
                #ffffff 0%,
                #fffafd 100%
            );
    }


    /*
     * Critical:
     * Forget every desktop grid/absolute positioning rule.
     */

    .v5-hero-inner {
        width: min(
            calc(100% - 28px),
            var(--container)
        );

        min-height: 0 !important;

        margin-inline: auto;

        display: flex !important;
        flex-direction: column !important;

        grid-template-columns: none !important;

        gap: 0 !important;

        position: relative;
    }


    /* ------------------------------------------------------
       TEXT FIRST
    ------------------------------------------------------ */

    .v5-hero-copy {
        order: 1 !important;

        width: 100% !important;

        position: relative !important;

        z-index: 5;

        padding:
            48px 0
            38px !important;

        margin: 0 !important;

        opacity: 1 !important;

        transform: none !important;
    }


    .v5-pill {
        max-width: 100%;

        padding:
            7px
            10px;

        white-space: normal;

        font-size: .54rem;

        line-height: 1.35;

        letter-spacing: .075em;
    }


    .v5-hero-title {
        width: 100% !important;
        max-width: 100% !important;

        margin:
            22px 0
            20px !important;

        font-size:
            clamp(
                2.55rem,
                11vw,
                3.45rem
            ) !important;

        line-height: .95 !important;

        letter-spacing:
            -.057em !important;
    }


    .v5-hero-title > span,
    .v5-hero-title > strong {
        display: block;
    }


    .v5-hero-title strong {
        margin-top: 5px;
    }


    .v5-hero-lead {
        width: 100%;
        max-width: 100% !important;

        margin: 0;

        font-size: .94rem;

        line-height: 1.68;
    }


    /* ------------------------------------------------------
       CTA
    ------------------------------------------------------ */

    .v5-hero-actions {
        width: 100%;

        margin-top: 28px !important;

        display: flex;
        flex-direction: column;

        gap: 10px;
    }


    .v5-primary-action {
        width: 100%;

        min-height: 54px;

        justify-content: space-between;
    }


    .v5-play-link {
        width: 100%;

        min-height: 52px;

        justify-content: center;
    }


    /* ------------------------------------------------------
       REAL METRICS
    ------------------------------------------------------ */

    .v5-hero-metrics {
        width: 100% !important;
        max-width: 100% !important;

        margin-top: 30px !important;

        display: grid !important;

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

        gap: 9px !important;
    }


    .v5-hero-metrics article {
        width: 100%;

        min-width: 0;
        min-height: 92px;

        padding:
            13px
            11px;

        gap: 9px;

        border-radius: 15px;
    }


    .v5-metric-icon {
        width: 34px;
        height: 34px;

        flex:
            0 0 34px;

        font-size: .56rem;
    }


    .v5-hero-metrics strong {
        font-size: .94rem;

        white-space: nowrap;
    }


    .v5-hero-metrics small {
        font-size: .59rem;

        line-height: 1.25;
    }


    /* ======================================================
       PHOTO SECOND
       This is the essential correction
    ====================================================== */

    .v5-hero-photo {
        order: 2 !important;

        position: relative !important;

        inset: auto !important;

        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;

        z-index: 2 !important;

        width: 100vw !important;

        height: auto !important;

        min-height: 0 !important;

        margin:
            10px
            calc(
                50% - 50vw
            )
            0 !important;

        padding: 0 !important;

        overflow: hidden;

        border-radius: 0 !important;

        transform: none !important;
    }


    .v5-hero-photo::before,
    .v5-hero-photo::after {
        display: none !important;

        content: none !important;
    }


    .v5-hero-photo img {
        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        max-height: none !important;

        display: block;

        position: static !important;

        object-fit: cover !important;

        object-position:
            center 30% !important;

        transform: none !important;

        filter: none;
    }


    /*
     * Desktop decorative layer must never take space.
     */

    .v5-hero-visual-space {
        order: 3 !important;

        display: none !important;

        width: 0 !important;
        height: 0 !important;

        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    .v5-hero-overlay {
        display: none !important;
    }


    .v5-hero-grid-overlay {
        z-index: 0;

        opacity: .08;

        pointer-events: none;

        mask-image:
            linear-gradient(
                to bottom,
                #000 0%,
                #000 38%,
                transparent 65%
            );
    }


    /* ======================================================
       TRUST STRIP
    ====================================================== */

    .v5-trust-strip {
        padding:
            25px 0
            22px;
    }


    .v5-trust-inner {
        display: flex;

        flex-direction: column;

        align-items: stretch;

        gap: 18px;
    }


    .v5-trust-inner > strong {
        white-space: normal;

        font-size: .75rem;

        line-height: 1.45;
    }


    .v5-trust-items {
        width: 100%;

        display: grid;

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

        border:
            1px solid
            var(--v5-border) !important;

        border-radius: 15px;

        overflow: hidden;
    }


    .v5-trust-items span {
        min-height: 58px;

        padding:
            10px
            8px;

        border: 0;

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

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

        text-align: center;

        font-size: .68rem;

        line-height: 1.3;
    }


    .v5-trust-items span:nth-child(2n) {
        border-right: 0;
    }


    /*
     * Fifth item — Diaspora — centered full width
     */

    .v5-trust-items span:last-child {
        grid-column:
            1 / -1;

        border-right: 0;

        border-bottom: 0;
    }


    /* ======================================================
       GLOBAL MOBILE SECTION SPACING
    ====================================================== */

    .section {
        padding-top:
            82px !important;

        padding-bottom:
            82px !important;
    }


    /* ======================================================
       MISSION
    ====================================================== */

    .v5-mission-layout {
        display: flex !important;

        flex-direction: column;

        gap: 34px !important;
    }


    .v5-mission-main {
        width: 100%;
    }


    .v5-mission-main h2 {
        max-width: 100%;

        font-size:
            clamp(
                2.45rem,
                11vw,
                3.55rem
            ) !important;
    }


    .v5-mission-mini-grid {
        grid-template-columns:
            1fr !important;
    }


    /* ======================================================
       MISS CAMEROUN
    ====================================================== */

    .v5-miss-card {
        width: 100% !important;

        display: flex !important;

        flex-direction: column !important;

        grid-template-columns:
            none !important;

        overflow: hidden !important;
    }


    .v5-miss-photo {
        width: 100% !important;

        min-height: 0 !important;

        position: relative !important;
    }


    .v5-miss-photo img {
        width: 100% !important;

        height: auto !important;

        min-height: 0 !important;

        display: block;

        object-fit: contain !important;

        object-position:
            center !important;

        transform: none !important;
    }


    .v5-miss-copy {
        width: 100% !important;
    }


    /* ======================================================
       PROGRAMS
    ====================================================== */

    .v5-program-heading {
        grid-template-columns:
            1fr !important;

        gap: 16px !important;
    }


    .v5-program-heading h2 {
        font-size:
            clamp(
                2.4rem,
                11vw,
                3.5rem
            ) !important;
    }


    .v5-program-grid {
        grid-template-columns:
            1fr !important;
    }


    /* ======================================================
       ACTIVITIES
    ====================================================== */

    .v10-activities-heading {
        grid-template-columns:
            1fr !important;
    }


    .v10-hackathon-feature {
        grid-template-columns:
            1fr !important;
    }


    .v10-hackathon-media {
        min-height: 0 !important;

        aspect-ratio:
            4 / 3;
    }


    .v10-hackathon-media img {
        object-position:
            center !important;
    }


    /* ======================================================
       PREVENT DESKTOP TILT ON TOUCH
    ====================================================== */

    .cgis-interactive-card,
    .v5-program-card,
    .mission-visual-card {
        transform:
            none !important;
    }

}


/* ==========================================================
   SMALL MOBILE <= 430px
   ========================================================== */

@media (max-width: 430px) {

    .v5-hero-copy {
        padding-top:
            42px !important;
    }


    .v5-hero-title {
        font-size:
            clamp(
                2.4rem,
                11.2vw,
                2.95rem
            ) !important;
    }


    .v5-hero-lead {
        font-size: .9rem;
    }


    .v5-hero-metrics article {
        min-height: 86px;

        padding: 11px 9px;
    }


    .v5-hero-metrics strong {
        font-size: .87rem;
    }


    .v5-hero-metrics small {
        font-size: .55rem;
    }


    .v5-hero-photo {
        margin-top:
            5px !important;
    }

}