/* ==========================================
   C.D.S. Corporation - Responsive Styles
   ========================================== */

/* Medium Desktop / Half-Screen Styles */
@media (max-width: 1550px) and (min-width: 1401px) {
    /* Move logo left more for this specific range */
    .nav-container {
        padding: 1rem 7rem 0.25rem 4rem;
    }
    
    .nav-menu {
        transform: translateX(-3rem);
    }
}

@media (max-width: 1400px) {
    /* Reduce nav menu left offset to prevent logo overlap */
    .nav-menu {
        transform: translateX(-2rem);
    }
    
    /* Logo moves inward like other websites */
    .nav-container {
        padding: 1rem 6rem 0.25rem 3rem;
    }
}

@media (max-width: 1200px) and (min-width: 1101px) {
    /* Logo moves more left in this range before hamburger */
    .nav-container {
        padding: 1rem 4rem 0.25rem 2.5rem;
    }
    
    .nav-menu {
        transform: translateX(-0.5rem);
    }
}

@media (max-width: 1100px) {
    /* Switch to mobile hamburger menu */
    .nav-menu, .cta-button {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
        justify-self: end; /* Right align hamburger */
    }
    
    .nav-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        padding: 1rem 2rem 0.25rem 2rem;
        gap: 1rem;
    }
    
    .logo-img {
        height: 70px; /* Larger logo in mobile */
    }
    
    /* Adjust main content margin for larger mobile header */
    main {
        margin-top: 90px;
    }
}



/* Tablet Styles */
@media (max-width: 968px) {
    .container {
        padding: 0 15px;
    }
    
    /* Hero Section */
    .hero-headline {
        font-size: 2.5rem;
    }
    
    .hero-subheadline {
        font-size: 1.3rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Trust Section */
    .trust-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .trust-stats {
        flex-direction: row;
        justify-content: space-around;
    }
    
    /* Project Categories */
    .project-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Fix 2-column layouts on tablets - stack on tablet size too */
    div[style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
        grid-template-columns: unset !important;
    }
    
    div[style*="grid-template-columns: 1fr 1fr"] > div {
        margin-bottom: 2rem;
    }
    
    div[style*="grid-template-columns: 1fr 1fr"] > div:last-child {
        margin-bottom: 0;
    }
}

/* Small Mobile Styles */
@media (max-width: 768px) {
    /* Smaller padding for very small screens with hamburger closer to right */
    .nav-container {
        padding: 0.75rem 1rem 0.25rem 1rem;
    }
    
    /* Move hamburger menu closer to right edge */
    .mobile-menu-toggle {
        margin-right: 0;
    }
    
    .logo-img {
        height: 60px; /* Slightly smaller on very small screens */
    }
    
    /* Typography */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    /* Hero Section */
    .hero {
        height: 70vh;
        min-height: 500px;
    }
    
    .hero-headline {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-subheadline {
        font-size: 1.2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    /* Sections */
    .services-overview,
    .trust-section,
    .featured-projects,
    .contact-cta {
        padding: 60px 0;
    }
    
    /* Services Grid */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    /* Trust Section */
    .trust-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .stat-item h3 {
        font-size: 2.5rem;
    }
    
    /* Project Categories */
    .project-categories {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-category {
        height: 250px;
    }
    
    /* Contact CTA */
    .cta-content h2 {
        font-size: 2rem;
    }
    
    .cta-content p {
        font-size: 1.1rem;
    }
    
    .cta-actions {
        flex-direction: column;
        align-items: center;
    }
    
    /* Footer */
    .footer {
        padding: 40px 0 20px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    /* Fix forced 2-column layouts on About, Contact, and Apply pages */
    /* About page: Our Story section */
    .services-overview div[style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
        grid-template-columns: unset !important;
    }
    
    .services-overview div[style*="grid-template-columns: 1fr 1fr"] > div {
        margin-bottom: 2rem;
    }
    
    /* Apply page: Current Opportunities section */
    section div[style*="grid-template-columns: 1fr 1fr; gap: 2rem"] {
        display: block !important;
        grid-template-columns: unset !important;
    }
    
    section div[style*="grid-template-columns: 1fr 1fr; gap: 2rem"] > div {
        margin-bottom: 2rem;
    }
    
    /* Hide Services section, logo, and trust section on mobile */
    .footer-nav:nth-child(2),
    .footer-logo,
    .trust-section {
        display: none;
    }
    
    /* Change Contact Info heading on mobile */
    .footer-contact h4 {
        font-size: 1rem;
        text-indent: -9999px;
        position: relative;
        text-align: center;
    }
    
    .footer-contact h4::before {
        content: "Construction Drilling Services Corp.";
        text-indent: 0;
        position: absolute;
        left: 50%;
        top: 0;
        transform: translateX(-50%);
        width: 100%;
        text-align: center;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    /* Move hamburger even closer to edge on very small screens */
    .nav-container {
        padding: 0.75rem 0.5rem 0.25rem 1rem;
    }
    
    /* Ensure all 2-column layouts become single column */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] {
        display: block !important;
        grid-template-columns: unset !important;
        gap: 1.5rem !important;
    }
    
    /* Add spacing between stacked elements */
    div[style*="grid-template-columns: 1fr 1fr"] > div,
    div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] > div {
        margin-bottom: 1.5rem !important;
    }
    
    /* Remove bottom margin from last child */
    div[style*="grid-template-columns: 1fr 1fr"] > div:last-child,
    div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] > div:last-child {
        margin-bottom: 0 !important;
    }
    
    /* Hero Section */
    .hero-headline {
        font-size: 1.8rem;
    }
    
    .hero-subheadline {
        font-size: 1.1rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
    }
    
    /* Buttons */
    .btn-primary, .btn-secondary {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    /* Service Cards */
    .service-card {
        padding: 1.2rem;
    }
    
    .service-card h3 {
        font-size: 1.2rem;
    }
    
    .service-card p {
        font-size: 0.9rem;
    }
    
    /* Project Categories */
    .project-category {
        height: 220px;
    }
    
    .project-overlay {
        padding: 1.5rem 1rem 1rem;
    }
    
    .project-overlay h3 {
        font-size: 1.2rem;
    }
    
    .project-overlay p {
        font-size: 0.85rem;
    }
    
    /* Contact CTA */
    .cta-content h2 {
        font-size: 1.8rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
}

/* Mobile Menu Animations */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #000000;
        --secondary: #000000;
        --accent: #0066cc;
        --text-light: #000000;
        --borders: #000000;
    }
    
    .hero-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .service-card, .project-category {
        border: 2px solid #000000;
    }
}

/* Focus Styles for Accessibility */
a:focus,
button:focus,
.mobile-menu-toggle:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .mobile-menu,
    .hero,
    .contact-cta,
    .footer {
        display: none;
    }
    
    .services-overview,
    .trust-section,
    .featured-projects {
        padding: 20px 0;
    }
    
    .services-grid,
    .project-categories {
        display: block;
    }
    
    .service-card,
    .project-category {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}