/* ========================================
   MUSTANG FENCING AND GATES - RESPONSIVE
   Mobile-First Responsive Design
   ======================================== */

/* ===== LARGE DESKTOPS (1400px+) ===== */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 5.5rem;
    }

    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== DESKTOPS (1200px - 1399px) ===== */
@media (max-width: 1399px) {
    .container {
        max-width: 1200px;
    }

    .footer-grid {
        grid-template-columns: 1.5fr repeat(3, 1fr);
        gap: 40px;
    }
}

/* ===== LAPTOPS (992px - 1199px) ===== */
@media (max-width: 1199px) {
    :root {
        --section-padding: 80px;
    }

    .nav-menu {
        gap: 25px;
    }

    .hero-stats {
        gap: 40px;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 250px);
    }

    .gallery-item:first-child {
        grid-column: span 1;
        grid-row: span 1;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

/* ===== TABLETS (768px - 991px) ===== */
@media (max-width: 991px) {
    :root {
        --section-padding: 70px;
    }

    /* Navigation */
    .navbar {
        padding: 15px 0;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        background: var(--bg-dark);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
        transition: var(--transition-medium);
        z-index: 1001;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-link {
        font-size: 1.2rem;
    }

    .nav-cta {
        margin-left: 0;
        margin-top: 20px;
    }

    .menu-toggle {
        display: flex;
        z-index: 1002;
    }

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

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

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

    /* Mobile Menu Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-medium);
        z-index: 1000;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Hero */
    .hero-stats {
        flex-direction: column;
        gap: 30px;
    }

    .stat-item {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .gallery-item {
        height: 250px;
    }

    /* Testimonials */
    .testimonial-card {
        flex: 0 0 350px;
    }

    /* Why Section */
    .why-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* CTA */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand p {
        max-width: 100%;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-contact-item {
        justify-content: center;
    }

    .footer-bottom .container {
        flex-direction: column;
        text-align: center;
    }

    /* Chat Widget */
    .chat-window {
        width: calc(100vw - 40px);
        max-width: 380px;
        right: -10px;
    }
}

/* ===== LARGE PHONES (576px - 767px) ===== */
@media (max-width: 767px) {
    :root {
        --section-padding: 60px;
    }

    /* Mobile: Iframe embed section - reduce height dramatically */
    .iframe-embed-section iframe {
        min-height: 280px !important;
        max-height: 350px !important;
    }

    /* Mobile: Services section - reduce top padding significantly */
    .services-section {
        padding-top: 20px !important;
    }

    /* Why section grid - stack on mobile */
    .why-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        margin-top: 30px !important;
    }

    /* Why section subtitle - reduce width on mobile */
    .why-subtitle {
        max-width: 100% !important;
        padding: 0 20px;
    }

    /* Why section - mobile font sizes */
    .why-grid h3 {
        font-size: 1.4rem !important;
    }

    .why-grid strong {
        font-size: 1rem !important;
    }

    .why-grid p {
        font-size: 0.9rem !important;
    }

    /* Why section - benefit cards padding on mobile */
    .why-grid > div > div {
        padding: 30px 20px !important;
    }

    /* Why section - benefit items mobile responsive */
    .benefit-item {
        gap: 10px !important;
        padding: 15px !important;
    }

    .benefit-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .benefit-icon i {
        font-size: 1.2rem !important;
    }

    .benefit-text strong {
        font-size: 0.95rem !important;
    }

    .benefit-text p {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }

    /* Why section - button adjustment */
    .why-grid .btn-large {
        font-size: 1rem !important;
        padding: 15px 30px !important;
    }

    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }

    /* Buttons */
    .btn {
        padding: 14px 30px;
        font-size: 0.9rem;
    }

    .btn-large {
        padding: 16px 35px;
    }

    /* Hero */
    .hero {
        min-height: 100vh;
        padding-top: 80px;
    }

    .hero-badge {
        padding: 8px 20px;
        font-size: 0.8rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 20px;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-card-image {
        height: 200px;
    }

    /* Why Section */
    .why-grid {
        grid-template-columns: 1fr;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item {
        height: 300px;
    }

    /* Testimonials */
    .testimonial-card {
        flex: 0 0 300px;
        padding: 30px;
    }

    .testimonial-text {
        font-size: 1rem;
    }

    /* Areas */
    .areas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .area-item {
        padding: 12px;
        font-size: 0.9rem;
    }

    .area-item i {
        font-size: 1rem;
    }

    /* Financing Banner */
    .financing-content {
        flex-direction: column;
        text-align: center;
    }

    .financing-text {
        flex-direction: column;
    }

    /* Page Header */
    .page-header {
        padding: 140px 0 60px;
    }

    /* Chat Widget */
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }

    .chat-button {
        width: 60px;
        height: 60px;
    }

    .chat-button i {
        font-size: 1.5rem;
    }

    .chat-window {
        bottom: 80px;
        width: calc(100vw - 40px);
        right: -10px;
    }
}

/* ===== SMALL PHONES (under 576px) ===== */
@media (max-width: 575px) {
    :root {
        --section-padding: 50px;
    }

    .container {
        padding: 0 15px;
    }

    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    /* Mobile: Iframe embed section - further reduce height on small phones */
    .iframe-embed-section iframe {
        min-height: 300px !important;
    }

    /* Small phones: Further reduce services section top padding */
    .services-section {
        padding-top: 15px !important;
    }

    /* Small phones: Why section additional adjustments */
    .why-grid h3 {
        font-size: 1.2rem !important;
    }

    .why-grid > div > div {
        padding: 25px 15px !important;
    }

    .why-grid .btn-large {
        font-size: 0.95rem !important;
        padding: 14px 25px !important;
    }

    /* Coverage area - tighter spacing on small phones */
    .areas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .area-item {
        padding: 10px 8px;
        font-size: 0.85rem;
        gap: 10px;
    }

    .area-item i {
        font-size: 0.9rem;
    }

    /* Navigation */
    .logo-text {
        font-size: 1.2rem;
    }

    .logo img {
        height: 40px;
    }

    /* Hero */
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .scroll-indicator {
        display: none;
    }

    /* Section Headers */
    .section-badge {
        font-size: 0.75rem;
        padding: 6px 15px;
    }

    .section-description {
        font-size: 1rem;
    }

    /* Service Cards */
    .service-card-content {
        padding: 20px;
    }

    .service-card h3 {
        font-size: 1.25rem;
    }

    /* Why Cards */
    .why-card {
        padding: 30px 20px;
    }

    .why-icon {
        width: 60px;
        height: 60px;
    }

    .why-icon i {
        font-size: 1.5rem;
    }

    /* Testimonials */
    .testimonial-card {
        flex: 0 0 280px;
        padding: 25px;
    }

    .testimonial-quote {
        font-size: 3rem;
        top: 20px;
        right: 20px;
    }

    /* Gallery */
    .gallery-item {
        height: 250px;
    }

    /* Forms */
    .form-input,
    .form-textarea,
    .form-select {
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    /* Footer */
    .footer-main {
        padding: 50px 0 30px;
    }

    .footer-title {
        font-size: 1rem;
    }

    .footer-legal {
        flex-direction: column;
        gap: 15px;
    }

    /* Chat Widget */
    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .chat-header {
        padding: 20px;
    }
}

/* ===== VERY SMALL PHONES (under 375px) ===== */
@media (max-width: 374px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }

    .btn {
        padding: 12px 25px;
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .hero-badge {
        font-size: 0.7rem;
        letter-spacing: 2px;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }

    .hero-stats {
        display: none;
    }

    .scroll-indicator {
        display: none;
    }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .chat-widget,
    .scroll-indicator,
    .hero-video,
    .financing-banner {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .hero {
        min-height: auto;
        padding: 50px 0;
    }

    .hero-overlay {
        background: transparent;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .btn {
        border: 2px solid black;
        background: transparent !important;
        color: black !important;
    }

    .section {
        padding: 30px 0;
        page-break-inside: avoid;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover {
        transform: none;
    }

    .why-card:hover {
        transform: none;
    }

    .gallery-item:hover img {
        transform: none;
    }

    .hover-lift:hover {
        transform: none;
    }

    /* Increase tap targets */
    .nav-link {
        padding: 10px 0;
    }

    .footer-links a {
        padding: 8px 0;
        display: inline-block;
    }
}

/* ===== DARK MODE PREFERENCE ===== */
@media (prefers-color-scheme: light) {
    /* Site is already dark themed, but you can add light mode overrides here */
}

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

/* Focus visible for keyboard navigation */
@media (prefers-reduced-motion: no-preference) {
    :focus-visible {
        outline: 3px solid var(--gold-primary);
        outline-offset: 3px;
    }
}
