/* base theme for BRM Contractors */
:root {
    --bg-gradient-start: #e0e7ef;
    --bg-gradient-end: #c0baba;
    --color-text: #222;
    --color-primary: #2d3a4b;
    --color-secondary: #3a4a5d;
    --color-accent: #007aff;
    --color-accent-hover: #005bb5;
    --nav-bg: rgba(255,255,255,0.25);
    --btn-bg: var(--color-accent);
    --btn-hover-bg: var(--color-accent-hover);
}
    .nav-links { flex-direction: column; width: 100%; }
    .navbar { flex-direction: row; align-items: center; justify-content: flex-start; }
    .menu-toggle { display: flex; margin-right: 0.5rem; }
    .logo { margin-right: 0.5rem; }


/* Small mobile breakpoint (optional tweaks) */
@media (max-width: 768px) {
    .nav-links { flex-direction: column; width: 100%; }
    .menu-toggle { display: flex; margin-right: 0.5rem; }
}

/* Desktop: always show nav links and hide toggle */
@media (min-width: 1025px) {
    .menu-toggle { display: none !important; }
    .nav-links { display: flex !important; flex-direction: row !important; margin-top: 0; }
}
.nav-links a {text-decoration:none;color:var(--color-primary);transition:color .2s;}
.nav-links a:hover {color:var(--color-accent);}

/* basic buttons */
.cta-btn, .submit-btn {
    background: var(--color-accent);
    color:#fff;
    border:none;
    padding:.6rem 1.2rem;
    border-radius:20px;
    cursor:pointer;
    transition:background .2s;
}
.cta-btn:hover, .submit-btn:hover {background:var(--color-accent-hover);}

/* hero */
.hero {position:relative;min-height:50vh;display:flex;align-items:center;justify-content:center;}
.hero-bg {position:absolute;inset:0;overflow:hidden;z-index:1;}
.hero-bg img {width:100%;height:100%;object-fit:cover;filter:brightness(.7) blur(2px);}
.hero-content {position:relative;z-index:2;text-align:center;padding:2rem;background:var(--glass-1);border-radius:30px;}

/* sections */
section {padding:4rem 0;}
.services .service-list{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));}
.service-card{background:var(--glass-2);padding:1.5rem;border-radius:20px;}
.gallery-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));}

/* contact form */
.contact-form{display:grid;gap:1rem;max-width:600px;margin:0 auto;padding:0 1rem;box-sizing:border-box;width:100%;}
.contact-form label{font-weight:600;}
.contact-form input,.contact-form textarea{width:100%;padding:.6rem;border:1px solid var(--color-secondary);border-radius:8px;box-sizing:border-box;}

/* Mobile: ensure contact form and inputs don't overflow viewport */
@media (max-width: 768px) {
    .contact-form { max-width: none !important; width: calc(100% - 1.5rem) !important; padding: 0 0.75rem !important; }
    .contact-form input, .contact-form textarea { width: 100% !important; box-sizing: border-box !important; }
}



body.dark-theme,
.dark-theme {
    /* dark-mode gradient colors */
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-end: #2d2d2d;
    --bg-gradient-end: #2d2d2d;
    --color-text: #eee;
    --color-primary: #e0e7ef;
    --color-secondary: #c9d6ff;
    --color-accent: #0a84ff;
    --color-accent-hover: #0060c8;
    --nav-bg: rgba(0,0,0,0.25);
    --btn-bg: var(--color-accent);
    --btn-hover-bg: var(--color-accent-hover);
    --glass-1: rgba(0,0,0,0.25);
    --glass-2: rgba(0,0,0,0.35);
    --glass-3: rgba(0,0,0,0.45);
    --glass-4: rgba(0,0,0,0.15);
    --glass-5: rgba(0,0,0,0.95);
    --border-light: rgba(0,0,0,0.18);
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 500;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--color-text);
}

.page-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1rem;
    overflow-x: hidden;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--color-primary);
}
.nav-links a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover {
    color: var(--color-accent);
}
.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    display: block;
    margin: 3px 0;
    transition: 0.3s;
    position: relative;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    margin-right: 1rem;
    color: var(--color-primary);
    transition: color 0.2s;
}
.theme-toggle:hover {
    color: var(--color-accent);
}

.color-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--color-primary);
    transition: color 0.2s;
    margin: 0;
}
.color-toggle:hover {
    color: var(--color-accent);
}

/* red color scheme overrides */
.red-theme {
    --color-accent: #c00c1b;
    --color-accent-hover: #a31621;
    --color-primary: #333232;
}

/* combine with dark if both classes present */
.red-theme.dark-theme {
    --color-accent: #d41919;
    --color-accent-hover: #e20b0b;
    --color-primary: #f8f9fa;
}
.hero h1 {
    font-size: 3.4rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.15);
}
.hero p {
    font-size: 1.3rem;
    color: var(--color-secondary);
    margin-bottom: 2rem;
}
.cta-btn {
    background: var(--color-primary);
    border: none;
    color: #fff;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 24px 0 rgba(31,38,135,0.10);
    transition: background 0.2s, color 0.2s;
}
/* ensure adequate contrast on alternate color schemes */
.red-theme .cta-btn {
    background: var(--color-accent);
}
.dark-theme .cta-btn {
    /* use accent color on dark backgrounds for better contrast */
    background: var(--color-accent);
    color: #fff;
}
.cta-btn:hover {
    background: var(--color-accent);
    color: #fff;
}
.services h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--color-primary);
}
.service-card {
    background: var(--glass-2);
    box-shadow: 0 4px 24px 0 rgba(31,38,135,0.10);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    /* let grid column size dictate width */
    width: auto;
    max-width: 240px;
    color: var(--color-primary);
}
.service-card h3 {
    margin-top: 0;
    color: var(--color-accent);
    font-size: 1.4rem; /* enlarge titles */
    font-weight: 900;
    display: flex;

}
@media (max-width: 1024px) {
    .nav-links { flex-direction: column; width:100%; }
    .navbar { flex-direction: row; align-items: center; justify-content: flex-start; padding: 1rem 1rem; }
    .menu-toggle { display: flex; margin-right: 0.5rem; }
    .logo { margin-right: 0.5rem; }

    /* Tablet: make the nav dropdown solid so content doesn't bleed through */
    header.navbar .nav-links {
        display: none !important;
        position: fixed !important;
        top: 64px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 88vw !important;
        max-width: 760px !important;
        background: rgba(255,255,255,0.98) !important;
        color: var(--color-primary) !important;
        backdrop-filter: none !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 10px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
        z-index: 200 !important;
        align-items: stretch !important;
    }
    header.navbar .nav-links.active { display: flex !important; }
    header.navbar .nav-links a { display: block !important; padding: 0.75rem 1rem !important; width: 100% !important; }
    header.navbar .menu-toggle { display: flex !important; }

    /* dark theme override for tablet nav */
    body.dark-theme header.navbar .nav-links {
        background: rgba(10,10,10,0.95) !important;
        color: var(--color-text) !important;
    }
    body.dark-theme header.navbar .nav-links a { color: var(--color-text) !important; }
}
@media (min-width: 1025px) {
    .menu-toggle { display: none !important; }
    .nav-links { display: flex !important; flex-direction: row !important; margin-top: 0; }
}

.service-card h3 .icon {
    font-size: 1.6rem; /* larger emoji only */
    line-height: 1;
}
.about h2, .contact h2 {
    color: var(--color-primary);
    font-size: 2rem;
    margin-bottom: 1rem;
}
.contact-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.contact-form label {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.95rem;
}
.contact-form input, .contact-form textarea {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--color-secondary);
    background: var(--glass-4);
    font-size: 1rem;
    resize: none;
}

/* make message textarea roughly 6 rows tall */
.contact-form textarea {
    min-height: 7.5rem; /* approx 6 rows at normal line-height */
}

/* focus + dark-mode input contrast improvements */
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* ensure readable typing color in dark theme */
body.dark-theme .contact-form input,
body.dark-theme .contact-form textarea {
    background: var(--glass-4);
    color: var(--color-text);
    border-color: rgba(255,255,255,0.08);
    caret-color: var(--color-accent);
}
body.dark-theme .contact-form input::placeholder,
body.dark-theme .contact-form textarea::placeholder {
    color: rgba(255,255,255,0.6);
}
.contact-form .submit-btn {
    background: var(--color-accent) !important;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    align-self: center;
}
.contact-form .submit-btn:hover {
    background: var(--color-accent-hover) !important;
}
.contact-form button:hover {
    background: var(--btn-hover-bg);
}
footer {
    text-align: center;
    padding: 1.5rem 0 1rem 0;
    color: var(--color-secondary);
    font-size: 1rem;
    background: var(--glass-1);
    margin-top: 2rem;
}

/* Contact form card styling */
.contact .contact-form {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(31,38,135,0.08);
    padding: 2rem;
    max-width: 720px;
    margin: 0 auto;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .contact .contact-form {
        padding: 1rem !important;
        width: calc(100% - 2rem) !important;
    }
}

/* dark-mode variant for the contact card */
body.dark-theme .contact .contact-form {
    background: var(--glass-1);
    color: var(--color-text);
    box-shadow: 0 14px 40px rgba(0,0,0,0.55);
}

/* keep submit button aligned inside card */
.contact .contact-form .submit-btn { align-self: center; }

.hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.10);
    border-radius: 0 0 40px 40px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}
.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) blur(2px) saturate(1.1);
}
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--glass-1);
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.10);
    backdrop-filter: blur(2px);
    border-radius: 30px;
    margin: 2rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--nav-bg);
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}
    .toggle-group {
    display: flex;
    gap: 0.2rem;
    position: fixed;
    top: 1px;
    right: 1rem;
    z-index: 101;
}
    
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--color-primary);
}
.nav-links {
    display: flex;
    gap: 2rem;
}
.nav-links a:last-child {
    margin-right: 0;
}
@media (min-width: 900px) {
    .nav-links a:last-child {
        margin-right: 7rem;
    }
}

@media (min-width: 900px) {
    .nav-links a:last-child {
        margin-right: 5rem;
    }
}


.nav-links a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover {
    color: var(--color-accent);
}
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 102;
}
.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    margin: 5px 0;
    transition: 0.3s;
}

@media (max-width: 768px) {
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}
.services {
    padding: 3rem 1rem 2rem 1rem;
    text-align: center;
}
.services h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--color-primary);
}
.service-list {
    display: grid;
    gap: 1rem;
    justify-content: center;
}

@media (max-width: 599px) {
    .service-list {
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    /* smaller cards and text on narrow screens */
    .service-card {
        padding: 1.5rem 1rem;
        width: 100%;
    }
    .service-card h3 {
        font-size: 1rem;
    }
    .service-card h3 .icon {
        font-size: 1.2rem;
    }
    /* mobile masthead tweaks */
    .hero h1 {
        font-size: 2.4rem;
    }
    .hero p {
        font-size: 1rem;
    }
}
@media (min-width: 600px) and (max-width: 899px) {
    .service-list {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 900px) and (max-width: 1199px) {
    .service-list {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 1200px) {
    .service-list {
        grid-template-columns: repeat(5, 1fr);
    }
}
.service-card h3 .icon {
    font-size: 1.6rem; /* larger emoji only */
    line-height: 1;
}
.about, .contact {
    padding: 3rem 1rem 2rem 1rem;
    text-align: center;
}
.about h2, .contact h2 {
    color: var(--color-primary);
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* gallery styles */
.gallery {
    padding: 3rem 1rem 2rem 1rem;
    text-align: center;
}
.gallery h2 {
    color: var(--color-primary);
    font-size: 2rem;
    margin-bottom: 1.5rem;
}
.gallery-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.gallery-tabs button {
    padding: 0.6rem 1rem;
    border: none;
    background: var(--color-accent);
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}
.gallery-tabs button.active {
    background: var(--color-accent-hover);
}
.gallery-tabs button:hover {
    background: var(--color-accent-hover);
}

.gallery-grid {
    display: grid;
    /* fixed column width to keep thumbnails uniform */
    grid-template-columns: repeat(auto-fill, 120px);
    gap: 0.5rem;
    justify-content: center;
    transition: opacity .3s;
    opacity: 1;
}
/* when fading to a new tag */
.gallery-grid.fade {
    opacity: 0;
}

@media (max-width: 599px) {
    .gallery {
        padding: 3rem 0.5rem 2rem 0.5rem;
    }
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 600px) and (max-width: 899px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
.gallery-grid.single {
    max-width: 440px; /* approximately two column width */
    margin: 0 auto;
}

/* back to top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    /* light mode: solid white for strong contrast against page */
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    backdrop-filter: none;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0.6;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-primary);
    transition: opacity .3s;
}
.back-to-top:hover {
    opacity: 1;
}

/* Dark mode: use accent color for strong contrast and visibility */
body.dark-theme .back-to-top {
    background: var(--color-accent);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
body.dark-theme .back-to-top:hover {
    background: var(--color-accent-hover);
}
.gallery-grid .item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3; /* uniform box size */
    border-radius: 12px;
}
.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.gallery-grid img:hover {
    transform: scale(1.05);
}

/* caption overlay */
.gallery-grid .item {
    position: relative;
    overflow: hidden;
}
.gallery-grid .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
}
.gallery-grid .item:hover .caption {
    opacity: 1;
}

/* lightbox styles */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 999;
}
#lightbox.visible {
    opacity: 1;
    pointer-events: auto;
}
#lightbox .lb-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: var(--glass-4);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
}
#lightbox img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
}
#lightbox .lb-tags {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}
#lightbox .lb-tags .badge {
    background: var(--color-accent);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}
#lightbox .lb-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    cursor: pointer;
}

@media (max-width: 700px) {
    .navbar {
        padding: 1rem;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 90vw;
        background: #fff;
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem 0.5rem;
        border-radius: 10px;
        box-sizing: border-box;
        box-shadow: 0 8px 32px 0 rgba(31,38,135,0.10);
    }
    body.dark-theme .nav-links {
        background: #222;
    }
    .nav-close-btn {
        position: absolute;
        top: 0.4rem;
        right: 0.6rem;
        background: none;
        border: none;
        color: var(--color-primary);
        font-size: 1.3rem;
        padding: 0.15rem 0.4rem;
        cursor: pointer;
        border-radius: 50%;
        transition: background 0.2s, transform 0.3s, opacity 0.3s;
        opacity: 0;
        transform: scale(0.7);
        z-index: 2;
        animation: navCloseBtnIn 0.3s forwards;
    }
    .nav-links.active .nav-close-btn {
        opacity: 1;
        transform: scale(1);
    }
    .nav-close-btn:hover {
        background: var(--glass-2);
        transform: scale(1.15);
    }
    @keyframes navCloseBtnIn {
        from { opacity: 0; transform: scale(0.7); }
        to { opacity: 1; transform: scale(1); }
    }
    .nav-links.active {
        display: flex;
    }
    .menu-toggle {
        display: flex;
    }
}

/* High-specificity safe overrides for nav behavior on tablet/mobile */
@media (max-width: 1024px) {
    header.navbar .nav-links {
        display: none !important;
        position: absolute !important;
        top: 60px !important;
        /* ensure any earlier translateX is cleared to avoid clipping */
        transform: none !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: calc(100% - 20px) !important;
        /* light mode: use solid white so content doesn't bleed through */
        background: #ffffff !important;
        backdrop-filter: none !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 10px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
        z-index: 200 !important;
        align-items: stretch !important;
    }

    header.navbar .nav-links.active {
        display: flex !important;
    }

    /* ensure nav items are stacked and full-width inside dropdown */
    header.navbar .nav-links a {
        display: block !important;
        padding: 0.75rem 1rem !important;
        background: transparent !important;
        color: var(--color-primary) !important;
        width: 100% !important;
    }

    /* styled close button placed inside the dropdown */
    header.navbar .nav-close-btn {
        position: absolute !important;
        top: 0.4rem !important;
        right: 0.6rem !important;
        background: none !important;
        border: none !important;
        color: var(--color-primary) !important;
        font-size: 1.3rem !important;
        padding: 0.15rem 0.4rem !important;
        cursor: pointer !important;
        border-radius: 50% !important;
        transition: background 0.2s, transform 0.3s, opacity 0.3s !important;
        opacity: 0 !important;
        transform: scale(0.85) !important;
        z-index: 210 !important;
    }

    header.navbar .nav-links.active .nav-close-btn {
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    /* show the hamburger toggle on tablet */
    header.navbar .menu-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 36px !important;
        height: 36px !important;
        cursor: pointer !important;
        z-index: 220 !important;
    }
}

/* Mobile only: up to 768px - ensure full-width dropdown behavior */
@media (max-width: 768px) {
    /* Mobile: centered floating dropdown similar to tablet */
    header.navbar .nav-links {
        display: none !important;
        position: fixed !important;
        top: 56px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90vw !important;
        max-width: 640px !important;
        /* light mode: solid white background for mobile dropdown */
        background: #ffffff !important;
        color: var(--color-primary) !important;
        backdrop-filter: none !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 10px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
        z-index: 200 !important;
        align-items: stretch !important;
    }

    header.navbar .nav-links.active { display: flex !important; }

    header.navbar .nav-links a {
        display: block !important;
        padding: 0.75rem 1rem !important;
        width: 100% !important;
    }

    /* Dark theme: use a dark opaque background for mobile nav */
    body.dark-theme header.navbar .nav-links {
        background: rgba(10,10,10,0.95) !important;
        color: var(--color-text) !important;
    }
    body.dark-theme header.navbar .nav-links a {
        color: var(--color-text) !important;
    }

    header.navbar .nav-close-btn {
        position: absolute !important;
        top: 0.35rem !important;
        right: 0.6rem !important;
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    header.navbar .menu-toggle {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    header.navbar .menu-toggle { display: none !important; }
    header.navbar .nav-links { display: flex !important; position: static !important; background: transparent !important; box-shadow: none !important; gap: 2rem !important; padding: 0 !important; }
}

/* Mobile-only: reduce hero height to ~1/4 screen and scale hero headings */
@media (max-width: 768px) {
    .hero {
        /* increase mobile hero height a bit for breathing room */
        min-height: 40vh !important;
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        color: #fff !important;
    }
    .hero-bg {
        display: block !important;
        height: 100% !important;
        overflow: hidden !important;
        position: absolute !important;
        inset: 0 !important;
        z-index: 1 !important;
    }
    .hero-bg img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    /* darken image with a solid overlay so text stays readable on mobile */
    .hero-bg::after {
        content: "" !important;
        position: absolute !important;
        inset: 0 !important;
        opacity: 0.55 !important;
        z-index: 2 !important;
        pointer-events: none !important;
    }
    .hero-content {
        z-index: 3 !important;
    }
    .hero-content {
        padding: 1rem !important;
        margin: 0.5rem !important;
        border-radius: 12px !important;
    }
    /* make main hero heading smaller and responsive only on mobile */
    .hero-content h1 {
        font-size: clamp(1.2rem, 5vw, 1.8rem) !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
    }
    /* if a smaller heading exists, make it responsive too */
    .hero-content h3 {
        font-size: clamp(0.95rem, 3.5vw, 1.2rem) !important;
        margin-top: 0.25rem !important;
        margin-bottom: 0.25rem !important;
    }
}

/* Mobile-only: make service list single column and cards full width */
@media (max-width: 768px) {
    .services .service-list {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .services .service-list .service-card,
    .service-card {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
        margin: 0 auto !important;
    }
}

/* Desktop: slightly reduce hero height for better balance */
@media (min-width: 760px) {
    .hero {
        min-height: 44vh !important;
    }
}
