/* Mobile Fixes */
html {
    overflow-x: hidden;
    height: 100%;
    scroll-behavior: smooth;
    position: relative;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    position: relative;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile Hero Section Fixes */
@media screen and (max-width: 768px) {
    .hero {
        min-height: auto;
        margin-top: 60px; /* Add navbar height margin */
        padding: 2rem 1rem;
        background-image: url('adove.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: scroll;
    }

    .hero-content {
        gap: 2rem;
        padding: 1rem;
        position: relative;
    }

    .hero-title {
        font-size: 2rem;
        text-align: center;
    }
    /* Fix scroll issue on mobile caused by background */
    .hero-background {
        background-attachment: scroll !important;
        overflow: visible !important;
    }
    .hero-subtitle {
        font-size: 1rem;
        text-align: center;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .btn {
        width: 100%;
        margin: 0;
    }

    .floating-card {
        width: 100%;
        margin: 1rem 0 !important;
    }
}

/* Fix for iOS momentum scrolling */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-y: scroll;
}

/* Improved touch targets for mobile */
button, 
a, 
input, 
select, 
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Mobile Nav Fixes */
@media screen and (max-width: 768px) {
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--white);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .nav-container {
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-menu {
        width: 100%;
        height: 100vh;
        position: fixed;
        top: 0;
        left: -100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        background-color: var(--white);
        transition: 0.3s;
        padding: 2rem;
        z-index: 100;
    }

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

    .nav-link {
        padding: 0.8rem;
        width: 100%;
        text-align: center;
    }

    .nav-toggle {
        display: block;
        cursor: pointer;
        z-index: 101;
    }

    .nav-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .logo-img img {
        width: 40px !important;
        height: 40px !important;
    }

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

    /* Fix for position:fixed elements */
    .lightbox,
    .loading,
    .back-to-top {
        position: fixed;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* Section Padding Fixes */
@media screen and (max-width: 768px) {
    section {
        padding: 3rem 1rem;
        scroll-margin-top: 60px; /* For smooth scrolling with fixed header */
    }

    .container {
        padding: 0 1rem;
        max-width: 100%;
        overflow: hidden;
    }

    /* Fix section spacing */
    section:not(:first-child) {
        margin-top: 2rem;
    }

    /* Form Element Fixes */
    input, 
    select, 
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Gallery Grid Fix */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    /* Timeline Fixes */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        z-index: 101;
        background: none;
        border: none;
    }

    .nav-toggle .bar {
        display: block;
        width: 28px;
        height: 4px;
        margin: 4px 0;
        background-color: #ec5f08;
        border-radius: 2px;
        transition: 0.3s;
    }
    .timeline-item {
        padding-left: 2rem;
    }

    /* Event Card Fixes */
    .event-card {
        margin-bottom: 2rem;
    }
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: none;
}

/* Fix sticky hover effects on mobile */
@media (hover: hover) {
    .nav-link:hover,
    .btn:hover {
        opacity: 0.8;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
}
