/* ==========================================================================
   DRS — effects shared by the seasonal themes (loaded with blackfriday.css or christmas.css, before them).
   Split-flap clock, tilting foil cards, kinetic band, 3D showroom, sections that light up, page transitions.
   Each theme sets its colours in the --fx-* variables. Behaviour in js/season-fx.js.
   body.bf-off / body.xm-off = the visitor turned the effects off.
   ========================================================================== */

/* ---------- Split-flap clock ---------- */
.bf-flap { position: relative; display: block; width: 1.06em; height: 1.5em; perspective: 260px; border-radius: 6px; box-shadow: 0 12px 26px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.10); }
.bf-flap i { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; font-style: normal; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bf-flap u { position: absolute; left: 0; right: 0; height: 200%; display: grid; place-items: center; text-decoration: none; }
.bf-flap .t, .bf-flap .ft { top: 0; border-radius: 6px 6px 0 0; background: var(--fx-flap-t); box-shadow: inset 0 1px 0 rgba(var(--fx-spot),.20); }
.bf-flap .b, .bf-flap .fb { bottom: 0; border-radius: 0 0 6px 6px; background: var(--fx-flap-b); }
.bf-flap :is(.t, .ft) u { top: 0; }
.bf-flap :is(.b, .fb) u { bottom: 0; }
.bf-flap .ft { transform-origin: 50% 100%; visibility: hidden; z-index: 2; }
.bf-flap .fb { transform-origin: 50% 0; transform: rotateX(90deg); visibility: hidden; z-index: 2; }
.bf-flap::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; z-index: 3; background: #000; box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.bf-flap.is-go .ft { visibility: visible; animation: bf-flap-top .22s ease-in forwards; }
.bf-flap.is-go .fb { visibility: visible; animation: bf-flap-bot .30s .20s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes bf-flap-top { from { transform: rotateX(0); filter: brightness(1); } to { transform: rotateX(-90deg); filter: brightness(.4); } }
@keyframes bf-flap-bot { from { transform: rotateX(90deg); filter: brightness(1.8); } to { transform: rotateX(0); filter: brightness(1); } }
.bf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Product cards: they tilt and the cover is a foil that follows the light ---------- */
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .product-card:hover {
    transform: perspective(1000px) translateY(-6px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .16s ease-out, border-color .3s ease, box-shadow .3s ease;
}
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .product-card-media::after {
    z-index: 1; mix-blend-mode: screen; pointer-events: none;
    background:
        radial-gradient(52% 90% at var(--bx, 50%) var(--by, 50%), rgba(255,255,255,.30), transparent 70%),
        var(--fx-foil);
    background-size: auto, 240% 100%; background-position: 0 0, var(--bx, 50%) 0;
}

/* ---------- Kinetic band ---------- */
.bf-band { position: relative; z-index: 1; overflow: hidden; padding: 22px 0 26px; border-block: 1px solid var(--fx-line); background: var(--fx-band); }
.bf-band-row { display: flex; width: max-content; will-change: transform; }
.bf-band-row span {
    flex: none; padding-right: .5em; white-space: nowrap; font-family: var(--font-display); font-style: italic; font-weight: 900; text-transform: uppercase;
    font-size: clamp(2.6rem, 6.4vw, 6rem); line-height: 1.12; letter-spacing: -.01em;
    background: var(--fx-metal); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.bf-band-row span.is-line { background: none; -webkit-text-stroke: 1.2px rgba(233,234,238,.42); }
.bf-band-row + .bf-band-row span { font-size: clamp(1.1rem, 2.1vw, 1.9rem); line-height: 1.5; font-weight: 700; }
.bf-band-row + .bf-band-row span.is-line { -webkit-text-stroke-width: .8px; }
.bf-band::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, var(--fx-ink), transparent 14%, transparent 86%, var(--fx-ink)); }

/* ---------- 3D showroom ---------- */
.bf-show { position: relative; isolation: isolate; padding: clamp(56px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); overflow: hidden; }
.bf-ring { display: flex; gap: 16px; overflow-x: auto; padding: 0 16px; }
.bf-item { position: relative; flex: none; display: block; width: min(560px, 74vw); border-radius: 12px; color: inherit; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.bf-item img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; border-radius: inherit; background: #0B0B0E; }
.bf-item-off { position: absolute; z-index: 2; top: 14px; right: 14px; padding: 6px 12px; border-radius: 6px; background: var(--fx-accent); color: #fff; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 1.35rem; line-height: 1; }
.bf-show.is-3d .bf-ring {
    position: relative; display: block; overflow: visible; padding: 0; height: calc(min(560px, 74vw) * .5625 + 130px);
    perspective: 1300px; perspective-origin: 50% 38%; cursor: grab; touch-action: pan-y;
}
.bf-show.is-3d .bf-ring.is-drag { cursor: grabbing; }
/* the floor and the light that falls on the one in front */
.bf-show.is-3d .bf-ring::before {
    content: ""; position: absolute; left: 50%; bottom: 10px; width: min(1180px, 130vw); height: 210px; transform: translateX(-50%); pointer-events: none;
    background: radial-gradient(50% 50% at 50% 40%, rgba(var(--fx-spot),.15), rgba(var(--fx-spot),.04) 46%, transparent 72%);
}
.bf-show.is-3d::before {
    content: ""; position: absolute; left: 50%; top: -40px; width: min(1100px, 130vw); height: 78%; transform: translateX(-50%); pointer-events: none; z-index: -1; opacity: 0;
    background: conic-gradient(from 180deg at 50% -6%, rgba(var(--fx-spot),.17) 0deg, rgba(var(--fx-spot),.11) 8deg, transparent 21deg, transparent 339deg, rgba(var(--fx-spot),.11) 352deg, rgba(var(--fx-spot),.17) 360deg);
    -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent);
}
.bf-show.is-3d.is-lit::before { animation: bf-strike 1.1s linear forwards; }
@keyframes bf-strike { 0% { opacity: 0; } 8% { opacity: .9; } 14% { opacity: .1; } 26% { opacity: .12; } 32% { opacity: 1; } 40% { opacity: .25; } 52%, 100% { opacity: 1; } }
.bf-show.is-3d .bf-item {
    position: absolute; left: 50%; top: 24px; will-change: transform; transform: translate3d(-50%,0,-400px);
}
.bf-show.is-3d .bf-item::before { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; background: var(--fx-ink); opacity: var(--dark, 0); pointer-events: none; }
.bf-show.is-3d .bf-item::after {
    content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: radial-gradient(46% 80% at var(--bx, 50%) var(--by, 20%), rgba(var(--fx-spot),.20), transparent 70%); box-shadow: inset 0 0 0 1px rgba(var(--fx-spot),.55), inset 0 0 40px rgba(var(--fx-spot),.07);
}
.bf-show.is-3d .bf-item.is-front::after { opacity: 1; }
/* the reflection on the floor (box-reflect takes the page to 20 fps) */
.bf-refl { position: absolute; left: 0; right: 0; top: calc(100% + 8px); height: 36%; overflow: hidden; border-radius: 12px 12px 0 0; opacity: calc(.34 - var(--dark, 0) * .36); pointer-events: none; -webkit-mask-image: linear-gradient(#000, transparent 92%); mask-image: linear-gradient(#000, transparent 92%); }
.bf-refl img { position: absolute; top: 0; left: 0; transform: scaleY(-1); border-radius: 0; }
.bf-item:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.bf-show-info { position: relative; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 12px 26px; flex-wrap: wrap; margin-top: -34px; padding: 0 16px; text-align: center; }
.bf-show-info[hidden] { display: none; }
.bf-show-info strong { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1.1; text-transform: uppercase; }
.bf-show-info p { margin: 0; }
.bf-show-info .price { font-size: 1.5rem; color: #fff; }
.bf-show-info.is-in > * { animation: bf-rise .5s cubic-bezier(.2,.8,.2,1) both; }
.bf-show-info.is-in > :nth-child(2) { animation-delay: .06s; }
.bf-show-info.is-in > :nth-child(3) { animation-delay: .12s; }
@keyframes bf-rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Sections: the lights come on, titles in metal, a line of light between them ---------- */
body:is(.blackfriday, .christmas) .section-head h2, body:is(.blackfriday, .christmas) .feature-title {
    background: linear-gradient(100deg, transparent 40%, var(--fx-shine) 50%, transparent 60%) 130% 0 / 280% 100% no-repeat, var(--fx-head);
    -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .06em;
}
body:is(.blackfriday, .christmas) .how-icon { color: var(--fx-shine); }
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .bf-sec.is-lit :is(.section-head h2, .feature-title) { animation: bf-metal 1.8s .15s cubic-bezier(.3,.7,.2,1) both; }
@keyframes bf-metal { from { background-position: 130% 0, 0 0; opacity: .25; } 35% { opacity: 1; } to { background-position: -60% 0, 0 0; opacity: 1; } }
.bf-sec { position: relative; }
.bf-sec:is(.section, .section-tight)::before {
    content: ""; position: absolute; top: 0; left: 50%; width: min(1280px, 100% - 32px); height: 1px; margin-left: calc(min(1280px, 100% - 32px) / -2); pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(var(--fx-spot),.55) 30%, var(--fx-accent) 50%, rgba(var(--fx-spot),.55) 70%, transparent);
    transform: scaleX(0); opacity: 0;
}
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .bf-sec.is-lit:is(.section, .section-tight)::before { transform: scaleX(1); opacity: .55; transition: transform 1.3s cubic-bezier(.2,.8,.2,1), opacity .5s; }
@property --bf-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
body:is(.blackfriday, .christmas) .cta-panel { border: 1px solid transparent; background: linear-gradient(var(--fx-panel), var(--fx-panel)) padding-box, conic-gradient(from var(--bf-a, 0deg), rgba(255,255,255,.10), var(--fx-shine) 8%, rgba(255,255,255,.10) 20%, rgba(255,255,255,.10) 50%, var(--fx-accent) 58%, rgba(255,255,255,.10) 70%) border-box; }
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .cta-panel.is-visible { animation: bf-spin 9s linear infinite; }
@keyframes bf-spin { to { --bf-a: 360deg; } }

/* reading progress, in infrared, under the header */
@supports (animation-timeline: scroll()) {
    body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .site-header::before {
        content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; z-index: 2; transform-origin: 0 50%; pointer-events: none;
        background: linear-gradient(90deg, transparent, var(--fx-accent) 70%, var(--fx-accent-hi)); transform: scaleX(0);
        animation: bf-read linear both; animation-timeline: scroll(root);
    }
    @keyframes bf-read { to { transform: scaleX(1); } }
}
/* the cart catches the light */
body:is(.blackfriday, .christmas) .cart-btn { position: relative; }
body:is(.blackfriday, .christmas):not(.bf-off, .xm-off) .cart-btn.is-bumping::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: 0 0 0 2px var(--fx-accent); animation: bf-ping .7s ease-out forwards; }
@keyframes bf-ping { to { transform: scale(2.1); opacity: 0; } }

/* from page to page: lights out, lights on */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root) { animation: bf-vt-out .18s ease-in both; }
    ::view-transition-new(root) { animation: bf-vt-in .42s ease-out both; }
    @keyframes bf-vt-out { to { opacity: 0; } }
    @keyframes bf-vt-in { 0% { opacity: 0; filter: brightness(.2); } 30% { opacity: 1; filter: brightness(1.25); } 100% { filter: brightness(1); } }
}

body:is(.bf-off, .xm-off) .bf-show.is-3d::before { opacity: 1; animation: none; }

@media (max-width: 860px) {
    .bf-show .section-head-row { margin-bottom: 10px; }
    .bf-show-info { margin-top: -52px; flex-direction: column; gap: 8px; }
    .bf-band { padding: 14px 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .bf-flap *, .bf-show-info.is-in > *, body:is(.blackfriday, .christmas) .cta-panel { animation: none !important; }
    .bf-show.is-3d.is-3d::before { opacity: 1; animation: none; }
    body:is(.blackfriday, .christmas) .product-card:hover { transform: none !important; }
}
