/**
 * Frontend styles for the yfr-recipe card.
 *
 * Modern, airy replacement for WP Recipe Maker's default cramped-box
 * look: clear whitespace between intro / metadata / ingredients /
 * instructions, inline SVG icons instead of plain-text labels, and a
 * pure-CSS strikethrough-on-check for ingredients (degrades gracefully
 * where :has() isn't supported). All colors/spacing are custom
 * properties so the palette can be retheme'd without touching markup.
 */

:root {
	--yfr-color-text: #2b2420;
	--yfr-color-text-muted: #6b6259;
	--yfr-color-accent: #c1631f;
	--yfr-color-accent-soft: #fbe9da;
	--yfr-color-border: #e7e0d6;
	--yfr-color-surface: #ffffff;
	--yfr-color-surface-alt: #faf7f2;
	--yfr-radius: 12px;
	--yfr-spacing-xs: 0.375rem;
	--yfr-spacing-sm: 0.75rem;
	--yfr-spacing-md: 1.25rem;
	--yfr-spacing-lg: 2rem;
	--yfr-spacing-xl: 3rem;
	--yfr-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.yfr-recipe {
	/* The theme's own typeface, so the card reads as part of the post. */
	font-family: inherit;
	color: var(--yfr-color-text);
	background: var(--yfr-color-surface);
	border: 1px solid var(--yfr-color-border);
	border-radius: var(--yfr-radius);
	padding: var(--yfr-spacing-lg);
	max-width: 760px;
	margin: var(--yfr-spacing-xl) auto;
	line-height: 1.6;
}

.yfr-recipe,
.yfr-recipe *,
.yfr-recipe *::before,
.yfr-recipe *::after {
	box-sizing: border-box;
}

.yfr-recipe__header {
	margin-bottom: var(--yfr-spacing-lg);
}

.yfr-recipe__title {
	font-size: 1.75rem;
	line-height: 1.25;
	margin: 0 0 var(--yfr-spacing-md);
}

.yfr-recipe__image {
	margin-bottom: var(--yfr-spacing-md);
}

.yfr-recipe__image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--yfr-radius);
}

.yfr-recipe__summary {
	color: var(--yfr-color-text-muted);
	font-size: 1.05rem;
}

.yfr-recipe__summary p:last-child {
	margin-bottom: 0;
}

/* Metadata row */
.yfr-recipe__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--yfr-spacing-md);
	background: var(--yfr-color-surface-alt);
	border-radius: var(--yfr-radius);
	padding: var(--yfr-spacing-md);
	margin-bottom: var(--yfr-spacing-lg);
}

.yfr-recipe__meta-item {
	display: flex;
	align-items: center;
	gap: var(--yfr-spacing-sm);
	flex: 1 1 140px;
}

.yfr-recipe__meta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: var(--yfr-color-accent-soft);
	color: var(--yfr-color-accent);
	flex-shrink: 0;
}

.yfr-recipe__meta-icon svg {
	width: 1.05rem;
	height: 1.05rem;
}

.yfr-recipe__meta-text {
	display: flex;
	flex-direction: column;
	line-height: 1.3;
}

.yfr-recipe__meta-label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--yfr-color-text-muted);
}

.yfr-recipe__meta-value {
	font-weight: 600;
}

/* Section titles */
.yfr-recipe__section-title {
	font-size: 1.25rem;
	margin: 0 0 var(--yfr-spacing-md);
	padding-bottom: var(--yfr-spacing-xs);
	border-bottom: 2px solid var(--yfr-color-accent-soft);
}

.yfr-recipe__group-title {
	font-size: 1rem;
	margin: var(--yfr-spacing-md) 0 var(--yfr-spacing-sm);
	color: var(--yfr-color-accent);
}

.yfr-recipe__ingredients,
.yfr-recipe__instructions,
.yfr-recipe__notes {
	margin-bottom: var(--yfr-spacing-lg);
}

/* Ingredients */
.yfr-recipe__ingredient-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.yfr-recipe__ingredient {
	border-bottom: 1px solid var(--yfr-color-border);
}

.yfr-recipe__ingredient:last-child {
	border-bottom: none;
}

.yfr-recipe__ingredient label {
	display: flex;
	align-items: flex-start;
	gap: var(--yfr-spacing-sm);
	padding: var(--yfr-spacing-sm) 0;
	cursor: pointer;
}

.yfr-recipe__ingredient-checkbox {
	appearance: none;
	-webkit-appearance: none;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.2rem;
	flex-shrink: 0;
	border: 2px solid var(--yfr-color-border);
	border-radius: 4px;
	position: relative;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.yfr-recipe__ingredient-checkbox:checked {
	background: var(--yfr-color-accent);
	border-color: var(--yfr-color-accent);
}

.yfr-recipe__ingredient-checkbox:checked::after {
	content: "";
	position: absolute;
	left: 3px;
	top: -1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.yfr-recipe__ingredient-text {
	flex: 1;
}

.yfr-recipe__ingredient-amount {
	font-weight: 600;
	margin-right: 0.35em;
}

.yfr-recipe__ingredient-notes {
	display: block;
	font-size: 0.875rem;
	color: var(--yfr-color-text-muted);
}

/*
 * Pure-CSS strikethrough on check. Modern-browsers-only nice-to-have:
 * where :has() isn't supported, the row simply stays unstruck — the
 * checkbox itself still works with zero JS either way.
 */
.yfr-recipe__ingredient:has(.yfr-recipe__ingredient-checkbox:checked) .yfr-recipe__ingredient-text {
	text-decoration: line-through;
	color: var(--yfr-color-text-muted);
	opacity: 0.65;
}

/* Instructions */
.yfr-recipe__step-list {
	list-style: none;
	counter-reset: yfr-step;
	margin: 0;
	padding: 0;
}

.yfr-recipe__step {
	counter-increment: yfr-step;
	position: relative;
	padding: 0 0 var(--yfr-spacing-lg) var(--yfr-spacing-xl);
	margin-bottom: var(--yfr-spacing-lg);
	border-bottom: 1px solid var(--yfr-color-border);
}

.yfr-recipe__step:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.yfr-recipe__step::before {
	content: counter(yfr-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--yfr-color-accent);
	color: #fff;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

.yfr-recipe__step-title {
	margin: 0 0 var(--yfr-spacing-xs);
	font-size: 1.05rem;
}

.yfr-recipe__step-text p {
	margin: 0 0 var(--yfr-spacing-sm);
}

.yfr-recipe__step-text p:last-child {
	margin-bottom: 0;
}

.yfr-recipe__step-image {
	margin-top: var(--yfr-spacing-sm);
}

.yfr-recipe__step-image img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: var(--yfr-radius);
}

/* Notes */
.yfr-recipe__notes-content {
	background: var(--yfr-color-surface-alt);
	border-left: 4px solid var(--yfr-color-accent);
	border-radius: 0 var(--yfr-radius) var(--yfr-radius) 0;
	padding: var(--yfr-spacing-md);
}

.yfr-recipe__notes-content p:last-child {
	margin-bottom: 0;
}

/* Footer / print link */
.yfr-recipe__footer {
	text-align: right;
}

.yfr-recipe__print-link {
	display: inline-flex;
	align-items: center;
	gap: var(--yfr-spacing-xs);
	color: var(--yfr-color-accent);
	text-decoration: none;
	font-weight: 600;
}

.yfr-recipe__print-link:hover {
	text-decoration: underline;
}

.yfr-recipe__print-link svg {
	width: 1.1rem;
	height: 1.1rem;
}

/* Responsive: most people read recipes on a phone while cooking */
@media (max-width: 600px) {
	.yfr-recipe {
		padding: var(--yfr-spacing-md);
		margin: var(--yfr-spacing-md) auto;
		border-left: none;
		border-right: none;
		border-radius: 0;
	}

	.yfr-recipe__title {
		font-size: 1.4rem;
	}

	/* Two columns: a flex column would turn each item's 140px basis into
	   its height. */
	.yfr-recipe__meta {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--yfr-spacing-sm);
		padding: var(--yfr-spacing-sm);
	}

	.yfr-recipe__meta-text {
		min-width: 0;
	}

	/* "Forberedelsestid" must fit on one line in half a phone screen. */
	.yfr-recipe__meta-label {
		text-transform: none;
		letter-spacing: 0;
	}

	.yfr-recipe__step {
		padding-left: 2.75rem;
	}

	.yfr-recipe__step::before {
		width: 1.85rem;
		height: 1.85rem;
		font-size: 0.9rem;
	}
}

/* Star ratings ------------------------------------------------------ */

.yfr-recipe__rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--yfr-spacing-xs) var(--yfr-spacing-sm);
	margin: 0 0 var(--yfr-spacing-md);
	color: var(--yfr-color-text-muted);
	font-size: 0.95rem;
}

.yfr-stars,
.yfr-comment-stars {
	position: relative;
	display: inline-block;
	line-height: 1;
	letter-spacing: 0.1em;
	font-size: 1.15rem;
	white-space: nowrap;
}

.yfr-stars__base {
	color: var(--yfr-color-border);
}

.yfr-stars__fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	color: var(--yfr-color-accent);
}

.yfr-comment-stars {
	display: block;
	margin-bottom: var(--yfr-spacing-xs);
	font-size: 1rem;
}

.yfr-rate {
	display: inline-flex;
	align-items: center;
	gap: var(--yfr-spacing-xs);
}

.yfr-rate__buttons {
	display: inline-flex;
	flex-direction: row-reverse;
}

.yfr-rate__star {
	border: 0;
	background: none;
	padding: 0 0.1em;
	font-size: 1.35rem;
	line-height: 1;
	color: var(--yfr-color-border);
	cursor: pointer;
}

.yfr-rate__star:hover,
.yfr-rate__star:hover ~ .yfr-rate__star,
.yfr-rate__star:focus-visible,
.yfr-rate__star:focus-visible ~ .yfr-rate__star,
.yfr-rate__star.is-selected,
.yfr-rate__star.is-selected ~ .yfr-rate__star {
	color: var(--yfr-color-accent);
}

.yfr-rate__thanks {
	color: var(--yfr-color-accent);
}

/* Comment form stars: radios in reverse order so :checked ~ fills left. */
.comment-form-yfr-rating {
	display: flex;
	align-items: center;
	gap: var(--yfr-spacing-sm);
}

.yfr-comment-rating {
	display: inline-flex;
	flex-direction: row-reverse;
}

.yfr-comment-rating input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.yfr-comment-rating label {
	font-size: 1.5rem;
	line-height: 1;
	padding: 0 0.1em;
	color: #d8d0c5;
	cursor: pointer;
}

.yfr-comment-rating input:checked ~ label,
.yfr-comment-rating label:hover,
.yfr-comment-rating label:hover ~ label {
	color: #c1631f;
}

.yfr-comment-rating input:focus-visible + label {
	outline: 2px solid #c1631f;
	outline-offset: 2px;
}

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

.yfr-recipe__nutrition {
	margin-top: var(--yfr-spacing-lg);
}

.yfr-recipe__nutrition-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: var(--yfr-spacing-xs) var(--yfr-spacing-md);
	margin: 0;
	padding: var(--yfr-spacing-md);
	background: var(--yfr-color-surface-alt);
	border-radius: var(--yfr-radius);
	font-size: 0.9rem;
}

.yfr-recipe__nutrient {
	display: flex;
	justify-content: space-between;
	gap: var(--yfr-spacing-sm);
	margin: 0;
}

.yfr-recipe__nutrient dt {
	color: var(--yfr-color-text-muted);
}

.yfr-recipe__nutrient dd {
	margin: 0;
	font-weight: 600;
}

.yfr-recipe__nutrition-note {
	margin: var(--yfr-spacing-xs) 0 0;
	font-size: 0.8rem;
	color: var(--yfr-color-text-muted);
}
