/*
 * Tiles of the tile area and the Berichte list (doc/spec/ui/post-tiles). The photo stays in colour;
 * the text block and the label carry the colour of the square. A tile is a dark square; the
 * widgets make the light squares of the chess board by setting the --lvooe-tile-* variables per
 * position (Lvooe_Post_Tiles_Base::light_tiles_css()).
 */

.lvooe-post-tiles-widget {
	--lvooe-light-bg: #E7E7E7;
	--lvooe-light-fg: #000;
	--lvooe-light-rgb: 231, 231, 231;

	background-color: white;
	display: grid;
	gap: 2px;
}

.lvooe-post-tiles-grid-item {
	--lvooe-tile-bg: #0b0b0b;
	--lvooe-tile-fg: #fff;
	/* Colour of the text block as "r, g, b", for the gradient below. */
	--lvooe-tile-rgb: 11, 11, 11;
	--lvooe-tile-backdrop: blur(16px) brightness(0.55);

	position: relative;
	display: block;
	overflow: hidden;
	background: var(--lvooe-tile-bg);
	color: var(--lvooe-tile-fg);
	text-decoration: none;
	/* The compact layout below depends on the width of the tile, not of the screen. */
	container-type: inline-size;
	outline: none;
}

.lvooe-post-tiles-grid-item:hover,
.lvooe-post-tiles-grid-item:focus {
	color: var(--lvooe-tile-fg);
}

/* Prefixed to win over Elementor's "img { height: auto }". */
.lvooe-post-tiles-grid-item .lvooe-post-tile-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

/* Image rule: anything but a photo is shown whole on a blurred, darkened copy of itself. */
.lvooe-post-tile--contain .lvooe-post-tile-image {
	object-fit: contain;
}

.lvooe-post-tiles-grid-item .lvooe-post-tile-image--backdrop {
	top: -24px;
	left: -24px;
	width: calc(100% + 48px);
	height: calc(100% + 48px);
	object-fit: cover;
	filter: var(--lvooe-tile-backdrop);
}

.lvooe-post-tiles-grid-item:hover .lvooe-post-tile-image {
	transform: scale(1.04);
}

/* Highlight like a square of a move: mouse and keyboard focus. */
.lvooe-post-tiles-grid-item::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	box-shadow: inset 0 0 0 0 #C3E7A3;
	transition: box-shadow 0.15s ease;
}

.lvooe-post-tiles-grid-item:hover::after,
.lvooe-post-tiles-grid-item:focus-visible::after {
	box-shadow: inset 0 0 0 5px #C3E7A3;
}

.lvooe-post-tile {
	position: relative;
	box-sizing: border-box;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	/* Here and not on the link: the site's "a { color }" wins over the link's class. */
	color: var(--lvooe-tile-fg);
	overflow: hidden;
}

/* The label sits on a small plate in the colour of the square, readable on any photo. */
.lvooe-post-tile-label {
	position: absolute;
	top: 16px;
	left: 16px;
	box-sizing: border-box;
	max-width: calc(100% - 32px);
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	background: var(--lvooe-tile-bg);
	font-size: 13px;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.lvooe-post-tile:has(.lvooe-post-tile-calendar) .lvooe-post-tile-label {
	max-width: calc(100% - 112px);
}

.lvooe-post-tile:has(.lvooe-post-tile-calendar--wide) .lvooe-post-tile-label {
	max-width: calc(100% - 132px);
}

.lvooe-post-tile-label-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lvooe-post-tile-piece {
	flex: none;
	width: 18px;
	height: 18px;
}

/* Calendar sheet of a Termin, top right. */
.lvooe-post-tile-calendar {
	position: absolute;
	top: 16px;
	right: 16px;
	min-width: 58px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 6px;
	background: #fff;
	color: #000;
	text-align: center;
	line-height: 1;
}

.lvooe-post-tile-calendar-month {
	padding: 5px 8px 4px;
	background: #000;
	color: #fff;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

.lvooe-post-tile-calendar-day {
	padding: 6px 8px 2px;
	font-size: 24px;
	font-weight: 700;
	white-space: nowrap;
}

.lvooe-post-tile-calendar-weekday {
	padding: 0 8px 6px;
	color: #555;
	font-size: 11px;
	white-space: nowrap;
}

/* Text block at the bottom: the colour of the square, fading out above the text into the photo. */
.lvooe-post-tile-content {
	--lvooe-fade: 56px;

	display: flex;
	flex-direction: column;
	padding: var(--lvooe-fade) 28px 24px;
	background: linear-gradient(0deg,
		rgba(var(--lvooe-tile-rgb), 0.93) 0%,
		rgba(var(--lvooe-tile-rgb), 0.86) calc(100% - var(--lvooe-fade)),
		rgba(var(--lvooe-tile-rgb), 0) 100%);
}

.lvooe-post-tile-content p {
	margin: 0;
}

.lvooe-post-tile-content .lvooe-post-tile-date {
	margin-bottom: 8px;
	font-size: 15px;
	font-weight: 500;
}

.lvooe-post-tile .lvooe-post-tile-content h3 {
	margin: 0;
	color: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.lvooe-post-tile-content .lvooe-post-tile-place {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
	font-size: 15px;
}

.lvooe-post-tile-place span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lvooe-post-tile-icon {
	flex: none;
	width: 15px;
	height: 15px;
}

.lvooe-post-tile-content .lvooe-post-tile-verein {
	margin-top: 6px;
	font-size: 14px;
	opacity: 0.85;
}

.lvooe-post-tile-content .lvooe-post-tile-excerpt {
	margin-top: 8px;
	font-size: 15px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Small tiles (e.g. two columns on a phone): label, date, title, place or Verein; no excerpt.
   The type stays beside the chess piece, cut with "…" before the calendar sheet. */
@container (max-width: 260px) {
	.lvooe-post-tile-label {
		top: 8px;
		left: 8px;
		max-width: calc(100% - 16px);
		gap: 3px;
		padding: 3px 5px;
		font-size: 10px;
		letter-spacing: 0.02em;
	}

	.lvooe-post-tile:has(.lvooe-post-tile-calendar) .lvooe-post-tile-label {
		max-width: calc(100% - 62px);
	}

	.lvooe-post-tile:has(.lvooe-post-tile-calendar--wide) .lvooe-post-tile-label {
		max-width: calc(100% - 82px);
	}

	.lvooe-post-tile-content {
		--lvooe-fade: 32px;

		padding: var(--lvooe-fade) 12px 12px;
	}

	.lvooe-post-tile-piece {
		width: 15px;
		height: 15px;
	}

	.lvooe-post-tile-calendar {
		top: 8px;
		right: 8px;
		min-width: 46px;
		border-radius: 5px;
	}

	.lvooe-post-tile-calendar-month {
		padding: 4px 6px 3px;
		font-size: 10px;
	}

	.lvooe-post-tile-calendar-day {
		padding: 4px 6px 1px;
		font-size: 18px;
	}

	.lvooe-post-tile-calendar-weekday {
		padding: 0 6px 4px;
		font-size: 10px;
	}

	.lvooe-post-tile-content .lvooe-post-tile-date {
		margin-bottom: 4px;
		font-size: 12px;
	}

	.lvooe-post-tile .lvooe-post-tile-content h3 {
		font-size: 15px;
		-webkit-line-clamp: 4;
	}

	.lvooe-post-tile-content .lvooe-post-tile-place,
	.lvooe-post-tile-content .lvooe-post-tile-verein {
		margin-top: 4px;
		font-size: 12px;
	}

	.lvooe-post-tile-icon {
		width: 12px;
		height: 12px;
	}

	.lvooe-post-tile-content .lvooe-post-tile-excerpt {
		display: none;
	}
}

/* Chess board of the tile area ("Kachelbereich") and the Berichte list: square tiles without gaps.
   Columns, light squares and, in the tile area, place of the intro, aspect ratio and hidden tiles
   come per device from the widget's own <style>. */

.lvooe-post-tiles-widget--board {
	gap: 0;
	background: none;
}

/* min-height wins over the one in the site's custom CSS. */
.lvooe-post-tiles-widget--board .lvooe-post-tiles-grid-item {
	aspect-ratio: 1;
	min-height: 0;
	overflow: hidden;
}

.lvooe-post-tiles-intro {
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
