/*
 * Deal Showcase home widget (widgets/deal_showcase.blade.php).
 * Colours come from the storefront theme tokens and corners from the
 * --theme-radius-* scale, so presets, dark mode and the Corners setting all
 * apply. Campaign backgrounds use --ds-bg (a banner's own gradient) or the
 * theme band.
 */
.ds { --ds-gap: 14px; }

/* ── Heading ─────────────────────────────────────────── */
.ds-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.ds-title {
    margin: 0;
    font-size: clamp(1.25rem, 1rem + 1vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--theme-text-strong);
}
.ds-sub { margin: 4px 0 0; color: var(--theme-text-muted); font-size: .95rem; }
.ds-nav { display: flex; gap: 8px; flex-shrink: 0; }
.ds-nav-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 50%;
    background: var(--theme-surface);
    color: var(--theme-text-strong);
    cursor: pointer;
    transition: background-color .15s ease, opacity .15s ease;
}
.ds-nav-btn:hover:not(:disabled) { background: var(--theme-hover); }
.ds-nav-btn:disabled { opacity: .4; cursor: default; }
.ds-nav-btn:focus-visible { outline: 2px solid var(--theme-primary); outline-offset: 2px; }

/* ── Campaign stage ──────────────────────────────────── */
.ds-stage {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--ds-gap);
    align-items: stretch;
}
.ds-stage--solo { grid-template-columns: minmax(0, 1fr); }

.ds-card {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 380px;
    overflow: hidden;
    border-radius: var(--theme-radius-4xl);
    background: var(--ds-bg, var(--theme-band));
    color: var(--theme-on-band);
    box-shadow: var(--theme-shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.ds-card:hover { transform: translateY(-3px); box-shadow: var(--theme-shadow-md); }
.ds-card:focus-within { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
.ds-card--feature { min-height: 420px; }
.ds-stage--solo .ds-card--feature { min-height: 320px; flex-direction: row; align-items: stretch; }
.ds-stage--solo .ds-card--feature .ds-card-copy { flex: 1 1 50%; justify-content: center; }
.ds-stage--solo .ds-card--feature .ds-card-media { flex: 1 1 50%; }

/* Rail posters without their own gradient take turns on theme colours. */
.ds-rail-item:nth-child(4n+1) .ds-card:not(.ds-card--custom) { background: linear-gradient(160deg, var(--theme-accent-strong), var(--theme-accent)); color: var(--theme-on-accent); }
.ds-rail-item:nth-child(4n+2) .ds-card:not(.ds-card--custom) { background: linear-gradient(160deg, var(--theme-primary), var(--theme-primary-hover)); color: var(--theme-on-primary); }
.ds-rail-item:nth-child(4n+3) .ds-card:not(.ds-card--custom) { background: linear-gradient(160deg, var(--theme-chrome-bg), var(--theme-chrome-bg-strong)); color: var(--theme-on-chrome); }
.ds-rail-item:nth-child(4n+4) .ds-card:not(.ds-card--custom) { background: var(--theme-band); color: var(--theme-on-band); }
/* Dark mode turns primary and accent into light tints, so those posters move to the dark band/chrome. */
[data-theme="dark"] .ds-rail-item:nth-child(4n+1) .ds-card:not(.ds-card--custom) { background: linear-gradient(160deg, var(--theme-band-end), var(--theme-chrome-bg)); color: var(--theme-on-band); }
[data-theme="dark"] .ds-rail-item:nth-child(4n+2) .ds-card:not(.ds-card--custom) { background: linear-gradient(160deg, var(--theme-band-start), var(--theme-chrome-bg-strong)); color: var(--theme-on-band); }
.ds-tone--light { color: var(--theme-text-strong); }

.ds-card-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: clamp(16px, 1.6vw, 26px);
}
.ds-chip {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: var(--theme-radius-pill);
    background: rgba(255, 255, 255, .18);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.ds-tone--light .ds-chip { background: rgba(15, 23, 42, .08); }
.ds-card-title {
    margin: 0;
    font-size: clamp(1.1rem, .9rem + .8vw, 1.45rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.02em;
    color: inherit;
}
.ds-card--feature .ds-card-title { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.5rem); max-width: 16ch; }
.ds-card-link { color: inherit; text-decoration: none; }
.ds-card-link:hover, .ds-card-link:focus { color: inherit; text-decoration: none; }
.ds-card-link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.ds-card-link:focus-visible { outline: none; }
.ds-card-sub { margin: 0; max-width: 34ch; font-size: .93rem; opacity: .88; }
.ds-cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 9px 16px;
    border-radius: var(--theme-radius-pill);
    background: var(--theme-surface);
    color: var(--theme-text-strong);
    font-size: .85rem;
    font-weight: 800;
    box-shadow: var(--theme-shadow-sm);
    transition: gap .2s ease;
}
.ds-card:hover .ds-cta { gap: 12px; }
.ds-card--poster .ds-cta { display: none; }

.ds-card-media {
    position: relative;
    display: flex;
    flex: 1;
    align-items: flex-end;
    justify-content: center;
    min-height: 150px;
    padding: 0 clamp(12px, 1.4vw, 22px) clamp(12px, 1.4vw, 22px);
}
/* Soft halo so transparent product cut-outs sit on light, not a hard edge. */
.ds-card-media::before {
    content: "";
    position: absolute;
    bottom: -22%;
    left: 50%;
    width: 82%;
    aspect-ratio: 1;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .32), rgba(255, 255, 255, 0));
}
/* Product shots sit in a white frame, slightly tilted, like a photo on a board. */
.ds-card-media--photo img {
    position: relative;
    width: auto;
    max-width: min(74%, 260px);
    height: auto;
    aspect-ratio: 1;
    padding: 10px;
    object-fit: contain;
    border-radius: var(--theme-radius-2xl);
    background: #fff;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .28);
    transform: rotate(-4deg);
    transition: transform .3s ease;
}
.ds-card--feature .ds-card-media--photo img { max-width: min(70%, 320px); }
.ds-rail-item:nth-child(even) .ds-card-media--photo img { transform: rotate(4deg); }
.ds-card:hover .ds-card-media--photo img,
.ds-rail-item:nth-child(even) .ds-card:hover .ds-card-media--photo img { transform: rotate(0) scale(1.03); }
/* Landscape artwork fills the lower part of the card edge to edge. */
.ds-card-media--wide { padding: 0; min-height: 170px; }
.ds-card-media--wide::before { display: none; }
.ds-card-media--wide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.ds-card:hover .ds-card-media--wide img { transform: scale(1.04); }
.ds-card--text { justify-content: flex-end; }

/* Countdown chip (campaigns ending soon, flash tiles). */
.ds-countdown {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 5px 10px;
    border-radius: var(--theme-radius-pill);
    background: rgba(0, 0, 0, .26);
    color: inherit;
    font-size: .78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ds-tone--light .ds-countdown { background: rgba(15, 23, 42, .08); }
.ds-countdown.is-ended { opacity: .7; }

/* ── Rail of campaign posters ────────────────────────── */
.ds-rail-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ds-rail {
    display: grid;
    flex: 1;
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, calc((100% - 2 * var(--ds-gap)) / 3));
    gap: var(--ds-gap);
    margin: 0;
    padding: 2px 2px 6px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}
.ds-rail::-webkit-scrollbar { display: none; }
.ds-rail:focus-visible { outline: 2px solid var(--theme-primary); outline-offset: 4px; border-radius: var(--theme-radius-md); }
.ds-rail-item { display: flex; scroll-snap-align: start; }
.ds-progress {
    height: 4px;
    overflow: hidden;
    border-radius: var(--theme-radius-pill);
    background: var(--theme-border);
}
.ds-progress span {
    display: block;
    width: 33%;
    height: 100%;
    border-radius: inherit;
    background: var(--theme-primary);
    transition: transform .15s linear;
}

/* ── Smart tiles ─────────────────────────────────────── */
.ds-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--ds-gap);
    margin: var(--ds-gap) 0 0;
    padding: 0;
    list-style: none;
}
.ds-tiles-item { display: flex; }
.ds-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-height: 250px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-3xl);
    background: var(--theme-surface);
    color: var(--theme-text);
    box-shadow: var(--theme-shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ds-tile:hover { transform: translateY(-3px); box-shadow: var(--theme-shadow-md); border-color: var(--theme-border-strong); }
.ds-tile:focus-within { outline: 3px solid var(--theme-focus); outline-offset: 2px; }
.ds-tile-head { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 10px; }
.ds-tile-text { min-width: 0; }
.ds-tile-icon {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    height: 34px;
    border-radius: var(--theme-radius-lg);
    background: var(--theme-accent-soft);
    color: var(--theme-accent-strong);
    font-size: .9rem;
}
.ds-tile-title { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.2; color: var(--theme-text-strong); }
.ds-tile-link { color: inherit; text-decoration: none; }
.ds-tile-link:hover, .ds-tile-link:focus { color: inherit; text-decoration: none; }
.ds-tile-link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.ds-tile-link:focus-visible { outline: none; }
.ds-tile-meta {
    display: -webkit-box;
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--theme-text-muted);
    font-size: .82rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.ds-tile-foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.ds-tile-go { display: inline-flex; align-items: center; gap: 6px; color: var(--theme-primary); font-size: .82rem; font-weight: 800; transition: gap .2s ease; }
.ds-tile:hover .ds-tile-go { gap: 10px; }

/* Fanned product stack: the lead product in front, two tilted behind. */
.ds-fan { position: relative; height: 124px; margin: 4px 0 2px; }
.ds-fan-item {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 76px;
    height: 76px;
    padding: 6px;
    object-fit: contain;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-xl);
    background: #fff;
    box-shadow: var(--theme-shadow-sm);
    transition: transform .25s ease;
}
.ds-fan-item--1 { z-index: 3; bottom: 10px; width: 100px; height: 100px; transform: translateX(-50%); }
.ds-fan-item--2 { z-index: 2; transform: translateX(-100%) rotate(-8deg); }
.ds-fan-item--3 { z-index: 1; transform: translateX(0) rotate(8deg); }
.ds-tile:hover .ds-fan-item--1 { transform: translateX(-50%) translateY(-4px); }
.ds-tile:hover .ds-fan-item--2 { transform: translateX(-108%) rotate(-12deg); }
.ds-tile:hover .ds-fan-item--3 { transform: translateX(8%) rotate(12deg); }

/* Tile variants. */
.ds-tile--continue { background: linear-gradient(180deg, var(--theme-surface-muted), var(--theme-surface)); }
.ds-tile--continue .ds-tile-icon { background: var(--theme-info-bg, var(--theme-accent-soft)); color: var(--theme-info-text, var(--theme-primary)); }
.ds-tile--flash {
    border-color: transparent;
    background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .12), transparent 60%), var(--theme-chrome-bg);
    color: var(--theme-on-chrome);
}
.ds-tile--flash .ds-tile-title { color: var(--theme-on-chrome-strong, var(--theme-on-chrome)); }
.ds-tile--flash .ds-tile-meta { color: var(--theme-on-chrome-muted, var(--theme-on-chrome)); }
.ds-tile--flash .ds-tile-icon { background: var(--theme-accent-strong); color: var(--theme-on-accent); }
.ds-tile--flash .ds-tile-go { color: var(--theme-chrome-accent, var(--theme-accent)); }
.ds-tile--flash .ds-fan-item { border-color: transparent; }
.ds-tile--campaign {
    border-color: transparent;
    background: var(--ds-bg, var(--theme-band));
    color: var(--theme-on-band);
}
.ds-tile--campaign .ds-tile-title, .ds-tile--campaign .ds-tile-meta, .ds-tile--campaign .ds-tile-go { color: inherit; }
.ds-tile--campaign .ds-tile-icon { background: rgba(255, 255, 255, .18); color: inherit; }
.ds-tile--campaign.ds-tone--light .ds-tile-icon { background: rgba(15, 23, 42, .08); }
.ds-tile-cover { display: flex; flex: 1; align-items: flex-end; justify-content: center; min-height: 110px; }
.ds-tile-cover img { width: 100%; max-height: 140px; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .2)); }

/* ── Dark mode: tokens cover colours; product images keep a light card. ── */
[data-theme="dark"] .ds-fan-item { border-color: transparent; background: #f8fafc; }
[data-theme="dark"] .ds-nav-btn { background: var(--theme-surface-raised, var(--theme-surface)); }

/* ── Smaller screens: stack the stage, swipe posters and tiles. ── */
@media (max-width: 991.98px) {
    .ds-stage { grid-template-columns: minmax(0, 1fr); }
    .ds-card, .ds-card--feature { min-height: 300px; }
    .ds-stage--solo .ds-card--feature { flex-direction: column; }
    .ds-rail { grid-auto-columns: minmax(200px, 42%); }
}
@media (max-width: 575.98px) {
    .ds { --ds-gap: 12px; }
    .ds-nav { display: none; }
    .ds-card--feature { min-height: 0; }
    .ds-card--feature .ds-card-media--photo img { max-width: min(60%, 200px); }
    .ds-card--poster { min-height: 300px; }
    .ds-rail { grid-auto-columns: 74%; }
    .ds-tiles {
        grid-auto-columns: 64%;
        grid-auto-flow: column;
        grid-template-columns: none;
        overflow-x: auto;
        padding-bottom: 6px;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }
    .ds-tiles::-webkit-scrollbar { display: none; }
    .ds-tiles-item { scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
    .ds-card, .ds-tile, .ds-fan-item, .ds-card-media img, .ds-cta, .ds-tile-go, .ds-progress span { transition: none; }
    .ds-card:hover, .ds-tile:hover { transform: none; }
    .ds-card:hover .ds-card-media--wide img { transform: none; }
    .ds-rail { scroll-behavior: auto; }
}
