/* =====================================================================================================================
   Motion, modern (Magpro, 2026-11-08). Loaded only on layout "modern" (functions.php: assets/layouts/<layout>.css).
   User: "más cariño… no puros fade in… usa elementos de la marca". The idea comes from Magpro's own story and art
   direction: precision, a molecule bonding, the right-pointing chevron of the logo, the cyan glow (#1abed9 / glow) on
   night blue, the product in a framed ring.
   - The isologo (six folded ribbons) assembles piece by piece when it enters: "el magnesio nunca viene solo".
   - Product frames: a ray of light runs around the frame in the product's own label color, and the jar leans
     toward the pointer (assets/motion.js sets --bb-rx/--bb-ry).
   - Figures count up (assets/motion.js), headings rise out of a mask, cards lean with a glare that follows the mouse.
   - Buttons get the logo's chevron and a sheen; a thin cyan line under the header tracks reading progress.
   SEO / Core Web Vitals: only transform, opacity, clip-path and paint (no size or position change: CLS 0). Nothing on
   screen at load starts hidden (LCP untouched). Scroll-driven parts only where the browser supports them. Off with
   "reduce motion".
   ===================================================================================================================== */

@property --bb-spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

@keyframes bb-mod-settle { from { transform: scale(1.07); } to { transform: none; } }
@keyframes bb-mod-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bb-mod-spin { to { --bb-spin: 360deg; } }
@keyframes bb-mod-piece {
	from { opacity: 0; transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, -30deg)) scale(.55); }
	60% { opacity: 1; }
	to { opacity: 1; transform: none; }
}
@keyframes bb-mod-glow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(26, 190, 217, 0)); } 45% { filter: drop-shadow(0 0 14px rgba(26, 190, 217, .55)); } }
@keyframes bb-mod-menu { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* The mark: always visible without JS; it only assembles when motion.js tags it below the fold. */
.bb-mark-wrap { display: flex; justify-content: center; margin: 0 auto var(--wp--preset--spacing--30); }
.bb-mark { width: 56px; height: auto; display: block; overflow: visible; }
.bb-mark-piece { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: no-preference) {

	/* ---- Entrances (shared engine tags .bb-reveal; --bb-d is the stagger) ---- */
	.bb-layout-modern .bb-reveal { opacity: 0; transform: translateY(22px) scale(.985);
		transition: opacity .6s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms), transform .7s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms); }
	.bb-layout-modern .bb-reveal.is-in { opacity: 1; transform: none; }
	/* Headings rise out of a line, like a reading on a display. */
	.bb-layout-modern h2.bb-reveal { opacity: 1; transform: translateY(.45em); clip-path: inset(0 0 100% 0);
		transition: transform .75s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms), clip-path .75s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms), opacity .75s; }
	.bb-layout-modern h2.bb-reveal.is-in { transform: none; clip-path: inset(0 0 -20% 0); }
	/* Images open like a lens. */
	.bb-layout-modern figure.bb-reveal { opacity: 1; transform: none; clip-path: inset(10% 10% 10% 10% round 28px);
		transition: clip-path .9s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms); }
	.bb-layout-modern figure.bb-reveal img { transform: scale(1.1); transition: transform 1.2s cubic-bezier(.2, .7, .2, 1) var(--bb-d, 0ms); }
	.bb-layout-modern figure.bb-reveal.is-in { clip-path: inset(0 0 0 0 round 0); }
	.bb-layout-modern figure.bb-reveal.is-in img { transform: none; }
	/* The eyebrow arrives from the left, the way the chevron points. */
	.bb-layout-modern .bb-eyebrow.bb-reveal { transform: translateX(-14px); }

	/* ---- The isologo assembles: each ribbon flies in from its own side, then a cyan glow passes once ---- */
	.bb-mark.bb-reveal { opacity: 1; transform: none; transition: none; }
	.bb-mark.bb-reveal .bb-mark-piece { opacity: 0; }
	.bb-mark.bb-reveal.is-in .bb-mark-piece { animation: bb-mod-piece .9s cubic-bezier(.2, .8, .2, 1) both; }
	.bb-mark.bb-reveal.is-in { animation: bb-mod-glow 1.6s ease .9s both; }
	.bb-mark-piece:nth-child(1) { --tx: 0; --ty: 26px; --rot: 40deg; animation-delay: 0s !important; }
	.bb-mark-piece:nth-child(2) { --tx: 26px; --ty: 10px; --rot: -35deg; animation-delay: .08s !important; }
	.bb-mark-piece:nth-child(3) { --tx: 18px; --ty: -10px; --rot: 30deg; animation-delay: .16s !important; }
	.bb-mark-piece:nth-child(4) { --tx: 0; --ty: -26px; --rot: -40deg; animation-delay: .24s !important; }
	.bb-mark-piece:nth-child(5) { --tx: -24px; --ty: -8px; --rot: 35deg; animation-delay: .32s !important; }
	.bb-mark-piece:nth-child(6) { --tx: -22px; --ty: 14px; --rot: -30deg; animation-delay: .4s !important; }
	/* Hover replays the bond: the ribbons breathe apart a little and close again. */
	.bb-mark-wrap:hover .bb-mark-piece { animation: bb-mod-piece .8s cubic-bezier(.2, .8, .2, 1) both; }

	/* ---- On load (always visible, no LCP cost): the hero photo settles, the hero art floats in place ---- */
	.bb-layout-modern .bb-hero-cover > .wp-block-cover__image-background { animation: bb-mod-settle 2.2s cubic-bezier(.2, .7, .2, 1) both; }

	/* ---- Product frames: a ray of light runs around the border in the label color, the jar leans to the pointer ---- */
	.bb-layout-modern .woocommerce ul.products li.product a img {
		transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease; will-change: transform; }
	.bb-layout-modern .woocommerce ul.products li.product:hover a img {
		--bb-a: var(--bb-accent, var(--wp--preset--color--glow));
		transform: perspective(700px) rotateX(var(--bb-rx, 0deg)) rotateY(var(--bb-ry, 0deg)) translateY(-6px) scale(1.03);
		background:
			radial-gradient(circle at var(--bb-mx, 50%) var(--bb-my, 40%), color-mix(in srgb, var(--bb-a) 22%, #fff) 0%, #fff 60%) padding-box,
			conic-gradient(from var(--bb-spin), var(--bb-a) 0deg, #dfe5ec 70deg, #dfe5ec 200deg, color-mix(in srgb, var(--bb-a) 70%, #fff) 300deg, var(--bb-a) 360deg) border-box !important;
		animation: bb-mod-spin 2.8s linear infinite;
		box-shadow: 0 22px 44px color-mix(in srgb, var(--bb-a) 30%, transparent), 0 0 0 6px color-mix(in srgb, var(--bb-a) 10%, transparent); }
	.bb-layout-modern .woocommerce ul.products li.product .woocommerce-loop-product__title { transition: color .25s ease; }
	.bb-layout-modern .woocommerce ul.products li.product:hover .woocommerce-loop-product__title { color: var(--bb-accent, var(--wp--preset--color--primary)); }

	/* ---- Cards and tools: lean toward the pointer with a cyan glare under it ---- */
	.bb-layout-modern .bb-card-box, .bb-layout-modern .bb-tool { position: relative; isolation: isolate;
		transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-color .35s ease; }
	.bb-layout-modern .bb-card-box::after, .bb-layout-modern .bb-tool::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
		pointer-events: none; z-index: -1; opacity: 0; transition: opacity .35s ease;
		background: radial-gradient(260px circle at var(--bb-mx, 50%) var(--bb-my, 0%), rgba(41, 182, 232, .16), transparent 70%); }
	.bb-layout-modern .bb-card-box.is-tilting, .bb-layout-modern .bb-tool.is-tilting {
		transform: perspective(900px) rotateX(var(--bb-rx, 0deg)) rotateY(var(--bb-ry, 0deg)) translateY(-4px);
		border-color: color-mix(in srgb, var(--wp--preset--color--glow) 55%, var(--wp--preset--color--line));
		box-shadow: 0 18px 40px rgba(6, 11, 38, .10); }
	.bb-layout-modern .bb-card-box.is-tilting::after, .bb-layout-modern .bb-tool.is-tilting::after { opacity: 1; }
	.bb-layout-modern .bb-hero-art img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
	.bb-layout-modern .bb-hero-art img.is-tilting { transform: perspective(1000px) rotateX(var(--bb-rx, 0deg)) rotateY(var(--bb-ry, 0deg)) scale(1.015); }
	.bb-layout-modern .bb-card-box .bb-icon img { transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); }
	.bb-layout-modern .bb-card-box:hover .bb-icon img { transform: translateY(-3px) rotate(-6deg) scale(1.08); }

	/* ---- Figures: tabular digits so the count-up never jitters ---- */
	.bb-layout-modern .bb-stat { font-variant-numeric: tabular-nums; }

	/* ---- Buttons: the logo's chevron slides in, a sheen crosses the pill ---- */
	.bb-layout-modern .wp-block-button__link { position: relative; overflow: hidden; padding-right: 2.6em !important;
		transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease; }
	.bb-layout-modern .wp-block-button__link::after { content: ""; position: absolute; right: 1.25em; top: 50%; width: .5em; height: .5em;
		border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translate(-6px, -50%) rotate(45deg); opacity: .55;
		transition: transform .3s cubic-bezier(.2, .7, .2, 1), opacity .3s ease; }
	/* The sheen lives only inside buttons of the page body, invisible until hover (user saw a stray glint in the footer). */
	.bb-layout-modern main .wp-block-button__link::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
		opacity: 0; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-160%) skewX(-18deg); }
	.bb-layout-modern .wp-block-button__link:hover { transform: translateY(-2px); box-shadow: 0 10px 26px color-mix(in srgb, var(--wp--preset--color--glow) 30%, transparent); }
	.bb-layout-modern .wp-block-button__link:hover::after, .bb-layout-modern .wp-block-button__link:focus-visible::after { transform: translate(0, -50%) rotate(45deg); opacity: 1; }
	.bb-layout-modern main .wp-block-button__link:hover::before { opacity: 1; transform: translateX(320%) skewX(-18deg); transition: transform .8s cubic-bezier(.2, .7, .2, 1), opacity .2s ease; }

	/* ---- Header: a cyan hairline once the page moves; reading progress under it ---- */
	.bb-layout-modern .bb-header { transition: box-shadow .3s ease; }
	.bb-layout-modern .bb-header.is-scrolled { box-shadow: 0 1px 0 rgba(41, 182, 232, .35), 0 10px 30px rgba(6, 11, 38, .07); }
	@supports (animation-timeline: scroll()) {
		.bb-layout-modern .bb-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
			background: linear-gradient(90deg, #26589e, var(--wp--preset--color--glow)); transform-origin: left;
			animation: bb-mod-progress linear both; animation-timeline: scroll(root); }
	}

	/* ---- Mobile menu: links slide in along the chevron, one after another ---- */
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item { animation: bb-mod-menu .4s cubic-bezier(.2, .7, .2, 1) both; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: .06s; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: .12s; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: .18s; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: .24s; }

	/* ---- FAQ: the answer unfolds, the + turns ---- */
	.bb-layout-modern .bb-faq summary::after { transition: transform .3s cubic-bezier(.2, .7, .2, 1), background-color .3s ease, color .3s ease; }
	.bb-layout-modern .bb-faq[open] summary::after { transform: translateY(-50%) rotate(180deg); }
	@supports (interpolate-size: allow-keywords) {
		.bb-layout-modern { interpolate-size: allow-keywords; }
		.bb-layout-modern .bb-faq::details-content { block-size: 0; overflow-y: clip;
			transition: block-size .4s cubic-bezier(.2, .7, .2, 1), content-visibility .4s allow-discrete; }
		.bb-layout-modern .bb-faq[open]::details-content { block-size: auto; }
	}
}
.bb-mark-wrap--left { justify-content: flex-start; margin-left: 0; }
.bb-dark .bb-mark-wrap .bb-mark { filter: drop-shadow(0 0 10px rgba(26, 190, 217, .25)); }

/* ---- v2 (2026-11-08): words never break in cards; the hexagon mesh of the brand's light backgrounds
   (art direction, register D) on the surface bands; concentric rings (register B) leave the featured jars on hover. */
.bb-layout-modern .bb-card-box :is(h3, p) { hyphens: manual; overflow-wrap: normal; word-break: normal; }
.bb-layout-modern .bb-families .bb-more-link { margin: .6rem 0 0; font-weight: 600; font-size: .92rem; }
.bb-layout-modern .bb-families .bb-more-link a { text-decoration: none; color: var(--wp--preset--color--primary); }
.bb-layout-modern .bb-families .bb-more-link a::after { content: ""; display: inline-block; width: .42em; height: .42em; margin-left: .45em;
	border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translateY(-.08em) rotate(45deg); transition: transform .3s ease; }
.bb-layout-modern .bb-families .bb-card-box:hover .bb-more-link a::after { transform: translate(.25em, -.08em) rotate(45deg); }
.bb-layout-modern .has-surface-background-color:not(.bb-dark) {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 55 16.5v31L28 63 1 47.5v-31Zm0 63v32' fill='none' stroke='%2329b6e8' stroke-opacity='.10' stroke-width='1'/%3E%3C/svg%3E");
	background-size: 56px 97px; }
.bb-layout-modern .bb-featured .wp-block-image { position: relative; isolation: isolate; }
.bb-layout-modern .bb-featured .wp-block-image::before, .bb-layout-modern .bb-featured .wp-block-image::after {
	content: ""; position: absolute; left: 50%; top: 50%; width: 78%; aspect-ratio: 1; border-radius: 50%; z-index: -1; pointer-events: none;
	border: 1.5px solid rgba(26, 190, 217, .45); transform: translate(-50%, -50%) scale(.8); opacity: 0; }
@keyframes bb-mod-ring { from { transform: translate(-50%, -50%) scale(.8); opacity: .9; } to { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
	.bb-layout-modern .bb-featured .wp-block-column:hover .wp-block-image::before { animation: bb-mod-ring 1.6s cubic-bezier(.2, .7, .2, 1) infinite; }
	.bb-layout-modern .bb-featured .wp-block-column:hover .wp-block-image::after { animation: bb-mod-ring 1.6s cubic-bezier(.2, .7, .2, 1) .55s infinite; }
	.bb-layout-modern .bb-featured .wp-block-image img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
	.bb-layout-modern .bb-featured .wp-block-column:hover .wp-block-image img { transform: translateY(-6px) scale(1.03); }
}

/* An eyebrow right above a centered section title is centered too. */
.bb-layout-modern .bb-eyebrow:has(+ .bb-section-title) { text-align: center; }

/* =====================================================================================================================
   v3 (2026-11-09, user: "sí, hay que ajustar Magpro"). Story: "Especialistas en magnesio" (content/getmagpro.com/historia.md).
   ===================================================================================================================== */

/* ---- The bond explainer on each product page (assets/layouts/modern.js draws it): the magnesium sphere, the
   molecule it is bound to, and the bond between them. The sentence below is HTML. ---- */
.bb-bond { margin: 1.4rem 0 1.8rem; padding: 1.2rem 1.2rem 1rem; border-radius: 18px; text-align: center;
	background: radial-gradient(120% 90% at 30% 20%, #0f2a66 0%, #060b26 70%); color: #fff; }
.bb-bond-art { width: 100%; max-width: 440px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.bb-bond-line { stroke: #29b6e8; stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(41, 182, 232, .6)); }
.bb-bond-ligand { fill: #0b1640; stroke: #29b6e8; stroke-width: 2; }
.bb-bond-ligand-core { fill: rgba(41, 182, 232, .22); }
.bb-bond-halo { fill: none; stroke: rgba(41, 182, 232, .35); stroke-width: 1.5; }
.bb-bond-symbol { fill: #fff; font-family: var(--wp--preset--font-family--poppins, sans-serif); font-weight: 700; }
.bb-bond-label { fill: #9fdcf2; font-family: var(--wp--preset--font-family--poppins, sans-serif); font-size: 14px; font-weight: 600; }
.bb-bond-text { margin: .6rem 0 0; font-size: 1rem; color: #dbe8f7; }
.bb-bond-text strong { color: #fff; }
.bb-bond-mineral, .bb-bond-ligands, .bb-bond-halo { transform-box: fill-box; transform-origin: center; }

@keyframes bb-mod-bond-in { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: none; } }
@keyframes bb-mod-bond-slide { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes bb-mod-bond-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes bb-mod-bond-halo { 0%, 100% { opacity: .2; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.06); } }
@media (prefers-reduced-motion: no-preference) {
	.bb-bond.bb-reveal { opacity: 1; transform: none; transition: none; }
	.bb-bond.bb-reveal .bb-bond-mineral { opacity: 0; }
	.bb-bond.bb-reveal .bb-bond-ligands { opacity: 0; }
	.bb-bond.bb-reveal .bb-bond-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
	.bb-bond.bb-reveal.is-in .bb-bond-mineral { animation: bb-mod-bond-in .7s cubic-bezier(.34, 1.56, .64, 1) both; }
	.bb-bond.bb-reveal.is-in .bb-bond-ligands { animation: bb-mod-bond-slide .8s cubic-bezier(.16, 1, .3, 1) .35s both; }
	.bb-bond.bb-reveal.is-in .bb-bond-line { animation: bb-mod-bond-draw .7s cubic-bezier(.65, 0, .35, 1) 1s both; }
	/* One slow loop for this screen: the bond keeps a soft halo around the magnesium. */
	.bb-bond.bb-reveal.is-in .bb-bond-halo { animation: bb-mod-bond-halo 3.6s ease-in-out 1.7s infinite; }
}

/* ---- Label data on the product page: a short spec sheet (form, mg, capsules, origin), cyan rule on the left ---- */
.bb-layout-modern.single-product div.product .bb-chips { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; list-style: none; padding: 0; margin: 1rem 0 1.3rem; }
.bb-layout-modern.single-product div.product .bb-chips > li { margin: 0; padding: .55rem .75rem !important; border: 0 !important; border-radius: 10px !important;
	background: var(--wp--preset--color--surface, #f4f7fb) !important; box-shadow: inset 3px 0 0 var(--bb-accent, var(--wp--preset--color--glow));
	font-size: .92rem; font-weight: 600; color: var(--wp--preset--color--ink) !important; }
.bb-layout-modern.single-product div.product .bb-chips > li:first-child { grid-column: 1 / -1; font-size: 1rem; }

/* ---- Mobile menu: the night panel gets the brand. The isologo watermark sits low on the right, every link carries
   the logo's chevron, and thin cyan rules separate the rows. The links slide in along the chevron (above). ---- */
@media (max-width: 599px) {
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open {
		background:
			url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cpath d='M18 16 98 60 18 104' fill='none' stroke='%2329b6e8' stroke-opacity='.10' stroke-width='14' stroke-linejoin='round'/%3E%3Cpath d='M42 36 78 60 42 84' fill='none' stroke='%2329b6e8' stroke-opacity='.10' stroke-width='10' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right -60px bottom -40px / 300px 300px,
			radial-gradient(120% 70% at 100% 100%, rgba(41, 182, 232, .16) 0%, transparent 60%),
			var(--wp--preset--color--night, #060b26) !important; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container { gap: 0 !important; width: 100%; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item { width: 100%;
		border-bottom: 1px solid rgba(41, 182, 232, .22); }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: flex !important; align-items: center; justify-content: space-between; width: 100%; padding: 1.05rem 0 !important; font-size: 1.45rem; }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content::after {
		content: ""; display: block !important; position: static; width: .55rem; height: .55rem; margin-right: .3rem; background: none !important;
		border-top: 2.5px solid #29b6e8; border-right: 2.5px solid #29b6e8; transform: rotate(45deg); }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover::after { transform: translateX(4px) rotate(45deg); }
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .current-menu-item > .wp-block-navigation-item__content,
	.bb-layout-modern .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content[aria-current] { color: #29b6e8 !important; }
}
