/* Fix for horizontal scroll gap */
html,
body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    max-width: 100vw;
}

/* Ensure images don't overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    /* Black w/ opacity */
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--charcoal);
    margin: auto;
    padding: 3rem;
    border: 1px solid var(--gold);
    width: 90%;
    max-width: 500px;
    position: relative;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.5s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    color: var(--gold);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--white);
}

/* Mobile Menu Styles */
@media (max-width: 768px) {

    /* Global box sizing fix for mobile */
    * {
        box-sizing: border-box;
    }

    /* Force all grids to single column to prevent overflow */
    .services-grid,
    .gallery-grid,
    .studio-grid,
    .reviews-grid,
    .about-container,
    .academy-container,
    .contact-container {
        display: grid;
        grid-template-columns: 1fr !important;
        /* Force single column */
        width: 100% !important;
        gap: 3rem;
        margin: 0 auto;
    }

    .section-title {
        font-size: 2.2rem;
        /* Reduce title size slightly to prevent wrap overflow */
        padding: 0 10px;
    }

    header {
        background-color: var(--black);
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    #hero {
        padding-top: 160px;
        /* Increased padding to clear fixed header */
        height: auto;
        /* allow content to grow */
        min-height: 100vh;
        width: 100%;
        align-items: flex-start;
        /* Start from top (plus padding) */
        background-attachment: scroll;
        /* Fix for mobile background jitter */
        background-position: center top;
    }

    .hero-content {
        margin-top: 1rem;
        padding-bottom: 4rem;
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-wrap: break-word;
        /* Prevent text overflow */
    }

    /* Ensure no element forces width */
    .section-subtitle,
    .about-text,
    .academy-text {
        width: 100%;
        max-width: 100%;
    }

    nav {
        display: none;
        /* Initially hidden */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        /* Full screen */
        background-color: var(--black);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 999;
        /* Below header z-index (1000) */
        gap: 2rem;
        transition: transform 0.3s ease-in-out;
        transform: translateY(-100%);
        /* Slide form top */
    }

    /* When active, show it */
    nav.active {
        display: flex;
        transform: translateY(0);
    }

    /* Ensure links are large enough to tap */
    nav a {
        font-size: 1.5rem;
        color: var(--white);
    }

    /* Hamburger Animation */
    .mobile-menu {
        z-index: 1001;
        /* Above the nav overlay */
    }

    .mobile-menu.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}