/**
 * Nook button: filled link with two corner brackets (top right, bottom left).
 * Loaded only by blocks that list "nook-button" in block.json "style".
 */

.nook-button {
	--_bg: var(--wp--preset--color--blue);
	--_fg: var(--wp--preset--color--white);
	--_frame: var(--wp--preset--color--black);
	--_hover: color-mix(in srgb, var(--_bg) 85%, var(--wp--preset--color--black));

	display: inline-block;
	position: relative;
	padding: 10px;

	&::before,
	&::after {
		content: "";
		position: absolute;
		width: 18px;
		height: 17px;
		border: 0 solid var(--_frame);
		pointer-events: none;
	}

	&::before {
		top: 0;
		right: 0;
		border-top-width: 1px;
		border-right-width: 1px;
	}

	&::after {
		bottom: 0;
		left: 0;
		border-bottom-width: 1px;
		border-left-width: 1px;
	}
}

.nook-button__link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 54px;
	padding: 1.25rem 2rem;
	border-radius: var(--wp--preset--border-radius--xs);
	background: var(--_bg);
	box-shadow: var(--wp--preset--shadow--button);
	color: var(--_fg);
	font-family: var(--wp--preset--font-family--figtree);
	font-size: var(--wp--preset--font-size--m);
	font-weight: 600;
	line-height: var(--wp--custom--line-height--tight);
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	transition:
		background-color var(--wp--custom--transition),
		box-shadow var(--wp--custom--transition);

	/* Hover: darker, and about 3px bigger on every side (designer's note, 2026-10-08).
	   A solid shadow grows it without moving anything around it. */
	&:hover {
		background: var(--_hover);
		box-shadow: 0 0 0 3px var(--_hover), var(--wp--preset--shadow--button);
		color: var(--_fg);
	}

	&:focus-visible {
		outline: var(--wp--custom--focus);
		outline-offset: 3px;
	}
}

.nook-button--blue {
	--_bg: var(--wp--preset--color--blue);
	--_fg: var(--wp--preset--color--white);
}

/* White on green is 2.6:1 and fails WCAG AA. Kept as in Figma at the client's request (2026-10-06). */
.nook-button--green {
	--_bg: var(--wp--preset--color--green);
	--_fg: var(--wp--preset--color--white);
}

.nook-button--white {
	--_bg: var(--wp--preset--color--white);
	--_fg: var(--wp--preset--color--black);
	--_hover: var(--wp--preset--color--beige);
}

/* Small button on service cards (Figma 366:9096). */
.nook-button--small .nook-button__link {
	min-height: 0;
	padding: 14px;
	font-size: var(--wp--preset--font-size--xs);
}

/* "Kmalu": a dimmed label in the button shape, not a link (Figma 366:9126). */
.nook-button.is-disabled .nook-button__link {
	min-width: 103px;
	opacity: 0.4;
	cursor: default;

	&:hover {
		background: var(--_bg);
		box-shadow: var(--wp--preset--shadow--button);
	}
}

.nook-button--frame-light {
	--_frame: var(--wp--preset--color--white);
}

/* Row of buttons from nook_buttons(). Stacks full width on phones (Figma 327:660). */
.nook-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);

	.nook-button__link {
		min-width: 248px;
	}
}

.nook-buttons--center {
	justify-content: center;
}

@media (width < 37.5rem) {
	.nook-buttons {
		flex-direction: column;
		gap: 0;

		/* Figma 327:661: full-width buttons inset 13px, with 24px wide corners. */
		.nook-button {
			display: block;
			padding-inline: 13px;

			&::before,
			&::after {
				width: 24px;
			}
		}

		.nook-button__link {
			min-width: 0;
		}
	}
}

/* Buttons shown on one size only ("Prikaz" in the Gumbi field). */
@media (width < 37.5rem) {
	.nook-button.nook-button--desktop-only {
		display: none;
	}
}

@media (width >= 37.5rem) {
	.nook-button.nook-button--mobile-only {
		display: none;
	}
}
