/* ==========================================================================
   Stitch Global - Responsive Styles
   ========================================================================== */

/* ==========================================================================
   Mobile First Base Styles (< 640px)
   ========================================================================== */
.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background-color: var(--color-bg-light);
}

.dark .mobile-nav {
    background-color: var(--color-bg-dark);
}

.mobile-nav.is-active {
    display: flex;
    flex-direction: column;
}

.mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.mobile-nav__close {
    padding: var(--space-2);
}

.mobile-nav__content {
    flex: 1;
    padding: var(--space-6);
    overflow-y: auto;
}

.mobile-nav__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.mobile-nav__link {
    display: block;
    padding: var(--space-3) 0;
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}

.dark .mobile-nav__link {
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav__actions {
    padding: var(--space-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ==========================================================================
   Small Devices (640px and up)
   ========================================================================== */
@media (min-width: 640px) {
    .sm\:flex { display: flex; }
    .sm\:hidden { display: none; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:flex-row { flex-direction: row; }
    
    .hero__actions {
        flex-direction: row;
    }
    
    .cta-banner__features {
        flex-direction: row;
    }
}

/* ==========================================================================
   Medium Devices (768px and up)
   ========================================================================== */
@media (min-width: 768px) {
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .md\:block { display: block; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:flex-row { flex-direction: row; }
    .md\:items-end { align-items: flex-end; }
    .md\:justify-between { justify-content: space-between; }
    
    .md\:px-10 {
        padding-left: var(--space-10);
        padding-right: var(--space-10);
    }
    
    .md\:px-16 {
        padding-left: var(--space-16);
        padding-right: var(--space-16);
    }
    
    .md\:py-20 {
        padding-top: var(--space-20);
        padding-bottom: var(--space-20);
    }
    
    /* Hero adjustments */
    .hero {
        padding: var(--space-20) var(--space-10);
    }
    
    .hero__title {
        font-size: var(--text-6xl);
    }
    
    .hero__description {
        font-size: var(--text-xl);
    }
    
    .hero__image-wrapper {
        height: 600px;
    }
    
    /* Products section */
    .products-section__header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
    
    /* Footer adjustments */
    .footer__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    .footer__bottom {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* CTA Banner */
    .cta-banner__title {
        font-size: var(--text-5xl);
    }
    
    /* How It Works */
    .how-it-works__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Large Devices (1024px and up)
   ========================================================================== */
@media (min-width: 1024px) {
    .lg\:flex { display: flex; }
    .lg\:hidden { display: none; }
    .lg\:block { display: block; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
    .lg\:col-span-1 { grid-column: span 1 / span 1; }
    
    .lg\:px-16 {
        padding-left: var(--space-16);
        padding-right: var(--space-16);
    }
    
    .lg\:px-20 {
        padding-left: var(--space-20);
        padding-right: var(--space-20);
    }
    
    /* Hero adjustments */
    .hero {
        padding: var(--space-20) var(--space-16);
    }
    
    /* Products grid */
    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    
    /* How It Works */
    .how-it-works__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Extra Large Devices (1280px and up)
   ========================================================================== */
@media (min-width: 1280px) {
    .xl\:flex { display: flex; }
    .xl\:hidden { display: none; }
    
    .xl\:px-20 {
        padding-left: var(--space-20);
        padding-right: var(--space-20);
    }
}

/* ==========================================================================
   Container Queries (for component-level responsiveness)
   ========================================================================== */
@container (min-width: 864px) {
    .hero__grid {
        flex-direction: row;
        align-items: center;
    }
    
    .hero__content,
    .hero__image-wrapper {
        width: 50%;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]::after {
        content: " (" attr(title) ")";
    }
    
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }
    
    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }
    
    thead {
        display: table-header-group;
    }
    
    tr,
    img {
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100% !important;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
    
    .site-header,
    .site-footer,
    .mobile-nav,
    .btn,
    nav {
        display: none !important;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #004830;
        --color-text-primary: #000;
        --color-text-secondary: #333;
        --color-border: #666;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .product-card:hover .product-card__image {
        transform: none;
    }
    
    .hero__image-card {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Focus Visible Styles (Accessibility)
   ========================================================================== */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    z-index: var(--z-tooltip);
    text-decoration: none;
    font-weight: var(--font-bold);
}

.skip-link:focus {
    top: 0;
}

/* ==========================================================================
   WordPress Specific Responsive Styles
   ========================================================================== */

/* Admin Bar Adjustments */
.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* Block Editor Alignment */
.alignwide {
    margin-left: -5vw;
    margin-right: -5vw;
    width: calc(100% + 10vw);
    max-width: calc(100% + 10vw);
}

.alignfull {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    max-width: 100vw;
}

@media (min-width: 1024px) {
    .alignwide {
        margin-left: -10vw;
        margin-right: -10vw;
        width: calc(100% + 20vw);
        max-width: calc(100% + 20vw);
    }
}

/* WooCommerce Responsive Adjustments */
.woocommerce .products {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: var(--space-6);
}

@media (min-width: 640px) {
    .woocommerce .products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .woocommerce .products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
