/**
 * Magazine patterns pack (0.17.0-alpha.1).
 *
 * Loaded ONLY on pages whose homepage composition uses a pack section
 * (mosaic, mix, thumb-list, text-list, carousel) and only while
 * features.patterns_enabled is on — zero bytes anywhere else.
 * Logical properties throughout; RTL needs no generated twin.
 */

/* Section heading bar: linked heading + View-all (Publisher style). */
.bosla-home-heading-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-block-end: 1rem;
}

.bosla-home-heading-bar .bosla-home-heading {
	margin-block-end: 0;
}

.bosla-home-heading-linked a {
	text-decoration: none;
	color: inherit;
}

.bosla-home-heading-linked a:hover {
	color: var(--bosla-color-accent, #0a7ea4);
}

.bosla-home-viewall {
	flex: none;
	font-size: 0.85rem;
	font-weight: 700;
	text-decoration: none;
	color: var(--bosla-color-accent, #0a7ea4);
}

.bosla-home-viewall::after {
	content: "\2192";
	margin-inline-start: 0.35rem;
}

[dir="rtl"] .bosla-home-viewall::after {
	content: "\2190";
}

.bosla-home-viewall:hover {
	text-decoration: underline;
}

/* Category chip. */
.bosla-chip {
	display: inline-block;
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	background: var(--bosla-color-accent, #0a7ea4);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0.01em;
}

/* Overlay card (mosaic tiles + carousel items). */
.bosla-overlay-card {
	position: relative;
	overflow: hidden;
	border-radius: var(--bosla-radius, 14px);
	background: var(--bosla-color-surface-raised, #10151c);
	isolation: isolate;
}

.bosla-overlay-card .bosla-overlay-media {
	position: absolute;
	inset: 0;
}

.bosla-overlay-card .bosla-overlay-img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.bosla-overlay-card::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgb(8 10 14 / 0.82) 0%, rgb(8 10 14 / 0.25) 45%, rgb(8 10 14 / 0.05) 100%);
	z-index: 1;
}

.bosla-overlay-body {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.4rem;
	justify-content: flex-end;
	block-size: 100%;
	padding: 1rem;
	color: #fff;
}

.bosla-overlay-title {
	margin: 0;
	font-size: 1rem;
	line-height: 1.45;
}

.bosla-overlay-title a {
	color: #fff;
	text-decoration: none;
}

.bosla-overlay-title a:hover {
	text-decoration: underline;
}

.bosla-overlay-ago {
	font-size: 0.75rem;
	opacity: 0.85;
}

/* Mosaic: lead cover + tiles. */
.bosla-mosaic {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: 10rem;
	gap: 0.75rem;
}

.bosla-mosaic-cell,
.bosla-mosaic-cell .bosla-overlay-card {
	block-size: 100%;
}

.bosla-mosaic-lead {
	grid-column: 1 / -1;
	grid-row: span 2;
}

.bosla-mosaic-lead .bosla-overlay-card .bosla-overlay-title {
	font-size: 1.35rem;
}

@media (min-width: 48rem) {
	.bosla-mosaic {
		grid-auto-rows: 11rem;
	}

	.bosla-mosaic-cell:not(.bosla-mosaic-lead):nth-of-type(2),
	.bosla-mosaic-cell:not(.bosla-mosaic-lead):nth-of-type(3) {
		grid-column: span 2;
	}
}

@media (max-width: 47.9375rem) {
	.bosla-mosaic {
		grid-template-columns: repeat(2, 1fr);
	}

	.bosla-mosaic-cell {
		grid-column: span 1;
	}
}

/* Mix: featured card + compact list. */
.bosla-mix {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	align-items: start;
}

@media (min-width: 48rem) {
	.bosla-mix {
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	}
}

.bosla-mix-lead .bosla-card-title {
	font-size: 1.25rem;
}

.bosla-mix-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--bosla-color-border, #e2e5e9);
	border-radius: var(--bosla-radius, 14px);
	overflow: hidden;
}

.bosla-mix-item {
	padding: 0.8rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.bosla-mix-item + .bosla-mix-item {
	border-block-start: 1px solid var(--bosla-color-border, #e2e5e9);
}

.bosla-mix-item-title {
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	line-height: 1.5;
}

.bosla-mix-item-title:hover {
	color: var(--bosla-color-accent, #0a7ea4);
}

.bosla-mix-item-ago,
.bosla-thumb-ago,
.bosla-text-item-ago {
	font-size: 0.75rem;
	color: var(--bosla-color-muted, #646970);
}

/* Thumbnail list rows. */
.bosla-thumb-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.9rem;
}

.bosla-thumb-item {
	display: flex;
	gap: 0.85rem;
	align-items: flex-start;
}

.bosla-thumb-media {
	flex: none;
	inline-size: 5rem;
	block-size: 3.4rem;
	border-radius: 10px;
	overflow: hidden;
	background: var(--bosla-color-surface-raised, #f0f0f1);
}

.bosla-thumb-img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.bosla-thumb-body {
	min-inline-size: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.bosla-thumb-title {
	margin: 0;
	font-size: 0.98rem;
	line-height: 1.5;
}

.bosla-thumb-title a {
	text-decoration: none;
	color: inherit;
}

.bosla-thumb-title a:hover {
	color: var(--bosla-color-accent, #0a7ea4);
}

/* Numbered text list. */
.bosla-text-list {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: bosla-text-item;
	border: 1px solid var(--bosla-color-border, #e2e5e9);
	border-radius: var(--bosla-radius, 14px);
	overflow: hidden;
}

.bosla-text-item {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	padding: 0.8rem 1rem;
}

.bosla-text-item + .bosla-text-item {
	border-block-start: 1px solid var(--bosla-color-border, #e2e5e9);
}

.bosla-text-item::before {
	counter-increment: bosla-text-item;
	content: counter(bosla-text-item, decimal-leading-zero);
	flex: none;
	font-weight: 800;
	font-size: 0.9rem;
	color: var(--bosla-color-accent, #0a7ea4);
	font-variant-numeric: tabular-nums;
}

.bosla-text-item-title {
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	line-height: 1.5;
	min-inline-size: 0;
}

.bosla-text-item-title:hover {
	color: var(--bosla-color-accent, #0a7ea4);
}

.bosla-text-item-ago {
	margin-inline-start: auto;
	flex: none;
}

/* Carousel: native scroll-snap, buttons only assist. */
.bosla-carousel-wrap {
	position: relative;
}

.bosla-carousel {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(15rem, 1fr);
	gap: 0.75rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-block-end: 0.25rem;
}

.bosla-carousel::-webkit-scrollbar {
	display: none;
}

.bosla-carousel .bosla-overlay-card {
	scroll-snap-align: start;
	block-size: 16rem;
}

/* Pages carousel overlay: title sits ON the image (same overlay skin as
   the posts carousel). Empty pages keep the branded gradient + compass. */
.bosla-pages-carousel .bosla-overlay-media {
	background: linear-gradient(135deg, #0d6861, #10233f);
}

.bosla-pages-carousel .bosla-page-card-ph {
	color: rgba(255, 255, 255, 0.85);
}

/* Page card (card grid only): image on top — or a branded gradient
   fallback with the compass mark when a page has no featured image — then
   title + excerpt below. */
.bosla-page-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	border-radius: 14px;
	overflow: hidden;
	background: var(--bosla-color-surface, #fff);
	border: 1px solid var(--bosla-color-border, #e2e5e9);
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.bosla-page-card:hover {
	box-shadow: 0 10px 26px rgba(16, 24, 40, 0.14);
	transform: translateY(-2px);
}

.bosla-page-card-media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, #0d6861, #10233f);
}

.bosla-page-card-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bosla-page-card-ph {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.85);
}

.bosla-page-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding: 0.9rem 1rem 1.1rem;
}

.bosla-page-card-title {
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.4;
}

.bosla-page-card-title a {
	color: inherit;
}

.bosla-page-card-excerpt {
	color: var(--bosla-color-muted, #5b6472);
	font-size: 0.9rem;
	line-height: 1.6;
}

/* Pages carousel: exactly 4 cards per screen; the 5th onward is reached
   with the prev/next controls (gap 0.75rem × 3 = 2.25rem). */
.bosla-pages-carousel .bosla-carousel {
	grid-auto-columns: calc((100% - 2.25rem) / 4);
	align-items: stretch;
}

.bosla-pages-carousel .bosla-overlay-card {
	scroll-snap-align: start;
}

/* Pages card grid: static 4-up grid (second pages layout). */
.bosla-pages-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.9rem;
}

@media (max-width: 900px) {
	.bosla-pages-carousel .bosla-carousel {
		grid-auto-columns: calc((100% - 0.75rem) / 2);
	}

	.bosla-pages-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.bosla-pages-carousel .bosla-carousel {
		grid-auto-columns: 100%;
	}

	.bosla-pages-grid {
		grid-template-columns: 1fr;
	}
}

.bosla-carousel-nav {
	display: flex;
	gap: 0.4rem;
	justify-content: flex-end;
	margin-block-end: 0.6rem;
}

.bosla-carousel-btn {
	inline-size: 2.2rem;
	block-size: 2.2rem;
	border-radius: 999px;
	border: 1px solid var(--bosla-color-border, #e2e5e9);
	background: var(--bosla-color-surface, #fff);
	color: inherit;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* The "prev" glyph is the next glyph mirrored. */
.bosla-carousel-btn:first-child {
	transform: scaleX(-1);
}

.bosla-carousel-btn:hover {
	border-color: var(--bosla-color-accent, #0a7ea4);
	color: var(--bosla-color-accent, #0a7ea4);
}
