/* ==========================================================================
   Salman Saffron — MOTION SYSTEM "The bloom"
   Slow, deliberate motion modelled on saffron releasing gold into water.
   Static is the default; every movement is opted in under
   prefers-reduced-motion: no-preference. Scroll effects use native
   scroll-driven animations only (progressive enhancement, no polyfill):
   browsers without support simply show the final state.
   ========================================================================== */
:root {
	--ss-ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* reveals */
	--ss-ease-io: cubic-bezier(0.76, 0, 0.24, 1);      /* curtains, page changes */
	--ss-ease-back: cubic-bezier(0.34, 1.56, 0.64, 1); /* confirmations */
	--ss-thread: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2020'%3E%3Cdefs%3E%3ClinearGradient%20id='g'%20x1='0'%20x2='1'%20y1='0'%20y2='0'%3E%3Cstop%20offset='0'%20stop-color='%236e1212'/%3E%3Cstop%20offset='.65'%20stop-color='%23b3261e'/%3E%3Cstop%20offset='1'%20stop-color='%23e0461f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath%20fill='url(%23g)'%20d='M2%2011C14%2010.4%2030%209.6%2044%208.6C49%208.2%2053%206.2%2057%204.4C60%203.2%2062.5%204.6%2062%207.6C61.6%2010%2062.4%2012.6%2061.4%2015C60.2%2017.4%2057.4%2016.6%2055%2014.6C51%2012.6%2047%2012%2043%2011.9C30%2012.2%2015%2012.2%202%2012.6Z'/%3E%3C/svg%3E");
}
html { scroll-padding-top: 6.5rem; }

/* ---------- Keyframes (used only inside the opt-ins below) ---------- */
@keyframes ss-rise-mask { from { clip-path: inset(0 0 100% 0); transform: translateY(0.4em); } to { clip-path: inset(-10% -5% -25% -5%); transform: none; } }
@keyframes ss-fade-up { from { opacity: 0; transform: translateY(26px); } }
@keyframes ss-fade { from { opacity: 0; } }
@keyframes ss-bloom { from { transform: scale(0.5); opacity: 0; } }
@keyframes ss-arch-open { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes ss-settle { from { transform: scale(1.16); } to { transform: scale(1); } }
@keyframes ss-tag-in { from { opacity: 0; transform: translate(-14px, 10px); } }
@keyframes ss-unveil { from { clip-path: inset(10% 9% 10% 9% round 10px); } to { clip-path: inset(0 round 0); } }
@keyframes ss-zoom-out { from { transform: scale(1.2); } to { transform: scale(1); } }
@keyframes ss-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes ss-shelf { from { opacity: 0; transform: translateY(46px); } }
@keyframes ss-sheen { from { transform: translateX(-130%) skewX(-12deg); } to { transform: translateX(130%) skewX(-12deg); } }
@keyframes ss-head { to { box-shadow: 0 14px 30px -22px rgba(0, 0, 0, 0.7); } }
@keyframes ss-logo-shrink { to { transform: scale(0.84); } }
@keyframes ss-drift { to { transform: translate3d(0, calc(var(--d, 80px) * -1), 0) rotate(var(--r2, 30deg)); } }
@keyframes ss-arch-depth { to { transform: translate3d(0, -70px, 0); } }
@keyframes ss-vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes ss-vt-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes ss-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes ss-bump { 0% { transform: none; } 30% { transform: translateY(-4px) rotate(-8deg); } 60% { transform: translateY(1px) rotate(5deg); } 100% { transform: none; } }
@keyframes ss-toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.98); } }

/* ---------- Floating saffron threads (injected into the hero by theme.js; decorative) ---------- */
.ss-floats { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ss-float { position: absolute; left: var(--x); top: var(--y); width: calc(64px * var(--s, 1)); height: calc(20px * var(--s, 1)); background: var(--ss-thread) center / contain no-repeat; opacity: var(--o, 0.55); filter: blur(var(--b, 0px)); transform: rotate(var(--r, 0deg)); }
.ss-hero > .wp-block-columns { position: relative; z-index: 1; }

/* ---------- Gold shimmer on primary actions (hover; colour change, not movement) ---------- */
.wp-block-button:not([class*="is-style-"]) .wp-block-button__link,
.ss-pdp__cart .single_add_to_cart_button,
.ss-ladder__panel .ss-ladder__add,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.wc-block-mini-cart__footer-checkout,
.ss-toast__checkout,
.ss-buybar button {
	background-image: linear-gradient(110deg, transparent 38%, rgba(255, 244, 214, 0.55) 50%, transparent 62%) !important;
	background-size: 260% 100% !important;
	background-repeat: no-repeat !important;
	background-position: 130% 0 !important;
	transition: background-position 0.9s var(--ss-ease-out), background-color 0.25s, transform 0.2s var(--ss-ease-out) !important;
}
.wp-block-button:not([class*="is-style-"]) .wp-block-button__link:hover,
.ss-pdp__cart .single_add_to_cart_button:hover,
.ss-ladder__panel .ss-ladder__add:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover,
.wc-block-mini-cart__footer-checkout:hover,
.ss-toast__checkout:hover,
.ss-buybar button:hover { background-position: -30% 0 !important; }

/* ---------- Product cards: soft light that follows the pointer (position set by theme.js) ---------- */
.ss-cards .ss-card__plate::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 40%), rgba(255, 238, 196, 0.42), transparent 62%); mix-blend-mode: soft-light; opacity: 0; transition: opacity 0.5s var(--ss-ease-out); z-index: 1; }
.ss-cards li:hover .ss-card__plate::after { opacity: 1; }

/* ---------- "Added to cart" panel + flying token (built by theme.js) ---------- */
.ss-toast { position: fixed; top: calc(var(--ss-head-h, 80px) + 12px); right: clamp(12px, 3vw, 40px); z-index: 90; width: min(380px, calc(100vw - 24px)); background: var(--ss-ivory); color: var(--ss-ink); border: 1px solid var(--ss-line); border-radius: var(--ss-r-md); box-shadow: 0 30px 60px -28px rgba(11, 34, 31, 0.55); padding: 1rem; display: grid; grid-template-columns: 64px 1fr auto; gap: 0.9rem; align-items: center; }
.ss-toast[hidden] { display: none; }
.ss-toast__img { width: 64px; height: 80px; border-radius: var(--ss-r-sm); background: var(--ss-plate); object-fit: cover; mix-blend-mode: multiply; }
.ss-toast__label { margin: 0; font-size: 0.82rem; color: var(--ss-pine-700); font-weight: 500; }
.ss-toast__name { margin: 0.15rem 0 0; font-weight: 500; line-height: 1.3; }
.ss-toast__price { margin: 0.15rem 0 0; font-size: 0.92rem; color: var(--ss-ink-2); font-variant-numeric: tabular-nums; }
.ss-toast__price del { opacity: 0.6; margin-right: 0.35em; }
.ss-toast__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.ss-toast__actions a, .ss-toast__actions button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.75rem; border-radius: var(--ss-r-sm); font: inherit; font-weight: 500; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.ss-toast__view { background: transparent; border: 1px solid var(--ss-line); color: var(--ss-ink); }
.ss-toast__view:hover { border-color: var(--ss-pine-700); }
.ss-toast__checkout { background-color: var(--ss-gold); color: var(--ss-pine-950) !important; border: 0; }
.ss-toast__checkout:hover { background-color: var(--ss-gold-soft); }
.ss-toast__close { align-self: start; width: 2.25rem; height: 2.25rem; border: 0; background: none; border-radius: 50%; cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--ss-ink-2); }
.ss-toast__close:hover { background: var(--ss-parchment); }
.ss-flyer { position: fixed; left: 0; top: 0; z-index: 95; width: 56px; height: 56px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 35% 30%, #f5d98a, var(--ss-gold) 55%, #9c7a24); box-shadow: 0 0 0 3px rgba(201, 164, 76, 0.25), 0 12px 24px -8px rgba(0, 0, 0, 0.45); overflow: hidden; }
.ss-flyer img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sticky purchase bar on small screens (product pages, built by theme.js) ---------- */
.ss-buybar { position: fixed; left: 0.6rem; right: 0.6rem; bottom: 0.6rem; z-index: 70; display: none; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.6rem 0.6rem 0.6rem 1rem; background: var(--ss-pine-900); color: var(--ss-on-dark); border: 1px solid var(--ss-line-dark); border-radius: var(--ss-r-md); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6); transform: translateY(140%); transition: transform 0.45s var(--ss-ease-out); }
.ss-buybar.is-visible { transform: none; }
.ss-buybar__name { display: block; font-size: 0.8rem; color: var(--ss-on-dark-2); max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-buybar__price { display: block; font-weight: 500; font-size: 1.1rem; }
.ss-buybar button { min-height: 2.9rem; padding: 0 1.2rem; border: 0; border-radius: var(--ss-r-sm); background-color: var(--ss-gold); color: var(--ss-pine-950); font: inherit; font-weight: 500; cursor: pointer; }
@media (max-width: 860px) {
	.ss-buybar { display: flex; }
	.single-product .ss-wa-float { bottom: 5.4rem; }
}

/* ---------- Cursor companion (fine pointers; created by theme.js; the system cursor stays visible) ---------- */
.ss-cursor { position: fixed; left: 0; top: 0; z-index: 99; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1px solid rgba(201, 164, 76, 0.8); border-radius: 50%; pointer-events: none; display: grid; place-items: center; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em; color: var(--ss-pine-950); opacity: 0; transition: width 0.35s var(--ss-ease-out), height 0.35s var(--ss-ease-out), margin 0.35s var(--ss-ease-out), background-color 0.35s, border-color 0.35s, opacity 0.3s; }
.ss-cursor.is-on { opacity: 1; }
.ss-cursor.is-view { width: 76px; height: 76px; margin: -38px 0 0 -38px; background-color: rgba(201, 164, 76, 0.92); border-color: transparent; }
.ss-cursor.is-link { width: 12px; height: 12px; margin: -6px 0 0 -6px; background-color: var(--ss-gold); border-color: transparent; }
.ss-cursor span { opacity: 0; transition: opacity 0.2s; }
.ss-cursor.is-view span { opacity: 1; }

/* ==========================================================================
   Motion opt-ins
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
	/* Page to page: the header stays, content settles in, product images morph between grid and product page. */
	@view-transition { navigation: auto; }
	::view-transition-old(root) { animation: 280ms var(--ss-ease-io) both ss-vt-out; }
	::view-transition-new(root) { animation: 560ms var(--ss-ease-out) both ss-vt-in; }
	::view-transition-group(*) { animation-duration: 620ms; animation-timing-function: var(--ss-ease-out); }
	header.ss-site-header { view-transition-name: ss-header; }

	/* Arrival: the bloom (once, on load) */
	.ss-hero__title { animation: ss-rise-mask 1.25s var(--ss-ease-out) 0.1s both; }
	.ss-hero__lede { animation: ss-fade-up 1s var(--ss-ease-out) 0.45s both; }
	.ss-hero__actions { animation: ss-fade-up 1s var(--ss-ease-out) 0.6s both; }
	.ss-hero__meaning { animation: ss-fade-up 1s var(--ss-ease-out) 0.75s both; }
	.ss-arch::before { animation: ss-bloom 2.2s var(--ss-ease-out) 0.35s both; }
	.ss-arch::after { animation: ss-fade 1.4s var(--ss-ease-out) 1s both; }
	.ss-arch__img { animation: ss-arch-open 1.5s var(--ss-ease-io) 0.15s both; }
	.ss-arch__img img { animation: ss-settle 2.6s var(--ss-ease-out) 0.15s both; }
	.ss-arch__tag { animation: ss-tag-in 1s var(--ss-ease-out) 1.25s both; }
	.ss-page-hero h1 { animation: ss-rise-mask 1.1s var(--ss-ease-out) 0.05s both; }
	.ss-page-hero .ss-hero__lede { animation: ss-fade-up 0.9s var(--ss-ease-out) 0.35s both; }
	.ss-pdp__gallery { animation: ss-fade 0.9s var(--ss-ease-out) both; }
	.ss-pdp__buy > * { animation: ss-fade-up 0.9s var(--ss-ease-out) both; }
	.ss-pdp__buy > :nth-child(2) { animation-delay: 0.06s; }
	.ss-pdp__buy > :nth-child(3) { animation-delay: 0.12s; }
	.ss-pdp__buy > :nth-child(4) { animation-delay: 0.18s; }
	.ss-pdp__buy > :nth-child(n + 5) { animation-delay: 0.24s; }

	/* Interaction feedback */
	.ss-cards .ss-card__plate img { transition: transform 1.2s var(--ss-ease-out); }
	.ss-cards li:hover .ss-card__plate img { transform: scale(1.06); }
	.ss-case__img img { transition: transform 1.2s var(--ss-ease-out); }
	.ss-case:hover .ss-case__img img { transform: scale(1.05); }
	.ss-minicart.is-bumped .wc-block-mini-cart__button { animation: ss-bump 0.7s var(--ss-ease-out); }
	.ss-minicart.is-bumped .wc-block-mini-cart__badge { animation: ss-pop 0.6s var(--ss-ease-back); }
	.ss-toast:not([hidden]) { animation: ss-toast-in 0.5s var(--ss-ease-out); }

	/* Scroll storytelling */
	@supports ((animation-timeline: view()) and (animation-range: entry)) {
		.ss-section-head h2, .ss-grade__title, .ss-gifting h2, .ss-help h2, .ss-details h2, .ss-related__title {
			animation: ss-rise-mask linear both;
			animation-timeline: view();
			animation-range: entry 5% cover 28%;
		}
		.ss-section-head p, .ss-section-head .ss-textlink, .ss-grade .ss-muted, .ss-gifting .ss-muted {
			animation: ss-fade-up linear both;
			animation-timeline: view();
			animation-range: entry 10% cover 30%;
		}
		.ss-case, .ss-gifting__img, .ss-rounded {
			animation: ss-unveil linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 35%;
		}
		.ss-case__img, .ss-gifting__img img, .ss-rounded img {
			animation: ss-zoom-out linear both;
			animation-timeline: view();
			animation-range: entry 0% exit 20%;
		}
		.ss-thread {
			animation: ss-wipe linear both;
			animation-timeline: view();
			animation-range: entry 25% cover 50%;
		}
		.ss-grades tbody tr, .ss-qa, .ss-specs > div, .ss-howto li, .ss-steps li, .ss-proof__list li {
			animation: ss-fade-up linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 22%;
		}
		.ss-cards > li {
			animation: ss-fade-up linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 24%;
		}
		.ss-cards > li:nth-child(4n + 2) { animation-range: entry 4% cover 28%; }
		.ss-cards > li:nth-child(4n + 3) { animation-range: entry 8% cover 32%; }
		.ss-cards > li:nth-child(4n + 4) { animation-range: entry 12% cover 36%; }
		.ss-ladder__rung {
			animation: ss-shelf linear both;
			animation-timeline: view();
			animation-range: entry calc(var(--i, 0) * 5%) cover calc(26% + var(--i, 0) * 5%);
		}
		.ss-quote {
			animation: ss-fade-up linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 30%;
		}
		.ss-gifting__img { position: relative; }
		.ss-gifting__img::after {
			content: ""; position: absolute; inset: 0; pointer-events: none;
			background: linear-gradient(100deg, transparent 30%, rgba(255, 231, 178, 0.38) 50%, transparent 70%);
			animation: ss-sheen linear both;
			animation-timeline: view();
			animation-range: entry 40% cover 70%;
		}
	}

	/* The interface recedes as you read: header condenses, the hero gains depth. */
	@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
		.ss-header {
			animation: ss-head linear both;
			animation-timeline: scroll(root);
			animation-range: 0px 160px;
		}
		.ss-logo img {
			transform-origin: left center;
			animation: ss-logo-shrink linear both;
			animation-timeline: scroll(root);
			animation-range: 0px 160px;
		}
		.ss-arch {
			animation: ss-arch-depth linear both;
			animation-timeline: scroll(root);
			animation-range: 0px 100vh;
		}
		.ss-float {
			animation: ss-drift linear both;
			animation-timeline: scroll(root);
			animation-range: 0px 120vh;
		}
	}
}
