/*
 * Dopee – button layouts and hover effects.
 * Customizer → Dopee Theme Options → Buttons & Glass.
 *
 * Layout  → body.dopee-btn-{glass|solid|outline|touch|gradient|soft|3d|contrast}
 * Hover   → body.dopee-bhover-{lift|fill-up|fill-down|fill-left|fill-center|
 *                              fill-circle|fill-diagonal|liquid|pulse|shine|none}
 *
 * Layouts restyle normal buttons (.dp-btn, block buttons, form submit buttons).
 * Neutral "ghost"/outline block styles and icon buttons are left alone.
 * Hover effects apply to those buttons only. The header button (.dp-touch)
 * keeps its own hover: arrow circle changes color and the arrow tilts.
 *
 * 1. Layouts   2. Hover effects   3. Glow switch / motion safety
 */

/* 1. Layouts -------------------------------------------------------- */

/* Header-button design for every button: glass pill + round arrow badge */
.dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *) {
	min-height: 52px;
	padding: 0.55em 3.9em 0.55em 1.6em;
	color: var(--dp-touch-text);
	text-transform: var(--dp-touch-case);
	letter-spacing: var(--dp-touch-spacing);
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
	border: 1px solid rgba(255, 255, 255, var(--dp-touch-rim));
	border-radius: var(--dp-touch-radius);
	background:
		radial-gradient(160px circle at var(--mx, 25%) var(--my, 0%), rgba(255, 255, 255, 0.18), transparent 60%),
		linear-gradient(135deg, rgba(255, 255, 255, calc(var(--dp-touch-gloss) * 0.6)) 0%, rgba(255, 255, 255, 0.02) 60%),
		linear-gradient(135deg, rgba(var(--dp-touch-tint-rgb), var(--dp-touch-tint-now, var(--dp-touch-tint))) 0%, rgba(var(--dp-touch-tint-rgb), calc(var(--dp-touch-tint-now, var(--dp-touch-tint)) * 0.48)) 100%);
	-webkit-backdrop-filter: blur(var(--dp-touch-blur)) saturate(180%);
	backdrop-filter: blur(var(--dp-touch-blur)) saturate(180%);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, min(calc(var(--dp-touch-rim) + 0.18), 1)),
		inset 0 -1px 0 rgba(255, 255, 255, calc(var(--dp-touch-rim) * 0.25)),
		0 10px 28px -14px rgba(0, 0, 0, var(--dp-touch-shadow));
}

[data-theme="light"] .dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]) {
	--dp-touch-tint-now: min(calc(var(--dp-touch-tint) + 0.26), 1);
}

.dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: var(--dp-touch-text);
	border-color: rgba(255, 255, 255, min(calc(var(--dp-touch-rim) + 0.18), 1));
}

/* The round arrow badge */
.dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *)::after {
	content: "";
	position: absolute;
	top: 5px;
	right: 5px;
	bottom: 5px;
	z-index: 1;
	aspect-ratio: 1;
	border-radius: min(50%, var(--dp-touch-radius));
	border: 1px solid rgba(255, 255, 255, min(calc(var(--dp-touch-rim) + 0.18), 1));
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat,
		var(--dp-touch-icon-bg, linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0.12)));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
	transition: transform 0.5s var(--dp-ease), background-color 0.4s, border-color 0.4s;
}

.dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover::after {
	transform: rotate(-45deg);
	border-color: var(--dp-touch-hover);
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat,
		var(--dp-touch-hover);
}

/* The badge replaces any inline arrow icon */
.dopee-btn-touch .dp-btn:not(.dp-btn--ghost) .dp-icon {
	display: none;
}

/* Brand gradient pill – the gradient drifts on hover */
.dopee-btn-gradient :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *) {
	color: #0c0d0d;
	border-color: transparent;
	background: linear-gradient(110deg, var(--dp-primary) 0%, color-mix(in srgb, var(--dp-primary) 55%, var(--dp-accent)) 50%, var(--dp-primary) 100%) 0 0 / 200% 100%;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 12px 28px -14px rgba(var(--dp-primary-rgb), 0.7);
	transition: background-position 0.8s var(--dp-ease), transform 0.45s var(--dp-ease), box-shadow 0.45s var(--dp-ease), color 0.3s;
}

.dopee-btn-gradient :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: #0c0d0d;
	background-position: 100% 0;
	border-color: transparent;
}

/* Soft tinted pill */
.dopee-btn-soft :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *) {
	color: var(--dp-primary);
	border-color: transparent;
	background: rgba(var(--dp-primary-rgb), 0.14);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	box-shadow: none;
}

[data-theme="light"] .dopee-btn-soft :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost) {
	color: color-mix(in srgb, var(--dp-primary) 60%, #000);
}

.dopee-btn-soft :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: var(--dp-primary);
	border-color: transparent;
	background-color: rgba(var(--dp-primary-rgb), 0.22);
	box-shadow: none;
}

/* Pressable 3D – solid with a bottom edge that sinks when clicked */
.dopee-btn-3d :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *) {
	color: #0c0d0d;
	border-color: transparent;
	background: var(--dp-primary);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 5px 0 color-mix(in srgb, var(--dp-primary) 55%, #000);
	transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.3s;
}

.dopee-btn-3d :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: #0c0d0d;
	border-color: transparent;
	transform: translateY(-2px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 7px 0 color-mix(in srgb, var(--dp-primary) 55%, #000);
}

.dopee-btn-3d :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):active {
	transform: translateY(4px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 0 color-mix(in srgb, var(--dp-primary) 55%, #000);
}

/* High contrast – black on light, white on dark */
.dopee-btn-contrast :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *),
.dopee-btn-contrast :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: var(--dp-bg);
	border-color: transparent;
	background: var(--dp-text);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.5);
}

/* 2. Hover effects -------------------------------------------------- */

/*
 * Fill effects: the ::before layer (normally the light sweep) becomes a solid
 * fill that animates in. Colors: --dp-btn-fill / --dp-btn-fill-text
 * (set in the Customizer; "auto" picks a color that contrasts with the layout).
 */
:is(.dopee-bhover-fill-up, .dopee-bhover-fill-down, .dopee-bhover-fill-left, .dopee-bhover-fill-center, .dopee-bhover-fill-circle, .dopee-bhover-fill-diagonal, .dopee-bhover-liquid) :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background: var(--dp-btn-fill);
	transition: transform 0.55s var(--dp-ease), clip-path 0.6s var(--dp-ease), top 0.8s var(--dp-ease);
}

:is(.dopee-bhover-fill-up, .dopee-bhover-fill-down, .dopee-bhover-fill-left, .dopee-bhover-fill-center, .dopee-bhover-fill-circle, .dopee-bhover-fill-diagonal, .dopee-bhover-liquid) :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible) {
	/* !important: the fill must win over every layout's own hover text color */
	color: var(--dp-btn-fill-text) !important;
	text-shadow: none;
}

/* Fill-up: rises smoothly from the bottom */
.dopee-bhover-fill-up :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	transform: translateY(101%);
}

/* Fill-down: pours in from the top */
.dopee-bhover-fill-down :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	transform: translateY(-101%);
}

/* Fill-left: slides in from the left, leaves to the right */
.dopee-bhover-fill-left :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	transform: scaleX(0);
	transform-origin: right center;
}

.dopee-bhover-fill-left :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible)::before {
	transform-origin: left center;
}

/* Fill-center: opens from the middle outwards */
.dopee-bhover-fill-center :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	transform: scaleX(0);
	transform-origin: center;
}

/* Fill-circle: a circle grows from the center */
.dopee-bhover-fill-circle :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	transform: none;
	clip-path: circle(0% at 50% 50%);
}

/* Fill-diagonal: a slanted panel sweeps across */
.dopee-bhover-fill-diagonal :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	inset: 0 -25%;
	border-radius: 0;
	transform: skewX(-25deg) translateX(-115%);
}

/* Liquid: a rotating wave rises up and fills the button */
.dopee-bhover-liquid :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	inset: auto;
	top: 105%;
	left: 50%;
	width: max(260%, 300px);
	aspect-ratio: 1;
	border-radius: 42%;
	transform: translateX(-50%) rotate(0deg);
}

.dopee-bhover-liquid :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible)::before {
	top: -40%;
	animation: dp-liquid 3.2s linear infinite;
}

@keyframes dp-liquid {
	from { transform: translateX(-50%) rotate(0deg); }
	to { transform: translateX(-50%) rotate(360deg); }
}

/* Shared "filled" end state */
:is(.dopee-bhover-fill-up, .dopee-bhover-fill-down, .dopee-bhover-fill-left, .dopee-bhover-fill-center) :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible)::before {
	transform: none;
}

.dopee-bhover-fill-circle :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible)::before {
	clip-path: circle(75% at 50% 50%);
}

.dopee-bhover-fill-diagonal :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible)::before {
	transform: skewX(-25deg) translateX(0);
}

/* "Header button design" layout on normal buttons: on a fill the arrow badge inverts so it stays visible */
:is(.dopee-bhover-fill-up, .dopee-bhover-fill-down, .dopee-bhover-fill-left, .dopee-bhover-fill-center, .dopee-bhover-fill-circle, .dopee-bhover-fill-diagonal, .dopee-bhover-liquid).dopee-btn-touch :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]):is(:hover, :focus-visible)::after {
	border-color: var(--dp-btn-fill-text) !important;
	background-color: var(--dp-btn-fill-text) !important;
}

/* Pulse: a soft ring ripples out while hovered */
.dopee-bhover-pulse :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):is(:hover, :focus-visible) {
	animation: dp-btn-pulse 1.3s ease-out infinite;
}

@keyframes dp-btn-pulse {
	0% { box-shadow: 0 0 0 0 rgba(var(--dp-primary-rgb), 0.55); }
	100% { box-shadow: 0 0 0 16px rgba(var(--dp-primary-rgb), 0); }
}

/* Shine: light sweep only, the button stays in place */
.dopee-bhover-shine :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):hover {
	transform: none;
}

/* None: no movement, no sweep – just the color change */
.dopee-bhover-none :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):hover {
	transform: none;
}

.dopee-bhover-none :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit))::before {
	display: none;
}

/* 3. Glow switch / motion safety ------------------------------------ */
.dopee-no-glow.dopee-btn-gradient :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn)) {
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
}

.dopee-no-glow.dopee-btn-3d :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn)) {
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 5px 0 color-mix(in srgb, var(--dp-primary) 55%, #000) !important;
}

@media (prefers-reduced-motion: reduce) {
	.dopee-bhover-liquid :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"])::before,
	.dopee-bhover-pulse :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]) {
		animation: none !important;
	}
}

/* Solid layout: keep dark text on hover (the base hover rule switches to light text) */
.dopee-btn-solid :is(.dp-btn, .wp-block-button__link, .wp-element-button, button[type="submit"]:not(.dp-news__btn):not(.dp-search-form__submit)):not(.dp-btn--ghost):not(.is-style-outline *):not(.is-style-dopee-glass *):hover {
	color: #0c0d0d;
}
