/* Colony storefront: smooth transitions layered over the original Astra/WooCommerce styles.
   Nothing here changes layout or colours; it only animates state changes. */

html { scroll-behavior: smooth; }

/* ---- Page changes -------------------------------------------------------------------
   Browsers with cross-document view transitions cross-fade between pages and keep the
   header still. Others get a short fade-in on load. */
/* Cross-page view transitions are off: coming back with Back from a payment site (PayHere, Koko, Mintpay) could leave Chrome
   stuck on the transition snapshot (white boxes behind text, nothing clickable until a refresh). */
@view-transition { navigation: none; }
#masthead { view-transition-name: site-header; }
::view-transition-old(root) { animation: 160ms ease-in both vt-out; }
::view-transition-new(root) { animation: 260ms ease-out both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in  { from { opacity: 0; } }

@supports not (view-transition-name: none) {
    #page { animation: page-in 320ms ease-out both; }
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Hover / focus / state changes ---------------------------------------------------- */
:where(a, button, .button, input, select, textarea, .cfvsw-swatches-option, .ast-qty-placeholder, .menu-link, .sub-menu) {
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease, transform .2s ease;
}
:where(.button, button[type=submit], .single_add_to_cart_button, .add_to_cart_button):active { transform: scale(.98); }
.cfvsw-swatches-option { transition-duration: .15s; }
.cfvsw-swatches-option:not(.cfvsw-swatches-disabled):hover { transform: translateY(-1px); }

/* product pictures: soft zoom on hover (inside the existing frame, so layout is unchanged) */
.astra-shop-thumbnail-wrap { overflow: hidden; }
.astra-shop-thumbnail-wrap img { transition: transform .5s cubic-bezier(.2, .6, .2, 1), opacity .4s ease; }
@media (hover: hover) { .astra-shop-thumbnail-wrap:hover img { transform: scale(1.03); } }

/* second product photo on hover (card markup: img.hover-img, source set by transitions.js on first hover) */
.astra-shop-thumbnail-wrap > a, .astra-shop-thumbnail-wrap .acoplw-badge { position: relative; display: block; }
.astra-shop-thumbnail-wrap .hover-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; z-index: 1; transition: opacity .45s ease, transform .5s cubic-bezier(.2, .6, .2, 1); }
.astra-shop-thumbnail-wrap .acoplw-badge-icon, .astra-shop-thumbnail-wrap .ast-shop-product-out-of-stock { z-index: 3; }
html.js .astra-shop-thumbnail-wrap img.hover-img, .astra-shop-thumbnail-wrap img.hover-img { opacity: 0; }
@media (hover: hover) { html.js .astra-shop-thumbnail-wrap:hover img.hover-img.is-ready, .astra-shop-thumbnail-wrap:hover img.hover-img.is-ready { opacity: 1; } }
@media (hover: none) { .astra-shop-thumbnail-wrap .hover-img { display: none; } }

/* size strip on product cards (shown on hover; always visible on touch screens) */
.astra-shop-thumbnail-wrap { position: relative; }
.card-sizes { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; background: rgba(255, 255, 255, .88); backdrop-filter: blur(2px);
    opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }
.card-size { flex: 1 1 0; min-width: 0; padding: 11px 2px; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 1; color: #000; text-decoration: none;
    border-left: 1px solid rgba(255, 255, 255, .9); transition: background-color .2s ease, color .2s ease; }
.card-size:first-child { border-left: 0; }
a.card-size:hover { background: #000; color: #fff; }
.card-size.is-soldout { text-decoration: line-through; opacity: .4; cursor: default; }
@media (hover: hover) { .astra-shop-thumbnail-wrap:hover .card-sizes, .astra-shop-thumbnail-wrap:focus-within .card-sizes { opacity: 1; transform: none; } }
@media (hover: none) { .card-sizes { opacity: 1; transform: none; } .card-size { padding: 9px 2px; font-size: 11px; } }

/* ---- Loading reveals (only active when JS has marked the page: html.js) -------------- */
html.js img.img-pending { opacity: 0; }
html.js img.img-ready { opacity: 1; transition: opacity .45s ease; }

html.js .reveal { opacity: 0; transform: translateY(14px); }
html.js .reveal.is-visible { opacity: 1; transform: none; transition: opacity .55s ease, transform .55s cubic-bezier(.2, .6, .2, 1); transition-delay: var(--reveal-delay, 0ms); }

/* notices & flash messages */
.woocommerce-message, .woocommerce-error, .woocommerce-info { animation: notice-in .35s ease both; }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } }

/* cart count / total gently pops when it changes (class added by transitions.js) */
.ast-icon-shopping-cart.cart-bump, .ast-cart-menu-wrap.cart-bump { animation: cart-bump .5s ease; }
@keyframes cart-bump { 40% { transform: scale(1.25); } }

/* buttons waiting for the server */
.button.loading, button.loading { opacity: .6; pointer-events: none; }

/* ---- Respect "reduce motion" --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    html.js .reveal, html.js img.img-pending { opacity: 1; transform: none; }
    @view-transition { navigation: none; }
}
