/* =========================================
   Robin Frot - Réalisations
   CSS volontairement isolé dans .gallery-section
   ========================================= */
.gallery-section {
    --brand-orange: #e86d2a;
    --brand-orange-hover: #e86d2a;
    --brand-blue: #0255a1;
    --text-main-color: #2c2c2c;
    --font-title: 'Oswald', sans-serif;
    --font-text: 'Open Sans', sans-serif;
    --gallery-gap: 10px;
    --section-padding-y: 60px;
    --title-margin-bottom: 40px;
    --container-width: 1200px;
    --hover-transition: 0.3s ease;
}

.gallery-section,
.gallery-section * {
    box-sizing: border-box;
}

.gallery-section {
    font-family: var(--font-text);
    color: var(--text-main-color);
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--section-padding-y) 20px;
    background: transparent;
}

.gallery-section img {
    max-width: 100%;
    height: auto;
    display: block;
}

.gallery-header {
    margin-bottom: var(--title-margin-bottom);
}

.gallery-title-wrapper {
    display: flex;
    align-items: center;
}

.gallery-title-decorator {
    width: 6px;
    height: clamp(30px, 4vw, 40px);
    background-color: var(--brand-orange);
    margin-right: 15px;
    border-radius: 4px;
}

.gallery-title {
    font-family: var(--font-title);
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--text-main-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
    margin: 0 !important;
}

.gallery-masonry-grid {
    display: flex;
    gap: var(--gallery-gap);
    margin-bottom: var(--section-padding-y);
    align-items: flex-start;
}

.gallery-column {
    display: flex;
    flex-direction: column;
    gap: var(--gallery-gap);
    flex: 1;
}

.gallery-item {
    display: grid !important;
    position: relative;
    z-index: 1;
    overflow: hidden;
    background-color: #f0f0f0;
    cursor: pointer;
    text-decoration: none !important;
    color: inherit;
}

.gallery-item > * {
    grid-area: 1 / 1;
    min-height: 0 !important;
    min-width: 0 !important;
}

.gallery-item::after {
    content: '';
    grid-area: 1 / 1;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color var(--hover-transition);
    z-index: 1;
}

.gallery-item:hover::after,
.gallery-item:focus-visible::after {
    background-color: rgba(0, 0, 0, 0.65);
}

.gallery-overlay {
    grid-area: 1 / 1;
    place-self: center;
    width: 90%;
    text-align: center;
    opacity: 0;
    z-index: 2;
    transition: all 0.4s ease;
    transform: translateY(20px);
    pointer-events: none;
}

.gallery-item:hover .gallery-overlay,
.gallery-item:focus-visible .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
}

.gallery-project-title {
    font-family: var(--font-title);
    color: #ffffff;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px 0 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.gallery-project-link {
    display: inline-block;
    color: var(--brand-orange);
    font-family: var(--font-text);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--brand-orange);
    padding-bottom: 2px;
}

.gallery-column:nth-child(3) .gallery-project-link,
.gallery-column:nth-child(2) .gallery-item:nth-child(n+3) .gallery-project-link,
.gallery-item.rfr-link-blue .gallery-project-link {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
}

.gallery-item.rfr-link-orange .gallery-project-link {
    color: var(--brand-orange);
    border-bottom-color: var(--brand-orange);
}

.gallery-image {
    width: 100% !important;
    display: block;
    height: auto !important;
    object-fit: cover;
    transition: transform var(--hover-transition);
}

.gallery-item:hover .gallery-image,
.gallery-item:focus-visible .gallery-image {
    transform: scale(1.03);
}

.rfr-image-placeholder {
    min-height: 260px;
    background: linear-gradient(135deg, #efefef, #d8d8d8);
}

.gallery-column:nth-child(1) .gallery-item {
    border-radius: 0 32px 32px 0;
}

.gallery-column:nth-child(2) .gallery-item {
    border-radius: 32px;
}

.gallery-column:nth-child(3) .gallery-item {
    border-radius: 32px 0 0 32px;
}

.gallery-footer {
    text-align: center;
    margin-top: var(--title-margin-bottom);
}

.btn-quote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-text);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 16px 45px;
    text-decoration: none !important;
    border-radius: 50px;
    transition: all var(--hover-transition);
    cursor: pointer;
    background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-hover) 100%);
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(216, 92, 39, 0.3);
}

.btn-quote:hover,
.btn-quote:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(216, 92, 39, 0.5);
    color: #ffffff !important;
}

.btn-quote:active {
    transform: translateY(0);
}

@media (hover: none), (max-width: 992px) {
    .gallery-masonry-grid {
        display: block;
        column-count: 2;
        column-gap: var(--gallery-gap);
    }

    .gallery-column {
        display: contents;
    }

    .gallery-item {
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
        margin-bottom: var(--gallery-gap);
        border-radius: 16px !important;
    }

    .gallery-item::after,
    .gallery-item:hover::after,
    .gallery-item:focus-visible::after {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 60%);
    }

    .gallery-overlay {
        opacity: 1;
        transform: translateY(0);
        place-self: end center;
        padding: 0 15px 25px 15px;
        width: 100%;
    }

    .gallery-project-title {
        font-size: 1.2rem;
        margin-bottom: 5px !important;
    }
}

@media (max-width: 768px) {
    .gallery-masonry-grid {
        column-count: 1;
        column-gap: 0;
    }

    .btn-quote {
        width: 100%;
        padding: 16px 20px;
    }
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid !important;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-modal:target {
    opacity: 1;
    visibility: visible;
}

.gallery-modal > * {
    grid-area: 1 / 1;
}

.gallery-modal-backdrop {
    background-color: rgba(0, 0, 0, 0.85);
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

.gallery-modal-content {
    background: #fff;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 16px;
    display: flex;
    overflow: hidden;
    transform: translateY(30px);
    transition: transform 0.3s ease;
    z-index: 2;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.gallery-modal:target .gallery-modal-content {
    transform: translateY(0);
}

.gallery-modal-image {
    flex: 1;
    min-width: 40%;
    background: #f0f0f0;
}

.gallery-modal-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    border-radius: 0 !important;
}

.gallery-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    color: var(--text-main-color);
}

.gallery-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px 10px 40px;
    border-bottom: 1px solid #eee;
}

.gallery-modal-header h3 {
    font-family: var(--font-title);
    color: var(--brand-orange);
    font-size: clamp(1.5rem, 3vw, 2rem);
    text-transform: uppercase;
    margin: 0 !important;
}

.gallery-modal-close {
    font-size: 2rem;
    color: #333 !important;
    text-decoration: none !important;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    transition: background 0.3s ease;
    flex-shrink: 0;
    margin-left: 15px;
}

.gallery-modal-close:hover,
.gallery-modal-close:focus-visible {
    background: #e0e0e0;
}

.gallery-modal-text {
    padding: 30px 40px 40px 40px;
}

.gallery-modal-text p {
    margin: 0 0 15px 0 !important;
    font-size: 1rem;
    line-height: 1.6;
}

.gallery-modal-text strong {
    color: var(--brand-blue);
    font-weight: 600;
}

.rfr-description p:first-child {
    margin-bottom: 8px !important;
}

@media (max-width: 992px) {
    .gallery-modal-content {
        flex-direction: column;
        width: 90%;
        max-width: 600px;
        max-height: 90vh;
    }

    .gallery-modal-image {
        flex: none;
        height: 35vh;
        min-height: 200px;
    }

    .gallery-modal-body {
        flex: 1;
    }

    .gallery-modal-header {
        padding: 20px 25px 15px 25px;
    }

    .gallery-modal-text {
        padding: 20px 25px 30px 25px;
    }
}
