/* General Body Styles */
body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #333;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navigation Bar */
.navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1rem;
}

#navbar-container .container {
    margin-top: 12px;
    margin-bottom: 12px;
}

.navbar-brand {
    font-weight: bold;
    color: #00509e !important;
}

.nav-link {
    color: #555 !important;
    margin-right: 20px;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    color: #00509e !important;
    border-bottom: 2px solid #00509e;
}

#footer-container .text-center.mt-5 {
    margin-top: 1.0rem !important;
    margin-bottom: 0rem;
}

/* Main Content Container */
.container {
    flex: 1;
    max-width: 1200px;
    margin-top: 30px;
    margin-bottom: 30px;
    margin-left: auto;
    margin-right: auto;
}

/* Page Headers */
h1, h2, h3 {
    color: #003366;
    margin-bottom: 20px;
}

/* Homepage Styles */
.profile-section {
    padding: 32px 0;
    text-align: center;
    background-color: #ffffff;
    border-radius: 8px;
    margin-bottom: 30px;
}

.profile-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.profile-details {
    text-align: center;
}

.profile-photo-container {
    width: 100%;
    max-width: 200px;
}

@media (min-width: 768px) {
    .profile-section {
        text-align: left;
        padding: 40px 40px;
    }

    .profile-wrapper {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 2rem;
    }

    .profile-details {
        text-align: left;
        max-width: 480px;
    }

    .profile-photo-container {
        max-width: 240px;
    }
}

.profile-photo {
    width: 100%;
    height: auto;
    border-radius: 0;
    object-fit: cover;
    border: 3px solid #dee2e6;
}

.profile-details h1 {
    font-size: clamp(1.75rem, 2vw + 1rem, 2.25rem);
    margin-bottom: 0.5rem;
}

.profile-details .lead {
    font-size: 1rem;
    line-height: 1.5;
    color: #4a4a4a;
}

.favorite-things {
    padding-block: clamp(0.5rem, 1.5vh, 1rem);
    background: linear-gradient(135deg, rgba(240, 244, 248, 0.6), rgba(226, 234, 243, 0.8));
    border-radius: 12px;
}

.favorite-things .row {
    --bs-gutter-x: clamp(0.75rem, 1.5vw, 1.25rem);
    --bs-gutter-y: clamp(0.75rem, 2vh, 1.25rem);
    row-gap: clamp(1rem, 2vh, 1.5rem);
    justify-content: center;
}

.favorite-things .col-md-4 {
    margin-block: clamp(0.4rem, 1.2vh, 0.85rem);
}

.slideshow-container {
    position: relative;
    border: none;
    padding: 24px;
    text-align: center;
    background-color: #ffffff;
    border-radius: 12px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.carousel-hover-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.carousel-hover-control.carousel-control-prev {
    left: 0.75rem;
}

.carousel-hover-control.carousel-control-next {
    right: 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
    .slideshow-container:hover .carousel-hover-control {
        opacity: 1;
        pointer-events: auto;
    }
}

.carousel-hover-control:focus {
    opacity: 0;
    pointer-events: none;
}

.carousel-hover-control:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.carousel-hover-control--disabled {
    display: none !important;
}

.carousel[data-image-directory] {
    aspect-ratio: 4 / 3;
    width: 100%;
    background-color: #f0f2f5;
    border-radius: 6px;
    overflow: hidden;
}

#promise-scholars .carousel[data-image-directory] {
    aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 1 / 1) {
    .carousel[data-image-directory] {
        position: relative;
        height: auto;
    }

    .carousel[data-image-directory]::before {
        content: "";
        display: block;
        padding-top: 75%;
    }

    .carousel[data-image-directory] .carousel-inner {
        position: absolute;
        inset: 0;
        height: 100%;
    }

    #promise-scholars .carousel[data-image-directory]::before {
        padding-top: 75%;
    }
}

.carousel[data-image-directory] .carousel-inner,
.carousel[data-image-directory] .carousel-item {
    height: 100%;
}

.carousel[data-image-directory] .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background-color: #f0f2f5;
}

.slideshow-container .slideshow-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.slideshow-container .slideshow-link:focus,
.slideshow-container .slideshow-link:hover {
    text-decoration: none;
}

.slideshow-container:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 35px rgba(0,0,0,0.12);
}

.slideshow-container h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #003366;
    font-size: 1.35rem;
    font-weight: 600;
}

.slideshow-container--promise {
    padding: 0;
    overflow: hidden;
}

.slideshow-container--promise .slideshow-link {
    height: 100%;
}

.slideshow-container--promise .carousel[data-image-directory] {
    border-radius: 0;
}

@media (max-width: 768px) {
    .favorite-things .row {
        row-gap: 1.0rem;
    }

    .favorite-things .slideshow-container {
        padding: 16px;
    }
}

/* Masonry Grid for Collage */
.masonry-grid {
    --masonry-column-count: 3;
    display: grid;
    grid-template-columns: repeat(var(--masonry-column-count), minmax(0, 1fr));
    gap: 1.5em;
    align-items: start;
}

.masonry-column {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    min-width: 0;
}

.masonry-item {
    background-color: #eee;
    border-radius: 8px;
    overflow: hidden;
    break-inside: avoid;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease-in-out, filter 0.4s ease, opacity 0.4s ease;
    background-color: #e2e8f0;
}

.masonry-item.collage-item-button {
    border: none;
    padding: 0;
    width: 100%;
    text-align: inherit;
    cursor: zoom-in;
    background-color: #eee;
    color: inherit;
    display: block;
    font: inherit;
}

.masonry-item.collage-item-button:focus {
    outline: none;
}

.masonry-item.collage-item-button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    min-height: 160px;
    text-align: center;
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.9), rgba(208, 215, 224, 0.75));
    color: #4b5563;
}

.loading-placeholder__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.loading-placeholder__spinner {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 3px solid rgba(148, 163, 184, 0.65);
    border-top-color: #2563eb;
    animation: collageSpinner 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .loading-placeholder__spinner {
        animation-duration: 1.5s;
    }
}

.loading-placeholder__text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #475569;
}

@keyframes collageSpinner {
    to {
        transform: rotate(360deg);
    }
}

.masonry-item--error {
    padding: 1.25rem 1rem;
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collage-status {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #4b5563;
}

.collage-status--complete {
    color: #047857;
    font-weight: 600;
}

body.image-modal-open {
    overflow: hidden;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 3rem);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.image-modal--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.image-modal__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.8);
    cursor: zoom-out;
}

.image-modal__content {
    --image-modal-max-width: min(90vw, 1100px);
    --image-modal-max-height: min(90vh, 900px);
    position: relative;
    z-index: 1;
    max-width: var(--image-modal-max-width);
    max-height: var(--image-modal-max-height);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
    background-color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

@supports (height: 1dvh) {
    .image-modal__content {
        --image-modal-max-height: min(90dvh, 900px);
    }
}

.image-modal__image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(90vw, 1100px);
    max-height: min(90vh, 900px);
    max-width: min(100%, var(--image-modal-max-width, min(90vw, 1100px)));
    max-height: var(--image-modal-max-height, min(90vh, 900px));
    object-fit: contain;
    object-position: center;
    background-color: #0f172a;
    flex: 0 1 auto;
}

.image-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: none;
    background-color: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.image-modal__close:hover,
.image-modal__close:focus-visible {
    background-color: rgba(15, 23, 42, 0.9);
    transform: scale(1.05);
}

.image-modal__close:focus {
    outline: none;
}

.image-modal__close-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
    .image-modal {
        transition: none;
    }

    .image-modal__close {
        transition: none;
    }
}

/* CV Page */
.cv-container {
    width: 100%;
    height: 90vh;
    border: none;
}

.cv-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Publications Page */
#books .row {
    margin-bottom: 30px;
}

/* SRP/INT Page */
#special-projects h2 {
    color: #003366;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px 0;
    margin-top: auto;
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .masonry-grid {
        --masonry-column-count: 2;
    }
    .profile-section {
        padding: 24px 16px;
        text-align: center;
    }
    .profile-section h1,
    .profile-section h2,
    .profile-section h3 {
        margin-bottom: 1.5rem;
    }
    .profile-photo {
        max-width: 280px;
        margin: 0 auto 1.5rem;
        display: block;
    }
    .navbar-nav {
        text-align: center;
    }
    .nav-link {
        margin-right: 0;
        padding: 10px 0;
    }
}

@media (max-width: 576px) {
    .masonry-grid {
        --masonry-column-count: 1;
    }
}
