/**
 * Cookie preferences: the fixed icon and the preferences panel. The panel is a
 * .mimi-dialog (chrome.css) so it shares the first-visit card's paper, type and
 * square buttons; only what differs is here. All sizes in px: the theme root is
 * 10px. The panel never has a scrolling box inside it: if a very short window
 * cannot fit it, the dialog itself is the only thing that scrolls.
 */

/* -------------------------------------------------------------------- icon */

.mimi-prefs-fab {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9000;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--slate, #1C2120);
	border-radius: 50%;
	background: var(--champagne, #CBBFB0);
	color: var(--slate, #1C2120);
	box-shadow: 0 2px 10px rgba(14, 16, 16, .35);
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.mimi-prefs-fab[hidden] {
	display: none;
}

.mimi-prefs-fab:hover {
	background: var(--slate, #1C2120);
	color: var(--bone, #F6F3EF);
	border-color: var(--bone, #F6F3EF);
}

/* Two rings so it shows on a light page and on the dark footer alike. */
.mimi-prefs-fab:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px #F6F3EF, 0 0 0 5px #1C2120;
}

.mimi-prefs-fab svg {
	display: block;
	width: 24px;
	height: 24px;
}

@media (prefers-reduced-motion: reduce) {
	.mimi-prefs-fab { transition: none; }
}

/* The cart's "Proceed to Checkout" bar is pinned to the bottom of a phone (84px
   tall) and would sit on top of the icon: lift the icon above it while it shows. */
body:has(.wc-block-cart__submit-container--sticky) .mimi-prefs-fab {
	bottom: 100px;
}

/* ------------------------------------------------------------------- panel */

.mimi-prefs {
	width: min(520px, calc(100vw - 32px));
	max-height: calc(100dvh - 24px);
	overflow-y: auto;
	scrollbar-width: none;
}

.mimi-prefs::-webkit-scrollbar {
	display: none;
}

.mimi-prefs .mimi-dialog__box {
	padding: 28px 28px 24px;
}

.mimi-prefs .mimi-dialog__title {
	margin-bottom: 8px;
}

.mimi-prefs__intro {
	margin-bottom: 12px;
	font-size: 16px;
	line-height: 1.5;
}

.mimi-prefs__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	padding: 10px 0;
	border-top: 1px solid rgba(28, 33, 32, .25);
}

.mimi-prefs__text {
	min-width: 0;
}

.mimi-prefs__name {
	display: block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--slate, #1C2120);
	cursor: pointer;
}

.mimi-prefs__desc {
	margin: 2px 0 0;
	font-size: 15px;
	line-height: 1.4;
	color: #3B403E;
}

/* A real checkbox drawn as a switch. The 6px margin makes the box 44px high. */
.mimi-prefs__switch {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	flex: none;
	width: 52px;
	height: 32px;
	margin: 6px 0;
	border: 0;
	border-radius: 16px;
	background: #6B655C;
	cursor: pointer;
	transition: background-color 150ms ease;
}

.mimi-prefs__switch::before {
	content: "";
	position: absolute;
	top: 4px;
	left: 4px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff;
	transition: transform 150ms ease;
}

.mimi-prefs__switch:checked {
	background: #66440F;
}

.mimi-prefs__switch:checked::before {
	transform: translateX(20px);
}

.mimi-prefs__switch:disabled {
	cursor: default;
}

.mimi-prefs__switch:focus-visible {
	outline: 2px solid #1C2120;
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.mimi-prefs__switch,
	.mimi-prefs__switch::before { transition: none; }
}

.mimi-prefs__actions {
	margin-top: 12px;
	padding-top: 16px;
	border-top: 1px solid rgba(28, 33, 32, .25);
}

.mimi-prefs__actions .mimi-dialog__btn {
	flex: 1 1 0;
	padding: 0 12px;
}

.mimi-prefs__actions .mimi-dialog__btn {
	letter-spacing: .1em;
	white-space: nowrap;
}

.mimi-prefs__actions .mimi-prefs__save {
	flex: 1 1 100%;
}

/* First-visit card: its third button is the same square button. */
#mimi-cookie .mimi-dialog__actions .mimi-dialog__btn {
	padding: 0 20px;
}

@media (max-width: 480px) {
	.mimi-prefs .mimi-dialog__box {
		padding: 20px 20px 16px;
	}

	.mimi-prefs__row {
		padding: 5px 0;
	}

	.mimi-prefs__actions {
		margin-top: 8px;
		padding-top: 12px;
	}
}
