/* Responsive CSS - Breakpoints & Mobile Overrides for Alnitak Construction */

/* ==========================================
   MEDIUM TABLETS & SMALLER (<= 992px)
   ========================================== */
@media screen and (max-width: 992px) {
    /* CRITICAL: Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    *, *::before, *::after {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Header Container */
    .site-header {
        background-color: #FFFFFF !important;
        position: sticky;
        top: 0;
        width: 100%;
        z-index: 1000;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    }
    
    .header-inner {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        height: 72px;
        position: relative;
        width: 100%;
        padding: 0 0.25rem;
    }
    
    /* Logo Box on Mobile */
    .logo-box {
        position: relative;
        height: 100%;
        width: auto;
        border: none;
        box-shadow: none;
        display: flex;
        align-items: center;
        background-color: transparent;
        padding: 0;
        z-index: 10;
    }
    
    .brand-link {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        text-decoration: none;
        padding: 0;
    }
    
    .brand-logo-img {
        height: 38px !important;
        width: 38px !important;
        object-fit: contain;
        flex-shrink: 0;
    }
    
    /* Prevent the global img { width: 100% !important } rule (≤768px / ≤576px)
       from expanding the mobile drawer brand logo and hiding the text next to it */
    .mobile-drawer-brand img {
        height: 36px !important;
        width: 36px !important;
        object-fit: contain;
        flex-shrink: 0;
    }
    
    .brand-text-block {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }
    
    .brand-main-title {
        font-family: 'Jost', sans-serif !important;
        font-size: 1.15rem !important;
        font-weight: 800 !important;
        color: #18181B !important;
        line-height: 0.95 !important;
        letter-spacing: 0.03em !important;
        text-transform: uppercase !important;
        white-space: nowrap !important;
    }
    
    .brand-sub-title {
        font-family: 'Jost', sans-serif !important;
        font-size: 0.52rem !important;
        font-weight: 800 !important;
        color: #D97706 !important;
        letter-spacing: 0.16em !important;
        text-transform: uppercase !important;
        line-height: 1 !important;
        margin-top: 2px !important;
        white-space: nowrap !important;
    }
    
    /* Hide Desktop Top Bar & Desktop Navigation on Mobile */
    .header-top-bar {
        display: none !important;
    }
    
    .desktop-nav {
        display: none !important;
    }
    
    .nav-cta-btn {
        display: none !important;
    }
    
    /* Main Nav container on Mobile */
    .header-main-nav {
        height: 100%;
        background-color: transparent !important;
        padding: 0 !important;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: auto;
    }
    
    /* Mobile Action Buttons in Header */
    .mobile-nav-actions {
        display: flex !important;
        align-items: center;
        gap: 0.45rem;
    }
    
    .mobile-quote-btn {
        padding: 0.38rem 0.65rem !important;
        font-size: 0.72rem !important;
        font-family: 'Jost', sans-serif !important;
        font-weight: 700 !important;
        color: #18181B !important;
        border: 1.5px solid #27272A !important;
        background: transparent !important;
        letter-spacing: 0.03em;
        height: auto;
        min-height: auto;
        border-radius: 3px;
        white-space: nowrap;
        text-transform: uppercase;
    }
    
    .mobile-quote-btn:hover {
        background: #18181B !important;
        color: #FFFFFF !important;
    }
    
    .mobile-nav-toggle {
        background: none;
        border: 1.5px solid #D4D4D8 !important;
        color: #18181B !important;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        border-radius: 4px;
        transition: all 0.2s;
        line-height: 1;
        padding: 0;
    }
    
    .mobile-nav-toggle:hover {
        background-color: #F4F4F5;
        border-color: #18181B;
    }
    
    /* Extra Narrow Mobile Viewport (<= 380px) */
    @media screen and (max-width: 380px) {
        .header-inner {
            padding: 0 0.15rem;
            height: 66px;
        }
        .brand-link {
            gap: 0.35rem;
        }
        .brand-logo-img {
            height: 32px !important;
            width: 32px !important;
        }
        .brand-main-title {
            font-size: 1.02rem !important;
            letter-spacing: 0.02em !important;
        }
        .brand-sub-title {
            font-size: 0.46rem !important;
            letter-spacing: 0.14em !important;
        }
        .mobile-nav-actions {
            gap: 0.35rem;
        }
        .mobile-quote-btn {
            padding: 0.32rem 0.5rem !important;
            font-size: 0.65rem !important;
        }
        .mobile-nav-toggle {
            width: 33px;
            height: 33px;
            font-size: 1.1rem;
        }
    }
    
    /* Backdrop overlay */
    .mobile-nav-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(4px);
        z-index: 100000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-nav-backdrop.active {
        display: block;
        opacity: 1;
    }
    
    /* Premium Slide-over Drawer (Clean Grey / White Website Theme) */
    .mobile-nav-drawer {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -320px;
        width: 310px;
        max-width: 88vw;
        height: 100vh;
        background-color: #FFFFFF; /* Crisp Clean White */
        z-index: 100001; /* Higher than backdrop */
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
        transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-nav-drawer.active {
        right: 0;
    }
    
    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.15rem;
        border-bottom: 1px solid #E4E4E7;
        background-color: #F4F4F5; /* Light subtle grey surface */
        gap: 0.5rem;
    }
    
    .mobile-drawer-brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        min-width: 0;
        flex: 1;
    }
    
    .mobile-drawer-close {
        background: #FFFFFF;
        border: 1px solid #D4D4D8;
        color: #18181B;
        width: 34px;
        height: 34px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.15rem;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s;
        line-height: 1;
        flex-shrink: 0;
    }
    
    .mobile-drawer-close:hover {
        background: #E4E4E7;
        color: #000000;
    }
    
    .mobile-drawer-nav {
        padding: 0.85rem 0.85rem;
        flex: 1;
    }
    
    .mobile-menu-list {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    
    .mobile-menu-list li {
        width: 100%;
    }
    
    .mobile-menu-list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0.95rem;
        font-family: 'Jost', sans-serif !important;
        font-size: 1.05rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #27272A;
        border-radius: 4px;
        text-decoration: none;
        border-bottom: 1px solid #F4F4F5;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-list a:hover {
        background-color: #FAFAFA;
        color: #D97706;
        padding-left: 1.15rem;
    }

    .mobile-menu-list a.active {
        background-color: #F4F4F5;
        color: #D97706;
        font-weight: 800;
        border-left: 3px solid #D97706;
        padding-left: 1.15rem;
    }
    
    .mobile-drawer-footer {
        padding: 1.15rem;
        border-top: 1px solid #E4E4E7;
        background-color: #F4F4F5;
        margin-top: auto;
    }
    
    .mobile-drawer-footer .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 0.85rem;
        font-size: 0.9rem;
    }
    
    /* Split layouts collapse to vertical */
    .split-wrapper {
        grid-template-columns: 1fr;
        gap: 3.5rem;
    }
    
    .overlap-image-container {
        height: 420px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* Grid system stack */
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .services-grid-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
        gap: 2rem;
    }
    
    .pricing-card.highlighted {
        transform: none;
    }
    
    .pricing-card.highlighted:hover {
        transform: translateY(-5px);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
}

/* ==========================================
   SMARTPHONES (<= 768px)
   ========================================== */
@media screen and (max-width: 768px) {
    /* CRITICAL: Prevent horizontal overflow */
    *, *::before, *::after {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Sections spacing */
    .section {
        padding: var(--spacing-xl) 0;
    }
    
    /* Container adjustments */
    .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Hero slider sizes */
    .hero-slider-content .hero-heading {
        font-size: 2.5rem;
    }
    
    .hero-slider-content .hero-subtext {
        font-size: 0.95rem;
        margin-bottom: 1.75rem;
    }
    
    .hero-slider-arrow {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .hero-slider-arrow-prev {
        left: 10px;
    }
    
    .hero-slider-arrow-next {
        right: 10px;
    }
    
    /* Single Image Wrapper Shrink */
    .philosophy-image-wrapper {
        height: 320px !important;
        min-height: 320px !important;
        width: 100% !important;
        margin-bottom: 2rem !important;
    }
    
    .overlap-image-container,
    .overlap-image-container-redesigned {
        height: 280px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 2rem !important;
    }
    
    .overlap-bg-frame {
        display: none !important;
    }
    
    .overlap-img-front,
    .overlap-img-front-redesigned {
        border-width: 4px !important;
        width: 58% !important;
        height: 72% !important;
    }
    
    .overlap-img-back,
    .overlap-img-back-redesigned {
        width: 72% !important;
        height: 80% !important;
    }
    
    /* Split layout fixes */
    .split-wrapper {
        flex-direction: column;
        gap: 2rem;
    }
    
    .split-wrapper > div {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Stats 2x2 grid on mobile */
    .stats-grid-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.75rem 0.75rem !important;
        width: 100% !important;
    }
    
    .stat-item-premium {
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }
    
    .stat-item-premium:not(:last-child)::after {
        display: none !important;
    }
    
    .stat-box-container {
        font-size: 2.1rem !important;
        padding: 0.35rem 1rem !important;
        min-width: 85px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .stat-label-row1 {
        font-size: 0.95rem !important;
        line-height: 1.15;
    }
    
    .stat-label-row2 {
        font-size: 0.82rem !important;
        line-height: 1.2;
    }
    
    /* Testimonials stack to single */
    .testimonials-slide-wrapper {
        flex: 0 0 100%;
    }
    
    .testimonials-duo-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Process timeline horizontal -> vertical */
    .process-timeline-row {
        flex-direction: column;
        gap: 2.5rem;
    }
    
    .process-line-connector {
        top: 0;
        bottom: 0;
        left: 40px;
        right: auto;
        width: 2px;
        height: 100%;
    }
    
    .process-step-node {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 0;
    }
    
    .process-step-number {
        width: 60px;
        height: 60px;
        font-size: 1.25rem;
        flex-shrink: 0;
        margin-bottom: 0;
        margin-right: 1.5rem;
    }
    
    .process-step-title {
        font-size: 1.15rem;
        margin-top: 0.5rem;
    }
    
    /* Portfolio masonry stack */
    .portfolio-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Image fixes */
    img {
        max-width: 100%;
        height: auto;
        width: 100% !important;
    }
    
    /* Prevent overflow in all containers */
    div, section, article, aside {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Projects page filter buttons - FIX CUTTING PROBLEM */
    .portfolio-tabs-wrapper {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        overflow-x: hidden;
        margin-bottom: 2rem;
    }
    
    .portfolio-tab-btn {
        width: 100%;
        text-align: center;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border: 1px solid var(--border-color);
        background: white;
        color: var(--charcoal);
        transition: all 0.2s;
        font-family: var(--font-heading);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        cursor: pointer;
    }
    
    .portfolio-tab-btn.active,
    .portfolio-tab-btn:hover {
        background: var(--primary-blue);
        color: white;
        border-color: var(--primary-blue);
    }
    
    /* Pricing page - FIX CUTTING PROBLEM */
    .pricing-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .pricing-card-title {
        font-size: 1.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .pricing-card-price {
        font-size: 2rem;
        word-wrap: break-word;
    }
    
    /* About page - FIX CUTTING PROBLEM */
    .about-split-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .about-split-content > div {
        width: 100%;
        max-width: 100%;
    }
    
    /* Contact form - FIX CUTTING PROBLEM */
    .form-control {
        width: 100%;
        max-width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }
    
    textarea.form-control {
        width: 100%;
        max-width: 100%;
        min-height: 120px;
    }
    
    /* CTA sections - FIX CUTTING PROBLEM */
    .cta-section-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .cta-section-content > div {
        width: 100%;
        max-width: 100%;
    }
    
    .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .cta-buttons .btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================
   EXTRA SMALL SCREENS (<= 576px)
   ========================================== */
@media screen and (max-width: 576px) {
    /* CRITICAL: Prevent horizontal overflow */
    *, *::before, *::after {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Container adjustments */
    .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Forms collapse */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group-full {
        grid-column: span 1;
    }
    
    /* Grid system single column */
    .grid-3, .grid-4, .services-grid-wrapper, .portfolio-masonry-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Image fixes - prevent overflow */
    img {
        max-width: 100%;
        height: auto;
        width: 100% !important;
    }
    
    /* Split layout fixes */
    .split-wrapper {
        flex-direction: column;
        gap: 2rem;
    }
    
    .split-wrapper > div {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Overlap image container fixes */
    .overlap-image-container,
    .overlap-image-container-redesigned {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 250px !important;
        margin: 0 auto 2rem auto !important;
    }
    
    .overlap-img-front,
    .overlap-img-front-redesigned,
    .overlap-img-back,
    .overlap-img-back-redesigned {
        width: 90% !important;
        height: auto !important;
        max-width: 90% !important;
    }
    
    /* Testimonial cards */
    .testimonials-duo-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .testimonial-card-premium {
        padding: 1.5rem !important;
    }
    
    /* About actions */
    .about-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Hero buttons */
    .hero-slider-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .hero-slider-buttons .btn {
        width: 100%;
    }
    
    /* Floating actions */
    .floating-actions-bar {
        bottom: 20px;
        right: 20px;
    }
    
    .float-action-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    /* Section padding reduction */
    .section {
        padding: 3rem 0;
    }
    
    /* Text size adjustments */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    /* Fix any overflowing elements */
    div, section, article, aside {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* PROJECTS PAGE - FIX FILTER BUTTONS CUTTING */
    .portfolio-tabs-wrapper {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        overflow-x: hidden;
        margin-bottom: 2rem;
    }
    
    .portfolio-tab-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border: 1px solid var(--border-color);
        background: white;
        color: var(--charcoal);
        transition: all 0.2s;
        font-family: var(--font-heading);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        cursor: pointer;
    }
    
    .portfolio-tab-btn.active,
    .portfolio-tab-btn:hover {
        background: var(--primary-blue);
        color: white;
        border-color: var(--primary-blue);
    }
    
    /* PRICING PAGE - FIX CUTTING PROBLEM */
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .pricing-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 1.5rem;
    }
    
    .pricing-card-title {
        font-size: 1.15rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
    
    .pricing-card-price {
        font-size: 1.75rem;
        word-wrap: break-word;
    }
    
    .pricing-card-features {
        font-size: 0.9rem;
    }
    
    .pricing-card-features li {
        padding: 0.5rem 0;
        word-wrap: break-word;
    }
    
    /* ABOUT PAGE - FIX CUTTING PROBLEM */
    .about-split-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .about-split-content > div {
        width: 100%;
        max-width: 100%;
    }
    
    .about-text-content {
        font-size: 0.95rem;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* CONTACT FORM - FIX CUTTING PROBLEM */
    .form-control {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border: 1px solid var(--border-color);
    }
    
    textarea.form-control {
        width: 100%;
        max-width: 100%;
        min-height: 100px;
        resize: vertical;
    }
    
    /* CTA SECTIONS - FIX CUTTING PROBLEM */
    .cta-section-content {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
    }
    
    .cta-section-content > div {
        width: 100%;
        max-width: 100%;
    }
    
    .cta-section-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .cta-section-text {
        font-size: 0.9rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .cta-buttons .btn {
        width: 100%;
        text-align: center;
        padding: 0.85rem 1rem;
        font-size: 0.85rem;
    }
    
    /* HOME PAGE - FIX CUTTING PROBLEM */
    .section-title {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Founder section */
    .founder-note-box {
        padding: 1.5rem;
        font-size: 0.9rem;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Journey cards */
    .journey-card {
        padding: 1.5rem;
    }
    
    .journey-card-title {
        font-size: 1.1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .journey-card-text {
        font-size: 0.85rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Service cards */
    .service-card-premium {
        padding: 1.5rem;
    }
    
    .service-card-title {
        font-size: 1.1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .service-card-desc {
        font-size: 0.85rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix text overflow in all paragraphs */
    p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
    
    /* Fix headings overflow */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}
