/* ═══════════════════════════════════════════════════════════════════════
   WISHLIST + RECENTLY-VIEWED — /wishlist and /recent, plus the reusable
   .wish-heart toggle button (data-wish-toggle, see wishlist.js's header
   comment for the exact markup contract) meant to be dropped into other
   pages later (header icon, product cards, the PDP).
   Composes tokens.css/theme.css/base.css/components.css/layout.css
   (.container, .breadcrumb, .btn, .badge, .empty-state, .state-banner,
   .icon, .product-grid) — nothing here redeclares a colour, radius,
   spacing or shadow. Logical properties only (RTL-first — no left/right).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Shared page shell (both /wishlist and /recent) ─────────────────────── */

.wishlist-page { padding-block: var(--space-4) var(--space-16); }
.wishlist-page__title { font-size: var(--text-3xl); font-weight: var(--weight-bold); color: var(--ink); margin: 0 0 var(--space-6); }

.wishlist-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-2);
}
.wishlist-page__header .wishlist-page__title { margin-bottom: 0; }

/* ── /wishlist — the line list ───────────────────────────────────────── */

.wishlist-list-wrap {
    background: var(--paper);
    border: var(--card-border, 1px solid var(--line));
    border-radius: var(--card-radius, var(--radius-md));
    padding: var(--space-6);
}

.wishlist-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }

.wishlist-line {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    grid-template-areas: "media info actions";
    column-gap: var(--space-4);
    align-items: center;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--line);
}
.wishlist-line:last-child { border-bottom: 0; padding-bottom: 0; }
.wishlist-line.is-unavailable { opacity: .7; }

.wishlist-line__media {
    grid-area: media;
    width: 88px;
    height: 88px;
    border-radius: var(--radius-sm);
    background: var(--tray);
    border: 1px solid var(--line);
    overflow: hidden;
    align-self: start;
}
.wishlist-line__media img { width: 100%; height: 100%; object-fit: contain; padding: .6rem; }

.wishlist-line__info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.wishlist-line__brand { font-size: var(--text-sm); color: var(--ink-soft); margin: 0; }
.wishlist-line__name {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    text-decoration: none;
    width: fit-content;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wishlist-line__name:hover { color: var(--brand); }
.wishlist-line__name--muted { color: var(--ink-soft); }
.wishlist-line__name--muted:hover { color: var(--ink); }

.wishlist-line__variant {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: var(--text-xs);
    color: var(--ink-soft);
    background: var(--paper-muted);
    border-radius: var(--radius-sm);
    padding: .1rem .45rem;
}

.wishlist-line__price { display: flex; align-items: baseline; gap: .3rem; margin-top: .1rem; }
.wishlist-line__price-value { font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--text-lg); color: var(--ink); }
.wishlist-line__price-currency { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink-soft); }

.wishlist-line__reason {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: var(--text-sm);
    color: var(--ink-soft);
    margin: .1rem 0 0;
}
.wishlist-line__reason .icon { flex: 0 0 auto; color: var(--warning-base); }

.wishlist-line__actions {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    min-width: 148px;
}
.wishlist-line__actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; white-space: nowrap; }

.wishlist-line__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    background: none;
    border: 0;
    color: var(--ink-soft);
    font-size: var(--text-sm);
    cursor: pointer;
    padding: .3rem;
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.wishlist-line__remove:hover { color: var(--danger-base); background: var(--danger-tint); }
.wishlist-line__remove:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 640px) { /* --bp-sm */
    .wishlist-line {
        grid-template-columns: 72px 1fr;
        grid-template-areas:
            "media info"
            "actions actions";
        row-gap: .6rem;
    }
    .wishlist-line__media { width: 72px; height: 72px; }
    .wishlist-line__actions { flex-direction: row; min-width: 0; }
    .wishlist-line__actions .btn { flex: 1; }
}

/* ── /recent — card grid (reuses the sitewide .product-grid layout) ─────── */

.recent-page__disclaimer {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    font-size: var(--text-sm);
    color: var(--ink-soft);
    line-height: var(--leading-normal);
    margin: 0 0 var(--space-6);
}
.recent-page__disclaimer .icon { flex: 0 0 auto; margin-top: 2px; }

.recent-card {
    position: relative;
    background: var(--paper);
    border: var(--card-border, 1px solid var(--line));
    border-radius: var(--card-radius, var(--radius-md));
    box-shadow: var(--card-shadow, var(--shadow-card));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--duration-base) var(--ease-standard);
}
.recent-card:hover { box-shadow: var(--card-shadow-hover, var(--shadow-card)); }

/* Stretched link — the card opens the product page; media/body sit above it at a
   higher stacking context so the remove/add-to-cart buttons stay independently
   clickable (same pattern as .product-card__link in components.css). */
.recent-card__link { position: absolute; inset: 0; z-index: 1; }
.recent-card__media,
.recent-card__body { position: relative; z-index: 2; pointer-events: none; }
.recent-card__actions { pointer-events: auto; }

.recent-card__media {
    aspect-ratio: var(--ratio-4-3);
    background: var(--tray);
    display: flex;
    align-items: center;
    justify-content: center;
}
.recent-card__media img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-5); }

.recent-card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .3rem; }
.recent-card__brand { font-size: var(--text-sm); color: var(--ink-soft); margin: 0; }
.recent-card__title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.recent-card__price { font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--text-lg); color: var(--ink); margin: .1rem 0 0; }
.recent-card__price--unknown { font-family: inherit; font-weight: var(--weight-regular); font-size: var(--text-sm); color: var(--ink-faint); }

.recent-card__actions { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }
.recent-card__actions .btn { flex: 1; }
.recent-card__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    background: var(--paper-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.recent-card__remove:hover { color: var(--danger-base); border-color: var(--danger-line); background: var(--danger-tint); }

/* ── .wish-heart — the reusable toggle button (data-wish-toggle) ───────────
   Not used by /wishlist or /recent's own markup (they use dedicated
   [data-wish-remove]/[data-wish-add-to-cart] buttons instead) — this is
   for wherever a heart icon gets wired next (header, product cards, PDP).
   See the exact <button> markup in wishlist.js's header comment. ───────── */

.wish-heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: var(--radius-full);
    border: 1px solid var(--line-strong);
    background: var(--paper);
    color: var(--ink-soft);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard),
                background var(--duration-fast) var(--ease-standard);
}
.wish-heart:hover { border-color: var(--danger-base); color: var(--danger-base); }
/* Composes the .icon primitive (base.css) instead of redeclaring it. The old rule
   restated all six properties and pinned stroke-width to 2 while the primitive is
   1.6 — MEASURED on the home page: 78 icons at 1.6 and 18 at 2, and the heavier
   ones were exactly the hearts sitting on the product cards, beside the lighter
   icons, in the same grid. Only `fill: none` is kept, because .is-active below
   flips it to currentColor and needs an explicit rest value to flip back from. */
.wish-heart .icon { fill: none; }
.wish-heart.is-active { border-color: var(--danger-base); color: var(--danger-base); background: var(--danger-tint); }
.wish-heart.is-active .icon { fill: currentColor; }
.wish-heart.is-loading { opacity: .55; pointer-events: none; }

@keyframes wish-heart-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.28); }
    100% { transform: scale(1); }
}
.wish-heart.is-pulsing .icon { animation: wish-heart-pulse 320ms var(--ease-standard); }

@media (prefers-reduced-motion: reduce) {
    .wish-heart.is-pulsing .icon { animation: none; }
}

/* ── .product-card__quick-actions — the wishlist heart above, PLUS quick-view
   and compare, clustered on Index/Search/Category/Brand's shared .product-card
   (integration pass, Q9: one definition here rather than duplicated per page).
   Positioned clear of .badge-unavailable/.badge-discount (components.css —
   both sit at the top corners) by starting lower. .product-card__media has
   pointer-events:none by default (components.css) — only .product-card__cta
   re-enables it; this wrapper does the same for its own buttons (same
   pattern, so nothing here swallows the card's stretched link). ─────────── */
/* Hover-only since 2026-08-24: these two buttons sat permanently ON TOP of the
   product photo as large filled circles, hiding the goods they were meant to help
   inspect — visible in the founder's own screenshot comparison. They now fade in
   on card hover/focus-within only, matching the reference comp where the card face
   carries the wishlist heart alone. Kept keyboard-reachable via :focus-within. */
.product-card__quick-actions {
    position: absolute;
    inset-block-start: var(--space-12);
    inset-inline-end: var(--space-3);
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(var(--space-2));
    transition: opacity var(--duration-base) var(--ease-standard),
                transform var(--duration-base) var(--ease-standard);
}
.product-card:hover .product-card__quick-actions,
.product-card:focus-within .product-card__quick-actions {
    opacity: 1;
    transform: none;
}
@media (hover: none) {
    /* Touch devices get no hover — never hide the controls there. */
    .product-card__quick-actions { opacity: 1; transform: none; }
}
.product-card__quick-actions .wish-heart,
.product-card__quick-actions .icon-btn {
    width: 38px;
    height: 38px;
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}
.product-card__compare.is-active {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-tint);
}
