/* =====================================================
   Luma Jewelry — Animation & Interaction Framework
   Pavoi-inspired micro-interactions & transitions
   ===================================================== */

/* ── Core Transition Curves ── */
:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spring-soft: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-firm: cubic-bezier(0.22, 1.28, 0.38, 1.18);
}

/* ============================================================
   SCROLL REVEAL — Intersection Observer driven
   ============================================================ */
.luma-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out-expo),
                transform 0.7s var(--ease-out-expo);
}

.luma-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fallback: when JS is disabled or fails, content must remain readable */
html.no-js .luma-reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

/* Emergency safety net — injected via inline script if interactions.js crashes */
.luma-reveal--emergency-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

.luma-reveal--left {
    transform: translateX(-24px);
}
.luma-reveal--left.is-visible {
    transform: translateX(0);
}

.luma-reveal--right {
    transform: translateX(24px);
}
.luma-reveal--right.is-visible {
    transform: translateX(0);
}

.luma-reveal--scale {
    transform: scale(0.96);
}
.luma-reveal--scale.is-visible {
    transform: scale(1);
}

/* Stagger children delays */
.luma-reveal-stagger > *:nth-child(1) { transition-delay: 0s; }
.luma-reveal-stagger > *:nth-child(2) { transition-delay: 0.08s; }
.luma-reveal-stagger > *:nth-child(3) { transition-delay: 0.16s; }
.luma-reveal-stagger > *:nth-child(4) { transition-delay: 0.24s; }
.luma-reveal-stagger > *:nth-child(5) { transition-delay: 0.32s; }
.luma-reveal-stagger > *:nth-child(6) { transition-delay: 0.40s; }
.luma-reveal-stagger > *:nth-child(7) { transition-delay: 0.48s; }
.luma-reveal-stagger > *:nth-child(8) { transition-delay: 0.56s; }

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */

/* Fade In Up */
@keyframes lumaFadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade In Down */
@keyframes lumaFadeInDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade In */
@keyframes lumaFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Scale In */
@keyframes lumaScaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* Slide In Right */
@keyframes lumaSlideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* Slide Out Right */
@keyframes lumaSlideOutRight {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

/* Cart Icon Bounce */
@keyframes lumaCartBounce {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.3); }
    30%  { transform: scale(0.9); }
    45%  { transform: scale(1.15); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Heart Beat (Wishlist) */
@keyframes lumaHeartBeat {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.3); }
    30%  { transform: scale(1); }
    45%  { transform: scale(1.3); }
    60%  { transform: scale(1); }
}

/* Pulse */
@keyframes lumaPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* Skeleton Shimmer */
@keyframes lumaShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Toast Slide In (from bottom) */
@keyframes lumaToastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast Slide Out */
@keyframes lumaToastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(20px) scale(0.96); }
}

/* Spinner Rotate */
@keyframes lumaSpin {
    to { transform: rotate(360deg); }
}

/* Crossfade (for tab panels / gallery) */
@keyframes lumaCrossfade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Drawer Slide */
@keyframes lumaDrawerSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* Overlay Fade */
@keyframes lumaOverlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   BUTTON INTERACTIONS
   ============================================================ */

/* Press effect — subtle scale-down on active */
.luma-btn:active,
button:active {
    transform: scale(0.97);
    transition: transform 0.1s var(--ease-out-quad);
}

/* Loading spinner inside button */
.luma-btn.is-loading,
.single_add_to_cart_button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.luma-btn.is-loading::after,
.single_add_to_cart_button.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: lumaSpin 0.6s linear infinite;
}

/* Focus ring — accessible & branded */
.luma-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    /* outline: 2px solid var(--luma-gold); */
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================================
   FORM INPUT INTERACTIONS
   ============================================================ */

/* Input focus glow */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    /* border-color: var(--luma-gold); */
    /* box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12); */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Invalid state shake */
@keyframes lumaShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.luma-shake {
    animation: lumaShake 0.5s var(--ease-out-quad);
}

/* ============================================================
   TOAST NOTIFICATION SYSTEM
   ============================================================ */

.luma-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.luma-toast {
    background: var(--luma-dark);
    color: var(--luma-white);
    padding: 14px 20px;
    border-radius: var(--luma-radius-sm);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.28px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    animation: lumaToastIn 0.35s var(--ease-out-expo) forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 380px;
}

.luma-toast.is-exiting {
    animation: lumaToastOut 0.3s var(--ease-out-quad) forwards;
}

.luma-toast--success {
    background: #2d6a4f;
}

.luma-toast--error {
    background: #c44;
}

.luma-toast__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.luma-toast__close {
    flex-shrink: 0;
    margin-left: auto;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 0 0 8px;
    background: none;
    border: none;
}

.luma-toast__close:hover {
    color: var(--luma-white);
}

@media (max-width: 768px) {
    .luma-toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .luma-toast {
        max-width: 100%;
        font-size: 12px;
        padding: 12px 16px;
    }
}

/* ============================================================
   SKELETON LOADER
   ============================================================ */

.luma-skeleton {
    background: linear-gradient(
        90deg,
        var(--luma-gray-100) 0%,
        var(--luma-gray-200) 40%,
        var(--luma-gray-100) 80%
    );
    background-size: 200% 100%;
    animation: lumaShimmer 1.5s ease-in-out infinite;
    border-radius: var(--luma-radius-sm);
}

.luma-skeleton--image {
    aspect-ratio: 3 / 4;
    width: 100%;
}

.luma-skeleton--text {
    height: 14px;
    margin-bottom: 8px;
    width: 80%;
}

.luma-skeleton--text-short {
    height: 14px;
    margin-bottom: 8px;
    width: 50%;
}

.luma-skeleton--title {
    height: 16px;
    margin-bottom: 12px;
    width: 90%;
}

/* ============================================================
   IMAGE LOADING FADE-IN
   ============================================================ */

img.luma-img-loading {
    opacity: 0;
    transition: opacity 0.4s ease;
}

img.luma-img-loaded {
    opacity: 1;
}

/* ============================================================
   HOVER LIFT EFFECT (Cards / Interactive elements)
   ============================================================ */

.luma-hover-lift {
    transition: transform 0.35s var(--ease-out-expo),
                box-shadow 0.35s var(--ease-out-expo);
}

.luma-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   STICKY HEADER TRANSITION
   ============================================================ */

.luma-header--fixed {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    animation: lumaFadeInDown 0.35s var(--ease-out-expo);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.luma-header--hidden {
    transform: translateY(-100%);
    transition: transform 0.35s var(--ease-out-quad);
}

.luma-header--visible {
    transform: translateY(0);
    transition: transform 0.35s var(--ease-out-expo);
}

/* ============================================================
   MOBILE MENU OVERLAY ANIMATION
   ============================================================ */

.luma-mobile-nav.is-active {
    animation: lumaFadeInDown 0.3s var(--ease-out-expo);
}

/* ============================================================
   CART DRAWER ENHANCED
   ============================================================ */

.luma-mini-cart--open {
    animation: lumaSlideInRight 0.4s var(--ease-out-expo) forwards !important;
}

.luma-mini-cart__overlay--visible {
    animation: lumaOverlayFadeIn 0.35s ease forwards;
}

/* Cart item exit animation */
.luma-mini-cart__item.is-removing {
    animation: lumaSlideOutRight 0.3s var(--ease-out-quad);
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    transition: max-height 0.3s var(--ease-out-quad),
                opacity 0.3s var(--ease-out-quad),
                margin 0.3s var(--ease-out-quad),
                padding 0.3s var(--ease-out-quad);
}

/* Cart count badge bounce */
.luma-header__cart-count.luma-cart-bounce {
    animation: lumaCartBounce 0.5s var(--ease-out-back);
}

/* ============================================================
   SEARCH OVERLAY ENHANCED
   ============================================================ */

.luma-search-overlay--open {
    display: flex !important;
    animation: lumaFadeIn 0.3s ease;
}

.luma-search-overlay--open .luma-search-overlay__inner {
    animation: lumaFadeInDown 0.4s var(--ease-out-expo);
}

/* Search results item */
.luma-search-result-item {
    animation: lumaFadeInUp 0.3s var(--ease-out-expo);
    animation-fill-mode: both;
}

.luma-search-result-item:nth-child(1) { animation-delay: 0.05s; }
.luma-search-result-item:nth-child(2) { animation-delay: 0.1s; }
.luma-search-result-item:nth-child(3) { animation-delay: 0.15s; }
.luma-search-result-item:nth-child(4) { animation-delay: 0.2s; }
.luma-search-result-item:nth-child(5) { animation-delay: 0.25s; }
.luma-search-result-item:nth-child(6) { animation-delay: 0.3s; }

/* ============================================================
   PRODUCT CARD ENHANCED INTERACTIONS
   ============================================================ */

/* Quick Add button enhanced animation */
.luma-product-card__quick-add {
    transition: opacity 0.35s var(--ease-out-expo),
                transform 0.35s var(--ease-out-expo) !important;
}

/* Wishlist heart burst */
.luma-product-card__wishlist.is-active {
    color: #c44 !important;
    border-color: #c44 !important;
    animation: lumaHeartBeat 0.6s var(--ease-out-quad);
}

/* Sale badge pulse */
.luma-product-card__badge--sale {
    animation: lumaPulse 2s ease-in-out infinite;
}

/* ============================================================
   VARIATION SWATCH SELECTION
   ============================================================ */

.luma-variation-swatch.is-selected {
    animation: lumaScaleIn 0.25s var(--spring-soft);
}

/* ============================================================
   QUANTITY BUTTON INTERACTION
   ============================================================ */

.quantity button:active {
    transform: scale(0.9);
    transition: transform 0.1s ease;
}

/* ============================================================
   ANNOUNCEMENT BAR SLIDE UP
   ============================================================ */

.luma-announcement.is-closing {
    animation: lumaFadeInDown 0.3s ease reverse;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 0.3s ease 0.25s,
                padding 0.3s ease 0.25s;
}

/* ============================================================
   PRODUCT TABS ENHANCED
   ============================================================ */

.luma-product-tabs__panel.is-active {
    animation: lumaCrossfade 0.4s var(--ease-out-expo);
}

/* Tab indicator slide */
.luma-product-tabs__tab {
    position: relative;
}

.luma-product-tabs__tab::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 50%;
    width: 0;
    height: 2.5px;
    background: var(--luma-gold);
    transition: width 0.3s var(--ease-out-expo),
                left 0.3s var(--ease-out-expo);
}

.luma-product-tabs__tab:hover::after {
    width: 60%;
    left: 20%;
}

.luma-product-tabs__tab.is-active::after {
    width: 100%;
    left: 0;
}

/* ============================================================
   ACCESSIBILITY — Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
