/*
 * Sara's Closet — hand-written extras.
 *
 * Loaded AFTER the compiled Tailwind theme.css, so the design tokens
 * (--primary, --accent, etc.) defined there are available here.
 *
 * Contains: animations/keyframes, hero + cart-drawer behaviour, scroll reveal,
 * and WooCommerce restyling to match the brand.
 */

/* ---------- Accessibility ---------- */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	padding: 10px 16px;
	clip: auto;
	background: var(--primary);
	color: var(--primary-foreground);
	border-radius: 9999px;
}

/* ---------- Hero background orbs ---------- */
.saras-orb-1 {
	background: radial-gradient(circle, oklch(0.86 0.05 30 / 0.5), transparent 70%);
	animation: saras-pulse 12s ease-in-out infinite;
}
.saras-orb-2 {
	background: radial-gradient(circle, oklch(0.72 0.09 65 / 0.35), transparent 70%);
	animation: saras-pulse 14s ease-in-out infinite;
}
@keyframes saras-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.12); }
}

/* Hero cards slight rotation, matching the original stacked look. */
.saras-hero-main { transform: rotate(-4deg); }
.saras-hero-next { transform: rotate(5deg); }

/* Floating label gentle bob. */
.saras-hero-float { animation: saras-bob 5s ease-in-out infinite; }
@keyframes saras-bob {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-12px); }
}

/* ---------- Marquee ---------- */
.saras-marquee {
	width: max-content;
	animation: saras-marquee 30s linear infinite;
}
@keyframes saras-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

/* ---------- Rotating story badge ---------- */
.saras-spin { animation: saras-spin 30s linear infinite; }
@keyframes saras-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ---------- Scroll reveal ---------- */
.reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: opacity, transform;
}
.reveal.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* ---------- Mobile menu ---------- */
#saras-mobile-menu.is-open {
	display: flex;
	animation: saras-menu-fade 0.3s ease-out both;
}
/* Staggered entrance for the individual links. */
#saras-mobile-menu.is-open .saras-menu-item {
	animation: saras-menu-item 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#saras-mobile-menu.is-open .saras-menu-item:nth-child(1) { animation-delay: 0.06s; }
#saras-mobile-menu.is-open .saras-menu-item:nth-child(2) { animation-delay: 0.12s; }
#saras-mobile-menu.is-open .saras-menu-item:nth-child(3) { animation-delay: 0.18s; }
#saras-mobile-menu.is-open .saras-menu-item:nth-child(4) { animation-delay: 0.24s; }
#saras-mobile-menu.is-open .saras-menu-item:nth-child(5) { animation-delay: 0.30s; }
#saras-mobile-menu.is-open .saras-menu-item:nth-child(6) { animation-delay: 0.36s; }
@keyframes saras-menu-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes saras-menu-item {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: translateY(0); }
}
body.saras-no-scroll { overflow: hidden; }

/* ---------- Cart drawer ---------- */
#saras-cart-drawer.is-open { transform: translateX(-100%); }
#saras-cart-overlay.is-open { opacity: 1; }

/* ---------- Sticky header scrolled state ---------- */
#saras-header.is-scrolled {
	border-bottom-color: color-mix(in oklab, var(--border) 60%, transparent);
	background-color: color-mix(in oklab, var(--background) 80%, transparent);
	backdrop-filter: blur(12px);
}

/* Hide products filtered out by the homepage category chips. */
.saras-product-hidden { display: none !important; }

/* Hide WooCommerce's auto-injected "View cart" link inside our custom cards. */
.saras-shop-grid .added_to_cart,
.saras-carousel .added_to_cart,
.woocommerce ul.products li.product .added_to_cart { display: none !important; }

/* ===================================================================
 * WooCommerce restyling
 * ================================================================ */

/* Product grid — override WooCommerce's float/column layout. */
.woocommerce ul.products,
.woocommerce-page ul.products {
	display: grid;
	grid-template-columns: repeat(1, minmax(0, 1fr));
	gap: 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
@media (min-width: 640px) {
	.woocommerce ul.products,
	.woocommerce-page ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
}
@media (min-width: 1024px) {
	.woocommerce ul.products,
	.woocommerce-page ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
}
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	width: auto !important;
	margin: 0 !important;
	float: none !important;
	clear: none !important;
}
.woocommerce ul.products li.product::before { content: none !important; }

/* Buttons. */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce .button,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.wc-block-components-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background-color: var(--primary);
	color: var(--primary-foreground);
	border: none;
	border-radius: 9999px;
	padding: 0.85rem 1.75rem;
	font-family: var(--font-body);
	font-size: 0.9rem;
	font-weight: 500;
	line-height: 1;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce .button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: color-mix(in oklab, var(--primary) 90%, transparent);
	box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.4);
}
.woocommerce .button.disabled,
.woocommerce button.button:disabled { opacity: 0.5; }

/* Prices. */
.woocommerce .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
	color: var(--primary);
	font-family: var(--font-display);
}
.woocommerce .price del { color: var(--muted-foreground); opacity: 0.7; }
.woocommerce .price ins { text-decoration: none; }

/* Sale flash. */
.woocommerce span.onsale {
	background: var(--accent);
	color: var(--accent-foreground);
	border-radius: 9999px;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	min-height: auto;
	min-width: auto;
	padding: 0.35rem 0.75rem;
	top: 1rem;
	left: 1rem;
}

/* Headings & single product. */
.woocommerce div.product .product_title {
	font-family: var(--font-display);
	color: var(--primary);
	font-size: clamp(2rem, 4vw, 3rem);
}
.woocommerce div.product .woocommerce-product-gallery { border-radius: 1.5rem; overflow: hidden; }
.woocommerce #reviews h2,
.woocommerce .related h2,
.woocommerce .upsells h2 {
	font-family: var(--font-display);
	color: var(--primary);
}

/* Tabs. */
.woocommerce div.product .woocommerce-tabs ul.tabs li {
	background: var(--card);
	border-color: var(--border);
	border-radius: 9999px;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li.active {
	background: var(--secondary);
}

/* Inputs / forms. */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce-page table.cart td.actions .coupon .input-text,
.select2-container .select2-selection {
	border: 1px solid var(--border);
	border-radius: 0.75rem;
	background: var(--card);
	padding: 0.65rem 0.9rem;
	color: var(--foreground);
}

/* Tables (cart/checkout/account). */
.woocommerce table.shop_table {
	border-radius: 1rem;
	border-color: var(--border);
}
.woocommerce table.shop_table th { font-family: var(--font-display); color: var(--primary); }

/* Notices. */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	border-top-color: var(--accent);
	background: var(--card);
	border-radius: 0.75rem;
}
.woocommerce-message::before,
.woocommerce-info::before { color: var(--accent); }

/* Result count / ordering. */
.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering { color: var(--muted-foreground); }

/* Pagination. */
.woocommerce nav.woocommerce-pagination ul { border: none; gap: 0.35rem; display: inline-flex; }
.woocommerce nav.woocommerce-pagination ul li {
	border: none;
}
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	border: 1px solid var(--border);
	border-radius: 9999px;
	min-width: 2.5rem;
	height: 2.5rem;
	display: grid;
	place-items: center;
}
.woocommerce nav.woocommerce-pagination ul li span.current {
	background: var(--primary);
	color: var(--primary-foreground);
	border-color: var(--primary);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.saras-orb-1, .saras-orb-2, .saras-hero-float, .saras-marquee, .saras-spin { animation: none; }
	#saras-mobile-menu.is-open,
	#saras-mobile-menu.is-open .saras-menu-item { animation: none; }
	.reveal { opacity: 1; transform: none; transition: none; }
}
