/*
 * Threadline motion layer: icons, animation, carousels, product-card hover, floating cart panel.
 * Loads last. Colors come from --ink and --accent (Appearance > Customize > Threadline > Colors).
 * Everything that moves is switched off for visitors who ask for reduced motion.
 */

/* =====================================================================
   Header: icons, sticky shadow
   ===================================================================== */
.rm-header { transition: box-shadow .3s ease; }
.rm-header .header-inner { transition: min-height .3s ease; }
.rm-header.is-scrolled { box-shadow: 0 8px 28px rgba(0, 0, 0, .10); }
.rm-header.is-scrolled .header-inner { min-height: 60px; }

.rm-header .header-actions { gap: 10px; }

.header-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	border: 2px solid var(--ink);
	border-radius: 50%;
	color: var(--ink);
	text-decoration: none;
	transition: background .2s ease, color .2s ease, transform .2s ease;
}
.header-icon:hover,
.header-icon:focus-visible { background: var(--ink); color: #fff; transform: translateY(-2px); }
.header-icon .tl-icon { width: 22px; height: 22px; }

.rm-header .header-cart { gap: 8px; height: 44px; padding: 0 14px; box-sizing: border-box; color: var(--ink); }
.rm-header .header-cart .tl-icon { width: 20px; height: 20px; }
.rm-header .header-cart:hover { color: #fff; }
.header-cart-wrap { display: inline-flex; }

.cart-count.is-pop { animation: tl-pop .5s cubic-bezier(.2, .9, .3, 1.6); }
@keyframes tl-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* Phones and small tablets */
@media (max-width: 782px) {
	.rm-header .header-actions { gap: 8px; }
}
@media (max-width: 600px) {
	.rm-header .header-inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
	.rm-header .site-branding { flex: 1 1 auto; min-width: 0; }
	/* The name may wrap onto two lines instead of pushing the buttons off the screen. */
	.rm-header .site-title { display: block; white-space: normal; line-height: 1; font-size: 18px; }
	.rm-header .custom-logo { max-height: 34px; }
	.header-icon { width: 40px; height: 40px; }
	.header-icon .tl-icon { width: 20px; height: 20px; }
	/* Cart becomes a round-cornered icon button with a small count badge. */
	.rm-header .header-cart { position: relative; width: 40px; height: 40px; padding: 0; justify-content: center; }
	.rm-header .header-cart-label { display: none; }
	.rm-header .header-cart .cart-count {
		position: absolute;
		top: -8px;
		right: -8px;
		min-width: 20px;
		height: 20px;
		line-height: 20px;
		font-size: 11px;
		border-radius: 10px;
		padding: 0 4px;
		box-sizing: border-box;
	}
}
@media (max-width: 380px) {
	.rm-header .header-inner { gap: 6px; padding-left: 10px; padding-right: 10px; }
	.rm-header .site-title { font-size: 16px; letter-spacing: -0.04em; }
	.rm-header .menu-toggle { padding: 6px; }
	.rm-header .header-actions { gap: 6px; }
	.header-icon, .rm-header .header-cart { width: 36px; height: 36px; }
}

/* =====================================================================
   Buttons: light sweep on hover
   ===================================================================== */
.button, .wp-block-button__link,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button {
	position: relative;
	overflow: hidden;
	transition: background .25s ease, color .25s ease, border-color .25s ease, transform .2s ease;
}
.button::before, .wp-block-button__link::before,
.woocommerce a.button::before, .woocommerce button.button::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
	transform: translateX(-130%);
	transition: transform .7s ease;
	pointer-events: none;
}
.button:hover::before, .wp-block-button__link:hover::before,
.woocommerce a.button:hover::before, .woocommerce button.button:hover::before { transform: translateX(130%); }
.button:active, .wp-block-button__link:active, .woocommerce a.button:active { transform: scale(.97); }

/* WooCommerce adds its own "View cart" link after an AJAX add; our floating panel replaces it. */
.woocommerce a.added_to_cart { display: none !important; }

/* =====================================================================
   Scroll reveal
   ===================================================================== */
.tl-js .tl-reveal {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.tl-js .tl-reveal.is-visible { opacity: 1; transform: none; }

/* =====================================================================
   Hero carousel (Group block "rm-carousel" holding Group blocks "rm-slide")
   ===================================================================== */
.rm-carousel { position: relative; overflow: hidden; background: var(--ink); }

.rm-slide {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: min(76vh, 640px);
	padding: 100px max(20px, calc((100vw - var(--max)) / 2 + 20px));
	background: var(--ink) center / cover no-repeat;
	color: #fff;
}
.rm-slide > * { max-width: none; margin-left: 0; margin-right: 0; padding: 0; }
.rm-slide h1, .rm-slide h2 {
	color: inherit;
	font-size: clamp(42px, 8.5vw, 112px);
	line-height: .95;
	margin: 0 0 22px;
	max-width: 14ch;
}
.rm-slide p { max-width: 520px; font-size: 18px; }
.rm-slide .rm-eyebrow { color: var(--accent); }
.rm-slide .wp-block-buttons { justify-content: flex-start; margin: 28px 0 0; }
.rm-slide .wp-block-button__link { background: #fff; color: var(--ink); border-color: #fff; }
.rm-slide .wp-block-button__link:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.rm-slide--dark   { background-color: var(--ink); color: #fff; }
.rm-slide--accent { background-color: var(--accent); color: #fff; }
.rm-slide--accent .rm-eyebrow { color: var(--ink); }
.rm-slide--accent .wp-block-button__link { background: var(--ink); border-color: var(--ink); color: #fff; }
.rm-slide--light  { background-color: var(--soft); color: var(--ink); }
.rm-slide--light .wp-block-button__link { background: var(--ink); border-color: var(--ink); color: #fff; }
.rm-slide--light .wp-block-button__link:hover { background: var(--accent); border-color: var(--accent); }

/* Before the script runs, show only the first slide (no flash of three stacked slides). */
.tl-js .rm-carousel:not(.is-ready) > .rm-slide:not(:first-child) { display: none; }

/* Ready: slides sit on top of each other and cross-fade. */
/* minmax(0, 1fr): the slide may never be wider than the screen, even when a heading or button is wide. */
.rm-carousel.is-ready { display: grid; grid-template-columns: minmax(0, 1fr); }
.rm-carousel .rm-slide { min-width: 0; }
.rm-slide h1, .rm-slide h2, .rm-slide p { overflow-wrap: break-word; }
.rm-slide .wp-block-buttons { flex-wrap: wrap; }
.rm-carousel.is-ready > .rm-slide {
	grid-area: 1 / 1;
	opacity: 0;
	visibility: hidden;
	transition: opacity .9s ease, visibility 0s linear .9s;
}
.rm-carousel.is-ready > .rm-slide.is-active { opacity: 1; visibility: visible; transition-delay: 0s; z-index: 1; }

/* Text enters one line at a time. */
.rm-carousel.is-ready .rm-slide > * { opacity: 0; transform: translateY(30px); }
.rm-carousel.is-ready .rm-slide.is-active > * {
	opacity: 1;
	transform: none;
	transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.rm-carousel.is-ready .rm-slide.is-active > :nth-child(1) { transition-delay: .15s; }
.rm-carousel.is-ready .rm-slide.is-active > :nth-child(2) { transition-delay: .3s; }
.rm-carousel.is-ready .rm-slide.is-active > :nth-child(3) { transition-delay: .45s; }
.rm-carousel.is-ready .rm-slide.is-active > :nth-child(4) { transition-delay: .6s; }
/* A slow zoom on the background picture */
.rm-carousel.is-ready .rm-slide.is-active { animation: tl-kenburns 12s ease-out both; }
@keyframes tl-kenburns { from { background-size: 108%; } to { background-size: 100%; } }
.rm-carousel.is-ready .rm-slide:not([style*="background-image"]) { animation: none; }

/* Controls */
.rm-carousel-controls {
	position: absolute;
	z-index: 5;
	left: max(20px, calc((100vw - var(--max)) / 2 + 20px));
	right: max(20px, calc((100vw - var(--max)) / 2 + 20px));
	bottom: 26px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	color: #fff;
	pointer-events: none;
}
.rm-carousel.on-light .rm-carousel-controls { color: var(--ink); }
.rm-carousel-controls > * { pointer-events: auto; }
.rm-dots { display: flex; gap: 8px; align-items: center; }
.rm-dots button {
	width: 12px;
	height: 12px;
	padding: 0;
	border: 2px solid currentColor;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: width .35s ease, background .35s ease;
}
.rm-dots button[aria-current="true"] { width: 34px; background: currentColor; }
.rm-arrows { display: flex; gap: 8px; }
.rm-arrow {
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 2px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, transform .2s ease;
}
.rm-arrow:hover, .rm-arrow:focus-visible { background: #fff; color: var(--ink); transform: scale(1.08); }
.rm-carousel.on-light .rm-arrow:hover { background: var(--ink); color: #fff; }

.rm-progress { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .18); }
.rm-carousel.on-light .rm-progress { background: rgba(0, 0, 0, .12); }
.rm-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.rm-carousel.on-accent .rm-progress i { background: #fff; }
.rm-progress.run i { animation: tl-progress var(--tl-speed, 6s) linear forwards; }
@keyframes tl-progress { from { width: 0; } to { width: 100%; } }

@media (max-width: 782px) {
	.rm-slide { min-height: 440px; padding-top: 70px; padding-bottom: 90px; }
	.rm-slide p { font-size: 16px; }
	.rm-arrow { width: 38px; height: 38px; }
	.rm-carousel-controls { bottom: 20px; }
}

/* =====================================================================
   Product carousel (any WooCommerce product shortcode inside a "rm-product-carousel" group)
   ===================================================================== */
.rm-product-carousel { position: relative; }
.rm-product-carousel .woocommerce ul.products {
	display: flex;
	gap: 20px;
	margin: 0;
	padding: 0 0 6px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.rm-product-carousel .woocommerce ul.products::-webkit-scrollbar { display: none; }
.rm-product-carousel .woocommerce ul.products li.product {
	flex: 0 0 calc((100% - 60px) / 4);
	min-width: 0;
	scroll-snap-align: start;
}
@media (max-width: 1000px) {
	.rm-product-carousel .woocommerce ul.products li.product { flex-basis: calc((100% - 20px) / 2.3); }
}
@media (max-width: 560px) {
	.rm-product-carousel .woocommerce ul.products li.product { flex-basis: 68%; }
}
.rm-product-arrow {
	position: absolute;
	top: 36%;
	z-index: 6;
	width: 46px;
	height: 46px;
	display: none;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--ink);
	border-radius: 50%;
	background: #fff;
	color: var(--ink);
	font-size: 20px;
	cursor: pointer;
	box-shadow: 4px 4px 0 var(--ink);
	transition: transform .2s ease, background .2s ease, color .2s ease, opacity .2s ease;
}
.rm-product-carousel.has-overflow .rm-product-arrow { display: inline-flex; }
.rm-product-arrow--prev { left: 10px; }
.rm-product-arrow--next { right: 10px; }
.rm-product-arrow:hover { background: var(--ink); color: #fff; transform: scale(1.08); }
.rm-product-arrow[disabled] { opacity: .3; pointer-events: none; }
@media (hover: none) { .rm-product-arrow { display: none !important; } }

/* =====================================================================
   Product cards: zoom, and an Add to cart bar that slides up on hover
   ===================================================================== */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link { display: block; overflow: hidden; }
.woocommerce ul.products li.product a img { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.woocommerce ul.products li.product:hover a img { transform: scale(1.05); }
.woocommerce ul.products li.product .woocommerce-loop-product__title { transition: color .2s ease; }
.woocommerce ul.products li.product:hover .woocommerce-loop-product__title { color: var(--accent); }
.woocommerce ul.products li.product span.onsale { animation: tl-sale-pulse 2.4s ease-in-out infinite; }
@keyframes tl-sale-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.07); } }

/* Mouse devices: the button floats over the bottom of the picture and slides up on hover.
   (Touch devices keep the normal button under the product.) */
@supports (width: 1cqw) {
	@media (hover: hover) and (pointer: fine) {
		.woocommerce ul.products li.product { container-type: inline-size; }
		.woocommerce ul.products li.product .button {
			position: absolute;
			left: 0;
			right: 0;
			top: calc(133.3333cqw - 48px);
			z-index: 4;
			width: 100%;
			margin: 0;
			box-sizing: border-box;
			opacity: 0;
			transform: translateY(16px);
			pointer-events: none;
			transition: opacity .3s ease, transform .35s cubic-bezier(.2, .7, .2, 1), background .25s ease;
		}
		.woocommerce ul.products li.product:hover .button,
		.woocommerce ul.products li.product:focus-within .button {
			opacity: 1;
			transform: none;
			pointer-events: auto;
		}
		.woocommerce ul.products li.product .price { margin-bottom: 4px; }
	}
}

/* Added: the button flashes */
.woocommerce a.button.added { background: var(--accent); border-color: var(--accent); }

/* =====================================================================
   Floating cart panel
   ===================================================================== */
.tl-cart-panel {
	position: fixed;
	z-index: 300;
	top: 90px;
	right: 20px;
	width: min(400px, calc(100vw - 24px));
	max-height: calc(100vh - 110px);
	display: flex;
	flex-direction: column;
	background: #fff;
	color: var(--ink);
	border: 3px solid var(--ink);
	box-shadow: 8px 8px 0 var(--ink);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-14px) scale(.97);
	transform-origin: top right;
	transition: opacity .25s ease, transform .3s cubic-bezier(.2, .8, .3, 1.1), visibility 0s linear .3s;
}
.tl-cart-panel.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.tl-cart-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--ink);
	color: #fff;
	transition: background .3s ease;
}
.tl-cart-title { flex: 1; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.tl-cart-check {
	display: none;
	width: 24px;
	height: 24px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #fff;
	color: var(--accent);
	font-size: 14px;
	font-weight: 800;
}
.tl-cart-panel[data-mode="added"] .tl-cart-head { background: var(--accent); }
.tl-cart-panel[data-mode="added"] .tl-cart-check { display: inline-flex; animation: tl-pop .6s cubic-bezier(.2, .9, .3, 1.6) both; }
.tl-cart-close { border: 0; background: none; color: inherit; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.tl-cart-close:hover { opacity: .7; }

.tl-cart-body { padding: 14px; overflow: auto; }
.tl-cart-items { list-style: none; margin: 0 0 10px; padding: 0; max-height: min(300px, 38vh); overflow: auto; }
.tl-cart-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #e6e2dc; animation: tl-item-in .4s ease both; }
.tl-cart-item:last-child { border-bottom: 0; }
@keyframes tl-item-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.tl-cart-thumb { display: block; width: 56px; aspect-ratio: 3 / 4; overflow: hidden; background: var(--soft); }
.tl-cart-thumb img { width: 100%; height: 100%; object-fit: cover; margin: 0; }
.tl-cart-name { display: block; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; text-decoration: none; line-height: 1.25; }
.tl-cart-name:hover { color: var(--accent); }
.tl-cart-meta { font-size: 12px; color: #6b6b6b; }
.tl-cart-meta dl, .tl-cart-meta dd, .tl-cart-meta dt, .tl-cart-meta p { display: inline; margin: 0; }
.tl-cart-price { margin-top: 4px; font-size: 13px; color: #444; }
.tl-cart-remove { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 20px; line-height: 1; text-decoration: none; color: #888; transition: background .2s ease, color .2s ease; }
.tl-cart-remove:hover { background: var(--ink); color: #fff; }
.tl-cart-subtotal { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-top: 2px solid var(--ink); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.tl-cart-subtotal strong { font-size: 18px; letter-spacing: 0; }
.tl-cart-empty { margin: 4px 0 14px; font-size: 15px; }

.tl-cart-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tl-btn {
	position: relative;
	overflow: hidden;
	display: block;
	box-sizing: border-box;
	padding: 12px 10px;
	border: 2px solid var(--ink);
	text-align: center;
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .1em;
	text-decoration: none;
	transition: background .2s ease, color .2s ease, transform .2s ease;
}
.tl-btn--ghost { background: #fff; color: var(--ink); }
.tl-btn--ghost:hover { background: var(--ink); color: #fff; }
.tl-btn--primary { grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: #fff; padding: 15px 10px; font-size: 13px; }
.tl-btn--primary:hover { background: var(--ink); border-color: var(--ink); transform: translateY(-2px); }
.tl-cart-buttons:has(.tl-btn--primary:only-child) { grid-template-columns: 1fr; }

/* Phones: the panel is a sheet that slides up from the bottom */
@media (max-width: 600px) {
	.tl-cart-panel {
		top: auto;
		right: 0;
		left: 0;
		bottom: 0;
		width: auto;
		max-height: 82vh;
		border-width: 3px 0 0;
		box-shadow: 0 -10px 30px rgba(0, 0, 0, .25);
		transform: translateY(100%);
		transform-origin: bottom center;
	}
	.tl-cart-panel.is-open { transform: none; }
}

/* =====================================================================
   Respect visitors who prefer less motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
	.tl-js .tl-reveal { opacity: 1; transform: none; transition: none; }
	.rm-carousel.is-ready .rm-slide,
	.rm-carousel.is-ready .rm-slide > *,
	.tl-cart-panel, .tl-cart-item { transition: none !important; animation: none !important; }
	.rm-carousel.is-ready .rm-slide > * { opacity: 1; transform: none; }
	.rm-progress { display: none; }
	.woocommerce ul.products li.product span.onsale, .cart-count.is-pop { animation: none; }
	.rm-product-carousel .woocommerce ul.products { scroll-behavior: auto; }
}

/* ---------- Footer: never wider than the screen (very small phones) ---------- */
.footer-grid > * { min-width: 0; }
.newsletter input { min-width: 0; flex: 1 1 auto; }
@media (max-width: 782px) {
	.footer-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Ticker strip: always full width on the home page ---------- */
.home .entry-content > p.rm-marquee {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding-left: 0;
	padding-right: 0;
}

/* ---------- Navigation: keep "Products" underlined on shop, category and product pages ---------- */
body.woocommerce .primary-nav .nav-products > a::after { transform: scaleX(1); }

/* ---------- Product cards: do not rely on WooCommerce's own stylesheet for these ---------- */
.woocommerce ul.products li.product span.onsale { position: absolute; z-index: 3; margin: 0; }
.woocommerce ul.products li.product a,
.woocommerce ul.products li.product a:hover { text-decoration: none; }
.woocommerce ul.products li.product .price del { text-decoration: line-through; }
