/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

html {
    overflow-x: hidden;  /* NEW: Global horizontal scroll prevention */
}

/* Consolidated body styling - Responsive background with fallback */
body {
    background-image: url(/Images/Picture1.jpg);
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;  /* Ensures it scales on all devices */
    background-color: color-mix(in srgb-linear, white 50%, lightgrey 50%);  /* MOVED: Fallback under image only on body */
    line-height: 1.6;  /* Improves readability */
    padding-top: 120px;  /* Matches navbar height */
    overflow-x: hidden;  /* NEW: Prevent body-level horizontal scroll */
}

/* Navbar - Fixed and responsive */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 120px; /* Fixed height for consistency */
    color: black;
    padding: 15px 20px;
    position: fixed; /* Keeps it in place */
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Optional shadow */
    background-color: rgba(255, 255, 255, 0.9);  /* NEW: Semi-transparent bg for readability over image */
    max-width: 100%;  /* NEW: Constrain to viewport */
}

.logo {
    padding-right: 20px;
}

.logo img {
    height: 100px;
    width: auto;
    max-width: 100%;  /* NEW: Prevent logo overflow */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;    /* Keep all in one line */
    /* REMOVED: overflow-x: auto; - Not needed, as it can cause unwanted scroll */
}

.nav-links li {
    margin: 2px;
}

.nav-links a {
    text-decoration: none;
    color: black;
    font-size: 18px;
    font-weight: 550;
    white-space: nowrap;  /* NEW: Prevent link text wrapping */
}

.menu-toggle {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
}

/* Dropdown menu (hidden by default) */
.dropdown-menu {
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);  /* NEW: Semi-transparent for consistency */
    position: fixed;
    width: 100%;
    height: calc(100vh - 120px);  /* NEW: Fit below navbar, full viewport height */
    top: 120px;  /* NEW: Start below navbar */
    left: 0;
    text-align: center;
    z-index: 999;
    padding: 20px;  /* NEW: Inner padding without overflow */
    overflow-y: auto;  /* NEW: Vertical scroll if many links, no horizontal */
    max-width: 100vw;  /* NEW: Match viewport width */
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu li {
    list-style: none;
    padding: 15px 0;
    border-bottom: 1px solid #555;
    width: 100%;  /* NEW: Full width, no overflow */
}

.dropdown-menu a {
    text-decoration: none;
    color: black;
    font-size: 1.5rem;
    overflow-wrap: break-word;  /* NEW: Wrap long links if needed */
}

/* Main wrapper - Constrained for no overflow */
.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;  /* Base padding, scaled in media queries */
    width: 100%;  /* NEW: Explicit full width */
    max-width: 100%;  /* NEW: Prevent exceeding viewport */
    overflow-x: hidden;  /* NEW: Clip any inner overflow */
}

/* Headings - Responsive, with wrapping to prevent overflow */
h1 {
    padding: 35px;
    font-size: 50px;
    font-weight: bold;
    text-align: center;
    color: black;
    overflow-wrap: break-word;  /* NEW: Helps long headings wrap */
}

h2 {
    color: red;
    font-size: 28px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
    overflow-wrap: break-word;  /* NEW: For long names */
}

h3 {
    font-size: 35px;
    text-align: center;
    margin: 0 auto 30px auto;  /* Increased bottom margin for space below header */
    max-width: 1200px;
    padding: 0 20px;
    width: 100%;  /* Full width for headers */
    overflow-wrap: break-word;  /* NEW: Ensures headers don't overflow */
}

/* Paragraphs - Responsive, with wrapping */
p {
    padding: 20px 0;  /* Vertical padding only, no horizontal to avoid overflow */
    font-size: 25px;
    font-weight: 700;
    color: #333;
    margin: 0;  /* Reset default margins */
    overflow-wrap: break-word;  /* NEW: Force long words/paragraphs to wrap */
    word-break: break-word;  /* NEW: Extra insurance for unbreakable text */
}

/* Team sections */
.team-section {
    margin-bottom: 50px;  /* Space between sections */
    width: 100%;
    max-width: 100%;  /* NEW: Prevent exceeding */
    overflow-x: hidden;  /* NEW: No horizontal scroll in sections */
}

/* Card groups - Handles 2-images-on-desktop layout */
.card-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);  /* Desktop: 2 columns for side-by-side */
    gap: 30px;
    padding: 20px;  /* Inner padding */
    max-width: 100%;
    margin: 0 auto;
    width: 100%;  /* NEW: Full width */
    overflow-x: hidden;  /* NEW: Clip grid overflow */
}

/* Single cards in a group - centers on desktop */
.card-group > .card:only-child {
    grid-column: 1 / -1;  /* Span full width if only one card */
    justify-self: center;  /* Center it */
    max-width: 500px;  /* Limit width for balance */
}

/* Card Styling - Responsive */
.card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    padding: 20px;
    transition: transform 1s ease-out, opacity 1s ease-out;
    opacity: 0;
    transform: translateX(-100px) rotateY(45deg);
    width: 100%;  /* Full width in grid */
    max-width: 100%;  /* Prevents overflow */
    overflow-x: hidden;  /* NEW: Ensure card content doesn't scroll horizontally */
}

.card:nth-child(even) {
    transform: translateX(100px) rotateY(-45deg);
}

.card.show {
    opacity: 1;
    transform: translateX(0) rotateY(0);
}

.card:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Image Styling - Scaled down */
.card img {
    width: 100%;
    height: auto;
    max-width: 500px;   /* NEW: Limit how wide images can get */
    max-height: 350px;  /* NEW: Limit height too */
    margin: 0 auto;     /* NEW: Center smaller images */
    display: block;
    border-radius: 8px;
    transition: transform 0.4s ease, filter 0.3s ease;
    object-fit: cover;  /* Maintains aspect ratio without distortion */
}

.card:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Button Styling (kept, even if unused) */
.info-button {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    letter-spacing: 1px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;  /* Responsive button */
    max-width: 100%;  /* NEW: Prevent button overflow */
}

.info-button:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

/* Footer */
footer {
    color: #fff;
    text-align: center;
    font-size: 22px;
    font-weight: 550;
    padding: 20px;  /* NEW: Add padding without overflow */
    width: 100%;
    max-width: 100%;  /* NEW: Constrain */
    overflow-x: hidden;  /* NEW: No scroll */
}

.socials a {
    color: #fff;
    margin: 0 10px;
    text-decoration: none;
    padding-right: 10px;
    display: inline-block;  /* NEW: Prevent inline overflow */
}

.socials a:hover {
    color: #ddd;
}

.image3 {
    height: 250px;
    width: 100%;  /* NEW: Full width, auto height */
    max-width: 100%;
    display: block;
    margin: 0 auto;  /* NEW: Center if needed */
}

#backToTop {
    background-color: blue;
    padding: 12px;
    border-radius: 7px;
    border: none;
    color: white;
}
.image11 {
    height: 100px;
    width: auto;
    max-width: 100%;  /* NEW: Prevent overflow */
    display: block;
}

/* Mobile Responsiveness (≤768px: 1 column, smaller everything, tighter to fix scroll) */
@media screen and (max-width: 768px) {
    body {
        background-attachment: scroll;  /* Fixed backgrounds can glitch on mobile */
    }

    .navbar {
        padding: 10px 15px;  /* REDUCED: Tighter on mobile */
        height: 100px;  /* REDUCED: Shorter navbar */
    }

    body {
        padding-top: 100px;  /* MATCH: Updated for shorter navbar */
    }

    .dropdown-menu {
        top: 100px;  /* MATCH: Below shorter navbar */
        height: calc(100vh - 100px);
        padding: 15px;  /* REDUCED */
    }

    .nav-links {
        display: none;  /* Hidden on mobile */
    }

    .menu-toggle {
        display: block;
    }

    .logo img {
        height: 70px;  /* REDUCED: Smaller logo */
    }

    .main-wrapper {
        padding: 8px;  /* REDUCED: From 10px - less outer padding */
    }

    h1 {
        font-size: 32px;
        padding: 20px 10px;  /* REDUCED horizontal */
    }

    h2 {
        font-size: 22px;
    }

    h3 {
        font-size: 24px;
        margin-bottom: 20px;
        padding: 0 8px;  /* REDUCED: From 10px */
    }

    p {
        font-size: 18px;
        padding: 15px 0;
    }

    .team-section {
        margin-bottom: 30px;
    }

    .card-group {
        grid-template-columns: 1fr;  /* 1 column on mobile - stacks images vertically */
        gap: 15px;  /* REDUCED: From 20px */
        padding: 12px;  /* REDUCED: From 15px */
    }

    .card {
        padding: 12px;  /* REDUCED: From 15px */
    }

    .card:only-child {
        grid-column: auto;  /* Reset for mobile */
        max-width: none;
    }

    footer {
        font-size: 18px;  /* REDUCED */
        padding: 15px;
    }

    .socials a {
        margin: 0 5px;  /* REDUCED */
        padding-right: 5px;
    }

    /* Extra tight for very small phones (≤480px) */
    @media screen and (max-width: 480px) {
        .main-wrapper {
            padding: 5px;  /* FURTHER REDUCE */
        }

        h3 {
            font-size: 20px;
            padding: 0 5px;
        }

        p {
            font-size: 16px;
            padding: 10px 0;
        }

        .card-group {
            padding: 8px;  /* TIGHTER */
            gap: 10px;
        }

        .card {
            padding: 8px;
        }

        footer {
            font-size: 16px;
            padding: 10px;
        }

        /* Ultra-tight for tiniest screens (≤375px) */
        @media screen and (max-width: 375px) {
            .navbar {
                padding: 8px 10px;
                height: 80px;
            }

            body {
                padding-top: 80px;
            }

            .dropdown-menu {
                top: 80px;
                height: calc(100vh - 80px);
                padding: 10px;
            }

            .logo img {
                height: 50px;
            }

            .main-wrapper {
                padding: 2px;  /* NEAR-ZERO */
            }

            h1 {
                font-size: 24px;
                padding: 15px 5px;
            }
        }
    }
}
