* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    background-color: #fff;
    color: #000;
    min-height: 100vh;
}

header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 100;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 3.2vw;
    width: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

nav a {
    color: #000;
    text-decoration: underline;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

nav a:hover {
    opacity: 0.6;
}

main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.gallery img {
    max-width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
}

.photo-group {
    display: flex;
    flex-direction: column;
}

.photo-group img {
    width: 100%;
    height: auto;
}

.photo-title {
    font-size: 14px;
    color: #000;
    margin-top: 10px;
    text-align: left;
    opacity: 0;
}

/* Tablet and up */
@media (min-width: 580px) {
    header {
        padding: 30px 40px;
    }

    .logo img {
        height: 25px;
    }

    nav {
        flex-direction: row;
        gap: 30px;
    }

    nav a {
        font-size: 16px;
    }

    main {
        padding: 40px;
    }

    .gallery {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }

    .gallery > * {
        width: calc(50% - 10px);
    }

    .gallery img {
        width: 100%;
        object-fit: cover;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .gallery {
        gap: 30px;
    }

    .gallery > * {
        width: calc(33.333% - 20px);
    }

    .gallery img {
        width: 100%;
        object-fit: cover;
    }
}

/* Large desktop */
@media (min-width: 1800px) {
    .gallery > * {
        width: calc(25% - 22.5px);
    }
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: background 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.97);
    overscroll-behavior: contain;
}

.lightbox-overlay.closing {
    background: rgba(255, 255, 255, 0);
}

.lightbox-content {
    position: fixed;
    overflow: hidden;
    border-radius: 2px;
}

.lightbox-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-image-a {
    z-index: 1;
}

.lightbox-image-b {
    z-index: 2;
}

.lightbox-close {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 1001;
    mix-blend-mode: difference;
    filter: contrast(2) grayscale(1);
}

.lightbox-overlay.active .lightbox-close {
    opacity: 1;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-close svg {
    width: 50px;
    height: 50px;
    stroke: #fff;
    stroke-width: 2.5;
}

/* Book Preview */
.book-preview {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.3s ease;
    display: flex;
    flex-direction: column;
}

.book-preview:hover {
    transform: scale(1.02);
    background: #e8e8e8;
}

.book-preview img {
    width: 100%;
    height: auto;
    border-radius: 2px;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 1 !important;
}

.book-title {
    font-size: 14px;
    color: #000;
    margin-top: 12px;
    text-align: center;
    font-style: italic;
}

/* Product Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

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

.product-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    font-style: italic;
    color: #000;
    text-decoration: underline;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
    padding: 10px 0;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

.product-modal.active .product-close {
    opacity: 1;
}

.product-close:hover {
    opacity: 0.6;
}

.product-content {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 70px 20px 20px;
    gap: 15px;
    min-height: 100svh;
    min-height: 100dvh;
    box-sizing: border-box;
}

.product-gallery {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image-container {
    position: relative;
    max-width: 100%;
    max-height: 35svh;
    max-height: 35dvh;
}

.product-image {
    max-width: 100%;
    max-height: 35svh;
    max-height: 35dvh;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-transform: translateZ(0);
    will-change: opacity;
}

.product-image-a {
    display: block;
}

.product-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    mix-blend-mode: difference;
    filter: contrast(2) grayscale(1);
    z-index: 10;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.product-prev {
    left: 10px;
}

.product-next {
    right: 10px;
}

.product-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

.product-nav svg {
    width: 40px;
    height: 40px;
    stroke: #fff;
    stroke-width: 2.5;
}

.product-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.product-name {
    font-family: 'Times New Roman', Times, serif;
    font-size: 28px;
    font-weight: normal;
    font-style: italic;
    margin: 0;
}

.product-price {
    font-size: 22px;
    margin: 0;
}

.product-shipping {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.product-description {
    font-size: 14px;
    line-height: 1.5;
    max-width: 500px;
    color: #333;
    margin: 5px 0;
}

.product-quantity {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 5px 0;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.qty-btn:hover {
    background: #f0f0f0;
}

.qty-value {
    font-size: 18px;
    min-width: 30px;
    text-align: center;
}

.product-buy {
    display: inline-block;
    background: #000;
    color: #fff;
    padding: 15px 50px;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 5px;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

.product-buy:hover {
    background: #333;
}

/* Desktop product modal */
@media (min-width: 768px) {
    .product-content {
        flex-direction: row;
        padding: 60px;
        align-items: center;
        min-height: 100vh;
        gap: 40px;
    }

    .product-gallery {
        flex: 1;
    }

    .product-image-container {
        max-height: 80vh;
    }

    .product-image {
        max-height: 80vh;
    }

    .product-info {
        flex: 0 0 350px;
        align-items: flex-start;
        text-align: left;
    }

    .product-close {
        position: fixed;
    }
}

@media (hover: hover) {
    .product-image-container {
        cursor: zoom-in;
    }
}
