/* ============================================
   GALLERY MODAL - "Blood Moon" Red Theme
   ============================================ */

.gallery-modal-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 3, 5, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    padding: 1rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.gallery-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.gallery-modal {
    position: relative;
    display: flex;
    flex-direction: row;
    max-width: 920px;
    width: 100%;
    max-height: 90vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0508 50%, #0a0a0a 100%);
    border: 1px solid rgba(139, 26, 26, 0.3);
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 0 60px rgba(89, 15, 25, 0.4),
        0 25px 50px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: scale(0.92) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-modal-overlay.active .gallery-modal {
    transform: scale(1) translateY(0);
}

/* Close button */
.gallery-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(139, 26, 26, 0.4);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.25s ease;
}

.gallery-modal-close:hover {
    background: rgba(139, 26, 26, 0.5);
    color: #fff;
    border-color: rgba(139, 26, 26, 0.7);
    transform: rotate(90deg);
}

.gallery-modal-close svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MODAL IMAGE
   ============================================ */

.gallery-modal__image {
    flex: 0 0 45%;
    max-width: 45%;
    overflow: hidden;
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gallery-modal__image::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: linear-gradient(to right, transparent 85%, rgba(10, 10, 10, 0.5) 100%);
    pointer-events: none;
}

.gallery-modal__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-modal:hover .gallery-modal__image img {
    transform: scale(1.03);
}

/* ============================================
   MODAL CONTENT
   ============================================ */

.gallery-modal__content {
    flex: 1;
    padding: 2rem 2rem 1.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: #3a0a10 transparent;
}

.gallery-modal__content::-webkit-scrollbar {
    width: 4px;
}

.gallery-modal__content::-webkit-scrollbar-thumb {
    background: #3a0a10;
    border-radius: 4px;
}

.gallery-modal__header {
    margin-bottom: 0;
}

.gallery-modal__title {
    font-family: var(--font-heading, serif);
    font-size: 1.6rem;
    color: #ffffff;
    margin: 0 0 0.35rem;
    letter-spacing: 0.5px;
}

.gallery-modal__meta {
    font-size: 0.8rem;
    color: rgba(139, 26, 26, 0.9);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.gallery-modal__description {
    font-size: 0.92rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   MODAL OPTIONS — Premium Segment Controls
   ============================================ */

.gallery-modal__options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(160deg, rgba(0, 0, 0, 0.4) 0%, rgba(89, 15, 25, 0.08) 100%);
    border: 1px solid rgba(139, 26, 26, 0.18);
    border-radius: 12px;
    position: relative;
}

.gallery-modal__options::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(ellipse at top left, rgba(139, 26, 26, 0.06), transparent 60%);
    pointer-events: none;
}

.gallery-modal__options .option-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.gallery-modal__options .option-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
}

/* ---- FORMAT SEGMENT BUTTONS ---- */
.gallery-modal__options .format-segments {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(139, 26, 26, 0.3);
    background: rgba(0, 0, 0, 0.25);
}

.gallery-modal__options .format-segment {
    flex: 1;
    padding: 0.6rem 0.4rem;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(139, 26, 26, 0.2);
    color: rgba(255, 255, 255, 0.5);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gallery-modal__options .format-segment:last-child {
    border-right: none;
}

.gallery-modal__options .format-segment::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    background: linear-gradient(180deg, rgba(139, 26, 26, 0.4), rgba(89, 15, 25, 0.6));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-modal__options .format-segment:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(139, 26, 26, 0.12);
}

.gallery-modal__options .format-segment.active {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.gallery-modal__options .format-segment.active::before {
    opacity: 1;
}

.gallery-modal__options .format-segment span,
.gallery-modal__options .format-segment {
    position: relative;
    z-index: 1;
}

/* ---- COLOR SWATCHES — With Tooltip ---- */
.gallery-modal__options .color-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gallery-modal__options .color-swatch-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.gallery-modal__options .color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.gallery-modal__options .color-swatch:hover {
    transform: scale(1.2) translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.gallery-modal__options .color-swatch.active {
    border-color: #c44;
    box-shadow:
        0 0 0 3px rgba(204, 68, 68, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.45),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
    transform: scale(1.15);
}

.gallery-modal__options .color-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.gallery-modal__options .color-tooltip {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    transition: color 0.25s ease;
    white-space: nowrap;
}

.gallery-modal__options .color-swatch-wrapper:hover .color-tooltip,
.gallery-modal__options .color-swatch.active ~ .color-tooltip {
    color: rgba(255, 255, 255, 0.7);
}

.gallery-modal__options .color-swatch--black   { background: linear-gradient(135deg, #2a2a2a, #0a0a0a); }
.gallery-modal__options .color-swatch--white   { background: linear-gradient(135deg, #ffffff, #e0e0e0); }
.gallery-modal__options .color-swatch--bone    { background: linear-gradient(135deg, #d4c5a9, #b8a88a); }
.gallery-modal__options .color-swatch--crimson { background: linear-gradient(135deg, #a01e1e, #6b1010); }
.gallery-modal__options .color-swatch--gold    { background: linear-gradient(135deg, #d4a017, #8b6914); }
.gallery-modal__options .color-swatch--silver  { background: linear-gradient(135deg, #c0c0c0, #808080); }

.gallery-modal__options .color-swatch--white.active::after {
    color: #333;
    text-shadow: none;
}

/* ============================================
   MODAL SPECS & CTA
   ============================================ */

.gallery-modal__specs {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(139, 26, 26, 0.2);
}

.gallery-modal__spec {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gallery-modal__spec-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.gallery-modal__spec-value {
    font-size: 1rem;
    color: #ffffff;
    font-weight: 500;
}

.gallery-modal__price {
    font-family: var(--font-heading, serif);
    font-size: 1.75rem;
    color: #c44;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(204, 68, 68, 0.3);
}

.gallery-modal__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    background: linear-gradient(135deg, #8b1a1a, #6b0e0e);
    color: #fff;
    border: 1px solid rgba(139, 26, 26, 0.5);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(139, 26, 26, 0.3);
}

.gallery-modal__cta:hover {
    background: linear-gradient(135deg, #a02020, #8b1a1a);
    box-shadow: 0 6px 25px rgba(139, 26, 26, 0.5);
    transform: translateY(-2px);
}

.gallery-modal__cta:active {
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media screen and (max-width: 768px) {
    .gallery-modal {
        flex-direction: column;
        max-height: 95vh;
        max-width: calc(100% - 1rem);
    }

    .gallery-modal__image {
        flex: 0 0 auto;
        max-width: 100%;
        max-height: 35vh;
    }

    .gallery-modal__image::after {
        background: linear-gradient(to bottom, transparent 80%, rgba(10, 10, 10, 0.6) 100%);
    }

    .gallery-modal__content {
        padding: 1.25rem;
    }

    .gallery-modal__title {
        font-size: 1.3rem;
    }

    .gallery-modal__options {
        padding: 1rem;
    }

    .gallery-modal__specs {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .gallery-modal__cta {
        width: 100%;
    }
}

/* Touch device: ensure minimum 44px tap targets */
@media (pointer: coarse) {
    .gallery-modal__options .format-segment {
        min-height: 44px;
        padding: 0.7rem 0.5rem;
    }

    .gallery-modal__options .color-swatch {
        width: 44px;
        height: 44px;
    }

    .gallery-modal-close {
        width: 44px;
        height: 44px;
    }

    .gallery-modal__cta {
        min-height: 48px;
    }
}
