/* Detail Layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 1024px) {
    .detail-layout {
        grid-template-columns: 1.5fr 1fr;
        gap: 2rem;
        align-items: stretch;
    }
}

/* Gallery Section */
.gallery-section {
    display: flex;
    flex-direction: column;
}

.gallery-main {
    position: relative;
    background-color: transparent;
    overflow: hidden;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    border: 1px solid #000;
    min-height: 300px;
}

.gallery-main-image {
    width: 100%;
    height: auto;
    min-height: 300px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
    display: block;
}

.gallery-main-image:hover {
    transform: scale(1.02);
}

/* Main Image Navigation */
.main-image-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.main-image-prev,
.main-image-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s ease;
    opacity: 0;
}

.gallery-main:hover .main-image-prev,
.gallery-main:hover .main-image-next {
    opacity: 1;
}

.main-image-prev:hover,
.main-image-next:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.main-image-prev {
    left: 10px;
}

.main-image-next {
    right: 10px;
}

.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    padding: 1rem 0;
    max-width: 100%;
}

@media (max-width: 768px) {
    .gallery-thumbnails {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

.gallery-thumbnail {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    border-radius: 0.25rem;
    border: 1px solid #000;
    transition: all 0.2s;
    display: block;
}

.gallery-thumbnail:hover {
    border-color: var(--primary-400);
    border-width: 2px;
    transform: scale(1.05);
}

.gallery-thumbnail.active {
    border-color: var(--primary-600);
    border-width: 2px;
    box-shadow: 0 0 0 2px var(--primary-100);
}

.no-image-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--gray-400);
    background-color: var(--gray-100);
}

.no-image-large svg {
    width: 6rem;
    height: 6rem;
    margin-bottom: 1rem;
}

.no-image-large p {
    font-size: 1.125rem;
    color: var(--gray-500);
}

/* Detail Info */
.detail-info {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.detail-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.badge-large {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--primary-100);
    color: var(--primary-800);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.2s;
}

.badge-large:hover {
    background-color: var(--primary-200);
    transform: translateY(-1px);
}

.detail-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.detail-section h2.no-border {
    border-bottom: none;
}

/* Reduce spacing between consecutive detail sections to avoid double border effect */
.detail-section + .detail-section {
    margin-top: 1rem;
}

/* Special case: when gallery-section is followed by other sections, add more spacing */
/* Gallery section - normal styling without box */
.detail-section.gallery-section + .detail-section {
    margin-top: 1rem;
}

.detail-list {
    display: grid;
    gap: 1rem;
}

.detail-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
}

.detail-item dt {
    font-weight: 600;
    color: var(--gray-700);
}

.detail-item dd {
    color: var(--gray-600);
}

.detail-description {
    color: var(--gray-700);
    line-height: 1.7;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Sources Section */
.sources-section {
    font-size: 0.875rem;
}

.source-box {
    background: var(--koehler-light-cream);
    border: 1px solid var(--koehler-warm-yellow);
    border-radius: 0.375rem;
    padding: 0.125rem 0.75rem 0.75rem 0.75rem;
    margin-bottom: 0.75rem;
}

.source-box:last-child {
    margin-bottom: 0;
}

.source-type {
    font-weight: 600;
    color: #374151;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.source-note {
    color: #6b7280;
    font-size: 0.8rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Artwork Details */
.artwork-details-item {
    margin-top: 0.75rem;
}

.artwork-details {
    margin: 0;
    font-size: 0.875rem;
}

.artwork-item {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.artwork-item:last-child {
    margin-bottom: 0;
}

.artwork-item dt {
    font-weight: 500;
    color: #374151;
}

.artwork-item dd {
    color: #6b7280;
    margin: 0;
}

.text-muted {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    /* Removed animation to prevent zoom conflicts */
    /* animation: zoom 0.3s; */
    cursor: grab;
    /* Removed transition to prevent lag during wheel zoom */
    /* transition: transform 0.1s ease-out; */
    transform-origin: center center;
}

.lightbox-content.zoomed {
    cursor: grabbing;
    /* max-width and max-height removed from base class, so no change needed here */
}

.lightbox-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    z-index: 10000;
}

.lightbox-image-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.lightbox-image-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-image-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.lightbox-image-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

@keyframes zoom {
    from {
        transform: scale(0.7);
    }
    to {
        transform: scale(1);
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10001;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-zoom-info {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    max-width: 80%;
    text-align: center;
    backdrop-filter: blur(4px);
}

/* Document Placeholder */
.document-placeholder {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: var(--gray-100);
}

.document-placeholder-large {
    max-width: 300px;
    margin: 0 auto;
}

.document-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 400px;
    background-color: var(--gray-50);
}

.document-info {
    margin: 1rem 0;
    color: var(--gray-600);
    font-size: 0.875rem;
    text-align: center;
}

.document-thumb {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-100);
    border: 2px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.document-thumb svg {
    width: 50%;
    height: 50%;
    color: var(--gray-400);
}

.document-thumb:hover {
    border-color: var(--primary-400);
    transform: scale(1.05);
}

.document-thumb.active {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 2px var(--primary-100);
}

/* Responsive adjustments */
@media (max-width: 1024px) {

    .gallery-main {
        margin: 0 auto;
        width: 100%;
        min-height: 250px;
    }

    .detail-info {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {

    .gallery-main {
        margin: 0 auto;
        width: 100%;
        min-height: 200px;
        max-height: 60vh;
    }

    .gallery-thumbnails {
        padding: 0.75rem 0;
    }

    .detail-info {
        padding: 1rem;
        border-radius: 0;
    }

    .detail-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .detail-title {
        font-size: 1.5rem;
    }

    .no-image-large {
        height: 300px;
    }

    .no-image-large svg {
        width: 4rem;
        height: 4rem;
    }

    .no-image-large p {
        font-size: 1rem;
    }

    .document-preview {
        min-height: 300px;
        padding: 1rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-zoom-info {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {

    .gallery-main {
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
        min-height: 180px;
    }

    .main-image-prev,
    .main-image-next {
        width: 35px;
        height: 35px;
    }

    .main-image-prev {
        left: 5px;
    }

    .main-image-next {
        right: 5px;
    }

    .detail-title {
        font-size: 1.25rem;
        padding: 0.75rem 0.5rem 0.5rem 0.5rem;
    }

    .badge-large {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        margin: 0 0.5rem 0.5rem 0.5rem;
    }
    
    .gallery-thumbnails {
        padding: 0.75rem 0.5rem;
    }
    
    
    .detail-description {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

