/*
 * WindCodex — Modern Design Layer
 * ------------------------------------------------------------------
 * Restyles every WindCodex widget, the header, CTA band and WooCommerce
 * pages in the "modern" look: heavy tight headlines, brand-gradient accent
 * words, light sentence-case badges, gradient buttons, soft brand-tinted
 * sections, calmer cards.
 *
 * Everything is scoped to body.wc-modern (Customizer → WindCodex Options →
 * Site Design → Modern). Choosing another design restores the
 * original look instantly.
 *
 * Colors derive from the Customizer brand colors (--wc-primary /
 * --wc-secondary), so a brand color change flows through automatically.
 * Per-widget Style-tab colors (inline styles) still win over this file.
 * ------------------------------------------------------------------ */

/* ── 1. Tokens ─────────────────────────────────────────────────── */
body.wc-modern {
	--m-brand: var(--wc-primary, #6347eb);
	--m-brand-2: var(--wc-secondary, #2e266d);
	--m-indigo: #4f46e5;
	--m-violet: #8b5cf6;
	--m-ink: #0f172a;
	--m-body: #475569;
	--m-grad: linear-gradient(90deg, var(--m-indigo) 0%, var(--m-brand) 50%, var(--m-violet) 100%);
	--m-btn-grad: linear-gradient(90deg, var(--m-indigo) 0%, var(--m-brand) 100%);

	/* Fallbacks first, color-mix() where supported */
	--m-brand-06: rgba(99, 71, 235, 0.06);
	--m-brand-10: rgba(99, 71, 235, 0.10);
	--m-brand-14: rgba(99, 71, 235, 0.14);
	--m-brand-20: rgba(99, 71, 235, 0.20);
	--m-brand-35: rgba(99, 71, 235, 0.35);
	--m-border: #e7e5f4;
	--m-tint-bg: #f7f6fe;
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
	body.wc-modern {
		--m-brand-06: color-mix(in srgb, var(--m-brand) 6%, transparent);
		--m-brand-10: color-mix(in srgb, var(--m-brand) 10%, transparent);
		--m-brand-14: color-mix(in srgb, var(--m-brand) 14%, transparent);
		--m-brand-20: color-mix(in srgb, var(--m-brand) 20%, transparent);
		--m-brand-35: color-mix(in srgb, var(--m-brand) 35%, transparent);
		--m-border: color-mix(in srgb, var(--m-brand) 10%, #e2e8f0);
		--m-tint-bg: color-mix(in srgb, var(--m-brand) 3%, #f8fafc);
	}
}

/* ── 2. Typography ─────────────────────────────────────────────── */
body.wc-modern {
	--wc-font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	--wc-font-display: var(--wc-font);
	font-family: var(--wc-font);
	font-feature-settings: 'cv11', 'ss01';
	-webkit-font-smoothing: antialiased;
}
/* Optional: keep the brand font (Customizer → Headline font → Brand) */
body.wc-modern.wc-font-brand {
	--wc-font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
}
body.wc-modern :is(h1, h2, h3) {
	font-family: var(--wc-font-display);
}

body.wc-modern :is(h1, h2) {
	font-weight: 800;
	letter-spacing: -0.032em;
}
body.wc-modern h1 { line-height: 1.05; }
body.wc-modern h2 { line-height: 1.1; }
body.wc-modern :is(h3, h4) {
	font-weight: 700;
	letter-spacing: -0.02em;
}
body.wc-modern.wc-font-brand :is(h1, h2) { font-weight: 700; }

/* Bigger, bolder headlines on phones */
@media (max-width: 639px) {
	body.wc-modern section h1 {
		font-size: 2.75rem;
		line-height: 1.05;
	}
	body.wc-modern section h2:is([class*="text-2xl"], [class*="text-3xl"], [class*="text-4xl"]) {
		font-size: 2rem;
		line-height: 1.12;
	}
}

/* Body copy: a touch larger and calmer */
body.wc-modern .windcodex-richtext,
body.wc-modern section p.text-slate-600,
body.wc-modern section p.text-slate-500 {
	line-height: 1.65;
}
body.wc-modern .windcodex-richtext :is(strong, b) {
	color: var(--m-ink);
	font-weight: 600;
}
body.wc-modern .windcodex-richtext a:not([class]) {
	color: var(--m-brand);
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
}

/* ── 3. Accent words → brand gradient text ─────────────────────── */
/* Only the text fill is transparent — `color` stays brand, so an icon inside
   the accent (stroke="currentColor") stays visible. */
body.wc-modern :is(h1, h2) .text-brand-primary {
	background-image: var(--m-grad);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	padding-bottom: 0.06em;
}
/* On brand / dark bands the gradient would vanish into the background → plain */
body.wc-modern :is(section.bg-brand-primary, section[class*="from-brand-primary"], section.bg-slate-900, section.bg-slate-950) :is(h1, h2) .text-brand-primary {
	background-image: none;
	-webkit-text-fill-color: currentColor;
}
/* Accent on purple CTA bands (was near-black) → soft lavender */
body.wc-modern :is(section.bg-brand-primary, section[class*="from-brand-primary"]) :is(h1, h2) .text-slate-900 {
	color: #d9d2ff;
}

/* ── 4. Badges & labels → light, sentence case ─────────────────── */
/* All ALL-CAPS tracked labels become sentence case */
body.wc-modern :is(.uppercase):is(.tracking-widest, .tracking-wider, .tracking-wide, [class*="tracking-["]) {
	text-transform: none;
	letter-spacing: -0.005em;
}
body.wc-modern .text-\[10px\] { font-size: 12px; }

/* Eyebrow pills (shared badge + page-hero badge) */
body.wc-modern section .rounded-full.inline-flex.uppercase:not(.text-\[10px\]) {
	font-size: 0.875rem;
	font-weight: 600;
	padding: 0.4rem 1rem;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
/* Solid / gradient pills on light sections → light tinted pill */
body.wc-modern section:not(.bg-slate-900):not(.bg-brand-primary):not([class*="from-brand-primary"])
	.rounded-full.inline-flex.uppercase:not(.text-\[10px\]):is(.bg-brand-primary, [class*="from-brand-primary"], [class*="bg-brand-primary/"]) {
	background: rgba(255, 255, 255, 0.72);
	background-image: none;
	border: 1px solid var(--m-brand-20);
	color: var(--m-brand);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
/* Keep the announcement bar exactly as configured */
body.wc-modern #wc-announcement-bar .uppercase {
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-size: 10px;
}

/* ── 5. Buttons ────────────────────────────────────────────────── */
body.wc-modern :is(a, button, input[type="submit"]).bg-brand-primary:not(.rounded-full.uppercase),
body.wc-modern #place_order,
body.wc-modern .woocommerce :is(a.button.alt, button.button.alt) {
	background-image: var(--m-btn-grad);
	border-color: transparent;
	box-shadow: 0 12px 28px -12px rgba(79, 70, 229, 0.55);
	transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
body.wc-modern :is(a, button).bg-brand-primary:not(.rounded-full.uppercase):not(:disabled):hover,
body.wc-modern #place_order:not(:disabled):hover {
	opacity: 1;
	transform: translateY(-1px);
	box-shadow: 0 18px 34px -12px rgba(79, 70, 229, 0.62);
}
/* Filter chips (rounded-full) — gradient, no big glow */
body.wc-modern button.bg-brand-primary.rounded-full {
	background-image: var(--m-btn-grad);
	box-shadow: 0 6px 16px -8px rgba(79, 70, 229, 0.55);
}

/* Secondary buttons (white + border) → light glass, brand text */
body.wc-modern section a.inline-flex.bg-white.border:is(.rounded-xl, .rounded-2xl) {
	background: rgba(255, 255, 255, 0.65);
	border-color: var(--m-brand-20);
	color: var(--m-brand);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
body.wc-modern section a.inline-flex.bg-white.border:is(.rounded-xl, .rounded-2xl):hover {
	background: #fff;
	border-color: var(--m-brand-35);
}

/* Outline buttons that fill on hover (border-brand-primary + hover:text-white) */
body.wc-modern a.border-brand-primary.text-brand-primary[class*="hover:text-white"]:hover {
	background-image: var(--m-btn-grad);
	border-color: transparent;
}

/* Visible keyboard focus everywhere */
body.wc-modern :is(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--m-brand);
	outline-offset: 2px;
}

/* ── 6. Cards ──────────────────────────────────────────────────── */
body.wc-modern :is(div, article, a, button.group).bg-white:is(.border-slate-200, .border-slate-100)[class*="rounded-"] {
	border-color: var(--m-border);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -18px rgba(15, 23, 42, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
/* Only cards that already had a hover effect get the lift */
body.wc-modern :is(div, article, a, button.group).bg-white:is(.border-slate-200, .border-slate-100)[class*="rounded-"][class*="hover:"]:hover {
	border-color: var(--m-brand-35);
	transform: translateY(-3px);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 22px 44px -22px rgba(79, 70, 229, 0.35);
}
/* Remove the old heavy grey mega-shadows */
body.wc-modern .bg-white[class*="shadow-2xl"][class*="shadow-slate"] {
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 40px -24px rgba(15, 23, 42, 0.16);
}

/* Icon badges inside cards → soft gradient tint. Only centred icon boxes
   (not full-width tinted panels); :where() keeps specificity low so Tailwind
   hover states (e.g. group-hover:bg-brand-primary/15) still apply. */
body.wc-modern :where(.bg-brand-primary\/10, .bg-brand-primary\/5):where(.rounded-xl, .rounded-2xl, .rounded-lg):where(.items-center.justify-center):not(.w-full) {
	background-color: transparent;
	background-image: linear-gradient(135deg, var(--m-brand-14), rgba(139, 92, 246, 0.10));
	box-shadow: inset 0 0 0 1px var(--m-brand-10);
}
/* Keep the existing "fill on hover" behaviour readable — only badges whose
   icon turns white on hover (a solid fill); tint-only hovers such as the
   cart's group-hover:bg-brand-primary/15 keep their own Tailwind colours.
   Covers plain groups (group-hover:) and named groups (group-hover/item:). */
body.wc-modern .group:hover :is(.bg-brand-primary\/10, .bg-brand-primary\/5)[class*="group-hover:text-white"],
body.wc-modern [class*="group/"]:hover :is(.bg-brand-primary\/10, .bg-brand-primary\/5)[class*="group-hover/"][class*=":text-white"] {
	background-image: var(--m-btn-grad);
	box-shadow: none;
}

/* FAQ items */
body.wc-modern .wc-faq-item,
body.wc-modern [data-faq] {
	background: #fff;
	border: 1px solid var(--m-border);
}

/* Inputs (not while focused, so Tailwind's focus:border-* still shows) */
body.wc-modern :is(input[type="text"], input[type="search"], input[type="email"], input[type="tel"], input[type="url"], input[type="password"], textarea, select):not(:focus) {
	border-color: var(--m-border);
}

/* ── 7. Section backgrounds ────────────────────────────────────── */
/* Hero sections (any light section containing the page H1):
   brand glow top-right, faint glow bottom-left, faint concentric arcs. */
body.wc-modern section:has(h1):is(.bg-slate-50, .bg-white):not([style*="radial-gradient"]) {
	position: relative;
	isolation: isolate;
	background-color: #f8fafc;
	background-image:
		radial-gradient(70% 55% at 90% 0%, var(--m-brand-14) 0%, transparent 70%),
		radial-gradient(60% 45% at 0% 100%, var(--m-brand-06) 0%, transparent 70%),
		linear-gradient(180deg, var(--m-tint-bg) 0%, #f8fafc 60%);
}
body.wc-modern section:has(h1):is(.bg-slate-50, .bg-white):not([style*="radial-gradient"])::before {
	content: "";
	position: absolute;
	inset: 0; /* stays inside the section — no sideways scroll on phones */
	z-index: -1;
	pointer-events: none;
	background: repeating-radial-gradient(circle at 100% 0%, transparent 0 78px, var(--m-brand-10) 78px 79.5px);
	-webkit-mask-image: radial-gradient(32rem 32rem at 100% 0%, #000 15%, transparent 68%);
	mask-image: radial-gradient(32rem 32rem at 100% 0%, #000 15%, transparent 68%);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}
/* Hide the old faint blobs inside modern heroes */
body.wc-modern section:has(h1) > .absolute.inset-0.overflow-hidden.pointer-events-none[aria-hidden="true"] {
	display: none;
}

/* Alternate light sections: very faint brand tint */
body.wc-modern section.bg-slate-50:not(:has(h1)) {
	background-color: var(--m-tint-bg);
}
body.wc-modern section.bg-slate-50:not(:has(h1)).border-y {
	border-color: var(--m-border);
}

/* Purple CTA bands: richer brand gradient + arcs */
body.wc-modern section:is(.bg-brand-primary, [class*="from-brand-primary"]) {
	position: relative;
	isolation: isolate;
	background-color: var(--m-brand);
	background-image:
		radial-gradient(60% 80% at 100% 0%, rgba(255, 255, 255, 0.16) 0%, transparent 60%),
		linear-gradient(135deg, var(--m-indigo) 0%, var(--m-brand) 45%, var(--m-brand-2) 100%);
}
body.wc-modern section:is(.bg-brand-primary, [class*="from-brand-primary"])::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background: repeating-radial-gradient(circle at 100% 0%, transparent 0 70px, rgba(255, 255, 255, 0.07) 70px 71.5px);
	-webkit-mask-image: radial-gradient(circle at 100% 0%, #000 10%, transparent 75%);
	mask-image: radial-gradient(circle at 100% 0%, #000 10%, transparent 75%);
}
/* Lift content above the arcs — but leave absolute decoration layers absolute */
body.wc-modern section:is(.bg-brand-primary, [class*="from-brand-primary"]) > :not(.absolute):not(.fixed) { position: relative; z-index: 1; }

/* Dark sections: add a subtle brand glow */
body.wc-modern section.bg-slate-900 {
	background-image: radial-gradient(60% 70% at 100% 0%, rgba(99, 71, 235, 0.28) 0%, transparent 60%);
}

/* ── 8. Header & mobile menu ───────────────────────────────────── */
body.wc-modern #wc-navbar {
	background: rgba(255, 255, 255, 0.82);
	border-bottom-color: rgba(15, 23, 42, 0.06);
}
body.wc-modern #wc-navbar .text-sm.font-medium { font-weight: 500; }
body.wc-modern #wc-navbar .text-sm.font-medium:not(.text-brand-primary) { color: #334155; } /* keep current-page highlight */
body.wc-modern #wc-navbar .text-sm.font-medium:hover { color: var(--m-brand); }
body.wc-modern #wc-mobile-menu a.bg-brand-primary { border-radius: var(--wc-radius-md); }

/* ── 9. Motion & accessibility ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	body.wc-modern *,
	body.wc-modern *::before {
		transition: none !important;
		animation: none !important;
	}
	body.wc-modern [class*="hover:"]:hover,
	body.wc-modern .bg-brand-primary:hover { transform: none !important; }
}

/* ── 10. My Account ────────────────────────────────────────────── */
/* The account page has no <section>/hero, so give it the same soft
   brand-tinted canvas as modern heroes. */
body.wc-modern.windcodex-myaccount #main-content {
	background-color: #f8fafc;
	background-image:
		radial-gradient(60% 40% at 100% 0%, var(--m-brand-10) 0%, transparent 70%),
		linear-gradient(180deg, var(--m-tint-bg) 0%, #f8fafc 45%);
}
/* Sidebar nav card (a <ul>, so the generic card rule misses it) */
body.wc-modern .woocommerce-MyAccount-navigation > ul {
	border-color: var(--m-border);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -18px rgba(15, 23, 42, 0.12);
}
body.wc-modern .woocommerce-MyAccount-navigation li { border-color: var(--m-border); }
body.wc-modern .woocommerce-MyAccount-navigation li.is-active > a {
	background-color: var(--m-brand-06);
	color: var(--m-brand);
}
body.wc-modern .woocommerce-MyAccount-navigation li.is-active > a > span:first-child {
	background-image: var(--m-btn-grad);
	color: #fff;
}
body.wc-modern .woocommerce-MyAccount-navigation li:not(.is-active):not(.woocommerce-MyAccount-navigation-link--customer-logout) > a:hover > span:first-child {
	background-color: var(--m-brand-10);
	color: var(--m-brand);
}
/* Cards nested inside the content card: flat, so shadows don't stack */
body.wc-modern .woocommerce-MyAccount-content :is(div, article).bg-white[class*="rounded-"] { box-shadow: none; }
body.wc-modern .woocommerce-MyAccount-content :is(.border-slate-100, .border-slate-200):not(:focus) { border-color: var(--m-border); }
body.wc-modern .woocommerce-MyAccount-content .bg-slate-50:not(input):not(select):not(textarea) { background-color: var(--m-tint-bg); }
/* Inputs: brand focus ring */
body.wc-modern.windcodex-myaccount :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
	border-color: var(--m-brand);
	box-shadow: 0 0 0 4px var(--m-brand-10);
}
