/* Styles: arrow-link = Arrow link */

/* core/button default look, ported from the static prototype (fews/index.html + fews/src/styles/app.css):
   `corner-cut sz-text-11 bg-orange px-[30px] py-[15px] font-syne font-semibold` */

@property --fews-corner {
	syntax: "<length-percentage>";
	inherits: false;
	initial-value: 0px;
}

/* Corner: a 45° triangle bottom left in --fews-corner-color (navy on orange buttons, orange on white or navy ones).
   On hover/focus it sweeps across and fills the button, text white. Not on Outline buttons (their own corner below),
   Arrow links or Icon buttons. The colour is set on the wrapper so re-pointing --contrast on the link can't change it. */
.wp-block-button {
	--fews-corner-color: var(--wp--preset--color--contrast);
}

.wp-block-button:not(.is-style-outline, .is-style-arrow-link, .has-fews-icon) .wp-block-button__link {
	--fews-corner: 13.7px; /* 19.4px legs, the prototype's corner */
	background-image: linear-gradient(45deg, var(--fews-corner-color) var(--fews-corner), transparent calc(var(--fews-corner) + 1px));
	transition: --fews-corner 0.3s ease-out, color 0.3s ease-out;
}

.wp-block-button .wp-block-button__link:is(.has-base-background-color, .has-contrast-background-color) {
	--fews-corner-color: var(--wp--preset--color--primary);
}

/* On a navy section the navy corner of an orange button disappears into the background: white corner, so the hover
   fill is white with navy text */
:is(.has-navy-gradient-background, .has-contrast-background-color, .has-ink-background-color) .wp-block-button {
	--fews-corner-color: var(--wp--preset--color--base);
}

:is(.has-navy-gradient-background, .has-contrast-background-color, .has-ink-background-color) .wp-block-button:not(.is-style-outline, .is-style-arrow-link, .has-fews-icon) .wp-block-button__link:where(:not(.has-background, .has-text-color)):is(:hover, :focus-visible) {
	color: var(--wp--preset--color--contrast);
}

.wp-block-button:not(.is-style-outline, .is-style-arrow-link, .has-fews-icon) .wp-block-button__link:is(:hover, :focus-visible) {
	--fews-corner: calc(100% + 1px);
}

/* navy text (white buttons) turns white; .has-contrast-color is !important, so re-point the colour */
.wp-block-button:not(.is-style-outline, .is-style-arrow-link, .has-fews-icon) .wp-block-button__link.has-contrast-color:is(:hover, :focus-visible) {
	--wp--preset--color--contrast: var(--wp--preset--color--base);
}

.wp-block-button .wp-block-button__link {
	position: relative;
	overflow: hidden;
	padding: 0.9375rem 1.875rem;
	border-radius: 0.25rem;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--text-11);
	line-height: 1.5;
	text-decoration: none;
	/* Tailwind `transition` default */
	transition-property: color, background-color, border-color, opacity, box-shadow, transform, filter;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	transition-duration: 150ms;
}

.wp-block-button .wp-block-button__link:where(:not(.has-background)) {
	background-color: var(--wp--preset--color--primary);
}

.wp-block-button .wp-block-button__link:where(:not(.has-text-color)) {
	color: var(--wp--preset--color--base);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	filter: brightness(90%);
}

/* Outline corner-cut: a rotated bar clipped by the button, showing as a triangle bottom-left.
   On hover/focus it sweeps right and fades out. Geometry values are the prototype's (px on purpose). Other sections
   re-use this ::before (case study and vacancy card covers, icon button disc). */
.wp-block-button .wp-block-button__link::before {
	content: "";
	position: absolute;
	bottom: -38px; /* the prototype's calc(-100% + 16px) at the 54px button height, fixed so taller buttons (e.g. the
	                  65px mobile Team CTA) keep the same corner; the left edge is already width-independent */
	right: calc(100% - 35px);
	width: 54px;
	height: 180px;
	transform: rotate(-45deg);
	transform-origin: bottom left;
	pointer-events: none;
	transition: all 0.25s ease-out, opacity 0.25s linear(0, 0.5 99.9%, 1);
}

.wp-block-button .wp-block-button__link:hover::before,
.wp-block-button .wp-block-button__link:focus-visible::before {
	right: -100%;
	opacity: 0;
	transition: all 0.25s ease-out, opacity 0.25s linear(0, 0.5 0%, 1);
}

/* Core "Outline" style (Figma Industrial Home hero: "Configurator"): transparent, 1px line + text + corner in the
   surrounding text colour (white in the hero, navy elsewhere). The line is an inset shadow, not a border, so the
   corner triangle covers it flush (overflow clips at the padding box, which a border would sit outside). */
.wp-block-button.is-style-outline > .wp-block-button__link:where(:not(.has-background)) {
	background-color: transparent;
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	border: 0;
	box-shadow: inset 0 0 0 1px currentColor;
	padding: 0.9375rem 1.875rem;
}

.wp-block-button.is-style-outline > .wp-block-button__link::before {
	background: currentColor;
}

/* "Arrow link" style: "Read more ◣" text link, underline grows in on hover (prototype `link-underline`).
   Figma: Event & Commercial Home › Intro 7256:11936 */
.wp-block-button.is-style-arrow-link > .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0;
	border-radius: 0;
	font-family: var(--wp--preset--font-family--body);
	font-weight: 500;
	font-size: var(--wp--preset--font-size--text-10);
	color: var(--wp--preset--color--ink);
	background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
	transition: background-size 0.3s;
}

.wp-block-button.is-style-arrow-link > .wp-block-button__link:hover,
.wp-block-button.is-style-arrow-link > .wp-block-button__link:focus-visible {
	filter: none;
	background-size: 100% 1px;
}

.wp-block-button.is-style-arrow-link > .wp-block-button__link::before {
	content: none;
}

.wp-block-button.is-style-arrow-link > .wp-block-button__link::after {
	content: "";
	inline-size: 0.625rem;
	block-size: 0.55rem;
	background: currentColor;
	clip-path: polygon(0 0, 0 100%, 100% 100%);
}

/* Icon button (a button with an Icon, inc/blocks/icon-field.php): white pill with the icon in a navy disc. With a
   YouTube or Vimeo link inside a Cover, a click swaps the Cover's content for the player (assets/js/video-play.js);
   the "tour" icon opens its link inside the Cover the same way; any other link opens normally.
   Disc = ::before, icon = ::after (a mask in --fews-button-icon-color) centred on it. Sections re-point the variables.
   Figma: Event Structures Article › Video › Play video 7026:28245; Orangery › See it for yourself 6927:5088 */
.wp-block-button.has-fews-icon {
	--fews-button-disc: 4.0625rem;
	--fews-button-disc-start: 0.625rem; /* the link's start padding */
	--fews-button-disc-color: var(--wp--preset--color--contrast);
	--fews-button-icon-size: 1.5425rem;
	--fews-button-icon-color: var(--wp--preset--color--base);
}

.wp-block-button.has-fews-icon > .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.9375rem;
	padding: 0.625rem 2.1875rem 0.625rem 0.625rem;
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--text-8);
	line-height: 1.28;
	color: var(--wp--preset--color--contrast);
	background: color-mix(in srgb, var(--wp--preset--color--base) 75%, transparent);
}

.wp-block-button.has-fews-icon > .wp-block-button__link::before,
.wp-block-button.has-fews-icon > .wp-block-button__link:is(:hover, :focus-visible)::before {
	content: "";
	position: static;
	flex: none;
	box-sizing: border-box;
	inline-size: var(--fews-button-disc);
	block-size: var(--fews-button-disc);
	border-radius: 50%;
	background: var(--fews-button-disc-color);
	opacity: 1;
	transform: none;
	transition: none;
}

.wp-block-button.has-fews-icon > .wp-block-button__link::after {
	content: "";
	position: absolute;
	top: 50%;
	left: calc(var(--fews-button-disc-start) + var(--fews-button-disc) / 2);
	inline-size: var(--fews-button-icon-size);
	block-size: var(--fews-button-icon-size);
	translate: -50% -50%;
	background: var(--fews-button-icon-color);
	mask: var(--fews-button-icon) center / contain no-repeat;
}

.wp-block-cover > .fews-video-frame {
	position: absolute;
	z-index: 3;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
	border: 0;
}

/* Full-screen player (assets/js/video-play.js, Media cards): dark page, the 16:9 player centred (1725 × 976 at 1920 ×
   1080), close square top right. Figma: Video 6927:10760, 360 6927:10764 */
.fews-video-dialog {
	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: none;
	block-size: 100%;
	max-block-size: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--wp--preset--color--ink);
}

.fews-video-dialog[open] {
	display: grid;
	place-items: center;
}

.fews-video-dialog::backdrop {
	background: var(--wp--preset--color--ink);
}

.fews-video-dialog > .fews-video-frame {
	inline-size: min(100% - 2.5rem, 89.85vw, 90.4vh * 16 / 9);
	block-size: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

.fews-video-dialog__close {
	position: absolute;
	top: 0;
	right: 0;
	display: grid;
	place-items: center;
	inline-size: 3.125rem;
	block-size: 3.125rem;
	padding: 0;
	border: 0;
	color: var(--wp--preset--color--base);
	background: color-mix(in srgb, var(--wp--preset--color--contrast) 55%, var(--wp--preset--color--muted)); /* Figma greyscale/600 #4a5565 */
	cursor: pointer;
	transition: background-color 0.2s;
}

.fews-video-dialog__close:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--primary);
}

@media (width <= 782px) {
	.wp-block-button.has-fews-icon {
		--fews-button-disc: 3.125rem;
		--fews-button-icon-size: 1.1875rem;
	}

	.wp-block-button.has-fews-icon > .wp-block-button__link {
		padding-inline-end: 1.5625rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-button.is-style-arrow-link > .wp-block-button__link,
	.wp-block-button:not(.is-style-outline, .is-style-arrow-link, .has-fews-icon) .wp-block-button__link,
	.wp-block-button .wp-block-button__link,
	.wp-block-button .wp-block-button__link::before,
	.wp-block-button .wp-block-button__link:hover::before,
	.wp-block-button .wp-block-button__link:focus-visible::before {
		transition: none;
	}
}
