/* Product Page — Editorial Layout */

.product-header {
    padding: 1.5rem 0 0.5rem 0;
    border-bottom: none;
    margin-bottom: 0;
}

.back-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1.5px solid var(--primary-black);
    border-radius: 50%;
    color: var(--primary-black);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    box-shadow: none;
}

.back-icon-btn:hover {
    background: var(--primary-black);
    color: var(--primary-white);
    transform: none;
    box-shadow: none;
}

.product-details {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
    gap: 3rem;
    padding: 2rem 0 4rem;
    max-width: 1300px;
    margin: 0 auto;
    align-items: start;
}

/* --- Gallery: swipeable carousel + dots + thumbnail strip --- */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
}

.gallery-stage {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    background: #f2f2f2;
    border-radius: 6px;
    overflow: hidden;
}

.gallery-viewport {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.gallery-viewport::-webkit-scrollbar { display: none; }

.gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 4 / 5;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    cursor: zoom-in;
}
.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 100px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.gallery-arrow:hover { background: #fff; }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.gallery-arrow.hidden { opacity: 0; pointer-events: none; }

/* On touch devices, swipe instead of arrows */
@media (hover: none) {
    .gallery-arrow { display: none; }
}

.gallery-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.gallery-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: #cfcfcf;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.gallery-dot.active {
    background: var(--primary-black);
    transform: scale(1.3);
}

.gallery-thumbs {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding-bottom: 2px;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb {
    flex: 0 0 auto;
    width: 64px;
    aspect-ratio: 3 / 4;
    padding: 0;
    border: 1.5px solid #e5e5e5;
    background: #f2f2f2;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    display: block;
}
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.active {
    border-color: var(--primary-black);
    opacity: 1;
}

/* --- Fullscreen lightbox --- */
body.no-scroll { overflow: hidden; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lb-fade 0.2s ease;
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}
.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
    will-change: transform;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-img.zoomed {
    cursor: grab;
    transition: none;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.9rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-counter {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    z-index: 3;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s ease;
}
.lightbox-arrow:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
.lightbox-arrow.hidden { display: none; }
@media (hover: none) {
    .lightbox-arrow { display: none; }
}

/* --- Right column: sticky info panel --- */
.product-info-section {
    padding: 1rem 0 0;
    position: sticky;
    top: 90px;
    align-self: start;
}

.product-brand-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--medium-grey);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0.75rem;
}

.product-info-section h1 {
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: var(--primary-black);
}

.product-price {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-black);
    margin-bottom: 1.75rem;
    letter-spacing: 0.3px;
}

.product-description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ececec;
}

.product-options {
    margin-bottom: 2rem;
}

.size-selector,
.quantity-selector {
    margin-bottom: 1.75rem;
}

.size-selector h4,
.quantity-selector h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.85rem;
    color: var(--primary-black);
}

.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.size-btn {
    flex: 0 0 auto;
    min-width: 56px;
    height: 44px;
    padding: 0 1.1rem;
    border: 1.5px solid #e5e5e5;
    background: var(--primary-white);
    color: var(--primary-black);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.size-btn:hover {
    border-color: var(--primary-black);
    background: var(--primary-white);
    color: var(--primary-black);
    transform: translateY(-1px);
}

.size-btn.selected {
    border-color: var(--primary-black);
    background: var(--primary-black);
    color: var(--primary-white);
    transform: none;
}

.size-btn:active {
    transform: scale(0.96);
}

.quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e5e5e5;
    border-radius: 999px;
    overflow: hidden;
    background: var(--primary-white);
    padding: 0 0.25rem;
    transition: border-color 0.2s ease;
}

.quantity-controls:hover {
    border-color: var(--primary-black);
}

.qty-btn {
    width: 40px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--primary-black);
    font-weight: 500;
    font-size: 1.2rem;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: transparent;
    color: var(--primary-black);
    border: none;
    transform: scale(1.15);
}

.qty-btn:active {
    transform: scale(0.92);
}

#quantity {
    width: 44px;
    height: 44px;
    text-align: center;
    border: none;
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 600;
    background: transparent;
    -moz-appearance: textfield;
    color: var(--primary-black);
}

#quantity::-webkit-outer-spin-button,
#quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#quantity:focus {
    outline: none;
    border-color: #d8d8d8;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.add-to-cart-btn {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 2rem;
    background: var(--primary-black);
    color: var(--primary-white);
    border: 1.5px solid var(--primary-black);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.4s ease, transform 0.15s ease;
    box-shadow: none;
    z-index: 0;
}

/* Sliding fill from left on hover */
.add-to-cart-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-white);
    transform: translateX(-101%);
    transition: transform 0.45s cubic-bezier(0.7, 0, 0.2, 1);
    z-index: -1;
}

.add-to-cart-btn:hover::before {
    transform: translateX(0);
}

.add-to-cart-btn:hover {
    color: var(--primary-black);
    transform: none;
    box-shadow: none;
}

.add-to-cart-btn:active {
    transform: scale(0.98);
}

.add-to-cart-btn:disabled {
    background: #e5e5e5;
    border-color: #e5e5e5;
    color: var(--primary-white);
    cursor: not-allowed;
}

.add-to-cart-btn:disabled::before {
    display: none;
}

.back-btn {
    padding: 0.85rem 2rem;
    background: transparent;
    color: var(--medium-grey);
    border: none;
    border-radius: 0;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.back-btn:hover {
    background: transparent;
    color: var(--primary-black);
}

/* Success Message */
.success-message {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--accent-color);
    color: var(--primary-white);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 700;
    z-index: 1000;
    transform: translateX(100%);
    transition: var(--transition);
}

.success-message.show {
    transform: translateX(0);
}

/* Similar Products Section */
.similar-products-section {
    background: var(--light-grey);
    padding: 4rem 0;
    margin-top: 3rem;
}

.similar-products-title {
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--primary-black);
}

.similar-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.similar-product-card {
    background: var(--primary-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.similar-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.no-similar-products {
    text-align: center;
    color: var(--medium-grey);
    font-size: 1.1rem;
    grid-column: 1 / -1;
    padding: 2rem;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .product-details {
        /* minmax(0, 1fr) — NOT plain 1fr — so the gallery's flex row of
           full-width slides can't blow the column out past the screen width
           (that overflow was forcing mobile browsers to zoom out). */
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
        padding: 1rem 0 2rem;
    }

    /* Disable sticky on mobile — info section flows under gallery */
    .product-info-section {
        position: static;
        top: auto;
        padding: 0.5rem 0 0;
    }

    /* Tighter gallery on mobile, full-width edge feel */
    .product-gallery {
        gap: 0.5rem;
        min-width: 0;
    }

    .product-info-section h1 {
        font-size: 1.4rem;
    }

    .product-price {
        font-size: 1.1rem;
        margin-bottom: 1.25rem;
    }

    .product-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .similar-products-section {
        padding: 3rem 0;
        margin-top: 2rem;
    }

    .similar-products-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    /* Show similar products two-per-row on mobile instead of one giant
       card at a time. */
    .similar-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .size-btn {
        height: 46px;
        min-width: 52px;
        padding: 0 1rem;
    }

    .similar-products-grid {
        gap: 1.25rem 0.6rem;
    }

    .similar-products-title {
        font-size: 1.35rem;
        margin-bottom: 1.5rem;
    }
}
