/* Media Diary widget styles */

.mdw-widget {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px;
	font-size: 14px;
	line-height: 1.4;
	container-type: inline-size;
}

.mdw-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mdw-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 14px 0;
	padding: 0 0 14px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mdw-item:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.mdw-image-link {
	flex: 0 0 auto;
	display: block;
	line-height: 0;
}

.mdw-image {
	border-radius: 3px;
	display: block;
	background: #ddd;
	object-fit: cover;
}

/* Letterboxd posters: tall, movie-poster aspect ratio. */
.mdw-source-letterboxd .mdw-image,
.mdw-source-letterboxd .mdw-image-placeholder {
	width: 60px;
	height: 90px;
}

/* Record Club covers: square, album-art aspect ratio. */
.mdw-source-recordclub .mdw-image,
.mdw-source-recordclub .mdw-image-placeholder {
	width: 70px;
	height: 70px;
}

/* Goodreads covers: unlike posters/album art, book cover aspect ratios vary
   a lot from book to book. Fix the height only and let width follow each
   image's own ratio, so every row lines up at a consistent height instead
   of a fixed crop box that would either overflow or crop covers oddly.
   max-width guards against unusually wide/panoramic covers; object-fit
   only engages in that rare case, so most covers render uncropped. */
.mdw-source-goodreads .mdw-image {
	width: auto;
	height: 90px;
	max-width: 70px;
	object-fit: cover;
}

.mdw-source-goodreads .mdw-image-placeholder {
	width: 60px;
	height: 90px;
}

.mdw-image-placeholder {
	background: #e2e2e2;
	border-radius: 3px;
	display: block;
}

.mdw-info {
	flex: 1 1 auto;
	min-width: 0;
}

.mdw-title {
	font-weight: 600;
	text-decoration: none;
	word-break: break-word;
}

.mdw-title:hover {
	text-decoration: underline;
}

.mdw-repeat {
	display: inline-block;
	opacity: 0.6;
	font-size: 0.9em;
	cursor: default;
}

.mdw-year {
	font-weight: 400;
	opacity: 0.7;
	font-size: 0.9em;
}

.mdw-subtitle {
	font-size: 0.85em;
	opacity: 0.75;
	margin-top: 2px;
	line-height: 0;
}

.mdw-rating {
	position: relative;
	display: inline-block;
	font-size: 0.9em;
	margin-top: 16px;
	line-height: 1;
	white-space: nowrap;
}

.mdw-stars-back,
.mdw-stars-front {
	letter-spacing: 2px;
}

.mdw-stars-back {
	color: rgba(0, 0, 0, 0.2);
}

.mdw-stars-front {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	white-space: nowrap;
	color: #ff8000;
}

.mdw-profile-link {
	margin: 10px 0 0 0;
	font-size: 0.85em;
}

.mdw-profile-link a {
	text-decoration: none;
}

.mdw-profile-link a:hover {
	text-decoration: underline;
}

.mdw-error {
	font-size: 0.9em;
	opacity: 0.75;
}

/* ---------------------------------------------------------------------
 * Responsive layout — no setting to configure. Each widget/shortcode is
 * a CSS size container (see .mdw-widget above), so this responds to the
 * actual width it's rendered at: narrow sidebars and mobile stay a
 * vertical list; anywhere wide enough (a blog post, a full-width page
 * area) automatically becomes a multi-column card grid, using auto-fill
 * so the column count itself keeps adapting as the container resizes.
 * ------------------------------------------------------------------- */
@container (min-width: 480px) {
	.mdw-list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 20px;
	}

	.mdw-item {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
		margin: 0;
		padding: 0;
		border-bottom: none;
		gap: 8px;
	}

	.mdw-image-link {
		align-self: center;
	}

	/* Images scale with the column instead of the fixed sidebar size,
	   keeping each source's natural aspect ratio. */
	.mdw-source-letterboxd .mdw-image,
	.mdw-source-letterboxd .mdw-image-placeholder {
		width: 100%;
		max-width: 160px;
		height: auto;
		aspect-ratio: 2 / 3;
	}

	.mdw-source-recordclub .mdw-image,
	.mdw-source-recordclub .mdw-image-placeholder {
		width: 100%;
		max-width: 160px;
		height: auto;
		aspect-ratio: 1 / 1;
	}

	/* Goodreads: still height-led rather than a fixed crop box, just scaled
	   up to match the larger card layout. The box is sized on the LINK
	   itself (not just the image) because .mdw-image-link shrink-wraps to
	   its content in this layout — a max-width on the image alone would be
	   measured against that same shrink-wrapped box and do nothing, which
	   was letting wide-aspect covers render arbitrarily large. object-fit:
	   contain (not cover) since there's spare width in a card, so odd-
	   shaped covers show in full instead of being cropped. */
	.mdw-source-goodreads .mdw-image-link {
		width: 100%;
		max-width: 147px;
		height: 220px;
	}

	.mdw-source-goodreads .mdw-image,
	.mdw-source-goodreads .mdw-image-placeholder {
		width: 100%;
		height: 100%;
		max-width: none;
		object-fit: contain;
	}

	.mdw-profile-link {
		text-align: center;
	}
}

/* Combined [media_diary source="a,b"] output. */
.mdw-multi-section + .mdw-multi-section {
	margin-top: 24px;
}

.mdw-section-heading {
	margin: 0 0 10px 0;
}

.mdw-debug {
	margin-top: 12px;
	padding: 10px;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	font-size: 12px;
}

.mdw-debug details {
	margin-bottom: 8px;
}

.mdw-debug pre {
	max-height: 200px;
	overflow: auto;
	background: #fff;
	padding: 6px;
	border: 1px solid #dcdcde;
}