/**
 * [trainings_bento] — asymmetric tile mosaic.
 *
 * Visual values live in --tb-* custom properties scoped to .tb-wrapper.
 * Override per-site via a skin stylesheet or TR_Post_Types::inject_color_vars
 * on the tr-bento-v1-styles handle.
 *
 * @package Tobalt_Renginiai
 * @author  Tobalt — https://tobalt.lt
 */

.tb-wrapper {
	/* Foundation tokens (override per skin) */
	--tb-gap: 16px;
	--tb-row-height: 180px;         /* desktop; overridden via inline style per shortcode-attr */
	--tb-radius: var(--tr-radius, 12px);

	--tb-gradient-overlay-bg: linear-gradient(to top, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.55) 45%, rgba(15, 23, 42, 0) 85%);
	--tb-title-fg: #ffffff;
	--tb-date-fg: rgba(255, 255, 255, 0.88);

	--tb-badge-bg: rgba(255, 255, 255, 0.92);
	--tb-badge-fg: var(--tr-color-text, #0F172A);
	--tb-badge-radius: 999px;

	--tb-fallback-bg: #1F2937;
	--tb-font-family: var(--tr-font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);

	font-family: var(--tb-font-family);

	/* Mobile-first: 2-column grid, auto rows */
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--tb-gap);
}

/* --------------------------------------------------------------------- */
/* Desktop: 4-col grid with fixed row height; tb-tile--large spans 2x2   */
/* --------------------------------------------------------------------- */
@media (min-width: 1024px) {
	.tb-wrapper {
		grid-template-columns: repeat(4, 1fr);
		grid-auto-rows: var(--tb-row-height);
	}
	.tb-tile--large {
		grid-row: span 2;
		grid-column: span 2;
	}
}

/* --------------------------------------------------------------------- */
/* Tile (the <a> wrapper)                                                 */
/* --------------------------------------------------------------------- */
.tb-tile {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--tb-radius);
	background-color: var(--tb-fallback-bg);
	text-decoration: none;
	color: var(--tb-title-fg);
	min-height: 220px;
	transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

@media (min-width: 1024px) {
	.tb-tile { min-height: 0; }  /* let grid-auto-rows control on desktop */
}

.tb-tile:hover,
.tb-tile:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
}
.tb-tile:focus-visible {
	outline: 2px solid var(--tb-title-fg);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------- */
/* Tile background image                                                  */
/* --------------------------------------------------------------------- */
.tb-tile__bg {
	position: absolute;
	inset: 0;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

/* --------------------------------------------------------------------- */
/* Category badge (top-right)                                             */
/* --------------------------------------------------------------------- */
.tb-tile__badge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	padding: 4px 12px;
	background: var(--tb-badge-bg);
	color: var(--tb-badge-fg);
	border-radius: var(--tb-badge-radius);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------- */
/* Gradient + title + date overlay (bottom)                               */
/* --------------------------------------------------------------------- */
.tb-tile__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	padding: 16px 18px;
	background: var(--tb-gradient-overlay-bg);
	color: var(--tb-title-fg);
}

.tb-tile__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--tb-title-fg);
}
.tb-tile--large .tb-tile__title {
	font-size: 1.4rem;
}

.tb-tile__date {
	margin: 4px 0 0;
	font-size: 0.82rem;
	color: var(--tb-date-fg);
}

/* --------------------------------------------------------------------- */
/* Empty / fallback-notice                                                */
/* --------------------------------------------------------------------- */
.tb-empty {
	padding: 40px 16px;
	text-align: center;
	color: rgba(15, 23, 42, 0.62);
}
.tb-fallback-notice {
	grid-column: 1 / -1;            /* span all columns on mobile + desktop */
	padding: 12px 16px;
	margin: 0 0 4px;
	background: rgba(245, 158, 11, 0.08);
	border-left: 3px solid #F59E0B;
	color: rgba(15, 23, 42, 0.72);
	border-radius: 6px;
	font-size: 0.92rem;
}
