/* Add spacing between image and social buttons */
.card-body {
    padding-bottom: 20px;
}

/* Add spacing between multiple media items */
.card {
    margin-bottom: 30px;
}

/* Container for responsive image/video sizing */
.card-body figure {
    margin: 0 0 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

/* Handle last figure to avoid extra spacing */
.card-body figure:last-child {
    margin-bottom: 0;
}

/* Single media item - can be larger */
.card:only-of-type .card-body figure img,
.card:only-of-type .card-body figure video {
    max-width: 100%;
    max-height: calc(80vh - 200px); /* Larger for single items */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Multiple media items - portrait images can be taller */
.card:not(:only-of-type) .card-body figure img,
.card:not(:only-of-type) .card-body figure video {
    max-width: 100%;
    max-height: 70vh; /* Allow portrait images to be taller */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Specific handling for video elements and their containers */
.card-body figure video,
.card-body figure .plyr,
.card-body figure .plyr__video-wrapper,
.card-body figure .plyr__video-embed,
.card-body figure iframe {
    max-width: 100%;
    width: auto !important;
    height: auto !important;
}

/* Override Plyr's default aspect ratio enforcement */
.plyr--video {
    max-height: 70vh;
}

.plyr__video-wrapper {
    padding-bottom: 0 !important;
    height: auto !important;
    background: transparent;
}

/* Ensure video maintains aspect ratio */
.plyr video,
.plyr iframe {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: 70vh;
    object-fit: contain !important;
}

/* Layout structure */
.session-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main content area - allow natural flow */
.session-page > div:not(.header):not(.footer) {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto; /* Allow scrolling for multiple items */
}

/* Card styling */
.card {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Ensure footer stays at bottom */
.footer {
    margin-top: auto;
    padding-top: 20px;
    padding-bottom: 20px;
    position: sticky;
    bottom: 0;
    background: inherit; /* Match page background */
}

/* Ensure card-footer (with social icons) is centered */
.card-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .card:not(:only-of-type) .card-body figure img,
    .card:not(:only-of-type) .card-body figure video {
        max-height: 60vh; /* Slightly smaller on mobile */
    }
    
    .card {
        margin-bottom: 20px;
    }
}