/* =========================================================
   Stalwart Chambers — Responsive & Mobile Design Fixes
   ========================================================= */

/* Global overflow safety (clip preserves sticky positioning) */
html,
body,
.wrapper {
    max-width: 100%;
    overflow-x: clip;
}

/* Fix testimonial company logos distorting into ovals on all screens */
.testimonial-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #ffffff;
    padding: 4px;
    border-radius: 50%;
}

/* Stats section — reliable overlay & stacking above background */
.stats-section {
    position: relative;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
.stats-section .container {
    position: relative;
    z-index: 2;
}
.stats-section .single_funfact_items {
    border: 1px solid rgba(182, 157, 116, 0.35);
    border-radius: 6px;
    background-color: rgba(20, 32, 51, 0.35);
}

/* What We Do section — reliable dark overlay so white text always reads cleanly */
.what-we-do-section {
    position: relative;
    background-color: #20314c;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}
.what-we-do-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(18, 28, 45, 0.35);
    z-index: 0;
}
.what-we-do-section .container {
    position: relative;
    z-index: 1;
}

/* Services & Pro Bono alternating sections — remove huge gap between title and copy */
.service-04 .shop-split-content {
    padding: 12px 0 0 !important;
}

/* Rich CMS content safety */
.entry-content,
.pp-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.entry-content img,
.pp-content img {
    max-width: 100% !important;
    height: auto !important;
}
.entry-content table,
.pp-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* Team card polish across viewports — keep social bar cleanly below portraits */
.team-item {
    border-color: #e2e2e2 !important;
    background-color: #ffffff;
    padding-bottom: 0 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.our-lawyers .team-item .resize {
    height: 280px !important;
    background-position: center top !important;
    background-size: cover !important;
}
.our-lawyers .team-item .team-inner {
    margin-top: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
    padding: 26px 15px 18px !important;
}
.our-lawyers .team-item .team-inner ul {
    top: -20px !important;
}
.our-lawyers .team-item .team-inner h3 {
    padding-top: 6px !important;
}

/* Fix bloated 51px DataTables select box on all viewports */
.dataTables_length .form-control,
select.form-control-sm:not([size]):not([multiple]) {
    height: 38px !important;
    padding: 6px 12px !important;
    line-height: 1.4;
}

/* Clickable links in contact info panel */
.contact-2 .addresss-info a {
    color: #ffffff;
    text-decoration: none;
}
.contact-2 .addresss-info a:hover {
    text-decoration: underline;
}

/* Equal-height blog / article / service grid cards */
.blog-grid-3-column .blog-entry {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    background: #ffffff;
}
.blog-grid-3-column .blog-detail {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.blog-grid-3-column .entry-share {
    margin-top: auto;
    padding-top: 12px;
}

/* Clickable team portrait cursor */
.our-lawyers .team-item .resize[data-bs-toggle="modal"] {
    cursor: pointer;
}

/* =========================================================
   Desktop & Laptop (>= 992px) — single-row flex nav & sticky
   ========================================================= */
@media screen and (min-width: 992px) {
    .mega-menu > section.menu-list-items .col-lg-12 {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .mega-menu .menu-logo {
        float: none !important;
        flex-shrink: 0;
        padding: 14px 0 !important;
    }
    .mega-menu .menu-bar {
        float: none !important;
        margin-left: auto;
    }
    .mega-menu .menu-links {
        float: none !important;
        display: flex !important;
        align-items: center;
        flex-wrap: nowrap;
    }
    .mega-menu .menu-links > li {
        float: none !important;
        white-space: nowrap;
        position: relative !important;
    }
    .mega-menu .menu-links > li > a {
        line-height: 1.4 !important;
        padding-top: 26px !important;
        padding-bottom: 26px !important;
    }
    .mega-menu .drop-down,
    .mega-menu .drop-down-tab-bar,
    .mega-menu .drop-down-multilevel {
        top: 100% !important;
        left: 0 !important;
        min-width: 220px;
        border-top: 2px solid var(--color-logo-yellow) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
    }

    /* Sticky desktop header alignment */
    .header.light .mega-menu.desktopTopFixed > section.menu-list-items {
        height: auto !important;
        padding: 6px 0 !important;
        box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
    }
    .mega-menu.desktopTopFixed .menu-logo {
        padding: 4px 0 !important;
    }
    .mega-menu.desktopTopFixed .menu-logo > li > a img {
        margin: 0 !important;
        height: 42px !important;
    }
    .mega-menu.desktopTopFixed .menu-list-items .menu-links > li > a {
        line-height: 1.4 !important;
        padding-top: 18px !important;
        padding-bottom: 18px !important;
    }
}

/* Small Laptop / iPad Pro (992px - 1199px) — prevent nav wrapping */
@media screen and (min-width: 992px) and (max-width: 1199px) {
    .mega-menu .menu-logo img {
        height: 38px !important;
        width: auto !important;
    }
    .mega-menu .menu-links > li > a {
        font-size: 13px !important;
        padding-left: 7px !important;
        padding-right: 7px !important;
    }
}

/* =========================================================
   Tablet & Mobile (<= 991px)
   ========================================================= */
@media screen and (max-width: 991px) {
    /* Eliminate justified-text word-spacing rivers on tablet & mobile */
    .text-justify {
        text-align: left !important;
    }

    /* Stop mega_menu.css from breaking words mid-letter */
    .mega-menu * {
        word-break: normal !important;
        overflow-wrap: break-word;
    }

    /* Header & mobile nav bar */
    .mega-menu > section.menu-list-items {
        height: auto !important;
        padding: 0 !important;
    }

    .mega-menu .menu-logo {
        width: 100%;
        padding: 12px 50px 12px 0 !important;
    }

    .mega-menu .menu-logo > li > a {
        padding: 0 !important;
        display: inline-flex;
        align-items: center;
    }

    .mega-menu .menu-logo img {
        height: 38px !important;
        width: auto !important;
        max-width: 100% !important;
        margin: 0 !important;
        object-fit: contain;
    }

    .mega-menu .menu-mobile-collapse-trigger {
        top: 50% !important;
        transform: translateY(-50%);
        right: 0 !important;
        width: 44px !important;
        height: 44px !important;
    }
    .mega-menu .menu-mobile-collapse-trigger:before {
        top: 13px !important;
    }
    .mega-menu .menu-mobile-collapse-trigger span {
        top: 21px !important;
    }
    .mega-menu .menu-mobile-collapse-trigger:after {
        top: 29px !important;
    }
    .mega-menu .menu-mobile-collapse-trigger.active:before {
        transform: rotate(35deg);
    }
    .mega-menu .menu-mobile-collapse-trigger.active:after {
        transform: rotate(-35deg);
    }

    /* Mobile menu drawer */
    .mega-menu .menu-links {
        width: 100% !important;
        background: #ffffff !important;
        border-top: 1px solid #ececec;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
        max-height: 75vh !important;
        overflow-y: auto !important;
        float: none !important;
    }

    .mega-menu .menu-links > li {
        border-bottom: 1px solid #f0f0f0;
    }

    .mega-menu .menu-links > li > a {
        display: block !important;
        width: 100% !important;
        padding: 13px 44px 13px 16px !important;
        font-size: 15px !important;
        line-height: 1.4 !important;
        color: #20314c !important;
    }

    .mega-menu .menu-links > li.active > a {
        color: #b69d74 !important;
        font-weight: 600;
    }

    .mega-menu .menu-links > li > a i.fa.fa-indicator {
        right: 16px !important;
        top: 0 !important;
        height: 48px !important;
        line-height: 48px !important;
        z-index: 0 !important;
        transition: transform 0.2s ease;
    }

    .mega-menu .menu-links > li.activeTriggerMobile > a i.fa.fa-indicator {
        transform: rotate(180deg);
    }

    .mega-menu .mobileTriggerButton {
        height: 48px !important;
        z-index: 5 !important;
        cursor: pointer;
    }

    /* Fix dropdown gap (overrides desktop top: 66%) */
    .mega-menu .drop-down,
    .mega-menu .drop-down-tab-bar,
    .mega-menu .drop-down-multilevel {
        top: 0 !important;
        left: 0 !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 4px 0 8px !important;
        background: #f8f7f4 !important;
        border-top: 1px solid #eee !important;
        box-shadow: none !important;
    }

    .mega-menu .drop-down-multilevel li {
        float: none !important;
    }

    .mega-menu .drop-down-multilevel li a,
    .mega-menu .drop-down-multilevel > li:first-child > a,
    .mega-menu .drop-down-multilevel > li:last-child > a {
        padding: 10px 16px 10px 28px !important;
        min-height: 42px;
        font-size: 14px !important;
        float: none !important;
        display: block !important;
        width: 100% !important;
        color: #323232 !important;
    }

    .header.light .mega-menu.mobileTopFixed .menu-list-items,
    .header.light .mega-menu.mobileTopFixed.desktopTopFixed .menu-list-items {
        background: #ffffff !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }
    .header.light .mega-menu.mobileTopFixed .menu-logo {
        padding: 10px 50px 10px 0 !important;
    }

    /* Remove redundant 45px top gap on inner page headers */
    .page-title,
    .page-title.small {
        margin-top: 0 !important;
    }

    /* About Us & Homepage .help-area — fix gold frame & shape overflow */
    .help-area {
        overflow: hidden;
        padding-top: 24px;
        padding-bottom: 16px !important;
    }

    .help-left {
        max-width: 100%;
        margin: 0 auto;
        padding: 14px 14px 14px 0;
    }

    .help-left:before {
        left: 14px;
        top: 0;
        width: calc(100% - 14px);
        height: 100%;
        border: 10px solid #b69d74;
        -webkit-animation: none !important;
        animation: none !important;
    }

    .help-item {
        margin-bottom: 24px;
    }

    .help-item .help-right {
        max-width: 100%;
        margin-left: 0 !important;
        padding-top: 6px;
    }

    .help-item .help-right h2 {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    .help-item .help-right p {
        margin-bottom: 16px;
        font-size: 15px;
        line-height: 1.7;
    }

    .help-item .help-right .help-inner-left,
    .help-item .help-right .help-inner-right {
        width: 100%;
        display: block;
    }

    .help-shape {
        display: none !important;
    }

    /* Practice Areas — hide decorative SVGs that overlap text on smaller screens */
    .feature_element,
    .about_element {
        display: none !important;
    }

    /* Blog detail — unlock nested 630px scroll box on mobile/tablet */
    .blog-detail-fixed {
        height: auto !important;
        overflow: visible !important;
    }

    /* Contact Us — compact map & info padding */
    .contact-2.mt-40 {
        margin-top: 0 !important;
    }

    .contact-2 .map-side {
        position: relative !important;
        height: auto !important;
    }

    .contact-2 .map-side iframe {
        height: 280px !important;
        display: block;
    }

    .contact-2 .contact-3-info.page-section-ptb {
        padding: 36px 0 !important;
    }

    .contact-2 .contact-3-info p.mb-50 {
        margin-bottom: 24px !important;
    }

    .contact-2 .contact-3-info .social-icons.mt-50 {
        margin-top: 24px !important;
    }

    /* What We Do — stronger contrast overlay on mobile/tablet */
    .what-we-do-section {
        background-position: left center !important;
    }
    .what-we-do-section::before {
        background: rgba(18, 28, 45, 0.72);
    }
}

/* =========================================================
   Mobile Phones (<= 767px)
   ========================================================= */
@media screen and (max-width: 767px) {
    /* Eliminate justified-text word-spacing rivers on narrow screens */
    .text-justify {
        text-align: left !important;
    }

    /* Compact topbar on mobile */
    .header.light .topbar {
        padding: 8px 0 !important;
    }
    .header.light .topbar .xs-mb-10 {
        margin-bottom: 4px !important;
    }
    .topbar ul li,
    .topbar ul li a {
        font-size: 13px !important;
        line-height: 1.5;
    }
    .topbar-call ul li {
        display: inline-block;
        margin: 0 6px;
        padding: 0;
    }
    .topbar-social ul li a {
        padding: 2px 6px !important;
        display: inline-block;
    }
    .topbar-social ul li a span {
        font-size: 14px !important;
    }

    /* Page title bar */
    .page-title.small {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }
    .page-title.small h1 {
        font-size: 20px !important;
        line-height: 1.35 !important;
        margin-top: 0 !important;
    }

    /* Section spacing */
    .page-section-ptb {
        padding: 44px 0 !important;
    }
    .section-title {
        margin-bottom: 24px !important;
    }
    .section-title h2 {
        font-size: 26px !important;
        line-height: 1.3 !important;
    }
    .section-title p {
        font-size: 15px !important;
        line-height: 1.65 !important;
    }

    /* Stats section — compact cards on mobile */
    .stats-section.page-section-ptb-20 {
        padding: 28px 0 36px !important;
    }
    .stats-section .mt-30 {
        margin-top: 14px !important;
    }
    .stats-section .single_funfact_items {
        padding: 22px 16px !important;
    }
    .stats-section .single_funfact_items h6 {
        margin-bottom: 4px !important;
        font-size: 12px;
        letter-spacing: 1px;
        text-transform: uppercase;
    }
    .stats-section .single_funfact_items h3.countern {
        font-size: 34px !important;
        line-height: 1.2;
        margin: 4px 0;
    }
    .stats-section .single_funfact_items h4 {
        font-size: 18px;
        margin-bottom: 0;
    }

    /* What We Do links */
    .what-we-do-section .list-hand li {
        margin-bottom: 10px;
    }

    /* Testimonials — clean card padding & circular logo */
    .testimonial.bottom_pos {
        padding: 46px 20px 56px 22px !important;
        margin-bottom: 52px !important;
    }
    .testimonial-info:before {
        top: -32px !important;
        left: -6px !important;
        font-size: 64px !important;
        opacity: 0.35;
    }
    .testimonial.bottom_pos .author-info {
        margin-left: 0 !important;
        margin-top: 14px !important;
        font-size: 14px;
    }
    .testimonial.bottom_pos .testimonial-avatar {
        width: 76px !important;
        height: 76px !important;
        bottom: -38px !important;
        left: 22px !important;
        margin-left: 0 !important;
    }

    /* Services & Pro Bono pages */
    .service-04 {
        padding-top: 20px !important;
        padding-bottom: 16px !important;
        border-bottom: 1px solid #f0f0f0;
    }
    .service-04 .service-04-video {
        margin-top: 0 !important;
        margin-bottom: 16px !important;
    }
    .service-04 .resize {
        height: 220px !important;
        border-radius: 4px;
    }
    .service-04 .section-title h2 {
        font-size: 22px !important;
        margin-bottom: 8px !important;
    }

    /* Team cards & modal */
    .our-lawyers .team-item .resize {
        height: 280px !important;
    }
    .modal-dialog {
        margin: 16px auto !important;
    }
    .modal-header,
    .modal-body {
        padding: 16px !important;
    }
    .modal-footer {
        padding: 12px 16px !important;
    }
    .our-team .team-details .title {
        float: none !important;
    }

    /* Blogs & Data Lists */
    .blog .blog-entry.mb-50 {
        margin-bottom: 28px !important;
    }
    .blog .resize {
        height: 210px !important;
    }
    .entry-pagination .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Most Useful Laws DataTable */
    .datatable-base.page-section-ptb {
        padding: 28px 0 !important;
    }
    #datatable_wrapper {
        padding: 0 !important;
    }
    #datatable_wrapper > .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    #datatable_wrapper > .row > [class*="col-"] {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    div.dataTables_wrapper div.dataTables_length,
    div.dataTables_wrapper div.dataTables_filter {
        text-align: left !important;
        margin-bottom: 12px;
    }
    div.dataTables_wrapper div.dataTables_length label,
    div.dataTables_wrapper div.dataTables_filter label {
        display: flex !important;
        align-items: center;
        gap: 8px;
        width: 100%;
        font-size: 14px;
        margin-bottom: 0;
    }
    .dataTables_length .form-control,
    select.form-control-sm:not([size]):not([multiple]) {
        height: 38px !important;
        padding: 6px 12px !important;
        width: auto !important;
        min-width: 72px;
        line-height: 1.4;
    }
    div.dataTables_wrapper div.dataTables_filter input.form-control {
        width: auto !important;
        flex: 1 1 auto;
        height: 38px !important;
        padding: 6px 12px !important;
        margin-left: 0 !important;
    }
    #datatable {
        width: 100% !important;
        font-size: 13px;
        margin-bottom: 12px !important;
    }
    #datatable th,
    #datatable td {
        padding: 8px 6px !important;
        white-space: normal !important;
        word-break: break-word;
        vertical-align: middle;
    }
    #datatable thead th {
        padding: 8px 20px 8px 6px !important;
        font-size: 12px;
        white-space: nowrap !important;
    }
    #datatable thead th:first-child {
        white-space: normal !important;
    }
    #datatable thead th.sorting:before,
    #datatable thead th.sorting_asc:before,
    #datatable thead th.sorting_desc:before {
        right: 9px !important;
        bottom: 9px !important;
        font-size: 11px;
    }
    #datatable thead th.sorting:after,
    #datatable thead th.sorting_asc:after,
    #datatable thead th.sorting_desc:after {
        right: 3px !important;
        bottom: 9px !important;
        font-size: 11px;
    }
    div.dataTables_wrapper div.dataTables_info {
        text-align: center !important;
        font-size: 13px;
        white-space: normal !important;
    }
    div.dataTables_wrapper div.dataTables_paginate ul.pagination {
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Contact form spacing & reCAPTCHA */
    .contact-2 .mb-50 {
        margin-bottom: 24px !important;
    }
    .contact-form .row.mb-20 {
        margin-bottom: 14px !important;
    }
    .g-recaptcha {
        max-width: 100%;
        overflow: hidden;
        transform-origin: left top;
    }

    /* Disclaimer popup */
    .white-popup {
        max-width: 92% !important;
    }
    .rmq-43f44628 {
        padding: 20px !important;
    }
    .white-popup .border-right {
        border-right: none !important;
        border-bottom: 1px solid #dddddd;
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    /* Footer */
    .footer.page-section-pt {
        padding-top: 40px !important;
    }
    .footer h6.mb-30 {
        margin-bottom: 14px !important;
    }
    .footer .sm-mb-30,
    .footer .xs-mb-30 {
        margin-bottom: 24px !important;
    }
    .footer-useful-link ul li a {
        display: inline-block;
        padding: 3px 0;
    }
    .footer-widget {
        margin-top: 10px !important;
        padding-bottom: 20px;
    }
    .footer-widget p.mt-15 {
        margin-top: 8px !important;
    }

    /* Back-to-top safe inset */
    #back-to-top .top {
        right: 12px !important;
        bottom: 14px !important;
    }
}

/* =========================================================
   Small Mobile Phones (<= 575px)
   ========================================================= */
@media screen and (max-width: 575px) {
    .mega-menu .menu-logo img {
        height: 34px !important;
    }

    /* Practice Areas cards — cleaner proportions on narrow phones */
    .feature-text.left-icon {
        margin-bottom: 24px !important;
    }
    .feature-text.left-icon .feature-icon img {
        width: 72px !important;
        height: 72px;
        object-fit: cover;
        border-radius: 4px;
    }
    .feature-text.left-icon .feature-info {
        padding-left: 86px !important;
    }
    .feature-text.left-icon .feature-info h5 {
        font-size: 16px;
        line-height: 1.35;
        margin-bottom: 6px;
    }
    .feature-text.left-icon .feature-info p {
        font-size: 14px;
        line-height: 1.55;
        margin-bottom: 0;
    }
}

/* Ultra-narrow screens (<= 360px) */
@media screen and (max-width: 360px) {
    .g-recaptcha {
        transform: scale(0.88);
    }
}
