/* ==========================================================================
   Wishlist hearts, header counter, product rails (upsell / cross-sell), toast
   Logic: functions/functionWishlist.php, assets/footer/js/global/wishlist.js
   Rails sit inside .dc-page (checkout tokens); fallbacks keep the hearts
   right on the listing pages, which have no tokens.
   ========================================================================== */

/* ---------- Heart button ---------- */

.dw-heart {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--dc-ink, #171717);
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.dw-heart__icon {
    width: 20px;
    height: 20px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linejoin: round;
    transition: fill .15s ease, stroke .15s ease, transform .15s ease;
}

.dw-heart.is-saved .dw-heart__icon {
    fill: #b8324b;
    stroke: #b8324b;
}

.dw-heart:hover .dw-heart__icon {
    transform: scale(1.08);
}

.dw-heart:focus-visible {
    outline: 2px solid #171717;
    outline-offset: 2px;
}

.dw-heart.is-pop .dw-heart__icon {
    animation: dw-pop .4s ease;
}

@keyframes dw-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .dw-heart.is-pop .dw-heart__icon { animation: none; }
}

/* Round heart on product images */
.dw-heart--icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 1px 2px rgba(23, 23, 23, .08), 0 2px 8px rgba(23, 23, 23, .08);
}

.dw-media {
    position: relative;
}

.dw-heart--card,
.dw-card__media .dw-heart {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
}

/* Product page: labelled button - same shape as .dc-btn--ghost (no pills) */
.dw-heart--pill {
    min-height: 48px;
    padding: 12px 22px;
    border: 1px solid #cfcac0;
    border-radius: 8px;
    background: #fff;
    font: 600 15px/1.2 "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: .01em;
    color: #171717;
    white-space: nowrap;
}

.dw-heart--pill:hover {
    border-color: #171717;
}

.dw-heart--pill.is-saved {
    border-color: #b8324b;
    color: #8f1f35;
    background: #fdf2f4;
}

.dw-pdp-heart {
    display: flex;
    justify-content: flex-start;
    margin: 10px 0 0;
}

/* ---------- Header link ---------- */

.dw-header-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: inherit;
    text-decoration: none;
}

.dw-header-link .della-wishlist-count {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #b8324b;
    color: #fff;
    font: 600 10px/17px "Figtree", sans-serif;
    text-align: center;
}

.dw-header-link .della-wishlist-count[hidden] {
    display: none;
}

/* ---------- Rails ---------- */

.dw-rail {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.dw-rail + .dw-rail {
    margin-top: 28px;
}

.dw-rail__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px 16px;
}

.dw-rail__title {
    font-family: var(--dc-font-display, "Playfair Display", Georgia, serif);
    font-size: 21px;
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
    color: var(--dc-ink, #171717);
}

.dw-rail__sub {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--dc-muted, #5c5c5c);
}

.dw-rail__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.dw-rail__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Horizontal scroller: swipe on phones, 4-up on desktop */
.dw-rail--rail .dw-rail__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 46%);
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding: 2px 2px 10px;
    margin: 0 -2px;
}

@media (min-width: 680px) {
    .dw-rail--rail .dw-rail__list { grid-auto-columns: minmax(180px, 31%); }
}

@media (min-width: 1100px) {
    .dw-rail--rail .dw-rail__list { grid-auto-columns: calc((100% - 36px) / 4); }
}

.dw-rail--rail .dw-card {
    scroll-snap-align: start;
}

/* Wishlist page grid */
.dw-rail--grid .dw-rail__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 680px) {
    .dw-rail--grid .dw-rail__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}

@media (min-width: 1200px) {
    .dw-rail--grid .dw-rail__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Card ---------- */

.dw-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--dc-surface, #fff);
    border: 1px solid var(--dc-line, #e7e5e0);
    border-radius: var(--dc-radius, 12px);
    overflow: hidden;
    transition: border-color .15s ease, opacity .25s ease, transform .25s ease;
}

.dw-card:hover {
    border-color: var(--dc-line-strong, #cfcac0);
}

.dw-card.is-leaving {
    opacity: 0;
    transform: scale(.96);
}

.dw-card__media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f4f2ed;
}

.dw-card__media > a {
    display: block;
    width: 100%;
    height: 100%;
}

.dw-card__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    mix-blend-mode: multiply;
}

.dw-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--dc-ink, #171717);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

.dw-card__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    color: var(--dc-ink, #171717);
    box-shadow: 0 1px 2px rgba(23, 23, 23, .08), 0 2px 8px rgba(23, 23, 23, .08);
    cursor: pointer;
}

.dw-card__remove:hover {
    color: var(--dc-error, #b42318);
}

.dw-card__remove .dc-icon {
    width: 18px;
    height: 18px;
}

.dw-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding: 12px 14px 8px;
}

.dw-card__eyebrow {
    margin: 0;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--dc-gold-ink, #7a5f2e);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dw-card__name {
    margin: 0;
    font-family: var(--dc-font, "Figtree", sans-serif);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dw-card__name a {
    color: var(--dc-ink, #171717);
    text-decoration: none;
}

.dw-card__name a:hover {
    text-decoration: underline;
}

.dw-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    margin: 4px 0 0;
    font-size: 15px;
    color: var(--dc-ink, #171717);
}

.dw-card__price s {
    font-size: 13px;
    color: var(--dc-muted, #5c5c5c);
}

.dw-card__muted {
    font-size: 13px;
    color: var(--dc-muted, #5c5c5c);
}

.dw-card__cta {
    padding: 4px 14px 14px;
}

.dw-card__btn {
    width: 100%;
}

.dw-card__btn.is-done {
    color: var(--dc-success, #067647) !important;
    border-color: currentColor;
}

.dw-card__btn.is-done .dc-btn__label {
    color: inherit !important;
}

@media (max-width: 479px) {
    .dw-hide-sm { display: none; }
    .dw-card__body { padding: 10px 10px 6px; }
    .dw-card__cta { padding: 4px 10px 10px; }
}

/* Compact rows (checkout sidebar) */
.dw-rail--list .dw-rail__title {
    font-size: 18px;
}

.dw-rail--list .dw-rail__list {
    display: grid;
    gap: 10px;
}

.dw-rail--list .dw-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.dw-rail--list .dw-card__media {
    width: 64px;
    border-radius: var(--dc-radius-sm, 8px);
    overflow: hidden;
}

.dw-rail--list .dw-card__media img {
    padding: 4px;
}

.dw-rail--list .dw-card__badge {
    display: none;
}

.dw-rail--list .dw-card__body {
    padding: 0;
}

.dw-rail--list .dw-card__name {
    font-size: 14px;
}

.dw-rail--list .dw-card__price {
    font-size: 14px;
    margin: 0;
}

.dw-rail--list .dw-card__cta {
    padding: 0;
}

.dw-rail--list .dw-card__btn {
    width: auto;
}

/* ---------- Where the rails sit ---------- */

.dw-cart-rails {
    margin-top: 32px;
    display: grid;
    gap: 28px;
}

.dc-summary .dw-rail--list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--dc-line, #e7e5e0);
}

/* Account area: the theme's dark inner-page colours */
.dc-account .dw-rail__title,
.dc-account .dw-card__name a,
.dc-account .dw-card__price {
    color: #171717 !important;
}

.dc-account .dw-rail__sub,
.dc-account .dw-card__price s,
.dc-account .dw-card__muted {
    color: #5c5c5c !important;
}

.dc-account .dw-card__eyebrow {
    color: #7a5f2e !important;
}

.dc-stat--wish .dc-stat__icon {
    background: #fdf2f4;
    color: #b8324b;
}

/* Cart line: "Save for later" */
.dc-item__save {
    margin-left: auto;
    min-height: 44px;
    font-size: 14px;
    background: none;
    border: 0;
    cursor: pointer;
}

.dc-item__save:hover {
    color: #b8324b;
}

/* ---------- Toast ---------- */

.dw-toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 10px;
    background: #171717;
    color: #fff;
    font: 500 14px/1.4 "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity .2s ease, transform .2s ease;
}

.dw-toast.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.dw-toast a {
    color: #e6d3ad;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

/* Keep clear of the mobile checkout bar */
@media (max-width: 991px) {
    body:has(.dc-sticky-bar) .dw-toast {
        bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    }
}
