/* =================================================================
   GLOBAL RESPONSIVE FIX
   Loaded last so it overrides earlier stylesheets.
   Goal: make every page usable on tablet & mobile without breaking
   desktop. Touches navbar, footer, common grid/flex layouts,
   typography, images, iframes, forms.
   ================================================================= */

/* ---- 0. Universal safe-guards ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

img, video, iframe, svg, canvas, embed, object {
    max-width: 100%;
    height: auto;
}

iframe[src*="google.com/maps"],
.ct-map-wrap iframe {
    max-width: 100%;
}

/* Hero video keeps cover behaviour */
.hero-video, video.hero-video { height: 100%; }

/* ---- 1. Mobile hamburger button (hidden by default) ------------ */
.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    cursor: pointer;
    position: relative;
    z-index: 1100;
    margin-left: auto;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    margin: 5px auto;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu backdrop */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1040;
}
.nav-backdrop.is-open { display: block; }

/* ---- 2. Tablet & below: navbar becomes off-canvas drawer ------- */
@media (max-width: 1024px) {

    .navbar {
        padding: 0 18px !important;
        flex-wrap: wrap;
        height: auto !important;
        min-height: 64px;
    }

    a.nav-logo,
    .nav-logo {
        margin-right: 0 !important;
    }
    a.nav-logo img,
    .nav-logo img {
        width: auto !important;
        max-height: 38px;
    }

    .nav-toggle { display: block; }

    /* Hide email shortcut on small screens to save space */
    .nav-email { display: none !important; }

    .nav-actions {
        order: 3;
        width: 100%;
        justify-content: center;
        padding: 0 0 14px;
        gap: 10px;
        margin-left: 0 !important;
        display: none;
    }
    .navbar.is-open .nav-actions { display: flex; }

    .nav-actions .nav-cta {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Stacked menu drawer */
    .nav-menu {
        order: 4;
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        height: auto;
        max-height: 0;
        overflow: hidden;
        background: #000;
        transition: max-height .35s ease;
        gap: 0;
        flex: 0 0 100%;
    }
    .navbar.is-open .nav-menu {
        max-height: 80vh;
        overflow-y: auto;
        padding-bottom: 18px;
    }

    .nav-item {
        height: auto;
        width: 100%;
        margin-left: 0 !important;
        flex-direction: column;
        align-items: stretch !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .nav-link {
        padding: 14px 18px !important;
        font-size: 15px !important;
        justify-content: space-between;
        width: 100%;
        height: auto;
    }
    .nav-link::after { display: none; }

    /* Mega-drop becomes inline accordion */
    .mega-drop {
        position: static !important;
        display: none;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        background: rgba(255,255,255,0.04) !important;
        border-radius: 0 !important;
        padding: 8px 0 14px !important;
        margin: 0 !important;
    }
    .nav-item.is-open > .mega-drop {
        display: block !important;
    }
    /* Disable hover-open on touch devices */
    .nav-item:hover > .mega-drop { display: none; }
    .nav-item.is-open:hover > .mega-drop { display: block !important; }

    .mega-grid {
        display: flex !important;
        flex-direction: column;
        gap: 10px !important;
        padding: 0 12px !important;
    }
    .m-col { padding: 0 !important; min-width: 0 !important; width: 100% !important; }
    .col-head, .col-subhead {
        color: #4ade80 !important;
        font-size: 13px !important;
        margin: 8px 0 6px !important;
    }
    .m-links {
        padding: 0 !important;
        margin: 0 !important;
        list-style: none;
    }
    .m-links li a {
        padding: 8px 4px !important;
        font-size: 13px !important;
        color: #c8e8d4 !important;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Contact strip inside mega-drop becomes vertical */
    .contact-strip {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: flex-start !important;
        padding: 12px !important;
        margin: 8px 12px 0 !important;
        width: auto !important;
    }
    .strip-items {
        flex-direction: column !important;
        gap: 6px !important;
        align-items: flex-start !important;
        width: 100%;
    }
    .strip-item {
        font-size: 12px !important;
        word-break: break-word;
    }

    /* Regions drop */
    .region-list {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 4px 12px 0 !important;
    }
    .region-list a {
        font-size: 13px !important;
    }

    /* Chevron rotates when section open */
    .nav-item.is-open > .nav-link .chevron {
        transform: rotate(-135deg) translateY(1px);
        opacity: 0.9;
    }
}

/* ---- 3. Footer (always grid-based, stack on tablet/mobile) ----- */
@media (max-width: 1024px) {
    .ufe-inner {
        max-width: 100% !important;
        padding: 60px 24px 0 !important;
    }
    .ufe-top {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 24px;
        padding-bottom: 36px;
    }
    .ufe-top a img { max-width: 180px; height: auto; }
    .ufe-headline {
        font-size: 40px !important;
        line-height: 1 !important;
        letter-spacing: -1px !important;
    }
    .ufe-top-right {
        align-items: flex-start !important;
        width: 100%;
    }
    .ufe-tagline {
        text-align: left !important;
        max-width: 100% !important;
    }
    .ufe-mid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 30px 20px !important;
        padding: 36px 0 !important;
    }
    .ufe-col { padding-right: 0 !important; }
    .ufe-contact-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 18px;
    }
    .ufe-contact-divider { display: none !important; }
}

@media (max-width: 600px) {
    .ufe-headline { font-size: 32px !important; }
    .ufe-mid {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
    }
    .ufe-inner { padding: 48px 20px 0 !important; }
}

/* ---- 4. Contact section (us-contact) --------------------------- */
@media (max-width: 1024px) {
    #us-contact .ct-info-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 18px !important;
        padding: 30px 20px !important;
    }
    #us-contact .ct-info-block {
        width: 100% !important;
        max-width: 100% !important;
    }
    .ct-map-wrap iframe {
        width: 100% !important;
        height: 320px !important;
    }
    .ct-form-wrap {
        padding: 40px 20px !important;
    }
    .ct-row {
        flex-direction: column !important;
        gap: 14px !important;
    }
    .ct-field { width: 100% !important; }
    .ct-field input,
    .ct-field textarea { width: 100% !important; }
    .ct-form-footer {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px !important;
    }
    .ct-submit { width: 100% !important; justify-content: center; }
}

/* ---- 5. Skeleton container width fix --------------------------- */
/* Original skeleton sets fixed widths (420px / 300px) on .container
   which OVERFLOW small phones. Force fluid widths instead. */
@media (max-width: 1199px) {
    .container {
        width: 100% !important;
        max-width: 1100px;
        padding: 0 24px !important;
    }
}
@media (max-width: 767px) {
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 18px !important;
    }
    .container .one.column,
    .container .one.columns,
    .container .two.columns,
    .container .three.columns,
    .container .four.columns,
    .container .five.columns,
    .container .six.columns,
    .container .seven.columns,
    .container .eight.columns,
    .container .nine.columns,
    .container .ten.columns,
    .container .eleven.columns,
    .container .twelve.columns,
    .container .one-fifth.column,
    .container .two-fifths.column,
    .container .three-fifths.column,
    .container .four-fifths.column {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        float: none !important;
    }
    .container .offset-by-one,
    .container .offset-by-two,
    .container .offset-by-three,
    .container .offset-by-four,
    .container .offset-by-five,
    .container .offset-by-six,
    .container .offset-by-seven,
    .container .offset-by-eight,
    .container .offset-by-nine,
    .container .offset-by-ten,
    .container .offset-by-eleven { padding-left: 0 !important; }
}

/* ---- 6. Typography scaling ------------------------------------- */
@media (max-width: 1024px) {
    h1 { font-size: clamp(28px, 5.6vw, 44px) !important; line-height: 1.15 !important; }
    h2 { font-size: clamp(24px, 4.6vw, 36px) !important; line-height: 1.2 !important; }
    h3 { font-size: clamp(20px, 3.8vw, 28px) !important; line-height: 1.25 !important; }
    h4 { font-size: clamp(17px, 3.2vw, 22px) !important; line-height: 1.3 !important; }
    .hero-title,
    .hero-section h1,
    .ban-head h1 {
        font-size: clamp(26px, 6vw, 46px) !important;
        line-height: 1.15 !important;
        word-break: break-word;
    }
    .hero-subtitle { font-size: clamp(14px, 2.6vw, 18px) !important; }
}
@media (max-width: 480px) {
    h1 { font-size: clamp(24px, 7vw, 34px) !important; }
    .ban-head h1, .hero-section h1, .hero-title {
        font-size: clamp(22px, 7.2vw, 34px) !important;
    }
    p, li, a { word-wrap: break-word; overflow-wrap: break-word; }
}

/* ---- 7. Generic multi-column patterns (defensive) -------------- */
@media (max-width: 1024px) {
    /* Anything using inline-grid 2+ cols collapses */
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: 1fr 1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .row, .flex-row {
        flex-wrap: wrap !important;
    }
}
@media (max-width: 600px) {
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    [style*="display:flex"][style*="gap"],
    [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }
}

/* ---- 8. Section padding scales --------------------------------- */
@media (max-width: 768px) {
    section, .section { padding-left: 0; padding-right: 0; }
    .section.full-height { min-height: 70vh; }
    .vidsec { min-height: 60vh; }
    .home-text { padding: 0 18px; }
}

/* ---- 9. Buttons & tables --------------------------------------- */
@media (max-width: 600px) {
    button, .btn, .nav-cta, .ct-submit, .ufe-cta {
        font-size: 14px !important;
    }
    table { display: block; overflow-x: auto; max-width: 100%; }
}

/* ---- 10. Hero video & full-height blocks ----------------------- */
@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
    }
    .hero-section .hero-video {
        object-fit: cover;
    }
    .home-text .container .ban-head { padding: 0 8px; }
}

/* ---- 11. Owl/Slick/Swiper carousels safety --------------------- */
@media (max-width: 768px) {
    .owl-carousel, .swiper, .slick-slider { max-width: 100%; }
    .owl-stage-outer, .swiper-wrapper { max-width: 100%; }
}

/* ---- 12. Footer tooltip city list wrap ------------------------- */
@media (max-width: 600px) {
    .uss-tooltip {
        min-width: 200px !important;
        max-width: 240px !important;
    }
    .ufe-contact-item div[style*="display:inline-flex"] {
        flex-wrap: wrap !important;
    }
}

/* ---- 13. Forms ------------------------------------------------- */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    select, textarea {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px; /* prevents iOS zoom */
    }
}

/* ---- 14. Catch-all: prevent fixed-pixel overflow --------------- */
@media (max-width: 1024px) {
    [style*="min-width:"] { min-width: 0 !important; }
    [style*="width: 1"][style*="px"] { max-width: 100% !important; }
}

/* ---- 15. Per-page class-targeted small-mobile rules ------------ */
/* These pages share a naming convention (abt-*, ind-*, rg-*, inf-*,
   ofs-*, lt-*, ev-*, pos-*, wwy-*, alp-*). Their own stylesheets
   already stack at 820-1024px; below that they can still feel
   cramped, so we tighten everything to a single column / smaller
   padding / hidden decorations on very small screens. */

@media (max-width: 768px) {
    /* Generic page-section padding scale-down */
    .abt-hero, .abt-story, .abt-diff, .abt-presence, .abt-cta,
    .ind-hero, .ind-intro-strip, .ind-main, .ind-cta,
    .rg-hero, .rg-sec, .rg-cta, .rg-marquee, .rg-stats,
    .inf-hero, .inf-intro, .inf-pillars, .inf-detail, .inf-cta,
    .ofs-hero, .ofs-intro, .ofs-pillars, .ofs-detail, .ofs-cta,
    .se-hero, .se-intro, .se-pillars, .se-detail, .se-cta,
    .ep-hero, .ep-intro, .ep-pillars, .ep-detail, .ep-cta,
    .lt-hero, .lt-bio, .lt-team, .lt-cta,
    .ev-hero, .ev-intro, .ev-detail, .ev-cta,
    .alp-hero, .alp-cards, .alp-cta,
    .wwy-hero, .wwy-intro, .wwy-cta,
    .pos-hero, .pos-list, .pos-cta {
        padding-left: 20px !important;
        padding-right: 20px !important;
        padding-top: 60px !important;
        padding-bottom: 60px !important;
    }
}

@media (max-width: 600px) {
    /* Force any 2+ column grid to single col on small mobile */
    .abt-stats-inner,
    .abt-city-grid,
    .abt-diff-grid,
    .abt-story-inner,
    .abt-presence-inner,
    .abt-hero-inner,
    .abt-diff-head,
    .ind-panel-body,
    .ind-img-strip,
    .ind-main,
    .ind-intro-strip .inner,
    .rg-2col,
    .rg-stats-inner,
    .cities-overview,
    .intro-stats,
    .inf-hero-inner,
    .inf-detail .inner,
    .inf-pillars .grid,
    .ofs-hero-inner,
    .ofs-detail .inner,
    .ofs-pillars .grid,
    .se-hero-inner,
    .se-detail .inner,
    .se-pillars .grid,
    .ep-hero-inner,
    .ep-detail .inner,
    .ep-pillars .grid,
    .lt-team-grid,
    .lt-bio-inner,
    .ev-grid,
    .alp-cards-grid,
    .wwy-grid,
    .pos-grid,
    .diff-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* Hide purely-decorative right-side visuals to save space */
    .abt-hero-right,
    .ind-hero-right,
    .rg-hero-right,
    .inf-hero-right,
    .ofs-hero-right,
    .se-hero-right,
    .ep-hero-right,
    .lt-hero-right,
    .abt-hero-year,
    .ind-hero-year,
    .rg-hero-year,
    .abt-presence-visual,
    .abt-pseb-badge {
        display: none !important;
    }

    /* Tighten hero left text */
    .abt-hero-inner, .ind-hero-inner, .rg-hero-inner,
    .inf-hero-inner, .ofs-hero-inner, .se-hero-inner,
    .ep-hero-inner, .lt-hero-inner {
        padding: 0 20px !important;
        gap: 30px !important;
    }

    /* Buttons row wraps */
    .abt-hero-btns, .ind-hero-btns, .rg-hero-btns,
    .inf-hero-btns, .ofs-hero-btns, .se-hero-btns,
    .ep-hero-btns, .lt-hero-btns {
        flex-wrap: wrap !important;
        gap: 12px !important;
    }
    .abt-btn-primary, .abt-btn-ghost,
    .ind-btn-primary, .ind-btn-ghost,
    .rg-btn-primary, .rg-btn-ghost {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Stat cards stack with bottom border instead of right border */
    .abt-stat, .ind-stat, .rg-sb-stat {
        border-right: none !important;
        border-bottom: 1px solid rgba(255,255,255,.1) !important;
        padding: 28px 20px !important;
    }
    .abt-stat:last-child, .ind-stat:last-child, .rg-sb-stat:last-child {
        border-bottom: none !important;
    }
    .abt-stat .sn, .rg-sb-num { font-size: 36px !important; }
}

/* ---- 16. Index/homepage specific --------------------------------- */
@media (max-width: 768px) {
    .vidsec .hero-video {
        position: absolute; inset: 0;
        width: 100% !important; height: 100% !important;
        object-fit: cover;
    }
    .home-text .container .ban-head h1 {
        text-align: center;
        padding: 0 12px;
    }
    .link-down { display: none; } /* tiny scroll-down arrow not useful on mobile */
    .services-gsap .hero-title,
    #hero .hero-title { font-size: clamp(26px, 6.5vw, 44px) !important; }
}

/* ---- 17. Open positions / career list cards --------------------- */
@media (max-width: 600px) {
    .pos-card, .career-card, .job-card {
        padding: 20px !important;
    }
    .pos-card-head, .career-card-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
}

/* ---- 18. Leadership team profile cards -------------------------- */
@media (max-width: 600px) {
    .lt-card, .leader-card {
        padding: 24px 20px !important;
    }
    .lt-card-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
    }
}

/* ---- 19. Alliances / Partners logo grid ------------------------- */
@media (max-width: 768px) {
    .alp-logos, .partner-logos {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}
@media (max-width: 400px) {
    .alp-logos, .partner-logos {
        grid-template-columns: 1fr !important;
    }
}

/* ---- 20. Final safety: any overflow guard ----------------------- */
@media (max-width: 600px) {
    /* Anything with inline-padding 56px+ becomes 20px */
    [style*="padding:120px 56px"],
    [style*="padding: 120px 56px"],
    [style*="padding:100px 56px"],
    [style*="padding: 100px 56px"],
    [style*="padding:80px 56px"],
    [style*="padding: 80px 56px"] {
        padding: 56px 20px !important;
    }
}
