/* Portfolio Section - Flexbox Gallery */
.ehs-portfolio {
    padding: 100px 0;
    background: #f8fafc;
}

.ehs-portfolio__header {
    text-align: center;
    margin-bottom: 60px;
}

.ehs-portfolio__title {
    font-size: var(--ehs-font-size-h2);
    color: var(--ehs-color-dark);
    margin: 0 0 16px;
    text-transform: uppercase;
    font-family: var(--ehs-font-family-heading);
    line-height: var(--ehs-line-height-tight);
}

.ehs-portfolio__subtitle {
    font-size: var(--ehs-font-size-subtitle);
    color: var(--ehs-color-muted);
    margin: 0;
    margin-left: auto;
    margin-right: auto;
    line-height: var(--ehs-line-height-normal);
}

/* Flexbox Gallery - Based on your example */
.ehs-portfolio__gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ehs-portfolio__item {
    height: 40vh;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.ehs-portfolio__item:hover {
    transform: scale(1.02);
    z-index: 2;
}

.ehs-portfolio__item:last-child {
    /* Magic number for best results as mentioned in your example */
    flex-grow: 10;
}

.ehs-portfolio__item img {
    max-height: 100%;
    min-width: 100%;
    object-fit: cover;
    vertical-align: bottom;
    width: 100%;
    height: 100%;
    transition: filter 0.3s ease;
}

.ehs-portfolio__item:hover img {
    filter: brightness(0.9);
}

/* CTA Item Styling */
.ehs-portfolio__item--cta {
    background: var(--ehs-gradient-cta-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 300px;
}

.ehs-portfolio__cta {
    text-align: center;
    color: var(--ehs-color-light);
    padding: 40px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ehs-portfolio__cta-title {
    font-size: var(--ehs-font-size-h3);
    font-weight: 700;
    color: var(--ehs-color-light);
    margin: 0 0 16px;
    font-family: var(--ehs-font-family-heading);
    line-height: var(--ehs-line-height-tight);
}

.ehs-portfolio__cta-text {
    font-size: var(--ehs-font-size-body);
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 24px;
    line-height: var(--ehs-line-height-relaxed);
}

.ehs-portfolio__cta .ehs-button {
    background: var(--ehs-color-light);
    color: var(--ehs-color-primary);
    border-color: var(--ehs-color-light);
    padding: 12px 24px;
    font-weight: 600;
}

.ehs-portfolio__cta .ehs-button:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--ehs-shadow-button);
}

/* Advanced Responsive - Following your example pattern */

/* Portrait orientation */
@media (max-aspect-ratio: 1/1) {
    .ehs-portfolio__item {
        height: 30vh;
    }
}

/* Short screens */
@media (max-height: 480px) {
    .ehs-portfolio__item {
        height: 80vh;
    }
}

/* Smaller screens in portrait */
@media (max-aspect-ratio: 1/1) and (max-width: 480px) {
    .ehs-portfolio {
        padding: 60px 0;
    }
    
   
    
    .ehs-portfolio__gallery {
        flex-direction: column;
    }
    
    .ehs-portfolio__item {
        height: auto;
        width: 100%;
    }
    
    .ehs-portfolio__item img {
        width: 100%;
        max-height: 75vh;
        min-width: 0;
    }
    
    .ehs-portfolio__item--cta {
        min-height: 200px;
    }
    
    .ehs-portfolio__cta {
        padding: 30px 20px;
    }
    
    .ehs-portfolio__cta-title {
        font-size: 1.25rem;
    }
    
    .ehs-portfolio__cta-text {
        font-size: 0.9rem;
    }
}

/* Standard responsive breakpoints */
@media (max-width: 768px) {
    .ehs-portfolio {
        padding: 80px 0;
    }
    
    .ehs-portfolio__header {
        margin-bottom: 40px;
    }
    
    
    .ehs-portfolio__subtitle {
        font-size: 1rem;
    }
    
    .ehs-portfolio__item {
        height: 35vh;
    }
    
    .ehs-portfolio__item--cta {
        min-width: 250px;
    }
    
    .ehs-portfolio__cta {
        padding: 30px;
    }
    
    .ehs-portfolio__cta-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) and (orientation: landscape) {
    .ehs-portfolio__gallery {
        flex-direction: row;
    }
    
    .ehs-portfolio__item {
        height: 60vh;
        width: auto;
    }
    
    .ehs-portfolio__item img {
        max-height: 100%;
        min-width: 100%;
    }
}

/* Very large screens */
@media (min-width: 1400px) {
    .ehs-portfolio__item {
        height: 45vh;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .ehs-portfolio__cta {
        padding: 20px;
    }
    
    .ehs-portfolio__cta-title {
        font-size: 1.125rem;
    }
    
    .ehs-portfolio__cta-text {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
}
