/*
 * Bento-Box (Block „bento“, snippets/blocks/bento.php).
 * Breite/Höhe jeder Kachel kommen als --cols/--rows aus dem Panel.
 *
 * Handy:   Spalten untereinander, Spalte 3 als 4er-Raster mit Foto rechts.
 * Tablet:  Spalte 1 + 2 nebeneinander, Spalte 3 als Streifen darunter (8er-Raster, 2 Zeilen).
 * Desktop: drei Spalten 24rem / 24rem / 12rem.
 */

.bento {
	--bento-blue: #009ee2;
	--bento-pink: #e200bf;
	--bento-tile: #131313;
	--bento-gap: 0.5rem;
	--bento-row: 5rem;

	display: grid;
	row-gap: var(--bento-gap);
	margin: 1rem -1rem;
	padding: 1rem;
	background: #000;
	color: #fff;
}

.bento__col {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-auto-rows: var(--bento-row);
	grid-auto-flow: dense;
	gap: var(--bento-gap);
	padding: 0 0.25rem;
}

/* ---------- Kachel ---------- */

.bento__tile {
	grid-column: span var(--cols, 2);
	grid-row: span var(--rows, 1);
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	min-height: 0;
	padding: 1rem 0.25rem;
	overflow: hidden;
	border-radius: 1rem;
	background: var(--bento-tile);
	color: #fff;
	text-align: center;
	text-decoration: none;
	font-size: 0.8rem;
	line-height: 1.1;
	letter-spacing: 0.05em;
}

/* gegen „.site-content a“ aus dem Theme */
.bento a.bento__tile {
	color: #fff;
	text-decoration: none;
}

a.bento__tile:hover .bento__subtitle,
a.bento__tile:focus-visible .bento__subtitle {
	text-decoration: underline;
}

a.bento__tile:focus-visible {
	outline: 2px solid var(--bento-blue);
	outline-offset: 2px;
}

.bento__title {
	display: block;
	padding: 0.25rem 0;
	font-size: 1.3rem;
	font-weight: 600;
	line-height: 1;
}

.bento__subtitle {
	display: block;
}

.bento__media {
	display: block;
	flex: 0 1 auto;
	width: auto;
	max-width: 85%;
	min-height: 0;
	max-height: 100%;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
}

video.bento__media {
	width: 80%;
}

.bento__tile--small-media .bento__media {
	max-width: 50%;
}

/* ---------- Stile ---------- */

.bento__tile--big .bento__title {
	font-size: 4rem;
	line-height: 1;
}

.bento__tile--gradient-blue .bento__title,
.bento__tile--gradient-pink .bento__title,
.bento__tile--gradient-mix .bento__title {
	color: transparent;
	-webkit-background-clip: text;
	background-clip: text;
}
.bento__tile--gradient-blue .bento__title { background-image: linear-gradient(90deg, var(--bento-blue), #fff); }
.bento__tile--gradient-pink .bento__title { background-image: linear-gradient(90deg, var(--bento-pink), #fff); }
.bento__tile--gradient-mix .bento__title  { background-image: linear-gradient(90deg, var(--bento-pink), var(--bento-blue)); }

.bento__tile--glow {
	border: 0.2rem solid var(--bento-blue);
	box-shadow: 0 0 1rem var(--bento-blue);
}

.bento__tile--blue {
	background: var(--bento-blue);
	box-shadow: 0 0 1rem var(--bento-blue);
}

.bento__tile--photo {
	padding: 0;
	justify-content: flex-end;
}
.bento__tile--photo .bento__media {
	position: absolute;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	object-fit: cover;
}
.bento__tile--photo .bento__title,
.bento__tile--photo .bento__subtitle {
	position: relative;
	z-index: 1;
}
.bento__tile--photo > :last-child:not(.bento__media) {
	margin-bottom: 0.5rem;
}

/* Abgeschaltete Ecken (Puzzle-Optik) */
.bento__tile--flat-tl { border-top-left-radius: 0; }
.bento__tile--flat-tr { border-top-right-radius: 0; }
.bento__tile--flat-bl { border-bottom-left-radius: 0; }
.bento__tile--flat-br { border-bottom-right-radius: 0; }

/* ---------- Handy ---------- */

@media (max-width: 599.98px) {
	/* Kleine Kacheln brachen sonst mitten im Wort um */
	.bento__tile {
		letter-spacing: 0;
	}
	.bento__tile[data-cols="1"] .bento__subtitle {
		font-size: 0.7rem;
	}
}

@media (max-width: 779.98px) {
	.bento__col {
		padding: 0 0.5rem;
	}
	/* Spalte 3: Foto rechts über die ganze Höhe, der Rest füllt links auf */
	.bento__col--narrow .bento__tile--photo {
		grid-column: 3 / -1;
		grid-row: 1 / span var(--rows, 3);
	}
}

@media (min-width: 600px) {
	.bento {
		--bento-row: 6rem;
	}
	.bento__media {
		max-width: 80%;
	}
}

/* ---------- Tablet ---------- */

@media (min-width: 780px) and (max-width: 74.99rem) {
	.bento {
		grid-template-columns: 1fr 1fr;
		padding: 0.5rem;
	}
	.bento__col--narrow {
		grid-column: 1 / -1;
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}
	/* Als Streifen höchstens 2 Zeilen hoch; breite Kacheln bekommen mehr Platz */
	.bento__col--narrow .bento__tile[data-rows="3"] {
		grid-row: span 2;
	}
	.bento__col--narrow .bento__tile[data-cols="2"]:not(.bento__tile--photo) {
		grid-column: span 3;
	}
	.bento__col--narrow .bento__tile.bento__tile--photo {
		grid-column: 5 / -1;
		grid-row: 1 / span 2;
	}
}

/* ---------- Desktop ---------- */

@media (min-width: 75rem) {
	.bento {
		grid-template-columns: 24rem 24rem 12rem;
		justify-content: center;
	}
	.bento__col--narrow {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
