/* Mobile-first responsive styles */

/* Base responsive fixes */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 1000;
    background: var(--spectrum-global-color-gray-800);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

/* Desktop styles - default */
@media screen and (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .mobile-overlay {
        display: none !important;
    }
    
    #nav {
        position: static !important;
        width: auto !important;
        height: auto !important;
        box-shadow: none !important;
        padding: 15px !important;
    }
}

/* Mobile styles (up to 768px) */
@media screen and (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block !important;
    }

    /* Adjust body grid for mobile */
    body.spectrum-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto 1fr !important;
        padding: 0 !important;
        display: grid !important;
        margin: 0 !important;
    }

    /* Header adjustments */
    header {
        grid-row: 1 !important;
        grid-column: 1 !important;
        padding: 10px 5px !important;
        margin: 0 !important;
    }

    header .spectrum-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    header .spectrum-Asset {
        grid-row: 1 !important;
        grid-column: 1 !important;
        text-align: center;
        padding: 0 !important;
        margin: 0 !important;
    }

    header .spectrum-Asset img {
        max-width: 200px;
        width: 100%;
        height: auto !important;
        display: block;
        margin: 0 auto;
    }

    /* Hide the motto on mobile */
    header > div > div:not(.spectrum-Asset),
    header .spectrum-grid > div:nth-child(2),
    header p {
        display: none !important;
    }

    /* Navigation - hidden by default on mobile */
    #nav {
        position: fixed !important;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 999;
        grid-row: auto !important;
        grid-column: 1 !important;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        padding: 60px 15px 15px 15px;
    }

    #nav.mobile-open {
        left: 0;
    }

    /* Overlay when menu is open */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }

    .mobile-overlay.active {
        display: block;
    }

    /* Content adjustments */
    #content {
        grid-row: 3 !important;
        grid-column: 1 !important;
        padding: 10px 5px !important;
        max-width: 100% !important;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
        margin: 0 !important;
    }

    /* Content grid adjustments */
    #content .spectrum-grid {
        grid-template-columns: 1fr !important;
        width: 100%;
        overflow-x: hidden;
    }

    #content .spectrum-grid > div {
        grid-column: 1 !important;
        grid-row: auto !important;
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Force all content divs to stack vertically on mobile */
    #content .spectrum-grid > div[style*="grid-column"] {
        grid-column: 1 !important;
    }
    
    #content .spectrum-grid > div[style*="grid-row"] {
        grid-row: auto !important;
    }

    /* Typography adjustments with proper wrappingant;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* Content grid adjustments */
    #content .spectrum-grid {with proper wrapping */
    .spectrum-Heading--sizeXXL {
        font-size: 24px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .spectrum-Heading--sizeXL {
        font-size: 22px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .spectrum-Heading--sizeL {
        font-size: 20px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .spectrum-Heading--sizeM {
        font-size: 18px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .spectrum-Body--sizeXL,
    .spectrum-Body--sizeL,
    .spectrum-Body--sizeM {
        font-size: 14px !important;
        line-height: 1.6 !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .spectrum-Typography {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    p, li, span, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    /* Lists */
    ul, ol {
        padding-left: 20px;
        margin-right: 0;
        font-size: 18px !important;
    }

    .spectrum-Body--sizeXL,
    .spectrum-Body--sizeL,
    .spectrum-Body--sizeM {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    /* Images responsive */
    img {
        max-width: 100%;
        height: auto !important;
    }

    .spectrum-Asset-image {
        width: 100% !important;
        height: auto !important;
    }

    /* Form elements */
    .spectrum-Textfield,
    .spectrum-Button {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Side navigation items */
    .spectrum-SideNav-itemLink {
        font-size: 16px !important;
        padding: 10px 15px !important;
    }

    .spectrum-SideNav-heading {
        font-size: 14px !important;
        padding: 10px 15px 5px !important;
    }
}

/* Tablet styles (769px to 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    body.spectrum-grid {
        grid-template-columns: 200px 1fr !important;
    }

    #nav {
        grid-column: 1 !important;
    }

    #content {
        grid-column: 2 !important;
        padding: 20px !important;
    }

    header {
        grid-column: 1 / -1 !important;
    }
}

/* Desktop styles (1025px and up) */
@media screen and (min-width: 1025px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-overlay {
        display: none !important;
    }
}
