/* Shared card presentation for the fourteen Distributions home product rails.
 * These rules preserve WoodMart's widths, scrolling and all SW1 cart handlers.
 * A variable product can grow its rail; no fixed total card height is imposed.
 */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 {
    --osd-card-ink: #172b45;
    --osd-card-muted: #65758a;
    --osd-card-line: #dce5ef;
    --osd-card-blue: #196cb6;
    --osd-card-blue-hover: #10538e;
    --osd-card-image-height: clamp(190px, 24vw, 252px);
}

/* Stretch through every nested flex item, including slides outside the viewport. */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-carousel-wrap {
    align-items: stretch !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-carousel-item {
    display: flex !important;
    height: auto !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: auto !important;
    --wd-trans-h: 0px !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-wrapper {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: auto !important;
    overflow: hidden;
    border: 1px solid var(--osd-card-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(23 43 69 / 5%);
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-wrapper:hover {
    transform: none !important;
}

/* Keep the complete packshot in an identical, white image area. */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-element-top {
    position: relative;
    flex: 0 0 var(--osd-card-image-height);
    width: 100%;
    height: var(--osd-card-image-height) !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden;
    background: #fff !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-image-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 18px;
    box-sizing: border-box;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-image-link img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center;
    transform: none !important;
}

/* Equal title, category and price slots align the content without clipping prices. */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-element-bottom {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    min-width: 0;
    padding: 16px !important;
    margin-bottom: 0 !important;
    text-align: left;
    transform: none !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-header {
    display: block;
    min-width: 0;
    margin: 0 !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-entities-title {
    display: -webkit-box !important;
    height: 4.2em !important;
    min-height: 4.2em !important;
    max-height: 4.2em !important;
    margin: 0 !important;
    overflow: hidden;
    color: var(--osd-card-ink);
    font-size: 15px !important;
    font-weight: 700;
    line-height: 1.4 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3 !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-entities-title a {
    white-space: normal !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-cats {
    display: block;
    height: 18px;
    min-height: 18px;
    margin: 6px 0 0 !important;
    overflow: hidden;
    color: var(--osd-card-muted);
    font-size: 12px !important;
    line-height: 18px !important;
    white-space: nowrap;
    text-overflow: ellipsis;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-cats a {
    color: inherit;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-cats .wd-meta-sep,
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-cats a:nth-of-type(n + 2) {
    display: none !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wrap-price {
    display: grid !important;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(44px, auto) 20px minmax(0, 1fr);
    column-gap: 0;
    row-gap: 4px;
    align-items: start;
    align-content: start;
    justify-content: stretch !important;
    width: 100%;
    min-width: 0;
    margin: 10px 0 0 !important;
    text-align: left;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wrap-price > .price {
    display: flex !important;
    grid-row: 1;
    flex-wrap: wrap;
    align-items: baseline;
    align-content: end;
    gap: 3px 7px;
    min-width: 0;
    min-height: 44px;
    margin: 0 !important;
    font-size: 18px;
    line-height: 1.3;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .price del {
    color: var(--osd-card-muted);
    font-size: 12px;
    font-weight: 400;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .price ins {
    text-decoration: none;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .woocommerce-price-suffix {
    color: var(--osd-card-muted);
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wrap-price > .wd-price-per-unit {
    grid-row: 2;
    min-height: 20px;
    margin: 0 !important;
    color: var(--osd-card-muted) !important;
    font-size: 11px !important;
    line-height: 20px !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wrap-price > :is(.sw1-stepper-row, .sw1-variations, .sw1-stepper-go) {
    grid-row: 3;
    align-self: end;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product-footer {
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

/* A quiet segmented control with a distinct add action and usable touch targets. */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-product .sw1-stepper-row {
    width: 100% !important;
    padding: 0 !important;
    margin: 8px 0 0 !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-simple .sw1-stepper {
    width: 100% !important;
    max-width: 196px !important;
    gap: 5px;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-controls {
    display: grid !important;
    grid-template-columns: 44px minmax(44px, 1fr) 44px;
    gap: 0 !important;
    width: 100%;
    min-height: 46px;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid #c8d7e6 !important;
    border-radius: 10px !important;
    background: #fff !important;
    box-shadow: none;
    box-sizing: border-box;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 :is(.sw1-stepper-btn, .sw1-qty-input) {
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box;
    line-height: 1 !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-btn {
    background: #edf3f9 !important;
    color: #244a71 !important;
    font-size: 23px !important;
    font-weight: 600;
    touch-action: manipulation;
    transition: background-color .15s ease, color .15s ease;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-btn.sw1-plus {
    background: var(--osd-card-blue) !important;
    color: #fff !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-qty-input {
    border-inline: 1px solid #dce5ef !important;
    background: #fff !important;
    color: var(--osd-card-ink) !important;
    font-size: 16px !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-controls:focus-within {
    border-color: var(--osd-card-blue) !important;
    box-shadow: 0 0 0 3px rgb(25 108 182 / 20%);
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 :is(.sw1-stepper-btn, .sw1-qty-input):focus-visible {
    outline: 3px solid #0f497c !important;
    outline-offset: -3px;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-btn:active {
    transform: none !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 :is(.sw1-stepper-btn, .sw1-qty-input):disabled {
    opacity: .5;
    cursor: not-allowed;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper[aria-busy="true"] .sw1-stepper-controls {
    opacity: .65;
    cursor: progress;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-subtotal {
    display: block !important;
    min-height: 18px;
    margin: 0;
    color: var(--osd-card-blue);
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
    text-align: center;
}

/* Each pack/unit variant remains independently purchasable. */
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variations {
    gap: 8px;
    padding: 0 !important;
    margin: 8px 0 0 !important;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-row {
    gap: 7px;
    padding: 9px;
    border: 1px solid var(--osd-card-line);
    border-radius: 11px;
    background: #f8fafc;
    box-shadow: none;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-head {
    flex-wrap: wrap;
    gap: 4px 8px;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-label {
    color: var(--osd-card-ink);
    font-size: 12px;
    white-space: normal;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-stepper,
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-stepper .sw1-stepper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 5px;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-stepper .sw1-stepper-controls {
    flex: 0 0 auto;
    max-width: 196px;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-variation-stepper .sw1-subtotal {
    flex: none;
    width: 100%;
    min-height: 18px;
    text-align: center;
}
body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 14px;
    border-radius: 10px;
}

@media (hover: hover) and (pointer: fine) {
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-btn:not(:disabled):hover {
        background: #dce9f5 !important;
    }
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .sw1-stepper-btn.sw1-plus:not(:disabled):hover {
        background: var(--osd-card-blue-hover) !important;
    }
}
@media (max-width: 767px) {
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-element-bottom {
        padding: 13px !important;
    }
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .product-image-link {
        padding: 15px;
    }
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-entities-title {
        font-size: 14px !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 :is(.product-wrapper, .sw1-stepper-btn, .sw1-qty-input) {
        transition: none !important;
        animation: none !important;
    }
}

/* Keep the rail arrows inside the phone viewport instead of outside the page. */
@media (max-width: 767px) {
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-nav-arrows .wd-prev {
        top: calc(var(--osd-card-image-height) / 2 - 22px) !important;
        left: -12px !important;
        right: auto !important;
    }
    body.sw1d-home-native-v3 .sw1d-home-rail-v3 .wd-nav-arrows .wd-next {
        top: calc(var(--osd-card-image-height) / 2 - 22px) !important;
        right: -12px !important;
        left: auto !important;
    }
}
