/* =====================================================================
   MOBILE SPACING: tightens every section on phones (≤767px).
   Loaded last on index.html, projects.html and project.html.
   ===================================================================== */
@media(max-width:767px){

    /* ---------- global rhythm ---------- */
    html body #about,html body #skills,html body #experience,html body #portfolio,
    html body #services,html body section#letter,html body #contact{
        padding:44px 0
    }
    section .mb-5{
        margin-bottom:22px !important
    }
    section .mt-5{
        margin-top:24px !important
    }
    .row.g-5{
        --bs-gutter-y:24px
    }
    .row.g-4{
        --bs-gutter-x:14px;
        --bs-gutter-y:14px
    }
    .stitle,.stitles{
        margin-bottom:10px
    }
    .stag{
        margin-bottom:10px
    }
    .sdesc{
        font-size:.9rem;
        line-height:1.7
    }
    .bgn{
        font-size:6.5rem
    }

    /* ---------- hero ---------- */
    #hero{
        height:auto;
        min-height:0;
        padding:100px 0 44px
    }
    #hero .scrl{
        display:none
    }
    .avail{
        margin-bottom:16px;
        font-size:.66rem;
        padding:5px 12px
    }
    .hrole{
        margin-bottom:14px
    }
    .hdesc{
        font-size:.9rem;
        line-height:1.75;
        margin-bottom:22px
    }
    .hbtns{
        margin-bottom:22px;
        gap:10px
    }
    .hbtns .btd,.hbtns .bto{
        padding:12px 20px;
        flex:1 1 auto
    }

    /* ---------- about ---------- */
    .abimg{
        height:auto;
        width:100%;
    }
    .abbadge{
        padding:14px 18px;
        bottom:-10px
    }
    .abcnt{
        margin-top:8px
    }
    .abbio{
        font-size:.92rem;
        line-height:1.75;
        margin-bottom:14px
    }
    .abdets{
        gap:10px 16px;
        margin-bottom:18px
    }
    .abstats{
        flex-wrap:nowrap;
        gap:0;
        padding:14px 0;
        margin-bottom:20px
    }
    .ast{
        flex:1 1 0;
        padding:0 6px
    }

    /* ---------- skills: 2 compact cards per row ---------- */
    #skills .row>[class*=col-]{
        flex:0 0 50%;
        max-width:50%
    }
    #skills .svcard{
        padding:16px 14px
    }
    #skills .svico{
        width:38px;
        height:38px;
        font-size:1rem;
        margin-bottom:10px
    }
    #skills .svnm{
        font-size:.95rem;
        line-height:1.2;
        margin:0;
        position:relative;
        z-index:1
    }
    #skills .svbgn{
        font-size:3rem;
        bottom:-8px
    }

    /* ---------- services ---------- */
    #services .svcard{
        padding:20px 18px
    }
    #services .svico{
        width:40px;
        height:40px;
        font-size:1rem;
        margin-bottom:12px
    }
    #services .svnm{
        font-size:1.05rem;
        margin-bottom:6px
    }
    #services .svbgn{
        font-size:3.4rem;
        bottom:-10px
    }

    /* ---------- experience ---------- */
    .exlbl{
        margin-bottom:14px
    }
    .tlit{
        padding:0 0 24px 28px
    }
    .educard{
        padding:16px 18px;
        margin-bottom:10px
    }

    /* ---------- portfolio (home) ---------- */
    #portfolio .pffilter{
        margin-bottom:4px
    }
    .pfall{
        margin-top:26px
    }

    /* ---------- contact ---------- */
    .ctemail{
        font-size:1.2rem;
        margin-bottom:12px;
        word-break:break-all
    }
    .ctrow{
        padding:10px 0
    }
    #contact .mt-4{
        margin-top:16px !important
    }

    /* ---------- footer ---------- */
    #footer{
        padding:34px 0 20px
    }
    .fttop{
        gap:14px;
        padding-bottom:20px;
        margin-bottom:16px
    }
    .ftnav{
        gap:8px 16px
    }

    /* ---------- projects listing ---------- */
    .phero{
        padding:100px 0 24px
    }
    .crumbs{
        margin-bottom:14px
    }
    .phttl{
        margin-bottom:12px
    }
    .phsub{
        font-size:.92rem;
        line-height:1.7
    }
    .pstats{
        margin-top:18px;
        gap:22px
    }
    .pstat b{
        font-size:1.9rem
    }
    #plist{
        padding:6px 0 50px
    }
    #plist .pffilter{
        margin-bottom:22px
    }
    .pcatsec{
        margin-top:34px
    }
    .pcathead{
        margin-bottom:14px;
        padding-bottom:10px;
        flex-wrap:wrap;
        gap:4px 10px
    }
    .pcathead h2{
        font-size:1.45rem
    }
    .pcathead span{
        white-space:nowrap
    }

    /* ---------- project detail ---------- */
    .pdinfo{
        padding:0 0 6px
    }
    .pdcover{
        margin-bottom:20px !important
    }
    .pdcover img{
        max-height:420px
    }
    .pdlead{
        font-size:1rem;
        line-height:1.75;
        margin-bottom:14px
    }
    .pdtext p{
        font-size:.9rem;
        line-height:1.75;
        margin-bottom:12px
    }
    .pdside{
        padding:18px 18px;
        margin-top:0
    }
    .pdrow{
        padding:10px 0
    }
    .pdgal{
        padding:30px 0 44px
    }
    .pdsec{
        margin-top:30px
    }
    .pdsechead{
        margin-bottom:12px;
        gap:10px
    }
    /* gallery: 2 per row on phones */
    .masonry{
        grid-template-columns:1fr 1fr;
        gap:10px
    }
    .gimg{
        height:170px;
        padding:8px
    }
    .masonry.one .gimg{
        height:auto
    }
    .masonry.one .gimg img{
        max-height:400px
    }
    .gitem figcaption{
        padding:7px 9px;
        font-size:.7rem;
        line-height:1.35
    }
    .pdnav{
        padding:34px 0
    }
    .pdnavgrid{
        gap:12px
    }
    .pdnavlink{
        padding:12px;
        gap:12px
    }
    .pdnavlink b{
        font-size:1rem
    }
}

/* very small phones */
@media(max-width:360px){
    .masonry{
        grid-template-columns:1fr
    }
    .gimg{
        height:220px
    }
}
