/* jk-animations.css — animations/transitions ported from jkdesign.us (Shopify "Ride"/Dawn theme)
 *
 * Source assets pulled from https://jkdesign.us/cdn/shop/t/2/assets/:
 *   base.css, animations.js, component-card.css.
 * Each block below names the production source rule it was ported from and the
 * OUR-markup selector it was mapped onto (Storefront child theme "jk-design").
 *
 * Fail-safe contract (matches Ride's no-js handling):
 *   - Reveal targets are FULLY VISIBLE by default.
 *   - The offscreen/hidden state only applies under `html.jk-anim-ready`, which
 *     jk-animations.js adds after DOMContentLoaded. If JS never runs, nothing is
 *     ever hidden, so content can never get stuck invisible.
 *   - prefers-reduced-motion: reduce disables every transform/animation here.
 */

/* =========================================================================
 * Timing tokens — ported from base.css :root
 *   --duration-*, --ease-out-slow, --animation-slide-in, --animation-fade-in
 * ========================================================================= */
:root {
	--jk-duration-short: .1s;
	--jk-duration-default: .2s;
	--jk-duration-medium: .3s;
	--jk-duration-long: .5s;
	--jk-duration-extra-long: .6s;
	--jk-ease-out-slow: cubic-bezier(0, 0, .3, 1);
}

/* =========================================================================
 * Scroll-reveal system
 * Ported from base.css:
 *   @keyframes slideIn / fadeIn
 *   .scroll-trigger.animate--slide-in / .animate--fade-in
 *   .scroll-trigger--offscreen (offscreen state)
 *   --animation-order cascade (data-cascade)  ->  our --jk-order
 * and animations.js (IntersectionObserver toggling the offscreen class).
 *
 * Mapped onto OUR sections/cards: .jk-hero, .jk-featured, .jk-newsletter,
 * ul.products li.product, plus generic .jk-reveal opt-in.
 * jk-animations.js tags these with .jk-reveal and toggles .jk-reveal--in.
 * ========================================================================= */
@keyframes jkSlideIn {
	0%  { transform: translateY(2rem); opacity: .01; }
	to  { transform: translateY(0);    opacity: 1;   }
}
@keyframes jkFadeIn {
	0%  { opacity: .01; }
	to  { opacity: 1;   }
}

/* Offscreen (pre-reveal) state — only once JS has declared itself ready. */
html.jk-anim-ready .jk-reveal {
	opacity: .01;
	transform: translateY(2rem);
	will-change: transform, opacity;
}

/* Fade-only variant (hero, newsletter band): no vertical travel. */
html.jk-anim-ready .jk-reveal--fade {
	transform: none;
}

/* Revealed state — replays Ride's slideIn/fadeIn keyframes. */
html.jk-anim-ready .jk-reveal.jk-reveal--in {
	animation: jkSlideIn var(--jk-duration-extra-long) var(--jk-ease-out-slow) forwards;
	/* Cascade: 75ms stagger per item, matching Ride's
	   `animation-delay: calc(var(--animation-order) * 75ms)`. */
	animation-delay: calc(var(--jk-order, 0) * 75ms);
}
html.jk-anim-ready .jk-reveal--fade.jk-reveal--in {
	animation: jkFadeIn var(--jk-duration-extra-long) var(--jk-ease-out-slow) forwards;
	animation-delay: calc(var(--jk-order, 0) * 75ms);
}

/* =========================================================================
 * Underlined-link hover — ported from base.css
 *   .underlined-link:hover { text-decoration-thickness:.2rem }
 *   (transition on text-decoration-thickness .1s)
 * Mapped onto OUR nav + footer links (jk.css already handles the aqua colour
 * change; this only adds the animated underline thickening, so it complements
 * rather than duplicates).
 * ========================================================================= */
.main-navigation ul li a,
.site-footer a {
	text-underline-offset: .3rem;
	text-decoration-thickness: .1rem;
	transition: text-decoration-thickness var(--jk-duration-short) ease,
	            color var(--jk-duration-default) ease;
}
.main-navigation ul li a:hover,
.site-footer a:hover {
	text-decoration-line: underline;
	text-decoration-thickness: .2rem;
}

/* =========================================================================
 * Button micro-interaction — ported from base.css
 *   .button { transition: box-shadow var(--duration-short) ease }
 *   .button:hover:after { border-offset grow } (Ride's animated ring)
 * Mapped onto OUR buttons. jk.css already swaps the background colour on hover;
 * here we only add the transition + a soft aqua ring/lift so the existing
 * colour swap animates smoothly instead of snapping. No colour is overridden.
 * ========================================================================= */
.jk-btn,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce #respond input#submit,
.jk-newsletter button {
	transition: background-color var(--jk-duration-default) ease,
	            color var(--jk-duration-default) ease,
	            box-shadow var(--jk-duration-default) ease,
	            transform var(--jk-duration-default) var(--jk-ease-out-slow);
}
.jk-btn:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce #respond input#submit:hover,
.jk-newsletter button:hover {
	/* Ride's "vertical-lift" micro-interaction (animate--hover-vertical-lift):
	   a small lift + subtle shadow. Kept subtle so it complements jk.css.
	   Glow color updated to the neon pink (was a hardcoded rgba of the old
	   cyan accent, 0,207,252 = #00cffc; now 251,68,120 = #fb4478). */
	transform: translateY(-.15rem);
	box-shadow: 0 .4rem 1.2rem -.4rem rgba(251, 68, 120, .45);
}
.jk-btn:active,
.woocommerce a.button:active,
.woocommerce button.button:active {
	transform: translateY(0);
}

/* =========================================================================
 * Sticky "on-scroll-up" header — ported from Ride's <sticky-header
 *   data-sticky-type="on-scroll-up"> behaviour (global.js) + base.css sticky
 *   header transform. Reimplemented in jk-animations.js for OUR #masthead.
 * Header slides out of view when scrolling down and returns when scrolling up.
 * Only active once JS is ready (html.jk-anim-ready) so no layout shift if JS
 * fails. .site-header already has a solid --jk-bg background (jk.css).
 * ========================================================================= */
html.jk-anim-ready .site-header {
	position: sticky;
	top: 0;
	z-index: 500;
	transition: transform var(--jk-duration-medium) var(--jk-ease-out-slow);
}
html.jk-anim-ready .site-header.jk-header--hidden {
	transform: translateY(-100%);
}

/* =========================================================================
 * NOTE on product-card image hover:
 * Ride's component-card.css uses `.media--hover-effect` scale(1.03) + crossfade
 * to the 2nd image. OUR jk.css ALREADY implements this on `.jk-thumb`
 * (scale(1.08) + secondary-image crossfade). Intentionally NOT re-ported here
 * to avoid fighting the existing rule.
 * ========================================================================= */

/* =========================================================================
 * prefers-reduced-motion: reduce
 * Ride disables its scroll animations under reduced motion
 * (@media(prefers-reduced-motion:no-preference) gate). We hard-disable every
 * transform/animation this file introduces and force reveal targets visible.
 * ========================================================================= */
@media (prefers-reduced-motion: reduce) {
	html.jk-anim-ready .jk-reveal,
	html.jk-anim-ready .jk-reveal--fade {
		opacity: 1 !important;
		transform: none !important;
		animation: none !important;
	}
	html.jk-anim-ready .site-header {
		transition: none !important;
	}
	html.jk-anim-ready .site-header.jk-header--hidden {
		transform: none !important;
	}
	.jk-btn,
	.woocommerce a.button,
	.woocommerce button.button,
	.jk-newsletter button {
		transition: none !important;
	}
	.jk-btn:hover,
	.woocommerce a.button:hover,
	.woocommerce button.button:hover,
	.jk-newsletter button:hover {
		transform: none !important;
	}
}
