/* ==========================================================================
   Clofits FX — 3D depth, quick add, night mode and motion polish.
   Every moving effect is off when the visitor prefers reduced motion.
   ========================================================================== */

:root {
    --fx-holo: linear-gradient(110deg, #c9d6ff 0%, #f4d9ff 22%, #fff3c4 40%, #c9fff1 58%, #d6e0ff 76%, #f4d9ff 100%);
    --fx-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Hero: a deeper 3D stage ---------- */
.hero { transform-style: preserve-3d; }
.hero::before,
.hero::after {
    content: "";
    position: absolute;
    z-index: 1;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(42px);
    opacity: .38;
    mix-blend-mode: screen;
}
.hero::before { width: 34%; aspect-ratio: 1; top: -12%; right: 8%; background: radial-gradient(circle, #b9c6ff, transparent 65%); }
.hero::after { width: 26%; aspect-ratio: 1; bottom: -10%; right: 32%; background: radial-gradient(circle, #ffd3f1, transparent 65%); }
.hero-copy :is(h1, h2) {
    background: linear-gradient(100deg, #fff 0%, #fff 38%, #e7ecff 46%, #ffe3f6 52%, #fff 60%, #fff 100%) 0 0 / 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 6px 22px #0007);
}
.hero-copy .button {
    background: #ffffffe6;
    box-shadow: 0 8px 24px #0004, inset 0 0 0 1px #fff;
    backdrop-filter: blur(6px);
}

@media (prefers-reduced-motion: no-preference) {
    .hero-copy :is(h1, h2) { animation: fx-sheen 6s ease-in-out infinite; }
    .hero::before { animation: fx-float 9s ease-in-out infinite alternate; }
    .hero::after { animation: fx-float 11s ease-in-out -3s infinite alternate-reverse; }
    .hero {
        transform: perspective(1400px) rotateX(calc(var(--fx-tilt-y, var(--pointer-y, 0)) * -2.2deg)) rotateY(calc(var(--fx-tilt-x, var(--pointer-x, 0)) * 3deg));
        transition: transform .4s var(--fx-ease);
    }
    .hero-copy { transform: translateZ(40px); }
}
@keyframes fx-sheen {
    0%, 30% { background-position: 100% 0; }
    70%, 100% { background-position: 0 0; }
}
@keyframes fx-float {
    from { translate: 0 0; scale: 1; }
    to { translate: -2.5rem 1.5rem; scale: 1.15; }
}

/* ---------- Product cards: tilt, glare, second photo, quick add ---------- */
.fx-card { --fx-rx: 0deg; --fx-ry: 0deg; --fx-gx: 50%; --fx-gy: 50%; }
.fx-media {
    position: relative;
    border-radius: .8rem;
    transform-style: preserve-3d;
    transform: perspective(900px) rotateX(var(--fx-rx)) rotateY(var(--fx-ry));
    transition: transform .45s var(--fx-ease), box-shadow .45s var(--fx-ease);
}
.fx-card.is-tilting .fx-media { transition: transform .08s linear, box-shadow .3s ease; box-shadow: 0 22px 40px -18px #0006; }
.fx-media .collection-product-image { position: relative; }
.fx-alt-image {
    position: absolute;
    inset: 0;
    height: 100%;
    opacity: 0;
    transition: opacity .45s ease;
}
.fx-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at var(--fx-gx) var(--fx-gy), #ffffff59, transparent 48%);
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity .3s ease;
}
.fx-card.is-tilting .fx-glare { opacity: 1; }

.fx-quick {
    position: absolute;
    z-index: 2;
    inset: auto .55rem .55rem;
    display: grid;
    gap: .45rem;
    padding: .65rem;
    border: 1px solid #ffffff80;
    border-radius: .75rem;
    background: #ffffffb8;
    box-shadow: 0 10px 30px #0002;
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    transform: translateZ(30px) translateY(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, transform .35s var(--fx-ease), visibility 0s .25s;
}
.fx-quick-title { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #3a3a3a; }
.fx-quick-sizes { display: flex; flex-wrap: wrap; gap: .3rem; }
.fx-quick-sizes button {
    min-width: 2.3rem;
    min-height: 2.1rem;
    padding: .2rem .5rem;
    border: 1px solid #151515;
    border-radius: .55rem;
    background: #fff;
    color: #151515;
    font: 700 .8rem/1 Arial, sans-serif;
    cursor: pointer;
}
.fx-quick-sizes button:hover:not(:disabled), .fx-quick-sizes button:focus-visible { background: #151515; color: #fff; }
.fx-quick-sizes button:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.fx-quick-sizes .fx-quick-one { flex: 1; }
.fx-quick.is-busy { pointer-events: none; opacity: .7; }
.fx-quick-toggle {
    position: absolute;
    z-index: 3;
    right: .55rem;
    bottom: .55rem;
    display: none;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid #fff9;
    border-radius: 50%;
    background: #151515e6;
    color: #fff;
    font: 400 1.4rem/1 Arial, sans-serif;
    box-shadow: 0 6px 18px #0004;
    cursor: pointer;
}
.fx-card.is-quick-open .fx-quick-toggle { rotate: 45deg; }
.fx-card.is-quick-open .fx-quick,
.fx-card:focus-within .fx-quick {
    opacity: 1;
    visibility: visible;
    transform: translateZ(30px) translateY(0);
    transition: opacity .25s ease, transform .35s var(--fx-ease), visibility 0s;
}
.fx-card.is-quick-open .fx-quick { bottom: 3.5rem; }

@media (hover: hover) and (pointer: fine) {
    .fx-card:hover .fx-quick {
        opacity: 1;
        visibility: visible;
        transform: translateZ(30px) translateY(0);
        transition: opacity .25s ease, transform .35s var(--fx-ease), visibility 0s;
    }
    .fx-card:hover .fx-alt-image { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
    .fx-quick-toggle { display: grid; }
}

/* ---------- Fly to bag + toast ---------- */
.fx-fly {
    position: fixed;
    z-index: 1000;
    border-radius: .8rem;
    object-fit: cover;
    pointer-events: none;
    box-shadow: 0 18px 40px #0005;
}
.fx-toast {
    position: fixed;
    z-index: 1001;
    left: 50%;
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: .9rem;
    max-width: calc(100vw - 2rem);
    padding: .7rem .75rem .7rem 1.1rem;
    border: 1px solid #ffffff2e;
    border-radius: 1rem;
    background: #151515f2;
    color: #fff;
    font: 600 .9rem/1.3 Arial, sans-serif;
    box-shadow: 0 18px 50px #0006;
    backdrop-filter: blur(10px);
    translate: -50% 0;
}
.fx-toast a { padding: .45rem .8rem; border-radius: 2rem; background: #fff; color: #151515; text-decoration: none; font-weight: 700; white-space: nowrap; }
.fx-toast.is-error { background: #7a1712f2; }
@media (prefers-reduced-motion: no-preference) {
    .fx-toast { animation: fx-toast-in .45s var(--fx-ease) both; }
    .bag-count.fx-bump { animation: cart-count-pop .52s ease-out both; }
}
@keyframes fx-toast-in {
    from { opacity: 0; translate: -50% 1.5rem; scale: .96; }
    to { opacity: 1; translate: -50% 0; scale: 1; }
}

/* ---------- Depth reveal for product grids ---------- */
@media (prefers-reduced-motion: no-preference) {
    .fx-stagger { opacity: 0; transform: perspective(900px) translateY(2.2rem) rotateX(12deg) scale(.96); transform-origin: 50% 100%; }
    .fx-stagger.fx-in {
        opacity: 1;
        transform: none;
        transition: opacity .7s var(--fx-ease) var(--fx-delay, 0ms), transform .9s var(--fx-ease) var(--fx-delay, 0ms);
    }
}

/* ---------- Custom cursor (mouse only) ---------- */
.fx-cursor {
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 2.1rem;
    height: 2.1rem;
    margin: -1.05rem 0 0 -1.05rem;
    border: 1.5px solid #fff;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: difference;
    transition: width .25s var(--fx-ease), height .25s var(--fx-ease), margin .25s var(--fx-ease), background-color .25s ease, opacity .2s ease;
    opacity: 0;
}
.fx-cursor.is-visible { opacity: 1; }
.fx-cursor.is-active { width: 3.2rem; height: 3.2rem; margin: -1.6rem 0 0 -1.6rem; background: #ffffff1f; border-width: 1px; }
.fx-cursor.is-pressed { width: 1.5rem; height: 1.5rem; margin: -.75rem 0 0 -.75rem; }

/* ---------- Night mode toggle ---------- */
.fx-theme-toggle .fx-sun { display: none; }
.fx-theme-toggle .fx-moon { fill: currentColor; }
.fx-theme-toggle .fx-sun { fill: currentColor; }
html[data-theme="night"] .fx-theme-toggle .fx-sun { display: block; }
html[data-theme="night"] .fx-theme-toggle .fx-moon { display: none; }

/*
 * Night mode inverts the monochrome page, then inverts photos back. A plain
 * invert(1) undoes itself exactly, so product colours stay true. Photo banners
 * (photo + dark overlay + white text) are inverted back as a whole so they look
 * the same as in day mode. Dialogs sit in the browser's top layer, which the
 * page filter does not reach, so they are inverted on their own.
 */
html[data-theme="night"] { filter: invert(1); background: #f4f4f3; }
html[data-theme="night"] :is(.hero, .category-card, .campaign, .bottom-campaign, .daily-deal, .home-video, .size-chart-dialog, .site-footer-dark) { filter: invert(1); }
html[data-theme="night"] body :is(img, video, iframe, .fx-fly):not(:is(.hero, .category-card, .campaign, .bottom-campaign, .daily-deal, .home-video, .size-chart-dialog) *) { filter: invert(1); }
html[data-theme="night"] dialog[open] { filter: invert(1); }
html[data-theme="night"] dialog[open] :is(img, video, iframe) { filter: invert(1); }
html[data-theme="night"] .fx-cursor { border-color: #000; }
html[data-theme="night"] .fx-cursor.is-active { background: #0000001f; }
html[data-theme="night"] :is(.fx-media, .category-card, .campaign, .daily-deal-card) {
    box-shadow: 0 0 0 1px #0000001a, 0 18px 40px -20px #0b3cff38;
}
html[data-theme="night"] .search { box-shadow: 0 0 0 1px #00000014, 0 8px 30px -10px #0b3cff2e; }
html[data-theme="night"] .fx-toast { filter: invert(1); }
@media (prefers-reduced-motion: no-preference) {
    html.fx-theme-switching { transition: filter .45s ease; }
}

@media print {
    html[data-theme="night"], html[data-theme="night"] * { filter: none !important; }
    .fx-cursor, .fx-toast, .fx-quick, .fx-quick-toggle { display: none !important; }
}
