.project-details-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    /* Add horizontal padding for smaller screens */
}

.project-header {
    text-align: center;
    margin-bottom: 20px;
}

.project-title {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: var(--primary-text);
}

.project-category {
    font-family: 'Architects Daughter', cursive;
    font-size: 1.2em;
    color: var(--secondary-text);
    margin-bottom: 10px;
}

.project-date-box {
    background: var(--bg-primary-card);
    padding: 10px;
    border-radius: 15px;
    border: 2px solid var(--primary-border);
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 8px var(--shadow-light);
}

.project-date {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1em;
    color: var(--primary-text);
    margin: 0;
}

.project-content-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.gallery-container {
    flex: 0 0 350px;
    position: relative;
    min-width: 300px;
}

.photo-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 0.754;
    border-radius: 15px;
    border: 2px solid var(--primary-border);
    background: linear-gradient(190deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 8px var(--shadow-light);
}

.gallery-media-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 13px;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.gallery-media {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.gallery-media.loaded {
    opacity: 1;
}

.gallery-media.is-video {
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 13px;
}

.gallery-media.is-youtube {
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    border-radius: 13px;
}

.gallery-media.is-image {
    /* Images use absolute positioning for cross-fade */
}

.gallery-media.is-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 13px;
}

.gallery-media.is-video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

.gallery-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-transparent-button);
    color: var(--text-transparent-button);
    border: none;
    padding: 15px 20px;
    font-size: 1.5em;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

.gallery-controls:hover {
    background: var(--bg-transparent-button-hover);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.gallery-indicators {
    text-align: center;
    margin-top: 10px;
}

.indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--indicator);
    margin: 0 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.indicator.active {
    background: var(--indicator-selected);
}

/* Enhanced gallery media styling */
.gallery-media.is-youtube {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 13px;
}

.gallery-media.is-error {
    width: 100%;
    height: 100%;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary-card);
    color: var(--secondary-text);
    font-size: 1.1em;
    text-align: center;
}

/* Preloader styling */
.gallery-preloader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-text);
    font-size: 1.1em;
    z-index: 5;
}

.gallery-preloader::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

.project-description {
    flex: 1;
    background: var(--bg-primary-card);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--primary-border);
    text-align: left;
    display: flex;
    flex-direction: column;
    height: 464px;
    box-sizing: border-box;
    min-width: 0;
    box-shadow: 0 4px 8px var(--shadow-light);
}

.project-description h3 {
    margin-bottom: 15px;
    font-size: 1.5em;
    color: var(--primary-text);
}

.project-description-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.project-description p {
    font-family: 'Rubik', sans-serif;
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--paragraph-text);
    margin-bottom: 15px;
}

.downloads-section {
    background: var(--bg-primary-card);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid var(--primary-border);
    margin-bottom: 20px;
    box-sizing: border-box;
    box-shadow: 0 4px 8px var(--shadow-light);
}

.downloads-section h3 {
    margin-bottom: 15px;
    font-size: 1.5em;
    color: var(--primary-text);
    text-align: center;
}

.error-message {
    text-align: center;
    color: var(--secondary-text);
    font-size: 1.2em;
    margin: 40px 0;
}

.project-content-wrapper.no-gallery .project-description {
    flex: none;
    width: 100%;
    height: auto;
}

/* Mobile responsiveness - stack layout on smaller screens */
@media (max-width: 768px) {
    .project-details-container {
        padding: 0 15px;
    }

    .project-title {
        font-size: 2em;
    }

    .project-content-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .gallery-container {
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: unset;
    }

    .project-description {
        flex: none;
        width: 100%;
        height: auto;
        min-height: 200px;
    }

    .gallery-controls {
        padding: 10px 15px;
        font-size: 1.3em;
    }

    .prev-btn {
        left: 5px;
    }

    .next-btn {
        right: 5px;
    }
}

/* Tablet responsiveness - adjust at medium screen sizes */
@media (max-width: 1024px) and (min-width: 769px) {
    .gallery-container {
        flex: 0 0 300px;
        min-width: 280px;
    }

    .project-description {
        height: auto;
        min-height: 350px;
    }
}