/* ==========================================================================
   Structural Layout Containers
   ========================================================================== */
.product-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    font-family: system-ui, -apple-system, sans-serif;
}

.product-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 4rem;
}

/* ==========================================================================
   Breadcrumb Navigation Links
   ========================================================================== */
.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 2.5rem;
    color: #8c8c8c;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.crumb-link {
    cursor: pointer;
    transition: color 0.2s ease;
}

    .crumb-link:hover {
        color: #111;
    }

.crumb-separator {
    margin: 0 0.5rem;
}

.crumb-current {
    color: #111;
    font-weight: 500;
}

/* ==========================================================================
   Left Section: Media Gallery Components
   ========================================================================== */
.gallery-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.main-image-wrapper {
    position: relative;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 3rem 3rem 4.5rem 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 480px;
    width: 100%;
}

.main-image {
    max-height: 450px;
    max-width: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

/* Dynamic Overlaid Attribute Badges - Centered flawlessly without stacking */
.format-badges {
    position: absolute !important;
    bottom: 1.5rem !important;
    left: 50% !important; /* Move anchor point to exactly half-width */
    right: auto !important;
    transform: translateX(-50%) !important; /* Offset width symmetrically to center perfectly */
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important; /* Firmly prevents items from stacking vertically */
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: max-content !important; /* Expands safely according to badges text values */
    max-width: 90% !important; /* Keeps bounding box clean of parent borders */
}

.badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
    font-weight: 600;
    border: 1px solid transparent;
    display: inline-block !important;
    white-space: nowrap !important; /* Protects badge inner labels from broken line wrapping */
}

.badge-physical {
    background-color: #111;
    color: #fff;
}

.badge-ebook {
    background-color: #fff;
    color: #111;
    border-color: #e5e5e5;
}

.badge-online {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

/* Interactive Gallery Thumbnails Grid */
.thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.thumbnail-wrapper {
    width: 80px;
    height: 80px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

    .thumbnail-wrapper:hover,
    .thumbnail-wrapper.active {
        border-color: #111;
    }

    .thumbnail-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        mix-blend-mode: multiply;
    }

/* ==========================================================================
   Right Section: Product Details & Typography Controls
   ========================================================================== */
.details-section {
    display: flex;
    flex-direction: column;
}

.meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.author-name {
    font-size: 1.1rem;
    color: #666;
}

/* Review Star Components */
.rating-stars {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.star {
    color: #e5e5e5;
    font-size: 1.1rem;
}

    .star.filled {
        color: #ffc107;
    }

.rating-text {
    font-size: 0.85rem;
    color: #666;
    margin-left: 0.4rem;
}

.product-title {
    font-size: 2.5rem;
    font-family: 'Playfair Display', serif, Georgia;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 2rem;
    color: #111;
}

/* ==========================================================================
   Interactive E-Commerce Selection Bars
   ========================================================================== */
.purchase-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.quantity-picker {
    display: flex;
    align-items: center;
    border: 1px solid #e5e5e5;
    border-radius: 100px;
    padding: 0.25rem 0.5rem;
}

.qty-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

    .qty-btn:hover {
        background-color: #f5f5f5;
    }

.qty-val {
    min-width: 30px;
    text-align: center;
    font-weight: 500;
}

.btn-add-to-cart {
    flex-grow: 1;
    background-color: #111;
    color: #fff;
    border: none;
    border-radius: 100px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0.5rem 1.5rem;
}

    .btn-add-to-cart:hover {
        background-color: #2a2a2a;
    }

.divider {
    border: 0;
    border-top: 1px solid #eee;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Informational Text Elements & Links
   ========================================================================== */
.info-block {
    margin-bottom: 2rem;
}

    .info-block h3 {
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #8c8c8c;
        margin-bottom: 0.75rem;
    }

.description-text,
.author-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

.author-bio-card {
    background-color: #fafafa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.btn-text-link {
    background: none;
    border: none;
    padding: 0;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #111;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
}

    .btn-text-link:hover {
        color: #444;
    }

/* ==========================================================================
   Responsive Adaptations & Breakpoints
   ========================================================================== */
@media (max-width: 992px) {
    .product-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .main-image-wrapper {
        min-height: 380px;
    }
}

@media (max-width: 576px) {
    .product-container {
        padding: 1rem 1rem;
    }

    .main-image-wrapper {
        min-height: 320px;
        padding: 2rem 1rem 4.5rem 1rem; /* Extra padding baseline clearance */
    }

    .main-image {
        max-height: 240px; /* Fluidly limits image height to avoid overlay overlapping */
    }

    .format-badges {
        bottom: 1.25rem !important; /* Fits beautifully aligned at the bottom center */
        gap: 0.4rem !important;
    }

    .badge {
        font-size: 0.65rem !important; /* Clean uniform scaling factor to clear margins */
        padding: 0.25rem 0.65rem !important;
    }

    .product-title {
        font-size: 1.85rem;
    }

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

    .quantity-picker {
        justify-content: space-between;
        width: 100%;
        padding: 0.5rem;
    }

    .btn-add-to-cart {
        width: 100%;
        padding: 0.85rem;
    }
}
