/* ILYAHĪKĀ — shared motion, clarity & adaptive-network styles */

/* ---------- 4K / high-DPI clarity ---------- */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
img {
    image-rendering: auto;
    backface-visibility: hidden; /* keeps scaled images crisp during transforms */
}
@media (min-resolution: 2dppx) {
    body { letter-spacing: 0.005em; }
}

/* lazy images get a quiet placeholder tone while loading */
img[loading="lazy"] { background-color: #f0edea; }

/* ---------- creative animations (luxury-subtle) ---------- */

/* slow ken-burns drift on the home hero */
@keyframes ily-kenburns {
    from { transform: scale(1); }
    to   { transform: scale(1.07) translateY(-1.5%); }
}
img[src$="hero.png"] {
    animation: ily-kenburns 26s ease-in-out infinite alternate;
    will-change: transform;
}

/* scroll-reveal applied by site.js via IntersectionObserver */
.anim-init {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.anim-init.anim-in {
    opacity: 1;
    transform: none;
}

/* light sheen sweep across primary buttons on hover */
button.bg-heritage-olive, a.bg-heritage-olive {
    position: relative;
    overflow: hidden;
}
@keyframes ily-sheen {
    from { left: -60%; }
    to   { left: 130%; }
}
button.bg-heritage-olive::after, a.bg-heritage-olive::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
button.bg-heritage-olive:hover::after, a.bg-heritage-olive:hover::after {
    animation: ily-sheen 0.8s ease;
}

/* cart badge pop when the count changes */
@keyframes ily-badge-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.65); }
    100% { transform: scale(1); }
}
.cart-badge.badge-pop { animation: ily-badge-pop 0.45s ease; }

/* dot that flies from Add to Cart into the bag (created by site.js) */
.fly-dot {
    position: fixed;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #33301F;
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.7s ease;
}

/* gentle lift on product tiles */
.product-card .tilt-card { transition: box-shadow 0.5s ease, transform 0.5s ease; }

/* ---------- adaptive: slow network or reduced motion ---------- */
html[data-net="lite"] *,
html[data-net="lite"] *::before,
html[data-net="lite"] *::after {
    animation: none !important;
    transition: none !important;
}
html[data-net="lite"] .anim-init { opacity: 1; transform: none; }
html[data-net="lite"] [id^="threejs-container"] { display: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .anim-init { opacity: 1; transform: none; }
}

/* ---------- back-to-top button ---------- */
.ily-totop {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 45;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #33301F;      /* heritage-olive */
    color: #FBF8F5;           /* ivory-base */
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    box-shadow: 0 4px 16px rgba(51, 48, 31, 0.25);
}
.ily-totop.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.ily-totop:hover { background: #000000; }
/* keep clear of the mobile bottom nav on small screens */
@media (max-width: 767px) {
    .ily-totop { bottom: 84px; right: 16px; }
}

/* ---------- button loading spinner ---------- */
.ily-spin {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -2px;
    margin-right: 6px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ily-rot 0.7s linear infinite;
}
@keyframes ily-rot { to { transform: rotate(360deg); } }

/* ---------- order-confirmation checkmark pop ---------- */
@keyframes ily-pop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.ily-check { animation: ily-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---------- PDP gallery image fade-in ---------- */
.ily-fade-img { opacity: 0; transition: opacity 0.6s ease; }
.ily-fade-img.is-loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .ily-fade-img { opacity: 1; }
}
html[data-net="lite"] .ily-fade-img { opacity: 1; }

/* ---------- PDP gallery + linked style options ---------- */
.pdp-media-thumb {
    border-color: rgba(51, 48, 31, 0.08);
    opacity: 0.72;
}
.pdp-media-thumb:hover {
    opacity: 1;
    border-color: rgba(51, 48, 31, 0.4);
    transform: translateY(-2px);
}
.pdp-media-thumb.is-active {
    opacity: 1;
    border-color: #33301F;
    box-shadow: 0 0 0 1px rgba(51, 48, 31, 0.12);
}
.pdp-media-thumb img,
.pdp-media-thumb video {
    display: block;
}
.pdp-media-main {
    box-shadow: 0 24px 48px rgba(51, 48, 31, 0.08);
}
.pdp-description p + p {
    margin-top: 1rem;
}
.pdp-linked-option {
    box-shadow: 0 10px 24px rgba(51, 48, 31, 0.04);
}
.pdp-linked-option:hover {
    transform: translateY(-2px);
}
.pdp-linked-option.is-current {
    box-shadow: 0 18px 32px rgba(51, 48, 31, 0.12);
}

/* ---------- wishlist heart (product cards) ---------- */
.ily-wish-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(251, 248, 245, 0.85);  /* ivory-base */
    color: #33301F;                          /* heritage-olive */
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
}
.product-card:hover .ily-wish-btn,
.ily-wish-btn.is-saved { opacity: 1; transform: translateY(0); }
.ily-wish-btn.is-saved { color: #B89B5E; }   /* gold-accent when saved */
.ily-wish-btn .material-symbols-outlined { font-size: 22px; }
/* touch devices have no hover — always show the heart */
@media (hover: none) {
    .ily-wish-btn { opacity: 1; transform: none; }
}

/* PDP heart sits inline beside Share — not an image overlay */
.ily-wish-pdp {
    position: static;
    top: auto;
    right: auto;
    width: 44px;
    height: 44px;
    background: transparent;
    opacity: 1;
    transform: none;
    color: rgba(51, 48, 31, 0.6);
}
.ily-wish-pdp:hover { color: #33301F; }
.ily-wish-pdp.is-saved { color: #B89B5E; }

/* ---------- search overlay ---------- */
.ily-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}
.ily-search-overlay.is-open { opacity: 1; visibility: visible; }
.ily-search-scrim {
    position: absolute;
    inset: 0;
    background: rgba(51, 48, 31, 0.4);
    backdrop-filter: blur(4px);
}
.ily-search-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #FBF8F5;
    padding: 24px 40px;
    box-shadow: 0 8px 32px rgba(51, 48, 31, 0.15);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}
.ily-search-overlay.is-open .ily-search-panel { transform: translateY(0); }
.ily-search-form {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}
.ily-search-form > .material-symbols-outlined { color: rgba(51, 48, 31, 0.5); }
#ily-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'EB Garamond', serif;
    font-size: 28px;
    color: #33301F;
    padding: 8px 0;
}
#ily-search-input::placeholder { color: rgba(51, 48, 31, 0.3); }
#ily-search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(51, 48, 31, 0.6);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ily-search-close:hover { color: #33301F; }

/* ---------- image lightbox ---------- */
.ily-lightbox {
    position: fixed;
    inset: 0;
    z-index: 70;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}
.ily-lightbox.is-open { opacity: 1; visibility: visible; }
.ily-lb-scrim { position: absolute; inset: 0; background: rgba(51, 48, 31, 0.92); }
.ily-lb-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}
.ily-lb-btn {
    position: absolute;
    z-index: 2;
    background: rgba(251, 248, 245, 0.12);
    color: #FBF8F5;
    border: none;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ily-lb-btn:hover { background: rgba(251, 248, 245, 0.25); }
.ily-lb-close { top: 24px; right: 24px; }
.ily-lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.ily-lb-next { right: 24px; top: 50%; transform: translateY(-50%); }
.ily-lb-count {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #FBF8F5;
    font-size: 11px;
    letter-spacing: 0.15em;
}

/* ---------- mobile bottom nav clearance (inner pages) ---------- */
@media (max-width: 767px) {
    body.has-mobile-nav { padding-bottom: 64px; }
}

/* ---------- sticky mobile add-to-bag bar (PDP) ---------- */
.ily-sticky-atc {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;   /* sits above the mobile bottom nav (z-40) when active */
    background: rgba(251, 248, 245, 0.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(51, 48, 31, 0.12);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateY(110%);
    transition: transform 0.3s ease;
}
.ily-sticky-atc.is-visible { transform: translateY(0); }
.ily-sticky-atc-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1440px;
    margin: 0 auto;
}
.ily-sticky-atc-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ily-sticky-atc-name {
    font-family: 'EB Garamond', serif;
    font-size: 14px;
    color: #33301F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ily-sticky-atc-price { font-size: 15px; font-weight: 500; color: #33301F; }
.ily-sticky-atc-btn {
    flex-shrink: 0;
    background: #33301F;
    color: #FBF8F5;
    padding: 14px 28px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 12px;
    border: none;
    cursor: pointer;
}

/* ---------- Brand wordmark: thin geometric, widely tracked (per client logo) ---------- */
.ily-wordmark {
    font-family: 'Jost', 'Hanken Grotesk', sans-serif !important;
    font-weight: 300 !important;
    letter-spacing: 0.30em !important;
    /* nudge so the wide tracking stays optically centred */
    text-indent: 0.30em;
}

.ily-hero-home {
    isolation: isolate;
}

/* ───────────────────────────────────────────────────────────
   Floating sari — a silk current that travels ACROSS the whole hero, low in the
   frame. JS crops the useful part of the source clip and removes the pale cream
   backdrop (saturation key); CSS spans it full-width, multiplies it into the
   courtyard light, and soft-fades all four edges. The headline sits in its own
   ivory glow ABOVE this layer (z-10 over z-5), so text stays readable while the
   silk drifts behind it.
   ─────────────────────────────────────────────────────────── */
.hero-sari-orb {
    position: absolute;
    left: -4%;
    right: -4%;                          /* full hero width + slight overscan for drift */
    bottom: 0;
    height: clamp(280px, 52vh, 560px);   /* lower band — travels across, clear of the CTAs */
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transform-origin: 70% 70%;
    will-change: transform, opacity;
    mix-blend-mode: multiply;            /* sits IN the scene light, not on top of it */
    animation: ily-sari-in 1.8s cubic-bezier(.16, 1, .3, 1) .7s forwards;
    /* melt the left/right edges so the silk has no rectangular boundary */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.6) 9%, #000 22%, #000 84%, transparent 100%);
            mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,.6) 9%, #000 22%, #000 84%, transparent 100%);
}
@keyframes ily-sari-in { to { opacity: 1; } }

.hero-sari-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;                   /* fill the wide band without distorting the silk */
    object-position: 50% 50%;
    filter: blur(.25px) saturate(1.3) contrast(1.16);
    opacity: 1;                           /* full presence — clearer, richer silk */
    /* keep the upper band clear (CTAs/headline live there); silk eases in lower and fades at the base */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 28%, rgba(0,0,0,.45) 46%, #000 66%, #000 88%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0%, transparent 28%, rgba(0,0,0,.45) 46%, #000 66%, #000 88%, transparent 100%);
    animation: ily-sari-float 15s ease-in-out infinite;
    will-change: transform;
}
/* slow, fabric-like drift travelling gently across the scene */
@keyframes ily-sari-float {
    0%, 100% { transform: translate3d(-1.5%, 0, 0) rotate(-1deg) scale(1.01); }
    50%      { transform: translate3d(2%, -3%, 0) rotate(-2.6deg) scale(1.035); }
}

/* Video failed to load → hide cleanly; the hero looks completely normal. */
.hero-sari-orb.hero-sari-failed { display: none; }

/* Tablet: still full-width, a touch softer so the headline stays clear. */
@media (max-width: 1024px) {
    .hero-sari-orb {
        height: clamp(280px, 52vh, 480px);
    }
    .hero-sari-canvas { opacity: 0.92; }
}
/* Mobile: keep it as a quieter low band so the centred headline stays readable. */
@media (max-width: 640px) {
    .hero-sari-orb {
        left: -8%;
        right: -8%;
        height: clamp(190px, 38vh, 300px);
    }
    .hero-sari-canvas {
        opacity: 0.72;
        filter: blur(.4px) saturate(1.18) contrast(1.08);
    }
}
/* Very small screens: hide entirely so the headline stays perfectly readable */
@media (max-width: 380px) {
    .hero-sari-orb { display: none; }
}

/* Reduced motion: keep it simple — no idle drift, no cursor parallax (JS opts out). */
@media (prefers-reduced-motion: reduce) {
    .hero-sari-orb { opacity: 1; animation: none; }
    .hero-sari-canvas { animation: none; }
}
