/**
 * LMR Recipe card — homemade index-card / recipe-card look.
 *
 * Ruled lines are drawn per row (each list item and heading), not on the card
 * backdrop, so wrapped steps and pasted photos stay on the same vertical rhythm.
 */

.lmr-recipe-card {
	--lmr-line-height: 1.6rem;
	--lmr-paper: #fdf6e3;
	--lmr-paper-edge: rgba(120, 90, 50, 0.22);
	--lmr-rule: rgba(80, 110, 150, 0.16);
	--lmr-margin-line: rgba(180, 60, 50, 0.45);
	--lmr-ink: #2c2218;
	--lmr-ink-red: #b13a35;
	--lmr-img-max-width: 17.5rem;

	position: relative;
	margin: 2em auto;
	max-width: 100%;
	overflow-x: hidden;
	padding: var(--lmr-line-height) 1.6em var(--lmr-line-height) 2.6em;
	box-sizing: border-box;
	background-color: var(--lmr-paper);
	border: 1px solid var(--lmr-paper-edge);
	border-radius: 3px;
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.6) inset,
		3px 3px 0 -1px #f7eed4,
		3px 3px 1px 0 rgba(120, 90, 50, 0.18),
		6px 6px 0 -2px #f1e6c4,
		6px 6px 1px -1px rgba(120, 90, 50, 0.15),
		0 12px 24px rgba(0, 0, 0, 0.1);
	color: var(--lmr-ink);
	line-height: var(--lmr-line-height);
}

/* The classic red "margin" rule down the left. */
.lmr-recipe-card::before {
	content: "";
	position: absolute;
	top: 0.6em;
	bottom: 0.6em;
	left: 1.85em;
	width: 1px;
	background: var(--lmr-margin-line);
	pointer-events: none;
}

/*
 * Per-row ruled lines — one horizontal rule per line-height band inside each block.
 * Multi-line <li> steps get multiple rules; nested sub-lists live inside the parent row.
 */
.lmr-recipe-card .lmr-section-title,
.lmr-recipe-card .lmr-subsection-title,
.lmr-recipe-card .lmr-lines > li {
	background-image: repeating-linear-gradient(
		to bottom,
		transparent 0,
		transparent calc(var(--lmr-line-height) - 1px),
		var(--lmr-rule) calc(var(--lmr-line-height) - 1px),
		var(--lmr-rule) var(--lmr-line-height)
	);
	background-size: 100% var(--lmr-line-height);
}

/* Sections are blocks on the same paper, not separate cards. */
.lmr-recipe-card .lmr-section {
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.lmr-recipe-card .lmr-section + .lmr-section {
	margin-top: var(--lmr-line-height);
	padding-top: var(--lmr-line-height);
	border-top: 1px dashed rgba(120, 90, 50, 0.3);
}

.lmr-recipe-card .lmr-section-title {
	/* Title on line 1; padding-bottom adds one blank ruled line before content. */
	margin: 0;
	padding: 0 0 var(--lmr-line-height);
	font-size: 1.4rem;
	font-weight: 400;
	line-height: var(--lmr-line-height);
	color: var(--lmr-ink-red);
	border: 0;
}

.entry-content .lmr-recipe-card .lmr-section-title {
	margin-top: 0;
	font-weight: 400;
}

.lmr-recipe-card .lmr-subsection-title {
	margin: 0;
	padding: 0;
	font-size: 1.15rem;
	font-weight: 400;
	line-height: var(--lmr-line-height);
	color: var(--lmr-ink-red);
	border: 0;
	letter-spacing: 0.02em;
}

.entry-content .lmr-recipe-card .lmr-subsection-title {
	margin-top: 0;
	margin-bottom: 0;
	font-weight: 400;
	text-transform: capitalize;
}

.lmr-recipe-card .lmr-section .lmr-lines + .lmr-subsection-title {
	margin-top: 0;
}

.lmr-recipe-card .lmr-lines {
	margin: 0;
	padding: 0 0 0 1.25em;
	line-height: var(--lmr-line-height);
	list-style: disc;
}

.lmr-recipe-card .lmr-lines > li {
	margin: 0;
	padding: 0;
	min-width: 0;
	max-width: 100%;
	line-height: var(--lmr-line-height);
}

.lmr-recipe-card .lmr-lines > li::marker {
	color: rgba(120, 90, 50, 0.55);
}

.lmr-recipe-card .lmr-lines strong,
.lmr-recipe-card .lmr-lines b {
	font-weight: 700;
}

.lmr-recipe-card .lmr-lines em,
.lmr-recipe-card .lmr-lines i {
	font-style: italic;
}

.lmr-recipe-card .lmr-lines del,
.lmr-recipe-card .lmr-lines s,
.lmr-recipe-card .lmr-lines strike {
	text-decoration: line-through;
}

.lmr-recipe-card .lmr-lines u {
	text-decoration: underline;
}

.lmr-recipe-card .lmr-lines a {
	color: var(--lmr-ink-red);
	text-decoration: underline;
}

.lmr-recipe-card .lmr-lines a:hover,
.lmr-recipe-card .lmr-lines a:focus {
	color: var(--lmr-ink);
}

.lmr-recipe-card .lmr-lines li ul,
.lmr-recipe-card .lmr-lines li ol {
	margin: 0;
	padding: 0 0 0 1.25em;
	list-style: disc;
}

.lmr-recipe-card .lmr-lines li ol {
	list-style: decimal;
}

.lmr-recipe-card .lmr-section-instructions .lmr-lines > li > ul,
.lmr-recipe-card .lmr-section-instructions .lmr-lines > li > ol {
	padding-left: 1.25em;
	list-style: disc;
}

/*
 * Photo rows: fixed eight-line slot on the grid; rules continue behind the image.
 */
.lmr-recipe-card .lmr-lines > li.lmr-line-media {
	list-style: none;
	margin: var(--lmr-line-height) 0 0;
	height: calc(var(--lmr-line-height) * 8);
	display: flex;
	align-items: center;
	justify-content: center;
}

.lmr-recipe-card .lmr-section-ingredients .lmr-lines > li.lmr-line-media,
.lmr-recipe-card .lmr-section-notes .lmr-lines > li.lmr-line-media {
	margin-left: 0;
	padding-left: 0;
	max-width: 100%;
}

.lmr-recipe-card a.lmr-recipe-img-link {
	display: block;
	max-width: min(100%, var(--lmr-img-max-width));
	margin: 0;
	border: 0;
	text-decoration: none;
	line-height: 0;
}

.lmr-recipe-card a.lmr-recipe-img-link:hover,
.lmr-recipe-card a.lmr-recipe-img-link:focus {
	opacity: 0.9;
}

.lmr-recipe-card .lmr-lines > li.lmr-line-media img,
.lmr-recipe-card .lmr-lines > li.lmr-line-media .lmr-recipe-img {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: min(100%, var(--lmr-img-max-width)) !important;
	max-height: calc(var(--lmr-line-height) * 8);
	margin: 0 auto;
	padding: 0;
	border: 0;
	border-radius: 2px;
	box-shadow: none;
	background: transparent;
	object-fit: contain;
	cursor: zoom-in;
}

body:not(.search-results) article:not(.type-page) .lmr-recipe-card img.below-entry-meta,
body:not(.search-results) article:not(.type-page) .lmr-recipe-card figure.below-entry-meta {
	margin-left: 0 !important;
	max-width: min(100%, var(--lmr-img-max-width)) !important;
}

.lmr-recipe-card .lmr-lines > li:not(.lmr-line-media) img {
	display: inline-block;
	vertical-align: middle;
	max-width: min(100%, var(--lmr-img-max-width)) !important;
	width: auto !important;
	height: auto !important;
	max-height: calc(var(--lmr-line-height) * 3);
	object-fit: contain;
}

.lmr-recipe-card .lmr-section-notes .lmr-lines strong,
.lmr-recipe-card .lmr-section-notes .lmr-lines b {
	font-style: normal;
}

.lmr-recipe-card .lmr-section-instructions .lmr-lines {
	list-style: none;
	padding-left: 0;
}

.lmr-recipe-card .lmr-section-notes {
	font-style: italic;
}

.lmr-recipe-card .lmr-section-notes .lmr-lines {
	list-style: none;
	padding-left: 0;
}

@media (max-width: 480px) {
	.lmr-recipe-card {
		padding-left: 2em;
		padding-right: 1.1em;
	}

	.lmr-recipe-card::before {
		left: 1.35em;
	}
}
