/**
 * ========================================================
 * RESPONSIVE.CSS - Mobile-First Media Queries
 * ========================================================
 *
 * This file contains all responsive styles using a
 * mobile-first approach. Styles are organized by breakpoint.
 *
 * Breakpoints:
 * - Base: 0 - 479px (Mobile - default styles)
 * - sm: 480px+ (Large mobile)
 * - md: 768px+ (Tablet)
 * - lg: 1024px+ (Desktop)
 * - xl: 1280px+ (Large desktop)
 * - 2xl: 1440px+ (Extra large)
 *
 * Contents:
 * 1. Mobile Navigation
 * 2. Small Mobile (480px+)
 * 3. Tablet (768px+)
 * 4. Desktop (1024px+)
 * 5. Large Desktop (1280px+)
 * 6. Extra Large (1440px+)
 * 7. Print Styles
 *
 * Dependencies: All other CSS files
 *
 * ========================================================
 */


/* ========================================================
   1. MOBILE NAVIGATION (Default/Base)
   ========================================================
   Mobile-first navigation styles

   SPECIFICATIONS:
   - Full viewport overlay
   - Semi-transparent dark background
   - Menu slides from right
   - Links stacked vertically with larger touch targets
   - Social icons at bottom
   - Close X button
   - Minimum touch targets: 44x44px
   ======================================================== */

/* Mobile menu toggle visibility */
@media (max-width: 1023px) {
    /* ========================
       MOBILE TOGGLE BUTTON
       ======================== */
    .nav-toggle {
        display: flex;
    }

    /* ========================
       MOBILE NAVIGATION PANEL
       ========================
       Full-screen overlay sliding from right
       ======================== */
    .nav {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 380px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background-color: #ffffff !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15) !important;
        transform: translateX(100%);
        transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        pointer-events: auto !important;
    }

    .nav.is-open {
        transform: translateX(0) !important;
    }

    /* ========================
       MOBILE MENU HEADER
       ======================== */
    .nav__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-md) var(--space-lg);
        border-bottom: 1px solid var(--color-light-gray);
        flex-shrink: 0;
    }

    .nav__header-title {
        font-family: var(--font-display);
        font-size: 1.25rem;
        font-weight: var(--font-weight-semibold);
        color: var(--color-charcoal);
    }

    .nav__close {
        display: flex;
    }

    /* ========================
       MOBILE NAVIGATION LIST
       ======================== */
    .nav__list {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        width: 100% !important;
        padding: 1rem 0 !important;
        flex: 1;
        list-style: none !important;
        margin: 0 !important;
        background-color: #ffffff !important;
    }

    .nav__item {
        position: relative !important;
        border-bottom: 1px solid #e5e5e5 !important;
        background-color: #ffffff !important;
    }

    .nav__item:first-child {
        border-top: none;
    }

    .nav__item:last-child {
        border-bottom: none;
    }

    /* ========================
       MOBILE NAVIGATION LINKS
       ========================
       Larger touch targets (minimum 44px height)
       ======================== */
    .nav__link {
        display: flex !important;
        position: relative !important;
        align-items: center !important;
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        letter-spacing: 0.02em !important;
        text-transform: none !important;
        color: #2D2B2A !important;
        min-height: 56px !important;
        text-decoration: none !important;
        width: 100% !important;
        z-index: 10 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(139, 168, 136, 0.3);
        touch-action: manipulation;
        background-color: #ffffff !important;
        box-sizing: border-box !important;
    }

    .nav__link:hover,
    .nav__link:focus {
        background-color: #f5f5f0 !important;
        color: #8BA888 !important;
    }

    .nav__link--active {
        background-color: rgba(139, 168, 136, 0.1) !important;
        color: #8BA888 !important;
    }

    /* Link text styling */
    .nav__link-text {
        color: inherit !important;
        pointer-events: none !important;
    }

    /* Hide underline animation on mobile */
    .nav__link-underline {
        display: none !important;
    }

    /* Active indicator bar on left */
    .nav__link--active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background-color: #8BA888;
        border-radius: 0 2px 2px 0;
        z-index: 0;
        pointer-events: none;
    }

    /* ========================
       MOBILE CTA BUTTON
       ======================== */
    .nav__cta {
        margin: var(--space-md) var(--space-lg);
        width: calc(100% - var(--space-lg) * 2);
        text-align: center;
        padding: 16px 28px;
        font-size: 1rem;
    }

    /* ========================
       MOBILE MENU FOOTER
       ========================
       Social icons at bottom
       ======================== */
    .nav__footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: var(--space-xl) var(--space-lg);
        margin-top: auto;
        border-top: 1px solid var(--color-light-gray);
        background-color: var(--color-secondary-light);
    }

    /* ========================
       MOBILE OVERLAY
       ======================== */
    .nav-overlay {
        z-index: calc(var(--z-header) - 1);
    }
}

/* ========================
   EXTRA SMALL MOBILE (<480px)
   ========================
   Full-width mobile menu
   ======================== */
@media (max-width: 479px) {
    .nav {
        max-width: 100%;
    }

    .nav__link {
        padding: var(--space-md) var(--space-md);
    }

    .nav__cta {
        margin: var(--space-md);
        width: calc(100% - var(--space-md) * 2);
    }

    .nav__footer {
        padding: var(--space-lg) var(--space-md);
    }
}

/* Mobile base styles */
@media (max-width: 479px) {
    /* Reduce section padding on small screens */
    .section {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
    }

    /* Smaller hero text */
    .hero__title {
        font-size: 2rem;
    }

    .hero__subtitle {
        font-size: 1.125rem;
    }

    .hero__description {
        font-size: 1rem;
    }

    /* Stack hero buttons */
    .hero__cta-group {
        flex-direction: column;
        width: 100%;
    }

    .hero__cta-group .btn {
        width: 100%;
    }

    /* Full width buttons on mobile */
    .btn--lg {
        width: 100%;
        justify-content: center;
    }

    /* Card adjustments */
    .card__content {
        padding: var(--space-md);
    }

    /* Footer single column */
    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .footer__bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }

    .footer__legal {
        justify-content: center;
    }

    /* CTA section */
    .cta__buttons {
        flex-direction: column;
    }

    .cta__buttons .btn {
        width: 100%;
    }

    /* Testimonial cards */
    .testimonial-card {
        padding: var(--space-lg);
    }

    .testimonial-card__quote {
        font-size: var(--font-size-body);
    }

    /* Form full width */
    .form-row {
        grid-template-columns: 1fr;
    }
}


/* ========================================================
   2. SMALL MOBILE (480px+)
   ========================================================
   Slightly larger mobile devices
   ======================================================== */

@media (min-width: 480px) {
    /* Allow side-by-side buttons */
    .hero__cta-group {
        flex-direction: row;
        justify-content: center;
    }

    .hero__cta-group .btn {
        width: auto;
    }

    /* Two column form rows */
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    /* CTA buttons inline */
    .cta__buttons {
        flex-direction: row;
    }

    .cta__buttons .btn {
        width: auto;
    }
}


/* ========================================================
   3. TABLET (768px+)
   ========================================================
   Tablet and larger mobile devices
   ======================================================== */

@media (min-width: 768px) {
    /* Increase section padding */
    .section {
        padding-top: var(--space-2xl);
        padding-bottom: var(--space-2xl);
    }

    /* Hero adjustments */
    .hero__title {
        font-size: clamp(2.5rem, 5vw, 4rem);
    }

    /* Footer two columns */
    .footer__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Card grid two columns */
    .card-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Product grid adjustments */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    /* Testimonials */
    .testimonials-slider {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Horizontal card layout */
    .card--horizontal {
        grid-template-columns: 1fr 1.5fr;
    }

    /* Page header */
    .page-header {
        padding: var(--space-4xl) 0 var(--space-2xl);
    }
}


/* ========================================================
   4. DESKTOP (1024px+)
   ========================================================
   Desktop computers and large tablets
   ======================================================== */

@media (min-width: 1024px) {
    /* Show desktop navigation */
    .nav-toggle {
        display: none;
    }

    .nav {
        position: static;
        width: auto;
        height: auto;
        max-width: none;
        background-color: transparent;
        flex-direction: row;
        padding: 0;
        box-shadow: none;
        transform: none;
        overflow: visible;
    }

    .nav__list {
        flex-direction: row;
        gap: var(--space-xs);
    }

    .nav__item {
        border-bottom: none;
    }

    .nav__link {
        padding: var(--nav-link-padding);
        font-size: var(--nav-link-font-size);
    }

    .nav__cta {
        margin-left: var(--space-md);
    }

    /* Full section padding */
    .section {
        padding-top: var(--space-3xl);
        padding-bottom: var(--space-3xl);
    }

    /* Footer full grid */
    .footer__grid {
        grid-template-columns: 2fr repeat(3, 1fr);
    }

    .footer__bottom {
        flex-direction: row;
    }

    /* Card grid three columns */
    .card-grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Product grid three columns */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Features grid four columns */
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Testimonials three columns */
    .testimonials-slider {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Two column layout with sidebar */
    .layout-sidebar {
        grid-template-columns: 1fr 300px;
    }

    /* Hero scroll indicator */
    .hero__scroll-indicator {
        display: flex;
    }
}


/* ========================================================
   5. LARGE DESKTOP (1280px+)
   ========================================================
   Large monitors and displays
   ======================================================== */

@media (min-width: 1280px) {
    /* Increase container max width */
    .container {
        max-width: var(--container-max);
    }

    .container--wide {
        max-width: var(--container-wide);
    }

    /* Product grid four columns */
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Card grid four columns option */
    .card-grid--4 {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Larger section header margins */
    .section-header {
        margin-bottom: var(--space-2xl);
    }

    /* Hero enhancements */
    .hero__content {
        max-width: 1000px;
    }
}


/* ========================================================
   6. EXTRA LARGE (1440px+)
   ========================================================
   Ultra-wide displays
   ======================================================== */

@media (min-width: 1440px) {
    /* Wide container */
    .container--wide {
        max-width: 1600px;
    }

    /* Increase base font slightly */
    html {
        font-size: 17px;
    }

    /* More spacing on large screens */
    .section--lg {
        padding-top: var(--space-4xl);
        padding-bottom: var(--space-4xl);
    }
}


/* ========================================================
   7. PRINT STYLES
   ========================================================
   Optimized styles for printing
   ======================================================== */

@media print {
    /* Reset colors for print */
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Hide non-essential elements */
    .header,
    .nav-toggle,
    .hero__scroll-indicator,
    .footer__social,
    .btn,
    video,
    audio,
    iframe {
        display: none !important;
    }

    /* Show URLs after links */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    /* Don't show URL for internal links */
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }

    /* Prevent page breaks inside elements */
    img,
    figure,
    table,
    .card {
        page-break-inside: avoid;
    }

    /* Ensure headings stay with content */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Paragraph widows and orphans */
    p {
        orphans: 3;
        widows: 3;
    }

    /* Full width for print */
    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Remove shadows and borders */
    .card,
    .testimonial-card {
        border: 1px solid #ddd;
        box-shadow: none;
    }

    /* Adjust spacing */
    .section {
        padding: 1rem 0;
    }

    /* Footer simplification */
    .footer {
        padding: 1rem 0;
        border-top: 1px solid #000;
    }

    .footer__grid {
        display: block;
    }

    .footer__bottom {
        border-top: none;
        padding-top: 0.5rem;
    }
}


/* ========================================================
   RESPONSIVE UTILITY CLASSES
   ========================================================
   Additional responsive helper classes
   ======================================================== */

/* Text alignment responsive */
@media (max-width: 767px) {
    .text-center-mobile { text-align: center !important; }
    .text-left-mobile { text-align: left !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .text-center-tablet { text-align: center !important; }
}

@media (min-width: 1024px) {
    .text-center-desktop { text-align: center !important; }
    .text-left-desktop { text-align: left !important; }
}

/* Spacing responsive adjustments */
@media (max-width: 767px) {
    .mb-lg-mobile { margin-bottom: var(--space-lg) !important; }
    .mb-xl-mobile { margin-bottom: var(--space-xl) !important; }
    .py-lg-mobile { padding-top: var(--space-lg) !important; padding-bottom: var(--space-lg) !important; }
}

/* Order utilities for responsive reordering */
@media (max-width: 767px) {
    .order-first-mobile { order: -1 !important; }
    .order-last-mobile { order: 999 !important; }
}

@media (min-width: 1024px) {
    .order-first-desktop { order: -1 !important; }
    .order-last-desktop { order: 999 !important; }
}

/* Gap responsive */
@media (max-width: 767px) {
    .gap-sm-mobile { gap: var(--space-sm) !important; }
    .gap-md-mobile { gap: var(--space-md) !important; }
}

/* Padding responsive */
@media (max-width: 767px) {
    .p-md-mobile { padding: var(--space-md) !important; }
    .px-sm-mobile { padding-left: var(--space-sm) !important; padding-right: var(--space-sm) !important; }
}


/* ========================================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   ========================================================
   Handle landscape mobile devices
   ======================================================== */

@media (max-width: 900px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-3xl) 0;
    }

    .hero__scroll-indicator {
        display: none;
    }

    /* Reduce vertical spacing in landscape */
    .section {
        padding-top: var(--space-xl);
        padding-bottom: var(--space-xl);
    }
}


/* ========================================================
   HIGH DPI / RETINA DISPLAYS
   ========================================================
   Adjustments for high-resolution displays
   ======================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Thinner borders on retina */
    .card,
    .form-input,
    .form-textarea,
    .form-select {
        border-width: 0.5px;
    }
}


/* ========================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================
   Improve touch interactions
   ======================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        min-width: 48px;
    }

    .nav__link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Disable hover effects on touch */
    .hover-lift:hover,
    .hover-grow:hover {
        transform: none;
        box-shadow: inherit;
    }

    /* Remove hover state styling */
    .card:hover {
        transform: none;
    }

    .card:hover .card__image {
        transform: none;
    }
}
