/* Gallery-first profile modal overrides. Loaded after style.css. */
.modal-container {
    width: min(1440px, calc(100vw - 36px));
    height: min(92vh, 980px);
    max-width: 1440px;
    max-height: 92vh;
    overflow: hidden;
}

.modal-content-grid {
    grid-template-columns: minmax(430px, 0.88fr) minmax(0, 1.12fr);
    height: 100%;
}

.modal-media-column,
.modal-details-column {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 0, 85, 0.5) rgba(255, 255, 255, 0.04);
}

.modal-media-column {
    padding: 32px;
    gap: 18px;
}

.modal-details-column {
    padding: 40px 46px;
}

.main-image-wrapper {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
    background: radial-gradient(circle at 50% 35%, rgba(120, 28, 70, 0.22), transparent 62%), #0a0307;
}

#modal-main-image {
    object-fit: contain;
    object-position: center;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(10, 3, 7, 0.72);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(8px);
}

.main-image-wrapper:hover .gallery-nav,
.gallery-nav:focus-visible {
    opacity: 1;
}

.gallery-nav:hover {
    border-color: var(--accent-pink);
    background: rgba(255, 0, 85, 0.72);
}

.gallery-nav:disabled {
    display: none;
}

.gallery-nav-prev { left: 14px; }
.gallery-nav-next { right: 14px; }

.gallery-position {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 2;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(10, 3, 7, 0.76);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    backdrop-filter: blur(8px);
}

.gallery-section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 0;
}

.gallery-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--accent-pink);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.gallery-section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 1.35rem;
}

.gallery-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.media-gallery {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.gallery-thumb {
    position: relative;
    height: 102px;
    padding: 0;
    background: #140711;
}

.gallery-thumb::after {
    content: attr(data-number);
    position: absolute;
    right: 5px;
    bottom: 5px;
    min-width: 24px;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(10, 3, 7, 0.72);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.62rem;
    line-height: 1.4;
}

.gallery-thumb img {
    display: block;
}

.gallery-thumb.active {
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 2px rgba(255, 0, 85, 0.18), var(--glow-rose-soft);
}

.gallery-loading {
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-secondary);
    text-align: center;
}

.gallery-loading i {
    margin-right: 7px;
    color: var(--accent-pink);
}

.gallery-more-button {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255, 0, 85, 0.3);
    border-radius: 9px;
    background: rgba(255, 0, 85, 0.08);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-more-button:hover {
    border-color: var(--accent-pink);
    background: rgba(255, 0, 85, 0.16);
}

@media (max-width: 1100px) {
    .modal-container {
        width: min(980px, calc(100vw - 28px));
    }
    .modal-content-grid {
        grid-template-columns: minmax(370px, 0.82fr) minmax(0, 1.18fr);
    }
    .modal-media-column,
    .modal-details-column {
        padding: 26px;
    }
}

@media (max-width: 860px) {
    .modal-container {
        width: min(720px, calc(100vw - 20px));
        height: auto;
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
    }
    .modal-content-grid {
        display: block;
        height: auto;
    }
    .modal-media-column,
    .modal-details-column {
        overflow: visible;
    }
    .modal-media-column {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .gallery-nav {
        opacity: 1;
    }
}

@media (max-width: 560px) {
    .modal-container {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }
    .modal-media-column,
    .modal-details-column {
        padding: 16px;
    }
    .media-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .gallery-thumb {
        height: 94px;
    }
    .gallery-nav {
        width: 40px;
        height: 40px;
    }
}
