/* ==========================================================================
   Calgary Concrete Masters - Responsive Overrides
   ========================================================================== */

/* Large Screen Adjustments (Desktop & Laptops) */
@media (max-width: 1200px) {
    .container {
        padding: 0 24px;
    }
    .nav-menu {
        gap: 20px;
    }
    .header-actions {
        gap: 12px;
    }
    .logo-main {
        font-size: 1.15rem;
    }
    .logo-sub {
        font-size: 0.7rem;
    }
}

/* Medium Screens (Laptops & Large Tablets) */
@media (max-width: 992px) {
    .section {
        padding: 50px 0;
    }
    
    .section-header {
        margin-bottom: 40px;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    /* Hero Layout */
    .hero {
        padding-top: calc(var(--header-height) + 20px);
        padding-bottom: 50px;
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .hero-content {
        max-width: 100%;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.75rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }


    .hero-trust-badges {
        justify-content: center;
    }
    
    .hero-card {
        max-width: 550px;
        margin: 0 auto;
        width: 100%;
    }
    
    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    /* Why Grid */
    .why-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    /* About Stack */
    .about-split {
        grid-template-columns: 1fr;
        gap: 0px;
    }
    
    .about-image-stack {
        max-width: 550px;
        margin: 0 0 0 10px;
        width: 100%;
    }
    
    /* Projects Grid */
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    /* Contact Split */
    .contact-split {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .contact-info-block {
        order: -1;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .contact-map-placeholder {
        grid-column: span 2;
    }
    
    /* Footer Grid */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    /* Service Detail */
    .service-detail-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .service-sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    /* ── Mobile Nav: breakpoint now 992px ── */

    /* Sticky Header on Mobile */
    .header {
        position: sticky !important;
        top: 0;
        z-index: 1000;
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: var(--shadow-sm);
        border-bottom: 1px solid var(--glass-border);
    }

    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 70px;
    }

    .logo {
        order: 1;
    }

    .logo-main {
        font-size: 1.1rem;
    }

    .logo-sub {
        font-size: 0.65rem;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }

    /* Re-order Header Actions & Hamburger Menu */
    .header-actions {
        order: 2;
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        margin-right: 12px;
    }

    .hamburger {
        order: 3;
        display: flex;
        z-index: 1001;
        margin-left: 0;
        align-self: center;
    }

    /* Hamburger active state transforms to X close button */
    .hamburger.is-active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .hamburger.is-active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.is-active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Circular Mobile Icon Buttons */
    .theme-toggle,
    .phone-link-header,
    .whatsapp-link-header {
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border: none !important;
        transition: all 0.3s ease !important;
    }

    /* Theme Toggle mobile background */
    .theme-toggle {
        background-color: var(--bg-alt) !important;
        border: 1px solid var(--border-color) !important;
    }
    
    [data-theme="dark"] .theme-toggle {
        background-color: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    /* Phone button circular layout (Primary Color) */
    .phone-link-header {
        background-color: var(--primary-color) !important;
        color: #ffffff !important;
        border: 1px solid var(--border-color) !important;
    }

    .phone-link-header:hover {
        background-color: var(--accent-color) !important;
        color: #ffffff !important;
        border: 1px solid var(--border-color) !important;
    }
    
    [data-theme="dark"] .phone-link-header {
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .phone-link-header span {
        display: none !important;
    }

    .phone-link-header svg {
        width: 16px !important;
        height: 16px !important;
        fill: #ffffff !important;
    }

    /* Remove WhatsApp from mobile headers */
    .whatsapp-link-header {
        display: none !important;
    }

    .header-actions .btn-outline {
        display: none !important;
    }

    /* ── Full-Screen Off-Canvas Mobile Navigation Menu ── */
    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background-color: var(--bg-color) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-right: none;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 80px 32px 0 32px;
        padding-bottom: 90px;
        gap: 20px;
        box-shadow: none;
        z-index: 999;
        /* Slide in from left via transform */
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.is-active {
        transform: translateX(0);
        left: 0;
        box-shadow: none;
    }
    
    .nav-link {
        font-size: 1.2rem;
        font-weight: 600;
        width: auto;
        padding: 8px 0;
        border-bottom: none;
        text-align: left;
    }

    /* Mobile Submenu accordion styling */
    .has-submenu {
        width: 100%;
        text-align: left;
    }

    .submenu-trigger-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        position: relative;
    }

    /* Tapping services navigates, tapping chevron expands */
    .submenu-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: var(--bg-alt);
        border: 1px solid var(--border-color);
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 50%;
        color: var(--text-color);
        cursor: pointer;
        padding: 0;
        transition: all 0.3s ease;
    }

    .submenu-arrow-icon {
        width: 18px;
        height: 18px;
        fill: currentColor;
        transition: transform 0.3s ease;
    }

    .submenu-toggle-btn.is-active {
        background: var(--accent-gradient);
        color: #ffffff;
        border-color: transparent;
    }

    .submenu-toggle-btn.is-active .submenu-arrow-icon {
        transform: rotate(180deg);
    }

    .submenu-arrow {
        display: none !important;
    }

    .submenu {
        position: static;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transform: none;
        box-shadow: none;
        background: transparent;
        border: none;
        border-left: 2px solid var(--border-color);
        border-radius: 0px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        width: 100%;
        padding: 0;
        margin: 0 0 0 15px;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease,
                    padding 0.3s ease,
                    visibility 0.4s;
    }

    .submenu.is-open {
        max-height: 400px !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 8px 0 8px 15px !important;
    }

    .submenu li {
        text-align: left;
    }

    .submenu a {
        font-size: 0.9rem;
        padding: 6px 0;
        color: var(--text-muted);
        font-weight: 600;
        transition: color 0.2s ease;
        display: block;
    }

    .submenu a:hover {
        background: transparent;
        color: var(--accent-color) !important;
    }

    /* ── Fixed "Get Free Estimate" CTA at bottom of off-canvas menu ── */
    .mobile-menu-cta {
        display: block !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        padding: 16px 24px !important;
        background-color: var(--bg-color) !important;
        border-top: 1px solid var(--border-color) !important;
        z-index: 1000 !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08) !important;
        /* Hidden when menu is closed */
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    /* Show CTA only when nav-menu is open */
    .nav-menu.is-active ~ * .mobile-menu-cta,
    .nav-menu.is-active .mobile-menu-cta {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    
    .mobile-menu-cta .btn {
        width: 100% !important;
        padding: 14px 24px !important;
        font-size: 1rem !important;
        text-align: center !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .stat-number {
        font-size: 2.2rem !important;
    }

    .stat-title {
        font-size: 0.8rem !important;
    }

    .stat-item {
        border-right: none;
        padding: 15px;
        background-color: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
    }
    
    /* Services Grid to Single Column on Mobile */
    .services-grid {
        grid-template-columns: 1fr !important;
        max-width: 500px !important;
        margin: 0 auto !important;
        gap: 30px !important;
    }
    
    .why-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* Projects Grid */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Review Card padding */
    .review-card {
        padding: 24px;
    }
    
    .review-text {
        font-size: 1rem;
    }
    
    /* Contact Page split info adjustments */
    .contact-info-block {
        grid-template-columns: 1fr;
    }
    
    .contact-map-placeholder {
        grid-column: span 1;
    }
    
    /* Footer Elements */
    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    /* Lightbox Navigation */
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-nav {
        background-color: rgba(0, 0, 0, 0.6);
    }
    
    /* Service Detail Sidebar */
    .service-sidebar {
        grid-template-columns: 1fr;
    }

    /* Page header */
    .page-header {
        background-color: var(--primary-color);
        color: #ffffff;
        padding: 30px 0 30px 0;
        position: relative;
    }

    p {
        font-size: 14px !important;
    }
}

/* Extra Small Screens (Portrait Phones) */
@media (max-width: 480px) {
    :root {
        --header-height: 70px;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .hero-content h1 {
        font-size: 1.9rem;
    }
    
    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 25px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .hero-trust-badges {
        flex-direction: row;
        gap: 15px;
        align-items: center;
    }
    
    .hero-card {
        padding: 20px;
    }
    
    .hero-card h3 {
        font-size: 1.15rem;
    }
    
    /* Stats Grid (50-50% width on extra small screens) */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .stat-number {
        font-size: 1.8rem !important;
    }

    .stat-title {
        font-size: 0.75rem !important;
    }
    
    /* Projects Grid (50-50% width on extra small screens) */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-width: none !important;
        margin: 0 !important;
    }
    
    /* About Stack Sub-image hidden on small screens */
    .about-img-sub {
        display: none;
    }
    
    .about-img-main {
        width: 100%;
        height: 280px;
    }
    
    .about-features {
        grid-template-columns: 1fr;
    }
    
    /* FAQ triggers font adjustment */
    .faq-trigger {
        font-size: 0.98rem;
    }
    
    /* Form wrapper padding */
    .contact-card-form {
        padding: 24px 20px;
    }
    
    /* Footer layout */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-col h3 {
        margin-bottom: 16px;
    }
    
    /* Error Code in 404 */
    .error-code {
        font-size: 5rem;
    }
    
    .error-title {
        font-size: 1.5rem;
    }
    
    .error-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .error-buttons .btn {
        width: 100%;
    }
    
    /* Page headers styling */
    .page-header h1 {
        font-size: 2rem;
    }
    
    .service-main-image {
        height: 240px;
    }
    
    .service-features-list {
        grid-template-columns: 1fr;
    }
}

/* Landscape Phone Viewport heights adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding-top: 100px;
    }
    
    .nav-menu {
        padding-top: 60px;
        gap: 14px;
    }
    
    .nav-link {
        padding: 4px 0;
        font-size: 1rem;
    }
}

/* Sticky Hamburger Animations (global, not inside media query) */
.hamburger.is-active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.is-active span:nth-child(2) {
    opacity: 0;
}

.hamburger.is-active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Desktop: ensure mobile-only elements are hidden */
@media (min-width: 993px) {
    .hamburger {
        display: none !important;
    }
    .mobile-menu-cta {
        display: none !important;
    }
    .mobile-nav-overlay {
        display: none !important;
    }
    /* Reset nav-menu transform on desktop */
    .nav-menu {
        transform: none !important;
    }
}

@media (max-width:767px) {
.hero-badge {
    display: flex;
    flex-direction: column;
}
}

@media (max-width: 992px) {
    .hero-content {
        margin-top: -40px;
    }
}