/* ==========================================================================
   Component: Book Card
   Product card for WooCommerce books — desktop 256px, mobile 159px
   ========================================================================== */

.book-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 224px;
    border-radius: var(--radius-card);
    color: inherit;
    transition: opacity 0.2s;
}

.book-card:hover {
    opacity: 0.9;
}

.book-card__image-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

/* --- Image Wrap --- */
.book-card__image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 256 / 320;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-white);
}

.book-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

/* --- Tags (top-left overlay) --- */
.book-card__tags {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
    align-items: center;
    z-index: 2;
}

.book-card__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 12px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--color-text);
}

.book-card__tag--discount {
    background: var(--color-accent-600);
}

.book-card__tag--new {
    background: var(--color-accent-200);
}

/* --- Bookmark / Wishlist toggle (top-right) --- */
.book-card__bookmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    z-index: 2;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.2s;
}

.book-card__bookmark:hover {
    transform: scale(1.15);
}

/* --- Heart bounce animation on like --- */
@keyframes dsb-heart-bounce {
    0%   { transform: scale(1); }
    25%  { transform: scale(1.3); }
    50%  { transform: scale(0.9); }
    75%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.book-card__bookmark--burst {
    animation: dsb-heart-bounce 0.5s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}

/* --- Particle burst --- */
@keyframes dsb-particle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

.dsb-heart-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    will-change: transform, opacity;
    animation: dsb-particle-fly var(--duration) var(--delay) cubic-bezier(0.15, 0.6, 0.35, 1) forwards;
}

.book-card__bookmark svg {
    width: 24px;
    height: 24px;
}

/* --- Book Formats (bottom-left) --- */
.book-card__formats {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 2;
}

.book-card__format {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px 4px 4px;
    background: rgba(16, 19, 23, 0.3);
    border-radius: var(--radius-sm);
    color: var(--color-accent-100);
}

.book-card__format svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.book-card__format-label {
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
    white-space: nowrap;
}

/* --- Body (text below image) --- */
.book-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
    width: 100%;
    padding: var(--spacing-md) 0;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.book-card__text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* --- Price --- */
.book-card__price {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    justify-content: center;
    font-family: var(--font-family-serif);
    font-style: italic;
    white-space: nowrap;
    font-variant-numeric: lining-nums proportional-nums;
}

.book-card__price-old {
    font-size: 20px;
    line-height: 20px;
    color: var(--color-text);
    text-decoration: line-through;
    opacity: 0.9;
}

.book-card__price-current {
    font-size: 28px;
    line-height: 30px;
    color: var(--color-text);
}

.book-card__price-current--sale {
    color: var(--color-red);
}

/* --- Title --- */
.book-card__title {
    font-family: var(--font-family);
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 24px;
    color: var(--color-text);
    max-height: 72px;
    overflow: hidden;
    width: 100%;
}

/* --- Author --- */
.book-card__author {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 20px;
    color: var(--color-dark-400);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

@media (max-width: 768px) {
    .book-card {
        min-width: 140px;
        border-radius: var(--radius-card);
    }

    .book-card__image-wrap {
        border-radius: var(--radius-md);
    }

    .book-card__image {
        border-radius: var(--radius-md);
    }

    /* Tags: smaller on mobile */
    .book-card__tag {
        padding: 3px 6px;
        font-size: 9px;
    }

    /* Bookmark: smaller */
    .book-card__bookmark {
        width: 26px;
        height: 26px;
        padding: 3px;
    }

    .book-card__bookmark svg {
        width: 18px;
        height: 18px;
    }

    /* Formats: icon-only on mobile */
    .book-card__format {
        padding: 4px;
    }

    .book-card__format-label {
        display: none;
    }

    /* Body */
    .book-card__body {
        gap: 12px;
    }

    /* Price: smaller on mobile */
    .book-card__price-old {
        font-size: 16px;
        line-height: 16px;
    }

    .book-card__price-current {
        font-size: 24px;
        line-height: 24px;
    }

    /* Title: smaller */
    .book-card__title {
        font-size: var(--font-size-base);
        line-height: 20px;
    }

    /* Author: smaller */
    .book-card__author {
        font-size: var(--font-size-sm);
        line-height: 17px;
    }
}
