/* Recipe Card Extras */

.wprm-recipe,
.rce-favorites-list,
.rce-timers,
.wprm-print {
	--rce-accent: #333333;
	--rce-accent-text: #ffffff;
	--rce-soft: rgba(0, 0, 0, 0.06);
	--rce-line: rgba(0, 0, 0, 0.2);
}

.wprm-recipe-template-meadow {
	--rce-accent: var(--meadow-accent-color, #333333);
}

[hidden].rce-units,
[hidden].rce-cook-mode {
	display: none !important;
}

/* Buttons we add share a reset. */
.rce-servings button,
.rce-units button,
.rce-switch,
.rce-check,
.rce-timer-link,
.rce-timers button,
.rce-favorites-remove {
	font: inherit;
	text-transform: inherit;
	letter-spacing: inherit;
	line-height: 1.2;
	margin: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/*
 * Themes often restyle every button on hover and focus (a white box, say).
 * These keep each control's own look; the state rules further down still
 * win because they come later at the same weight.
 */
.rce-servings-minus:is(:hover, :focus),
.rce-servings-plus:is(:hover, :focus),
.rce-servings-custom:is(:hover, :focus) {
	background: transparent;
	color: inherit;
}

.rce-servings-pill:is(:hover, :focus) {
	background: var(--rce-pill-bg, transparent);
	color: var(--rce-pill-text, inherit);
}

.rce-switch:is(:hover, :focus),
.rce-favorites-remove:is(:hover, :focus) {
	background: none;
	color: inherit;
}

.rce-units-button:is(:hover, :focus) {
	background: var(--rce-button-bg, transparent);
	color: inherit;
}

.rce-check:is(:hover, :focus) {
	background: transparent;
}

.rce-timer-link:is(:hover, :focus) {
	background: var(--rce-soft);
	color: inherit;
}

.rce-timers button:is(:hover, :focus) {
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
}

/* ---------- Servings ---------- */

.rce-servings {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--rce-pill-gap, 6px);
	vertical-align: middle;
}

.rce-servings-stepper,
.rce-servings-inline {
	gap: 0;
	border: 1px solid var(--rce-button-accent, var(--rce-line));
	border-radius: var(--rce-button-radius, 999px);
	background: var(--rce-button-bg, transparent);
	overflow: hidden;
}

.rce-servings-minus,
.rce-servings-plus {
	background: transparent;
	border: 0;
	color: inherit;
	min-width: 2em;
	padding: 0.25em 0.5em;
	font-weight: 600;
}

.rce-servings-minus:hover,
.rce-servings-plus:hover,
.rce-servings-minus:focus-visible,
.rce-servings-plus:focus-visible {
	background: var(--rce-soft);
}

.rce-servings input.rce-servings-input,
.rce-servings input.rce-servings-custom {
	height: auto;
	min-height: 0;
	margin: 0;
	box-shadow: none;
	line-height: inherit;
}

.rce-servings-input,
.rce-servings-custom {
	width: 3.5em;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: center;
	padding: 0.25em 0;
	-moz-appearance: textfield;
	appearance: textfield;
}

.rce-servings-input::-webkit-outer-spin-button,
.rce-servings-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.rce-servings-inline .rce-servings-number {
	padding: 0 0.25em;
	min-width: 1.5em;
	text-align: center;
}

.rce-servings-pill {
	height: var(--rce-pill-height, 28px);
	min-width: var(--rce-pill-height, 28px);
	padding: 0 0.65em;
	border-radius: var(--rce-pill-radius, 999px);
	border: 1px solid var(--rce-pill-border, var(--rce-line));
	background: var(--rce-pill-bg, transparent);
	color: var(--rce-pill-text, inherit);
}

.rce-servings-pill[aria-pressed="true"] {
	background: var(--rce-pill-active-bg, var(--rce-accent));
	border-color: var(--rce-pill-active-border, var(--rce-accent));
	color: var(--rce-pill-active-text, var(--rce-accent-text));
}

.rce-servings-custom {
	height: var(--rce-pill-height, 28px);
	border: 1px solid var(--rce-accent);
	border-radius: var(--rce-pill-radius, 999px);
	width: 4em;
}

.wprm-recipe-header .rce-servings,
.wprm-recipe-header .rce-units,
.wprm-recipe-header .rce-cook-mode {
	font-size: 0.8em;
	font-weight: normal;
	margin-left: 0.5em;
}

/* ---------- Switches (units, Cook Mode) ---------- */

.rce-switch {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
}

.rce-switch-track {
	position: relative;
	display: inline-block;
	width: calc(var(--rce-switch-height, 22px) * 1.8);
	height: var(--rce-switch-height, 22px);
	border-radius: 999px;
	background: var(--rce-switch-off, #cccccc);
	transition: background 0.2s;
	flex: none;
}

.rce-switch-knob {
	position: absolute;
	top: 3px;
	left: 3px;
	width: calc(var(--rce-switch-height, 22px) - 6px);
	height: calc(var(--rce-switch-height, 22px) - 6px);
	border-radius: 50%;
	background: var(--rce-switch-off-knob, #ffffff);
	transition: transform 0.2s;
}

[aria-checked="true"] > .rce-switch-track {
	background: var(--rce-switch-on, var(--rce-accent));
}

[aria-checked="true"] > .rce-switch-track .rce-switch-knob {
	background: var(--rce-switch-on-knob, #ffffff);
	transform: translateX(calc(var(--rce-switch-height, 22px) * 0.8));
}

.rce-switch:focus-visible .rce-switch-track,
.rce-check:focus-visible,
.rce-timer-link:focus-visible,
.wprm-rating-star:focus-visible {
	outline: 2px solid var(--rce-accent);
	outline-offset: 2px;
}

.rce-cook-mode-button {
	--rce-switch-height: 16px;
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	border-style: solid;
	border-width: 1px;
}

.rce-cook-mode-button .rce-switch-text {
	white-space: nowrap;
}

.rce-cook-mode-button[aria-checked="true"] {
	background-color: var(--rce-on-bg, #333333) !important;
	border-color: var(--rce-on-bg, #333333) !important;
	color: var(--rce-on-text, #ffffff) !important;
}

.rce-cook-mode-button[aria-checked="true"] .rce-cook-mode-icon {
	display: none;
}

.rce-cook-mode-button[aria-checked="true"] .rce-switch-text::before {
	content: "\2713\00a0";
}

.rce-cook-mode-button.wprm-recipe-link-wide-button {
	display: flex;
	justify-content: center;
}

.rce-cook-mode-icon svg {
	width: 1em;
	height: 1em;
}

/* ---------- Units ---------- */

.rce-units {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}

.rce-units-buttons {
	border: 1px solid var(--rce-button-accent, var(--rce-line));
	border-radius: var(--rce-button-radius, 999px);
	overflow: hidden;
}

.rce-units-button {
	background: var(--rce-button-bg, transparent);
	border: 0;
	color: inherit;
	padding: 0.25em 0.75em;
}

.rce-units-button[aria-pressed="true"] {
	background: var(--rce-button-accent, var(--rce-accent));
	color: var(--rce-accent-text);
}

/* ---------- Cook Mode ---------- */

.rce-cook-mode {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.25em 0.75em;
	margin: 0.5em 0 1em;
}

.wprm-recipe-header .rce-cook-mode {
	display: inline-flex;
	margin: 0 0 0 0.5em;
}

.rce-cook-mode.rce-cook-mode-button {
	margin: 0;
}

.rce-cook-mode .rce-switch-text {
	font-weight: 600;
}

.rce-cook-mode-help {
	font-size: 0.85em;
	opacity: 0.7;
}

/* ---------- Tick-off boxes ---------- */

li.rce-has-check {
	position: relative;
	cursor: pointer;
}

li.rce-has-check:not(.rce-check-end),
.wprm-recipe li.rce-has-check:not(.rce-check-end) {
	list-style: none !important;
}

li.rce-has-check:not(.rce-check-end),
.wprm-recipe li.rce-has-check:not(.rce-check-end) {
	padding-left: 1.9em !important;
}

/* The box replaces ingredient bullets, including ones themes draw themselves. */
.wprm-recipe-ingredient.rce-has-check::before,
.wprm-recipe-equipment-item.rce-has-check::before,
li.rce-has-check:not(.rce-check-end)::marker {
	content: none !important;
	display: none !important;
}

/* Steps keep their numbers, and the box moves to the right. */
li.rce-has-check.rce-check-end,
.wprm-recipe li.rce-has-check.rce-check-end {
	padding-right: 2em !important;
}

.rce-check-end > .rce-check {
	left: auto;
	right: 0;
}

.rce-check {
	position: absolute;
	left: 0;
	top: 0.2em;
	width: 1.15em;
	height: 1.15em;
	padding: 0;
	border: 2px solid var(--rce-accent);
	border-radius: 4px;
	background: transparent;
}

.rce-checked > .rce-check {
	background: var(--rce-accent);
}

.rce-checked > .rce-check::after {
	content: "";
	position: absolute;
	left: 0.3em;
	top: 0.05em;
	width: 0.3em;
	height: 0.6em;
	border: solid var(--rce-accent-text);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

li.rce-checked > :not(.rce-check) {
	opacity: 0.5;
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

li.rce-checked .wprm-recipe-instruction-text {
	text-decoration: none;
}

/* ---------- Timers ---------- */

.rce-timer-link {
	display: inline;
	padding: 0 0.2em;
	border: 0;
	border-bottom: 1px dashed currentColor;
	border-radius: 2px;
	background: var(--rce-soft);
	color: inherit;
	font-weight: 600;
}

.rce-timer-link::after {
	content: "\23F1";
	font-weight: normal;
	margin-left: 0.25em;
	font-size: 0.85em;
}

body .rce-timers {
	position: fixed;
	right: 12px;
	bottom: 12px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: calc(100vw - 24px);
	font-size: 15px;
}

.rce-timer {
	display: grid;
	grid-template-columns: 1fr auto auto auto;
	grid-template-areas: "label label label close" "time pause reset close";
	align-items: center;
	gap: 4px 8px;
	min-width: 240px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #1d1d1d;
	color: #ffffff;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.rce-timer-label {
	grid-area: label;
	font-size: 0.8em;
	opacity: 0.8;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rce-timer-time {
	grid-area: time;
	font-size: 1.4em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.rce-timer-pause { grid-area: pause; }
.rce-timer-reset { grid-area: reset; }
.rce-timer-close { grid-area: close; align-self: start; }

.rce-timers button {
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
	border: 0;
	border-radius: 6px;
	padding: 4px 8px;
	font-size: 0.85em;
}

.rce-timers .rce-timer-close {
	background: none;
	font-size: 1.2em;
	padding: 0 4px;
}

.rce-timer-done {
	background: #b3261e;
	animation: rce-pulse 1s ease-in-out infinite alternate;
}

@keyframes rce-pulse {
	to { box-shadow: 0 0 0 6px rgba(179, 38, 30, 0.35); }
}

/* ---------- Ratings ---------- */

.rce-rating-voteable .wprm-rating-star {
	cursor: pointer;
}

.rce-rating-saving {
	opacity: 0.6;
	pointer-events: none;
}

.rce-rating-message {
	margin-top: 0.35em;
	font-size: 0.85em;
}

/* ---------- Favorites ---------- */

.rce-favorite {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	font: inherit;
	cursor: pointer;
	border-style: solid;
	border-width: 1px;
}

.rce-favorite.wprm-recipe-link:not([class*="wprm-recipe-link-"]) {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
}

.rce-favorite .rce-favorite-icon svg {
	width: 1em;
	height: 1em;
	vertical-align: -0.125em;
}

.rce-favorite[aria-pressed="true"] .rce-favorite-icon path {
	fill: currentColor;
}

.rce-favorites-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 20px;
}

.rce-favorites-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

.rce-favorites-link {
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-decoration: none;
	color: inherit;
}

.rce-favorites-image {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 8px;
}

.rce-favorites-name {
	font-weight: 600;
}

.rce-favorites-meta {
	font-size: 0.85em;
	opacity: 0.75;
}

.rce-favorites-remove {
	align-self: flex-start;
	background: none;
	border: 0;
	padding: 0;
	font-size: 0.85em;
	text-decoration: underline;
	color: inherit;
	opacity: 0.75;
}

/* ---------- Toast ---------- */

body .rce-toast {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 99999;
	max-width: calc(100vw - 32px);
	padding: 10px 16px;
	border-radius: 8px;
	background: #1d1d1d;
	color: #ffffff;
	font-size: 15px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
	transform: translate(-50%, 150%);
	opacity: 0;
	transition: transform 0.25s, opacity 0.25s;
	pointer-events: none;
}

.rce-toast a {
	color: #ffffff;
	font-weight: 600;
	text-decoration: underline;
}

body .rce-toast.rce-toast-visible {
	transform: translate(-50%, 0);
	opacity: 1;
	pointer-events: auto;
}

/* ---------- Nutrition ---------- */

.rce-nutrition-list {
	line-height: 1.6;
}

.rce-nutrition-list-grouped {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
}

.rce-nutrition-name {
	font-weight: 600;
}

.rce-nutrition-label {
	max-width: 320px;
	padding: 6px 8px;
	border: 1px solid #000000;
	background: #ffffff;
	color: #000000;
	font-family: Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.35;
}

.rce-nl-title {
	font-size: 2em;
	font-weight: 900;
	line-height: 1;
	margin-bottom: 2px;
}

.rce-nl-recipe {
	font-size: 0.85em;
	padding-bottom: 2px;
	border-bottom: 1px solid #000000;
}

.rce-nl-serving {
	display: flex;
	justify-content: space-between;
	font-weight: 700;
	padding-top: 2px;
}

.rce-nl-bar {
	background: #000000;
	margin: 2px 0;
}

.rce-nl-bar-thick { height: 8px; }
.rce-nl-bar-medium { height: 4px; }

.rce-nl-small {
	font-size: 0.8em;
	font-weight: 700;
}

.rce-nl-calories {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: 1.6em;
	font-weight: 900;
	line-height: 1.1;
}

.rce-nl-dv-head {
	text-align: right;
	font-size: 0.8em;
	font-weight: 700;
	border-bottom: 1px solid #000000;
	padding-bottom: 2px;
}

.rce-nl-row {
	display: flex;
	justify-content: space-between;
	border-bottom: 1px solid #000000;
	padding: 1px 0;
}

.rce-nl-strong .rce-nl-name {
	font-weight: 700;
}

.rce-nl-indent {
	padding-left: 1em;
}

.rce-nl-dv {
	font-weight: 700;
}

.rce-nl-footnote {
	font-size: 0.75em;
	padding-top: 2px;
}

/* ---------- Links ---------- */

.rce-link-disclosure {
	margin: 0.75em 0 0;
	font-size: 0.8em;
	opacity: 0.75;
}

/* ---------- Print page ---------- */

.rce-print-controls {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.rce-print-label {
	padding: 0 0.5em;
	font-weight: 600;
}

.rce-hide-nutrition .rce-nutrition {
	display: none !important;
}

.wprm-print .rce-cook-mode,
.wprm-print .rce-favorite,
.wprm-print .rce-rating-message {
	display: none !important;
}

/* Ad spots in the card */
.rce-card-ad {
	clear: both;
	margin: 24px 0;
	text-align: center;
}

/* Thin ad strips between ingredient groups and between steps. They take no
   step number and none of the theme's bullets or step markers. A strip is
   as wide as the ad and centred on its column, so on a phone it can use the
   card's side padding instead of being cut off by it. */
.rce-card-strip,
.wprm-recipe-instructions > li.rce-card-strip {
	display: block;
	clear: both;
	box-sizing: border-box;
	width: 320px;
	max-width: none;
	margin: 16px 0 16px calc(50% - 160px) !important;
	padding: 0 !important;
	list-style: none !important;
	counter-increment: none !important;
	text-align: center;
	border: 0 !important;
}

li.rce-card-strip::before,
li.rce-card-strip::after,
li.rce-card-strip::marker {
	content: none !important;
	display: none !important;
}

@media (min-width: 768px) {
	.rce-card-strip-phone {
		display: none !important;
	}
}

@media print {
	.rce-card-ad,
	.rce-card-strip {
		display: none !important;
	}

	.rce-timers,
	.rce-toast,
	.rce-cook-mode,
	.rce-favorite,
	.rce-check,
	.rce-servings,
	.rce-units,
	.rce-print-controls,
	.rce-rating-message {
		display: none !important;
	}

	li.rce-has-check {
		padding-left: 0 !important;
	}

	li.rce-checked > :not(.rce-check) {
		opacity: 1;
		text-decoration: none;
	}

	.rce-timer-link {
		background: none;
		border: 0;
		font-weight: inherit;
	}

	.rce-timer-link::after {
		content: none;
	}
}
