/* ========================================
   GLOBAL RESPONSIVE LAYOUT FIXES
   For all pages in the portfolio
   ======================================== */

/* Ensure main content is always visible */
body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Main content wrapper */
main,
.main-content,
#main {
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Container responsive fixes */
.container,
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Responsive container max-widths */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Section padding responsive */
section {
    padding: 60px 0;
    width: 100%;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    section {
        padding: 40px 0;
    }
}

@media (max-width: 575px) {
    section {
        padding: 30px 0;
    }
}

/* Row responsive fixes */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.row>* {
    padding-right: 15px;
    padding-left: 15px;
}

/* Column responsive fixes */
@media (max-width: 767px) {

    .col,
    [class*="col-"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* Image responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Text responsive */
@media (max-width: 575px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5,
    h6 {
        font-size: 1rem;
    }

    p {
        font-size: 0.9rem;
    }
}

/* Button responsive */
.btn,
button,
[type="button"],
[type="submit"] {
    padding: 10px 20px;
    font-size: 14px;
}

@media (max-width: 575px) {

    .btn,
    button,
    [type="button"],
    [type="submit"] {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Card/Box responsive */
.card,
.box {
    width: 100%;
    margin-bottom: 20px;
}

/* Grid responsive */
.grid,
.portfolio-grid,
.gallery-grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

@media (min-width: 768px) {

    .grid,
    .portfolio-grid,
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {

    .grid,
    .portfolio-grid,
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {

    .grid,
    .portfolio-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Fix for fixed/sticky elements on mobile */
@media (max-width: 767px) {

    .sticky-top,
    .fixed-top {
        position: relative;
    }
}

/* Prevent horizontal scroll */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    position: relative;
}

/* Mobile menu active state - prevent content shift */
body.mobile-nav-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Ensure content is visible when menu is closed */
body:not(.mobile-nav-active) {
    overflow-x: hidden;
    overflow-y: auto;
}