/**
 * Revita: core/group block styles.
 * Card, lavender card, glass, honeycomb background and honey outline.
 * Card-type groups are light surfaces: they bring their own text, heading and link
 * colours so they stay readable inside purple sections. Editor colour choices win.
 */

/* Card */
.wp-block-group.is-style-card {
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--custom--color--surface);
	box-shadow: var(--wp--preset--shadow--soft);
}

/* Lavender card */
.wp-block-group.is-style-card-lavender {
	padding: var(--wp--preset--spacing--50);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--preset--color--lavender);
}

/* Glass: frosted panel for sticky bars and content over images. */
.wp-block-group.is-style-glass {
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--custom--color--glass-edge);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--custom--color--glass);
	box-shadow: var(--wp--preset--shadow--soft);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	backdrop-filter: blur(14px) saturate(140%);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	.wp-block-group.is-style-glass:not(.has-background) {
		background-color: color-mix(in srgb, var(--wp--custom--color--surface) 94%, transparent);
	}
}

/* Light-surface text colours (skipped when the editor sets a background or text colour). */
.wp-block-group:is(.is-style-card, .is-style-card-lavender, .is-style-glass):not(.has-background) {
	color: var(--wp--preset--color--contrast);
}

:is(.is-style-card, .is-style-card-lavender, .is-style-glass):not(.has-background, .has-text-color) :where(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--primary-deep);
}

:is(.is-style-card, .is-style-card-lavender, .is-style-glass):not(.has-background, .has-text-color) a:where(:not(.wp-element-button, .has-link-color a)) {
	color: var(--wp--preset--color--primary);
}

/* Cards gain the "lifted" shadow on hover or when a link inside has keyboard focus;
 * the 4px lift itself comes from the motion layer. */
@media (hover: hover) {
	body:not(.revita-motion-off) .wp-block-group.is-style-card:hover {
		box-shadow: var(--wp--preset--shadow--lifted);
	}
}

body:not(.revita-motion-off) .wp-block-group.is-style-card:has(:focus-visible) {
	box-shadow: var(--wp--preset--shadow--lifted);
}

@media (prefers-reduced-motion: no-preference) {
	.wp-block-group.is-style-card {
		transition:
			box-shadow var(--wp--custom--motion--duration--base) var(--wp--custom--motion--easing--standard),
			transform var(--wp--custom--motion--duration--base) var(--wp--custom--motion--easing--emphasized),
			translate var(--wp--custom--motion--duration--base) var(--wp--custom--motion--easing--emphasized);
	}
}

/* Honeycomb: a tiled pattern layer behind the content, fading out towards the bottom.
 * Purple lines on light surfaces, white lines on dark ones. */
.wp-block-group.is-style-honeycomb {
	isolation: isolate;
}

.wp-block-group.is-style-honeycomb:not(.is-position-sticky, .is-position-fixed) {
	position: relative;
}

.wp-block-group.is-style-honeycomb::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background-image: url(../../images/honeycomb-purple.svg);
	background-position: 0 0;
	background-repeat: repeat;
	-webkit-mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 0.45) 60%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 0.45) 60%, transparent 100%);
	pointer-events: none;
}

/* The group itself is dark… */
.wp-block-group.is-style-honeycomb:is(
	.is-style-section-purple,
	.is-style-section-deep,
	.has-primary-background-color,
	.has-primary-deep-background-color,
	.has-primary-dark-background-color,
	.has-contrast-background-color,
	.has-royal-gradient-background,
	.has-royal-glow-gradient-background,
	.has-night-gradient-background,
	.revita-dark
)::before,
/* …or it sits on a dark surface without a light background of its own. */
:is(
	.is-style-section-purple,
	.is-style-section-deep,
	.has-primary-background-color,
	.has-primary-deep-background-color,
	.has-primary-dark-background-color,
	.has-royal-gradient-background,
	.has-royal-glow-gradient-background,
	.has-night-gradient-background,
	.wp-block-cover:not(.is-light),
	.revita-dark
) .wp-block-group.is-style-honeycomb:not(.has-background, .is-style-section-lavender, .is-style-section-cream, .is-style-section-honey)::before {
	background-image: url(../../images/honeycomb.svg);
}

/* Honey outline: a nod to the current revita.mk cards. */
.wp-block-group.is-style-outline-honey {
	padding: var(--wp--preset--spacing--50);
	border: 2px solid var(--wp--preset--color--accent);
	border-radius: var(--wp--custom--radius--xl);
}
