

/* =============================================================
   1) MOBILE NAV DRAWER  (≤ 991px)
   ============================================================= */
@media (max-width: 991px) {

    /*
     * Sticky/fixed bar: full-width bar stays at top while scrolling.
     * Body offset matches --nav-height (see global.css).
     */
    .main-navbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 10050;
    }
    body {
        padding-top: var(--nav-height);
    }

    /* The hamburger icon is the entry point on mobile */
    .nav-mobile-toggle {
        display: flex !important;
        order: 4;
        margin-left: auto;
        position: relative;
        z-index: 10003;            /* above drawer + backdrop so it stays clickable */
        pointer-events: auto;
        cursor: pointer;
    }
    /* Make sure clicks land on the BUTTON, not the inner spans */
    .nav-mobile-toggle span { pointer-events: none; }

    /* Mobile-only search icon (next to hamburger) */
    .nav-mobile-search {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        color: var(--primary);
        font-size: 16px;
        cursor: pointer;
        order: 3;
        position: relative;
        z-index: 10003;
    }
    .nav-mobile-search:hover { color: var(--accent); }
    .nav-mobile-search i { pointer-events: none; }

    /* Hide the desktop right-side socials/search on mobile (they live in the drawer) */
    .nav-right { display: none !important; }

    /* Logo stays on the left */
    .navbar-brand-link { order: 1; }

    .navbar-inner {
        justify-content: space-between;
        gap: 0;
    }

    /* ---- The drawer itself (built on top of <ul.nav-links>) ---- */
    .nav-links {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 320px;
        max-width: 85vw;
        background: var(--white);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.18);
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        margin: 0;
        list-style: none;
        z-index: 10001;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform 0.32s ease;
        border: none;
        border-radius: 0;
    }

    /* Open state */
    .nav-links.open { transform: translateX(0); }

    /* ---- Drawer header (logo + divider + socials) ---- */
    .nav-drawer-header {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 28px 22px 22px;
        border-bottom: 1px solid #efefef;
        list-style: none;
    }

    .nav-drawer-logo {
        display: inline-block;
        margin-bottom: 14px;
    }
    .nav-drawer-logo img {
        max-height: 56px;
        width: auto;
        display: block;
    }

    .nav-drawer-divider {
        width: 110px;
        height: 2px;
        background: var(--accent);
        margin: 6px auto 18px;
        border-radius: 2px;
    }

    .nav-drawer-socials {
        display: flex;
        gap: 18px;
        justify-content: center;
        align-items: center;
    }
    .nav-drawer-socials a {
        color: var(--primary);
        font-size: 15px;
        text-decoration: none;
        transition: color 0.2s ease;
    }
    .nav-drawer-socials a:hover { color: var(--accent); }

    /* ---- Drawer nav items ---- */
    .nav-links li {
        width: 100%;
        list-style: none;
    }

    .nav-links .nav-link {
        display: block;
        width: 100%;
        padding: 18px 26px;
        font-family: var(--font-nav);
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 1px;
        color: #2b2b2b;
        text-transform: uppercase;
        border-bottom: 1px solid #f0f0f0;
        background: transparent !important;
        border-left: none !important;
        text-align: left;
        height: auto;
        line-height: 1.3;
    }
    .nav-links .nav-link::after { display: none !important; }

    .nav-links .nav-link:hover,
    .nav-links .nav-link.active {
        color: var(--accent);
        background: #fafbff !important;
    }

    /* ---- Backdrop: MUST stay below .main-navbar (drawer lives inside nav) or taps never reach links ---- */
    .nav-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 25, 45, 0.55);
        z-index: 10040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .nav-drawer-backdrop.open {
        opacity: 1;
        visibility: visible;
    }

    /* ---- Floating Close (X) button next to drawer ---- */
    .nav-drawer-close {
        position: fixed;
        top: 16px;
        left: calc(min(320px, 85vw) + 16px);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--white);
        color: var(--primary);
        border: 1px solid #e2e2e2;
        font-size: 14px;
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10060;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
        transition: background 0.2s ease, color 0.2s ease;
    }
    .nav-drawer-close.open { display: flex; }
    .nav-drawer-close:hover { background: var(--accent); color: var(--white); border-color: var(--accent); }
}

/* On desktop the drawer header / mobile search button must NOT show */
@media (min-width: 992px) {
    .nav-drawer-header,
    .nav-mobile-search,
    .nav-drawer-backdrop,
    .nav-drawer-close {
        display: none !important;
    }
}

/* =============================================================
   2) HAMBURGER colour matches white navbar
   ============================================================= */
@media (max-width: 991px) {
    .nav-mobile-toggle { color: var(--primary); }
    .nav-mobile-toggle span { background: var(--primary); }
    /* Keep the X-rotation working when drawer is open */
    .nav-mobile-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-mobile-toggle.open span:nth-child(2) { opacity: 0; }
    .nav-mobile-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Body scroll lock helper – set by main.js when drawer opens */
    body.nav-locked { overflow: hidden; }
}

/* =============================================================
   3) GENERIC MOBILE LAYOUT POLISH (≤ 767px)
   ============================================================= */
@media (max-width: 767px) {

    /* ── Typography rhythm ── */
    h1, .h1, .section-title, .page-hero h1 { font-size: 26px !important; line-height: 1.25; }
    h2, .h2 { font-size: 22px !important; line-height: 1.3; }
    h3, .h3 { font-size: 18px !important; line-height: 1.35; }

    .container { padding-left: 18px; padding-right: 18px; }

    /* Center alignment for the most common content patterns on mobile */
    .container .row > [class*="col-"] { text-align: center; }

    /* Keep form/input groups left-aligned (centering inputs looks broken) */
    .container .row > [class*="col-"] form,
    .container .row > [class*="col-"] .contact-form,
    .container .row > [class*="col-"] .cmf-form,
    .container .row > [class*="col-"] .review-form,
    .container .row > [class*="col-"] table { text-align: left; }

    /* Section labels & subtitles centered */
    .section-label, .section-subtitle, .section-title { text-align: center !important; }

    /* Title separator centered */
    .title-separator { justify-content: center; margin-left: auto; margin-right: auto; }

    /* Center buttons */
    .btn-primary-custom,
    .btn-outline-custom { display: inline-block; margin: 0 auto; }

    /* List items inherit centering from parent column unless explicitly opted-out */
    ul.list-plain { text-align: left; }

    /* ── Image safety ── */
    img { max-width: 100%; height: auto; }
    iframe { max-width: 100%; }

    /* ── Bootstrap row gap reduction ── */
    .row.g-4 { --bs-gutter-y: 1.25rem; }
    .row.g-5 { --bs-gutter-y: 1.5rem; }
}

/* =============================================================
   4) PAGE-SPECIFIC MOBILE OVERRIDES
   ============================================================= */

/* ---- HOME : HERO SLIDER ---- */
@media (max-width: 991px) {
    .hero-slide {
        height: auto !important;
        min-height: 520px;
        max-height: none;
        background-position: center;
    }
    .hero-content {
        padding-top: 30px;
        padding-bottom: 30px;
        text-align: center;
    }
    .hero-text-wrap {
        max-width: 100%;
        margin: 0 auto;
    }
    .hero-tag {
        font-size: 16px;
        letter-spacing: 2px;
    }
    .hero-title {
        font-size: 42px;
        margin-bottom: 28px;
        text-align: center;
    }
    .hero-btns {
        justify-content: center;
        gap: 14px;
    }
    /* The carousel arrows often overlap text on tablets — soften them */
    #heroCarousel .carousel-control-prev,
    #heroCarousel .carousel-control-next {
        width: 40px; height: 40px;
        margin: 0 6px;
        background: rgba(255, 255, 255, 0.18);
    }
}

@media (max-width: 767px) {
    .hero-slide   { min-height: 480px; }
    .hero-content { padding-top: 20px; padding-bottom: 30px; }

    .hero-tag   { font-size: 15px; letter-spacing: 1.8px; margin-bottom: 16px; }
    .hero-title { font-size: 32px; line-height: 1.2; margin-bottom: 24px; }

    .hero-btns { flex-direction: column; align-items: center; gap: 12px; }
    .hero-btns .btn-primary-custom,
    .hero-btns .btn-outline-custom {
        width: 80%;
        max-width: 280px;
        margin: 0 auto !important;
        text-align: center;
    }

    /* Hide swipe-confusing arrows on phones; indicators are enough */
    #heroCarousel .carousel-control-prev,
    #heroCarousel .carousel-control-next { display: none; }

    #heroCarousel .carousel-indicators { margin-bottom: 22px; }
    #heroCarousel .carousel-indicators [data-bs-slide-to] { width: 22px; height: 3px; }
    #heroCarousel .carousel-indicators .active { width: 36px; }
}

@media (max-width: 480px) {
    .hero-slide   { min-height: 440px; }
    .hero-tag     { font-size: 13px; letter-spacing: 1.4px; }
    .hero-title   { font-size: 26px; }
    .hero-content { padding-left: 14px; padding-right: 14px; }
}

/* ---- HOME : Ever Reliable & Partners & Testimonials ---- */
@media (max-width: 991px) {
    .ever-reliable-section { flex-direction: column; }
    .er-left, .er-right    { flex: 1 1 100%; width: 100%; }
    .er-right              { min-height: 240px; }
    .er-left-inner         { max-width: 100%; }

    /* Partners / Clients vertical stack already handled in home.css */
}

@media (max-width: 575px) {
    .er-features { grid-template-columns: 1fr; gap: 18px; }
    .er-feature  { justify-content: center; text-align: left; }

    .pc-heading { font-size: 18px; }
    .ct-heading { font-size: 22px; letter-spacing: 1px; }
    .ct-cards   { grid-template-columns: 1fr !important; }
    .ct-card    { width: 100%; }
}

/* ---- ABOUT page ---- */
@media (max-width: 991px) {
    .about-hero          { min-height: 380px; }
    /* Hero / bar font sizes controlled in about.css (Teko) */
    .about-combined-section .row { flex-direction: column; }
    .ac-vertical-divider { display: none !important; }
    .about-combined-left,
    .about-combined-right { flex: 0 0 100%; max-width: 100%; padding: 0 0 24px; }
    /* Override generic mobile column centering — live site keeps justified columns */
    .about-combined-section .ac-text,
    .about-combined-section .ac-quality-text,
    .about-combined-section .ac-closing-text { text-align: justify !important; }
    .about-combined-section .ac-expertise-intro { text-align: left !important; }
    .ac-quality-row      { flex-direction: column; text-align: center; }
    .ac-quality-row .col-lg-8,
    .ac-quality-row .col-lg-4 { flex: 0 0 100%; max-width: 100%; }
    .ac-cert-badges      { margin-top: 22px; }
}

@media (max-width: 767px) {
    .never-fails-split            { flex-direction: column; }
    .never-fails-split .nf-left,
    .never-fails-split .nf-right  { flex: 1 1 100%; width: 100%; }
    .never-fails-split .nf-right  { min-height: 240px; }
    .nf-left-inner                { max-width: 100%; padding: 50px 24px; text-align: center; }
}

/* ---- CONTACT page ---- */
@media (max-width: 991px) {
    .contact-map-form .cmf-row { flex-direction: column; }
    .contact-map-form .cmf-map-col,
    .contact-map-form .cmf-form-col { flex: 0 0 100%; max-width: 100%; }
    .cmf-map-wrap { min-height: 320px; }
}

@media (max-width: 767px) {
    .contact-title       { font-size: 26px; }
    .cmf-row-3           { display: flex; flex-direction: column; gap: 12px; }
    .cmf-row-3 input     { width: 100%; }
    .contact-cta-banner h2 { font-size: 22px; line-height: 1.3; }
}

/* ---- PROJECTS page ---- */
@media (max-width: 767px) {
    .projects-grid      { grid-template-columns: 1fr !important; gap: 22px !important; }
    .project-image-wrap { height: 220px; }
}

/* ---- PRODUCTS page ---- */
@media (max-width: 767px) {
    .products-grid          { grid-template-columns: 1fr 1fr !important; gap: 24px 14px !important; }
    .product-name           { font-size: 12px; }
    .product-quickview-icon { width: 32px; height: 32px; font-size: 12px; }

    .single-product-section .row { flex-direction: column; }
    .single-product-section .col-lg-6 { flex: 0 0 100%; max-width: 100%; }
    .single-product-info { padding-left: 0; margin-top: 24px; text-align: center; }
    .sp-pager { justify-content: center; }
    .sp-share-row { justify-content: center; }
    .sp-cat { text-align: center; }

    .single-reviews-section .row { flex-direction: column; }
    .single-reviews-section .col-lg-6 { flex: 0 0 100%; max-width: 100%; }
    .reviews-heading,
    .reviews-empty,
    .reviews-note { text-align: center; }
    .review-form { align-items: stretch; }
    .rf-submit   { align-self: center; }

    .rp-grid { grid-template-columns: 1fr 1fr !important; gap: 18px 12px !important; }

    /* Quick View modal becomes single column already handled in products.css */
}

/* ---- SERVICES page ---- */
@media (max-width: 991px) {
    .services-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575px) {
    .services-grid { grid-template-columns: 1fr; }
    .services-numbered-list { columns: 1; }
}

/* ---- FOOTER ---- */
@media (max-width: 767px) {
    .footer-mini { padding: 30px 16px; }
    .footer-mini-socials { flex-wrap: wrap; gap: 14px; justify-content: center; }
    .footer-mini-socials a { font-size: 13px; }
}

/* =============================================================
   5) UTILITY: prevent horizontal scroll on small screens
   ============================================================= */
@media (max-width: 991px) {
    html, body { overflow-x: hidden; }
}
