/**
 * Homepage grid + category tiles.
 *
 * Explicit 4-up at desktop, NOT the archive's auto-fill minmax(180px) — that yields ~7
 * narrow columns at 1440px, which reads as a contact sheet rather than a browse surface.
 * Colours come from the app-chrome tokens (--ek-accent / --ek-ink); nothing new here.
 */

.ek-home {
	/* Same two tokens the header aligns to (app-chrome.css :root) — that shared shell is
	   what keeps the wordmark and the first card on one left edge. */
	max-width: var(--ek-shell, 1600px);
	margin: 0 auto;
	padding: var(--ek-shell-pad, 18px) var(--ek-shell-pad, 18px) 40px;
	color: var(--ek-ink, #f4f4f6);
}

.ek-home__h1 {
	margin: 4px 0 10px;
	font-size: 20px;
	font-weight: 800;
	color: #fff;
}

.ek-home__sechead {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 26px 0 12px;
}
.ek-home__sectitle { margin: 0; font-size: 17px; font-weight: 800; color: #fff; }
.ek-home__secsub { font-size: 12px; color: #8a8a92; }
.ek-home__secmore {
	margin-left: auto;
	color: var(--ek-accent, #ff2b5e);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.ek-home__secmore:hover { text-decoration: underline; }

.ek-home__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.ek-home__shorts {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 14px;
}

/* ---- Homepage banner ad ---------------------------------------------------
   The zone serves a fixed 900x250 creative. Two things to fix: it sprawled at full
   width (cap + centre + scale via js/home.js's --ek-ad-fit), and a bare box reserved
   ~200px even when nothing filled — a dead gap for the many adblocked visitors.
   So the box starts COLLAPSED and js/home.js adds .is-filled only once a creative
   paints: no fill, no space. */
.ek-home__ad {
	--w: var(--ek-ad-w, 900);
	--h: var(--ek-ad-h, 250);
	position: relative;
	width: 100%;
	max-width: 728px;
	height: 0;          /* collapsed until a creative fills (adblock/unsold => no gap) */
	margin: 0 auto;
	overflow: hidden;
}
.ek-home__ad.is-filled {
	height: auto;
	aspect-ratio: var(--w) / var(--h);
	margin: 24px auto;
}
.ek-home__ad .ek-ad-slot {
	position: absolute;
	top: 0;
	left: 50%;
	display: grid;
	place-items: center;
	width: calc(var(--w) * 1px);
	height: calc(var(--h) * 1px);
	transform: translateX(-50%) scale(var(--ek-ad-fit, 1));
	transform-origin: top center;
}
.ek-home__ad .ek-ad-slot--fixture {
	width: calc(var(--w) * 1px);
	height: calc(var(--h) * 1px);
}

/* ---- Category tiles ------------------------------------------------------ */

.ek-home__cats {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 12px;
}
.ek-cattile {
	position: relative;
	display: flex;
	align-items: flex-end;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-radius: 10px;
	background: #17171a;
	text-decoration: none;
}
.ek-cattile__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.18s ease;
}
.ek-cattile::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0) 62%);
}
.ek-cattile__name {
	position: relative;
	z-index: 2;
	padding: 9px 10px;
	font-size: 13px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.ek-cattile__count {
	position: absolute;
	z-index: 2;
	top: 7px;
	right: 7px;
	padding: 2px 7px;
	border-radius: 20px;
	background: rgba(0, 0, 0, 0.6);
	font-size: 10.5px;
	color: #d6d6da;
}
.ek-cattile:hover .ek-cattile__img { transform: scale(1.04); }

/* ---- Pager --------------------------------------------------------------- */

.ek-home__pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 30px;
}
.ek-home__page {
	padding: 7px 13px;
	border-radius: 7px;
	background: rgba(255, 255, 255, 0.06);
	color: #c9c6d0;
	font-size: 13px;
	text-decoration: none;
}
.ek-home__page:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ek-home__page.is-current { background: var(--ek-accent, #ff2b5e); color: #fff; font-weight: 800; }

/* ---- Responsive ---------------------------------------------------------- */

@media (max-width: 1023px) {
	.ek-home__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
	.ek-home__cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
	/* Bottom padding clears the fixed mobile bottom nav. */
	.ek-home { padding: 12px 12px 96px; }
	.ek-home__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
	.ek-home__cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ek-home__sectitle { font-size: 15px; }
	.ek-home__h1 { font-size: 17px; }
	/* 8 portrait tiles never fit 2-up — the strip becomes a snap scroller. */
	.ek-home__shorts {
		display: flex;
		gap: 10px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
	}
	.ek-home__shorts > * { flex: 0 0 38vw; scroll-snap-align: start; }
}
