.notify-me {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 1em 0;
	/* Flex-column summaries (Dermond) order children explicitly: 5 = the cart form's slot. */
	order: 5;
}

.notify-me--form { margin: 0 0 12px; }
.notify-me--end { order: 99; }

/* Theme button styles set display; keep [hidden] authoritative. Parent-scoped rules below outrank theme .button colours. */
.notify-me__open[hidden],
.notify-me__status[hidden],
.notify-me__text[hidden],
.notify-me__variation[hidden] {
	display: none !important;
}

.notify-me { --nm-brand: #d32f2f; }
.notify-me--brand { --nm-brand: var(--dm-brand, var(--primary-color, #2a2877)); }
.notify-me--dark { --nm-brand: #1f1f1f; }
.notify-me--green { --nm-brand: #2e7d32; }

/* Short hint above its button; hidden together with it (variable products toggle the button per variation). */
.notify-me__hint {
	margin: 0 0 -2px;
	color: #6b6b6b;
	font-size: .85em;
	line-height: 1.5;
}
.notify-me__hint:has(+ .notify-me__open[hidden]) { display: none; }

.notify-me .notify-me__open {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 8px 16px;
	border: 1.5px solid var(--nm-brand);
	border-radius: var(--dm-r-sm, 5px);
	background: var(--nm-brand);
	color: #fff;
	font-weight: 700;
	line-height: 1.4;
	text-transform: none;
	transition: background-color .2s, color .2s, box-shadow .2s;
}

.notify-me .notify-me__open:hover,
.notify-me .notify-me__open:focus-visible {
	background: color-mix(in srgb, var(--nm-brand) 85%, #000);
	color: #fff;
	box-shadow: 0 6px 18px color-mix(in srgb, var(--nm-brand) 35%, transparent);
}

/* Logged-in customer already waiting for this choice: say so, and let them withdraw. */
.notify-me__status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 12px;
	margin: 0;
	padding: 10px 14px;
	border: 1px dashed color-mix(in srgb, var(--nm-brand) 45%, transparent);
	border-radius: var(--dm-r-sm, 5px);
	background: color-mix(in srgb, var(--nm-brand) 6%, #fff);
	color: #333;
	font-size: .9em;
	line-height: 1.6;
}

.notify-me__status::before {
	content: "✓";
	color: var(--nm-brand);
	font-weight: 700;
}

.notify-me__status span { flex: 1; }

.notify-me .notify-me__cancel {
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--nm-brand);
	font-size: inherit;
	font-weight: 700;
	line-height: inherit;
	text-decoration: underline;
	text-transform: none;
	cursor: pointer;
}

/* Secondary action: outlined, so the restock button stays the strongest call to action. */
.notify-me .notify-me__open--sale {
	background: #fff;
	color: var(--nm-brand);
	border-style: dashed;
}
.notify-me .notify-me__open--sale:hover,
.notify-me .notify-me__open--sale:focus-visible {
	background: var(--nm-brand);
	color: #fff;
}

/* Theme rules on `.button span` / `svg` (display, line-height) shift the glyph: scope tightly. */
.notify-me .notify-me__open .notify-me__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	padding: 0;
	line-height: 0;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
	color: #fff;
	transition: background-color .2s, color .2s;
}

.notify-me .notify-me__open--sale .notify-me__icon {
	background: var(--nm-brand);
}

.notify-me .notify-me__open .notify-me__icon svg {
	display: block;
	width: 18px;
	height: 18px;
	margin: 0;
	overflow: visible;
	transform-origin: 50% 10%;
}

.notify-me .notify-me__open--sale:hover .notify-me__icon,
.notify-me .notify-me__open--sale:focus-visible .notify-me__icon {
	background: rgba(255, 255, 255, .2);
}

.notify-me__open--stock:hover .notify-me__icon svg,
.notify-me__open--stock:focus-visible .notify-me__icon svg {
	animation: notify-me-ring .8s ease-in-out;
}

@keyframes notify-me-ring {
	0%, 100% { transform: rotate(0); }
	20% { transform: rotate(14deg); }
	40% { transform: rotate(-12deg); }
	60% { transform: rotate(8deg); }
	80% { transform: rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
	.notify-me__open .notify-me__icon svg { animation: none !important; }
}

.notify-me__dialog {
	/* Themes reset dialog margins; re-centre the modal. */
	position: fixed;
	inset: 0;
	margin: auto;
	width: min(420px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100dvh - 32px);
	height: fit-content;
	overflow: hidden auto;
	box-sizing: border-box;
	padding: 0;
	border: 0;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
}

.notify-me__dialog::backdrop {
	background: rgba(0, 0, 0, .5);
}

.notify-me__form {
	position: relative;
	padding: 24px;
	margin: 0;
}

.notify-me__title {
	margin: 0 0 .5em;
	padding-inline-end: 32px;
}

.notify-me__text,
.notify-me__variation {
	margin-bottom: 1em;
	font-size: .9em;
}

.notify-me__variation {
	font-weight: bold;
}

.notify-me__close {
	position: absolute;
	inset-inline-end: 12px;
	top: 12px;
	min-height: 0;
	margin: 0;
	padding: 0 6px;
	font-size: 24px;
	line-height: 1;
	background: none;
	border: 0;
	cursor: pointer;
}

.notify-me__form input[type="tel"],
.notify-me__form input[type="email"] {
	width: 100%;
	text-align: left;
}

.notify-me__form select {
	width: 100%;
}

.notify-me__hp {
	/* Visually hidden in place; an off-screen offset overflows the dialog in RTL. */
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap;
}

.notify-me__form .notify-me__submit {
	width: 100%;
	margin: 0;
	background: var(--dm-brand, var(--primary-color, #2a2877));
	border-color: var(--dm-brand, var(--primary-color, #2a2877));
	color: #fff;
}

.notify-me__message:empty {
	display: none;
}

.notify-me__message {
	margin: 1em 0 0;
	font-size: .9em;
}

.notify-me__message.is-success {
	color: #2e7d32;
}

.notify-me__message.is-error {
	color: #c62828;
}

/* Logged-in customer: the account's mobile, shown but not editable. */
.notify-me__dialog .notify-me__phone--locked {
	background: #f3f3f3;
	color: #555;
	cursor: not-allowed;
}
.notify-me__phone-note {
	display: block;
	margin: -6px 0 12px;
	color: #6b6b6b;
	font-size: .8em;
}
