/**
 * Стили одной карточки товара (синхронизировано с shared/product-card.css).
 * Подключается на главной и на странице ассортимента через functions.php.
 */

.product-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    padding-right: 8px;
    position: relative;
}

.product-controls {
    display: flex;
    flex-direction: column;
    padding-left: 16px;
    text-align: left;
    align-items: flex-start;
}

.product-media .product-card-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    text-decoration: none;
}

.product-media .product-card-link:hover {
    text-decoration: none;
}

.product-card button:not(.product-media-arrow):not(.product-media-mobile-add):not(.add-to-cart-btn):not(.sold-out-btn),
.product-card .color-options {
    position: relative;
    z-index: 2;
}

.product-media {
    position: relative;
    width: 100%;
    height: 460px;
    border-radius: 0;
    overflow: hidden;
    background-color: #F4F4F4;
}

.product-media a {
    display: block;
    width: 100%;
    height: 100%;
}

.product-media > a > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
    transition: opacity 0.2s ease;
}

.product-media-track {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.product-media-track img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.product-media-slide-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.product-media-slide-strip {
    display: flex;
    width: 200%;
    height: 100%;
    transition: transform 0.35s ease-out;
    backface-visibility: hidden;
}

.product-media-slide-strip img {
    width: 50%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

@media (max-width: 1179px) and (min-width: 769px) {
    .product-card {
        font-size: clamp(14px, 1.6vw, 16px);
    }
    .product-media {
        height: clamp(320px, 42vw, 420px);
        max-width: 100%;
    }

    .product-media > a > img,
    .product-media-track img {
        height: 100%;
        object-fit: cover;
        max-width: 100%;
    }

    .product-card .product-media-mobile-add {
        width: clamp(26px, 8.5vw, 40px);
        height: clamp(26px, 8.5vw, 40px);
        min-width: clamp(26px, 8.5vw, 40px);
        min-height: clamp(26px, 8.5vw, 40px);
        left: clamp(8px, 2.5vw, 13px);
        bottom: clamp(7px, 2.5vw, 10px);
    }
    .product-card .product-media-mobile-add .product-media-mobile-add-img,
    .product-card .product-media-mobile-add img {
        width: clamp(14px, 2.8vw, 18px);
        height: clamp(14px, 2.8vw, 18px);
    }
}

@media (min-width: 1180px) {
    .product-card {
        font-size: clamp(15px, 1.2vw, 16px);
    }
    .product-media {
        height: clamp(380px, 28vw, 460px);
        max-width: 100%;
    }

    .product-media > a > img,
    .product-media-track img {
        height: 100%;
        object-fit: cover;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .product-card {
        padding: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
        min-width: 0;
        font-size: clamp(14px, 3.8vw, 16px);
        gap: clamp(4px, 1vw, 8px);
    }

    .product-media {
        width: 100%;
        min-width: 0;
        height: clamp(160px, 70vw, 380px);
        overflow: hidden;
        background-color: #F4F4F4;
        isolation: isolate;
    }

    .product-media > a > img,
    .product-media-track img {
        height: 100%;
        object-fit: cover;
        object-position: center center;
        display: block;
    }

    .product-card .product-media-mobile-add {
        width: clamp(26px, 8.5vw, 40px);
        height: clamp(26px, 8.5vw, 40px);
        min-width: clamp(26px, 8.5vw, 40px);
        min-height: clamp(26px, 8.5vw, 40px);
        left: clamp(8px, 2.5vw, 13px);
        bottom: clamp(7px, 2.5vw, 10px);
    }
    .product-card .product-media-mobile-add .product-media-mobile-add-img,
    .product-card .product-media-mobile-add img {
        width: clamp(14px, 2.8vw, 18px);
        height: clamp(14px, 2.8vw, 18px);
    }

    .product-card .sold-out-btn-mobile {
        display: block;
        width: 100%;
        padding: 0.4em 0;
        margin-top: 0.5em;
        border: none;
        background-color: #7A7A7A;
        color: #F8F7F4;
        font-family: inherit;
        font-size: 0.9em;
        letter-spacing: 0.04em;
        font-weight: 400;
        cursor: default;
        pointer-events: none;
        box-sizing: border-box;
    }

    .product-controls {
        display: flex;
        flex-direction: column;
        padding-left: clamp(12px, 3vw, 16px);
        width: 100%;
        min-width: 0;
        flex: 1;
    }

    .product-name-container {
        display: flex;
        align-items: flex-start;
        min-width: 0;
    }

    .product-name-container .product-name {
        font-size: 1.15em;
        line-height: 1.4;
        margin-bottom: 0;
    }

    .product-name {
        font-size: 1.15em;
        line-height: 1.4;
        margin-bottom: 0;
        min-width: 0;
    }

    .product-price {
        margin-top: 0;
        font-size: 0.95em;
    }

    .product-card .add-to-cart-btn {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .sold-out-btn-mobile {
        display: none;
    }

    .color-options {
        gap: 0.5em;
        margin: 0.3em 0 0.5em;
        position: relative;
        padding-left: 0;
        align-items: center;
    }

    .color-swatch {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        aspect-ratio: 1;
        flex-shrink: 0;
    }

    .color-options .color-swatch:nth-child(n+4) {
        display: none;
    }

    .color-options .color-more-link {
        display: flex;
        align-items: center;
        font-family: inherit;
        font-size: 0.88em;
        line-height: 1.4;
        color: #2a0812;
        font-weight: 400;
        flex-shrink: 0;
        text-decoration: none;
    }

    .color-more-btn {
        width: 1em;
        height: 1em;
        min-width: 1em;
        flex-shrink: 0;
    }

    .product-controls-top {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
    }

    .product-controls-bottom {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        padding-left: 1.5em;
        font-size: inherit;
    }
}

.add-to-cart-btn {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    padding: 14px 146px;
    border: none;
    background-color: #5d0d21;
    color: #F8F7F4;
    font-family: 'Source Serif Pro', serif;
    letter-spacing: 0.09em;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 3;
}

@media (min-width: 1180px) {
    .product-card:hover .add-to-cart-btn:not([data-hidden]),
    .product-card:focus-within .add-to-cart-btn:not([data-hidden]) {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

.add-to-cart-btn-mobile {
    display: none !important;
}
.add-to-cart-btn-mobile-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
    object-fit: contain;
}

.product-card .sold-out-btn {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    padding: 14px 96px;
    min-width: 270px;
    box-sizing: border-box;
    border: none;
    background-color: #7A7A7A;
    color: #F8F7F4;
    font-family: 'Source Serif Pro', serif;
    letter-spacing: 0.09em;
    font-size: 13px;
    font-weight: 400;
    cursor: default;
    white-space: nowrap;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.product-card[data-in-stock="true"] .sold-out-btn,
.product-card[data-in-stock="true"] .sold-out-btn-mobile {
    display: none !important;
}

@media (min-width: 1180px) {
    .product-card:hover .sold-out-btn[style*="inline-flex"],
    .product-card:focus-within .sold-out-btn[style*="inline-flex"] {
        opacity: 1;
        visibility: visible;
    }
}

.product-card .color-swatch[data-sold-out="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.product-card .color-swatch[data-sold-out="true"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 1px;
    background-color: #333;
    transform: translate(-50%, -50%) rotate(45deg);
    pointer-events: none;
}

.product-name {
    font-size: 18px;
    color: #440a0a;
    margin: 0 0 -6px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

.product-collection {
    font-size: 12px;
    color: #440a0a;
    text-decoration: none;
    margin: 0 0 2px 0;
    display: inline-block;
    transition: color 0.2s ease, opacity 0.2s ease;
    text-align: left;
}

.product-collection:hover {
    color: #360808;
    text-decoration: underline;
}

@media (min-width: 769px) {
    .product-collection {
        font-size: 13px;
    }
    .product-name {
        font-size: 20px;
    }
}

.product-name-container {
    display: flex;
    align-items: flex-start;
}

.color-options {
    display: flex;
    gap: 10px;
    margin: 9px 0 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

.color-options-spacer {
    width: 100%;
    height: 0;
    visibility: hidden;
    flex-basis: 100%;
}

.color-swatch {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid #2a0812;
    background: var(--swatch-color, #ccc);
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.color-swatch.active {
    border-color: transparent;
    outline: 1px solid #2a0812;
    outline-offset: 2px;
    transform: scale(1.05);
}

.product-price {
    font-size: 15px;
    color: #440a0a;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    text-align: left;
}

@media (min-width: 769px) {
    .product-name {
        margin-bottom: -2px !important;
        min-height: auto !important;
    }

    .product-price {
        margin-top: 0 !important;
    }

    .product-name-price-wrapper {
        gap: 2px !important;
    }

    .product-name-price-wrapper .product-name {
        margin-bottom: 0 !important;
        min-height: auto !important;
    }

    .product-name-price-wrapper .product-price {
        margin-top: 0 !important;
    }
}

.product-name-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-controls-top {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.product-controls-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.color-more-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid #7A7A7A;
    background-color: #7A7A7A;
    color: #F8F7F4;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    position: relative;
    z-index: 2;
    line-height: 1;
}

.product-card .color-more-link {
    text-decoration: none;
    color: #2a0812;
}
@media (min-width: 769px) {
    .product-card .color-more-link {
        display: none !important;
    }
}
