/**
 * Tiles (0.86.0) — see includes/class-asc-tiles.php.
 * The home page "menu": a grid of image-backed cards. Colours are the theme's
 * --alexi-* tokens; the white text on a picture is the one literal.
 */

.asc-tiles {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( min( var( --asc-tile-min, 230px ), 100% ), 1fr ) );
	gap: var( --asc-tile-gap, 14px );
	margin: 0 0 1.5rem;
}

.asc-tile,
a.asc-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	box-sizing: border-box;
	/* 0.86.1 — Alex: "All tiles should be 16:9 format." The shape follows the
	   column width, so every tile in a row is the same size; a double-width
	   tile is 32:9 so it stays level with its neighbours. --asc-tile-h is
	   now only a floor. */
	aspect-ratio: 16 / 9;
	min-height: var( --asc-tile-h, 0px );
	padding: 16px;
	border: 1px solid var( --alexi-line, #e7e6e1 );
	border-radius: 8px;
	overflow: hidden;
	background: var( --alexi-surface, #efefec );
	color: #fff;
	text-decoration: none !important;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease;
}
div.asc-tile { cursor: default; }
.asc-tile.is-wide { grid-column: span 2; aspect-ratio: 32 / 9; }
.asc-tile.is-tall { aspect-ratio: 4 / 3; }

.asc-tile:hover,
.asc-tile:focus-visible {
	transform: translateY( -3px );
	box-shadow: 0 10px 24px rgba( 10, 16, 24, .18 );
	outline: none;
}
a.asc-tile:focus-visible { box-shadow: 0 0 0 3px var( --alexi-focus-ring, rgba( 60, 79, 98, .3 ) ), 0 10px 24px rgba( 10, 16, 24, .18 ); }
/* The theme's :where(a) hover tint must not catch tiles. */
a.asc-tile:hover { background: var( --alexi-surface, #efefec ); color: #fff; }

.asc-tile-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	margin: 0;
	border-radius: 0;
}
.asc-tile-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient( to top, rgba( 10, 16, 24, .78 ) 0%, rgba( 10, 16, 24, .25 ) 55%, rgba( 10, 16, 24, 0 ) 100% );
}
.asc-tile-body {
	position: relative;
	z-index: 1;
	display: block;
	min-width: 0;
}
.asc-tile-title {
	display: block;
	font-size: 1.2rem;
	font-weight: 400;
	line-height: 1.2;
	color: #fff;
	text-wrap: balance;
}
.asc-tile-text {
	display: block;
	margin-top: 4px;
	font-size: .85rem;
	line-height: 1.4;
	color: rgba( 255, 255, 255, .9 );
}

/* Tiles without a picture: a plain tone, text in the theme's ink. */
.asc-tile.is-plain .asc-tile-shade { display: none; }
.asc-tile.is-tone-surface { background: var( --alexi-surface, #efefec ); }
.asc-tile.is-tone-surface,
.asc-tile.is-tone-surface .asc-tile-title { color: var( --alexi-ink, #1a1a1a ); }
.asc-tile.is-tone-surface .asc-tile-text { color: var( --alexi-body, #2e2e2c ); }
.asc-tile.is-tone-mint { background: var( --alexi-mint, #7fdfbf ); }
.asc-tile.is-tone-mint,
.asc-tile.is-tone-mint .asc-tile-title { color: var( --alexi-ink, #1a1a1a ); }
.asc-tile.is-tone-mint .asc-tile-text { color: var( --alexi-body, #2e2e2c ); }
.asc-tile.is-tone-ink { background: var( --alexi-ink, #1a1a1a ); }
a.asc-tile.is-tone-ink:hover { background: var( --alexi-accent, #3c4f62 ); }
a.asc-tile.is-tone-mint:hover { background: var( --alexi-mint, #7fdfbf ); }
a.asc-tile.is-tone-surface:hover { background: var( --alexi-btn-bg-hover, #deded9 ); }

@media ( max-width: 520px ) {
	.asc-tile.is-wide { grid-column: span 1; aspect-ratio: 16 / 9; }
	.asc-tile { padding: 14px; }
	.asc-tile-title { font-size: 1.1rem; }
}

@media ( prefers-reduced-motion: reduce ) {
	.asc-tile { transition: none; }
	.asc-tile:hover { transform: none; }
}

/* Editor canvas: the same look, plus a dashed frame where no picture is set
   yet and a small hint of what the tile does. */
.asc-tile-ed { position: relative; }
.asc-tile-ed .asc-tile { cursor: default; transform: none !important; box-shadow: none !important; }
.asc-tile-ed .asc-tile.is-empty { border-style: dashed; border-color: var( --alexi-outline, #c9c8c3 ); }
.asc-tile-ed .asc-tile-title[data-rich-text-placeholder]::after,
.asc-tile-ed .asc-tile-text[data-rich-text-placeholder]::after { opacity: .7; }
.asc-tile-ed .asc-tile-kind {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	padding: 2px 7px;
	border-radius: 3px;
	background: rgba( 255, 255, 255, .9 );
	color: var( --alexi-tint-ink, #0f2a47 );
	font: 500 10px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	letter-spacing: .14em;
	text-transform: uppercase;
	pointer-events: none;
}
.asc-tile-ed .asc-tile-pick {
	position: absolute;
	left: 12px;
	top: 12px;
	z-index: 2;
}
.asc-tiles-ed-appender { margin-top: 8px; }
