/**
 * Ricettario — scheda ricetta.
 *
 * Il carattere è quello del tema (Avada); colori e spazi sono variabili qui
 * sotto. Selettori con prefisso .rct-recipe per prevalere sugli stili
 * generici del tema su ul/li/h2/h3.
 */

.rct-recipe {
	--rct-accent: #747b2d;
	--rct-accent-soft: #eef0e2;
	--rct-text: #2b2b2b;
	--rct-muted: #6b6b6b;
	--rct-line: #e4e2da;
	--rct-bg: #fbfaf6;
	--rct-radius: 12px;

	container-type: inline-size;
	margin: 2em 0;
	padding: clamp(16px, 4cqi, 32px);
	background: var(--rct-bg);
	border: 1px solid var(--rct-line);
	border-radius: var(--rct-radius);
	color: var(--rct-text);
	line-height: 1.55;
}

.rct-recipe p:empty {
	display: none;
}

.rct-recipe img {
	max-width: 100%;
	height: auto;
}

/* Intestazione ------------------------------------------------------- */

.rct-recipe .rct-head {
	display: flex;
	flex-direction: column-reverse;
	gap: 16px;
}

@container (min-width: 620px) {
	.rct-recipe .rct-head {
		flex-direction: row;
		align-items: stretch;
	}
	.rct-recipe .rct-head-text {
		flex: 1 1 auto;
		display: flex;
		flex-direction: column;
	}
	.rct-recipe .rct-head .rct-image {
		flex: 0 0 34%;
		align-self: flex-start;
	}
}

.rct-recipe .rct-name {
	margin: 0 0 0.4em;
	padding: 0;
	font-size: 1.8em;
	line-height: 1.2;
	color: var(--rct-text);
}

.rct-recipe .rct-summary {
	color: var(--rct-muted);
}

.rct-recipe .rct-summary p {
	margin: 0 0 0.5em;
}

.rct-recipe .rct-image {
	margin: 0;
}

.rct-recipe .rct-image img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: calc(var(--rct-radius) - 4px);
}

.rct-recipe .rct-image-zoom {
	display: block;
	cursor: zoom-in;
}

/* Immagine ingrandita: finestra creata da recipe.js in fondo alla pagina. */
.rct-lightbox {
	box-sizing: border-box;
	max-width: 96vw;
	max-height: 96vh;
	margin: auto;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: visible;
}

.rct-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.85);
}

.rct-lightbox img {
	display: block;
	width: auto;
	height: auto;
	max-width: 96vw;
	max-height: 92vh;
	border-radius: 6px;
	cursor: zoom-out;
}

.rct-lightbox button {
	position: fixed;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 28px;
	line-height: 44px;
	cursor: pointer;
}

.rct-recipe ul.rct-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0.8em 0 0;
	padding: 0;
	list-style: none;
}

.rct-recipe ul.rct-tags li {
	margin: 0;
	padding: 3px 10px;
	background: var(--rct-accent-soft);
	border-radius: 999px;
	font-size: 0.85em;
}

.rct-recipe ul.rct-tags li::before {
	content: none;
}

.rct-recipe .rct-tags-label {
	color: var(--rct-muted);
	margin-right: 2px;
}

.rct-recipe .rct-author {
	margin: 0.8em 0 0;
	font-size: 0.9em;
	color: var(--rct-muted);
}

/* Stelle ------------------------------------------------------------- */

.rct-recipe .rct-rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	margin: 0.8em 0 0;
	font-size: 0.9em;
	color: var(--rct-muted);
}

.rct-recipe .rct-rating.is-busy {
	opacity: 0.6;
}

.rct-recipe .rct-rating-mine[hidden] {
	display: none;
}

.rct-star {
	--rct-star-on: #e0a800;
	--rct-star-off: #d6d3c8;
	display: inline-block;
	color: var(--rct-star-off);
	font-size: 1.35em;
	line-height: 1;
}

.rct-star.is-full {
	color: var(--rct-star-on);
}

/* Mezza stella: metà sinistra colorata. */
.rct-star.is-half {
	background: linear-gradient(90deg, var(--rct-star-on) 50%, var(--rct-star-off) 50%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.rct-recipe .rct-stars-vote .rct-star {
	margin: 0;
	padding: 2px 1px;
	border: 0;
	background-color: transparent;
	cursor: pointer;
	font-size: 1.6em;
}

.rct-recipe .rct-stars-vote .rct-star.is-half {
	background-color: transparent;
}

.rct-recipe .rct-stars-vote .rct-star:focus-visible {
	outline: 2px solid var(--rct-accent);
	outline-offset: 1px;
	border-radius: 4px;
}

/* Stelle nei commenti e nel modulo commenti (fuori dalla scheda). */
.rct-comment-stars {
	margin: 0 0 0.4em;
}

.rct-comment-rating {
	display: flex;
	align-items: center;
	gap: 10px;
}

.rct-stars-input {
	display: inline-flex;
	flex-direction: row-reverse;
}

.rct-stars-input input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.rct-stars-input label {
	margin: 0;
	padding: 0 2px;
	color: #d6d3c8;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
}

.rct-stars-input label::before {
	content: "★";
}

.rct-stars-input input:checked ~ label,
.rct-stars-input label:hover,
.rct-stars-input label:hover ~ label {
	color: #e0a800;
}

.rct-stars-input input:focus-visible + label {
	outline: 2px solid #747b2d;
	border-radius: 4px;
}

/* Tempi, porzioni, stampa -------------------------------------------- */

.rct-recipe .rct-facts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin: 20px 0;
	padding: 14px 0;
	border-top: 1px solid var(--rct-line);
	border-bottom: 1px solid var(--rct-line);
}

/* Tempi: nell'intestazione, sotto la valutazione, in basso come l'immagine (una riga per tempo). */
.rct-recipe .rct-times {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: auto;
	padding-top: 16px;
}

/* Porzioni a sinistra, stampa e modifica a destra, sulla stessa riga. */
.rct-recipe .rct-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	margin-left: auto;
}

.rct-recipe .rct-fact {
	display: flex;
	flex-direction: row;
	align-items: baseline;
	gap: 12px;
}

.rct-recipe .rct-times .rct-fact-label {
	min-width: 8em;
}

.rct-recipe .rct-fact-label {
	font-size: 0.75em;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--rct-muted);
}

.rct-recipe .rct-fact-value {
	font-weight: 600;
}

.rct-recipe .rct-fact-servings {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
}


.rct-recipe .rct-stepper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--rct-line);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.rct-recipe .rct-stepper-btn {
	min-width: 40px;
	margin: 0;
	padding: 0 10px;
	border: 0;
	background: transparent;
	color: var(--rct-accent);
	font-size: 1.2em;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
}

.rct-recipe .rct-stepper-btn:hover {
	background: var(--rct-accent-soft);
}

.rct-recipe .rct-servings-input {
	width: 4.2em;
	min-height: 40px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-left: 1px solid var(--rct-line);
	border-right: 1px solid var(--rct-line);
	border-radius: 0;
	background: #fff;
	text-align: center;
	font-weight: 600;
	font-size: 1em;
	-moz-appearance: textfield;
	appearance: textfield;
}

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

/* Porzioni bloccate per i non registrati: comandi disattivati + invito. */
.rct-recipe .rct-stepper-lock {
	position: relative;
	display: inline-flex;
	border-radius: 8px;
	cursor: help;
}

.rct-recipe .rct-stepper-lock:focus-visible {
	outline: 2px solid var(--rct-accent);
	outline-offset: 2px;
}

.rct-recipe .rct-stepper.is-disabled {
	opacity: 0.55;
	pointer-events: none; /* gli eventi del mouse arrivano al contenitore */
}

.rct-recipe .rct-stepper.is-disabled .rct-stepper-btn {
	color: var(--rct-muted);
}

.rct-recipe .rct-invito {
	position: absolute;
	z-index: 20;
	left: 0;
	top: 100%;
	width: max-content;
	max-width: min(280px, 80vw);
	margin-top: 0;
	padding: 10px 12px;
	border: 1px solid var(--rct-line);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
	font-size: 0.9em;
	line-height: 1.4;
	cursor: auto;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.15s, visibility 0.15s;
}

/* Ponte invisibile tra i comandi e il riquadro: il mouse ci arriva senza farlo sparire. */
.rct-recipe .rct-invito::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 8px;
}

.rct-recipe .rct-stepper-lock:hover .rct-invito,
.rct-recipe .rct-stepper-lock:focus-within .rct-invito {
	visibility: visible;
	opacity: 1;
	margin-top: 8px;
}

.rct-recipe .rct-invito a {
	display: block;
	margin-top: 6px;
	color: var(--rct-accent);
}

.rct-recipe .rct-invito .rct-invito-login {
	display: block;
	margin-top: 6px;
	color: var(--rct-muted);
	font-size: 0.9em;
}

.rct-recipe .rct-invito .rct-invito-login a {
	display: inline;
	margin: 0;
}

.rct-recipe .rct-servings-unit {
	color: var(--rct-muted);
}

.rct-recipe .rct-print {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 16px;
	border-radius: 8px;
	background: var(--rct-accent);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

.rct-recipe .rct-print:hover,
.rct-recipe .rct-print:focus {
	color: #fff;
	filter: brightness(1.1);
}

/* Solo per chi può modificare la ricetta: porta all'editor in admin. */
.rct-recipe .rct-edit {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--rct-accent);
	border-radius: 8px;
	color: var(--rct-accent);
	font-weight: 600;
	text-decoration: none;
}

.rct-recipe .rct-edit:hover,
.rct-recipe .rct-edit:focus {
	background: var(--rct-accent-soft);
	color: var(--rct-accent);
}

/* Corpo: ingredienti e passaggi -------------------------------------- */

.rct-recipe .rct-body {
	display: grid;
	gap: 28px;
}

@container (min-width: 720px) {
	.rct-recipe .rct-body {
		grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
		align-items: start;
	}
}

.rct-recipe .rct-section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 12px;
}

.rct-recipe .rct-section-title {
	margin: 0 0 0.4em;
	padding: 0;
	font-size: 1.25em;
	color: var(--rct-text);
}

.rct-recipe .rct-group-name {
	margin: 1.1em 0 0.3em;
	padding: 0;
	font-size: 0.95em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--rct-accent);
}

.rct-recipe .rct-hint {
	margin: 0 0 0.4em;
	font-size: 0.8em;
	color: var(--rct-muted);
}

.rct-recipe .rct-used-count {
	font-size: 0.85em;
	color: var(--rct-muted);
}

.rct-recipe .rct-used-reset {
	margin: 0 0 0 auto;
	padding: 4px 12px;
	border: 1px solid var(--rct-line);
	border-radius: 999px;
	background: #fff;
	color: var(--rct-text);
	font-size: 0.85em;
	cursor: pointer;
}

.rct-recipe .rct-used-reset[hidden],
.rct-recipe .rct-used-count[hidden] {
	display: none;
}

.rct-recipe ul.rct-ingredient-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rct-recipe ul.rct-ingredient-list li.rct-ingredient {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-height: 44px;
	margin: 0;
	padding: 10px 6px;
	border-bottom: 1px solid var(--rct-line);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	transition: opacity 0.15s ease;
}

.rct-recipe ul.rct-ingredient-list li.rct-ingredient::before {
	content: none;
}

.rct-recipe li.rct-ingredient:focus-visible {
	outline: 2px solid var(--rct-accent);
	outline-offset: 2px;
	border-radius: 6px;
}

.rct-recipe .rct-check {
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
	margin-top: 1px;
	border: 2px solid var(--rct-accent);
	border-radius: 50%;
	background: #fff;
	position: relative;
}

.rct-recipe .rct-quantity {
	font-weight: 700;
	white-space: nowrap;
}

.rct-recipe .rct-ingredient-notes {
	color: var(--rct-muted);
	font-size: 0.92em;
}

.rct-recipe .rct-ingredient-notes::before {
	content: "· ";
}

/* Ingrediente già usato: attenuato e barrato, con la spunta piena. */
.rct-recipe li.rct-ingredient.is-used {
	opacity: 0.45;
}

.rct-recipe li.rct-ingredient.is-used .rct-ingredient-text {
	text-decoration: line-through;
}

.rct-recipe li.rct-ingredient.is-used .rct-check {
	background: var(--rct-accent);
}

.rct-recipe li.rct-ingredient.is-used .rct-check::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.rct-recipe ol.rct-steps {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: rct-step;
}

.rct-recipe ol.rct-steps li.rct-step {
	position: relative;
	margin: 0 0 16px;
	padding: 0 0 0 44px;
	counter-increment: rct-step;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: opacity 0.15s ease;
}

.rct-recipe li.rct-step:focus-visible {
	outline: 2px solid var(--rct-accent);
	outline-offset: 4px;
	border-radius: 6px;
}

/* Passaggio già eseguito: attenuato, il numero diventa una spunta piena. */
.rct-recipe ol.rct-steps li.rct-step.is-used {
	opacity: 0.45;
}

.rct-recipe ol.rct-steps li.rct-step.is-used::before {
	content: "✓";
	background: var(--rct-accent);
	color: #fff;
}

.rct-recipe ol.rct-steps li.rct-step::before {
	content: counter(rct-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--rct-accent-soft);
	color: var(--rct-accent);
	font-weight: 700;
	line-height: 30px;
	text-align: center;
}

.rct-recipe .rct-step-name {
	margin: 0 0 0.2em;
	font-weight: 700;
}

.rct-recipe .rct-step-text p {
	margin: 0 0 0.5em;
}

.rct-recipe .rct-step-image {
	margin: 8px 0 0;
}

.rct-recipe .rct-step-image img {
	border-radius: 8px;
}

/* Video -------------------------------------------------------------- */

.rct-recipe .rct-video {
	margin-top: 24px;
}

.rct-recipe .rct-video-embed iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 8px;
}

/* Note --------------------------------------------------------------- */

.rct-recipe .rct-notes {
	margin-top: 24px;
	padding: 16px 18px;
	border-left: 4px solid var(--rct-accent);
	border-radius: 0 8px 8px 0;
	background: var(--rct-accent-soft);
}

.rct-recipe .rct-notes p {
	margin: 0 0 0.5em;
}

/* Scheda breve (elenchi di articoli) -------------------------------- */

.rct-recipe.rct-recipe-compact {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding: 14px;
}

.rct-recipe-compact .rct-image {
	flex: 0 0 96px;
}

.rct-recipe-compact .rct-image img {
	aspect-ratio: 1;
}

.rct-recipe-compact .rct-name {
	font-size: 1.15em;
	font-weight: 700;
	margin: 0 0 0.2em;
}

.rct-recipe-compact .rct-open {
	font-weight: 600;
	color: var(--rct-accent);
}

/* Note personali (solo utenti collegati) ----------------------------- */

.rct-recipe .rct-my-note {
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid var(--rct-line);
}

.rct-recipe .rct-my-note-info {
	margin: 0 0 8px;
	font-size: 0.9em;
	color: var(--rct-muted);
}

.rct-recipe .rct-my-note textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--rct-line);
	border-radius: 8px;
	background: #fff;
	color: var(--rct-text);
	font: inherit;
	resize: vertical;
}

.rct-recipe .rct-my-note-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-top: 8px;
}

.rct-recipe .rct-my-note-actions button {
	padding: 8px 14px;
	border: 1px solid var(--rct-accent);
	border-radius: 8px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.rct-recipe .rct-my-note-actions .rct-my-note-save {
	background: var(--rct-accent);
	color: #fff;
}

.rct-recipe .rct-my-note-actions .rct-my-note-delete {
	background: transparent;
	color: var(--rct-accent);
}

.rct-recipe .rct-my-note-actions button:disabled {
	opacity: 0.5;
	cursor: default;
}

.rct-recipe .rct-my-note-actions [hidden] {
	display: none;
}

.rct-recipe .rct-my-note-count {
	margin-left: auto;
	font-size: 0.85em;
	color: var(--rct-muted);
}

@media print {
	.rct-recipe .rct-my-note,
	.rct-recipe .rct-print,
	.rct-recipe .rct-edit,
	.rct-recipe .rct-rating,
	.rct-recipe .rct-stepper-btn,
	.rct-recipe .rct-hint,
	.rct-recipe .rct-used-reset {
		display: none;
	}
}
