/* ============================================================
   The Learning Sutra — Home Blog
   Parchment-first storybook editorial section.
   Orchid #E662D9 · Sky #45A8FF · Ink #202020 · Blush #FCE6FA
   ============================================================ */

.tls-hb {
	--tls-hb-bg: #F8F5F3;
	--tls-hb-orchid: #E662D9;
	--tls-hb-orchid-deep: #C754CD;
	--tls-hb-sky: #45A8FF;
	--tls-hb-ink: #202020;
	--tls-hb-blush: #FCE6FA;
	--tls-hb-card: #FFFFFF;
	--tls-hb-muted: #57514F;
	--tls-hb-line: #EFE6EC;
	--tls-hb-gap: 28px;

	background: var(--tls-hb-bg);
	padding: 88px 24px 92px;
	font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--tls-hb-ink);
	box-sizing: border-box;
}

.tls-hb *,
.tls-hb *::before,
.tls-hb *::after {
	box-sizing: border-box;
}

.tls-hb__inner {
	max-width: 1240px;
	margin: 0 auto;
}

/* ---------- heading ---------- */
.tls-hb__head {
	text-align: center;
	margin-bottom: 42px;
}

.tls-hb--align-left .tls-hb__head {
	text-align: left;
}

.tls-hb__title {
	margin: 0;
	font-size: clamp(27px, 3.4vw, 38px);
	font-weight: 600;
	line-height: 1.22;
	letter-spacing: -0.8px;
	color: var(--tls-hb-ink);
}

.tls-hb__squiggle {
	line-height: 0;
	margin: 14px 0 0;
}

.tls-hb__squiggle svg {
	width: 118px;
	height: 16px;
}

.tls-hb__sub {
	margin: 14px auto 0;
	max-width: 58ch;
	font-size: 17px;
	font-weight: 400;
	line-height: 1.7;
	color: var(--tls-hb-muted);
}

.tls-hb--align-left .tls-hb__sub {
	margin-left: 0;
}

/* ---------- shared track ---------- */
.tls-hb__viewport {
	position: relative;
}

.tls-hb__track {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* ---------- grid layout ---------- */
.tls-hb--grid .tls-hb__track {
	display: grid;
	gap: var(--tls-hb-gap);
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tls-hb--cols-2.tls-hb--grid .tls-hb__track {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tls-hb--cols-4.tls-hb--grid .tls-hb__track {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px) {
	.tls-hb--grid .tls-hb__track {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 680px) {
	.tls-hb--grid .tls-hb__track {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}
}

/* ---------- carousel layout ---------- */
.tls-hb--carousel .tls-hb__track {
	display: flex;
	flex-wrap: nowrap;
	gap: 24px;
	padding: 6px 2px 14px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.tls-hb--carousel .tls-hb__track::-webkit-scrollbar {
	display: none;
}

.tls-hb--carousel .tls-hb__track:focus-visible {
	outline: 3px solid var(--tls-hb-sky);
	outline-offset: 6px;
	border-radius: 24px;
}

.tls-hb--carousel .tls-hb__card {
	flex: 0 0 calc((100% - 72px) / 4);
	scroll-snap-align: start;
}

.tls-hb--cols-3.tls-hb--carousel .tls-hb__card {
	flex-basis: calc((100% - 48px) / 3);
}

.tls-hb--cols-2.tls-hb--carousel .tls-hb__card {
	flex-basis: calc((100% - 24px) / 2);
}

@media (max-width: 1024px) {
	.tls-hb--carousel .tls-hb__card,
	.tls-hb--cols-3.tls-hb--carousel .tls-hb__card {
		flex-basis: calc((100% - 24px) / 2);
	}
}

@media (max-width: 680px) {
	.tls-hb--carousel .tls-hb__track {
		gap: 16px;
	}

	.tls-hb--carousel .tls-hb__card,
	.tls-hb--cols-2.tls-hb--carousel .tls-hb__card,
	.tls-hb--cols-3.tls-hb--carousel .tls-hb__card {
		flex-basis: 80%;
	}
}

/* ---------- card ---------- */
.tls-hb__card {
	margin: 0;
	list-style: none;
}

.tls-hb__card-inner {
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--tls-hb-card);
	border-radius: 28px;
	padding: 14px 14px 4px;
	box-shadow: 0 22px 50px -42px rgba(32, 32, 32, 0.85);
	transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
		box-shadow 0.5s ease;
}

.tls-hb__card-inner:hover {
	transform: translateY(-8px) rotate(-0.4deg);
	box-shadow: 0 32px 60px -34px rgba(230, 98, 217, 0.5);
}

.tls-hb__media {
	position: relative;
	display: block;
	border-radius: 20px;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: linear-gradient(140deg, var(--tls-hb-blush), #F3F6FF);
}

.tls-hb__media img,
.tls-hb-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tls-hb__card-inner:hover .tls-hb__media img {
	transform: scale(1.05);
}

.tls-hb-thumb--empty {
	display: grid;
	place-items: center;
	background: linear-gradient(140deg, var(--tls-hb-blush), #EDF5FF);
}

.tls-hb-thumb--empty svg {
	width: 76px;
	height: 62px;
	opacity: 0.8;
}

.tls-hb__chip {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(255, 255, 255, 0.94);
	color: var(--tls-hb-orchid-deep);
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: 0.1px;
	padding: 7px 15px;
	border-radius: 999px;
	backdrop-filter: blur(4px);
	box-shadow: 0 8px 20px -14px rgba(32, 32, 32, 0.9);
}

.tls-hb__body {
	padding: 18px 8px 22px;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 9px;
}

.tls-hb__card-title {
	margin: 0;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -0.3px;
}

.tls-hb__card-title a {
	color: var(--tls-hb-ink);
	text-decoration: none;
	background-image: linear-gradient(var(--tls-hb-orchid), var(--tls-hb-orchid));
	background-repeat: no-repeat;
	background-size: 0% 2px;
	background-position: 0 100%;
	transition: background-size 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.35s ease;
}

.tls-hb__card-title a:hover,
.tls-hb__card-title a:focus-visible {
	color: var(--tls-hb-orchid-deep);
	background-size: 100% 2px;
}

.tls-hb__meta {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	font-size: 13px;
	color: #857C79;
}

.tls-hb__excerpt {
	margin: 0;
	font-size: 15px;
	line-height: 1.7;
	color: var(--tls-hb-muted);
}

.tls-hb__link {
	margin-top: auto;
	padding-top: 6px;
	align-self: flex-start;
	font-size: 14.5px;
	font-weight: 500;
	color: var(--tls-hb-sky);
	text-decoration: none;
	position: relative;
}

.tls-hb__link span:first-child::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 100%;
	height: 1.6px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tls-hb__card-inner:hover .tls-hb__link span:first-child::after,
.tls-hb__link:focus-visible span:first-child::after {
	transform: scaleX(1);
}

/* ---------- reveal on scroll ---------- */
.tls-hb.tls-hb--reveal .tls-hb__card {
	opacity: 0;
	transform: translateY(18px);
}

.tls-hb.tls-hb--reveal .tls-hb__card.is-in {
	opacity: 1;
	transform: none;
	transition: opacity 0.7s ease var(--tls-hb-delay, 0ms),
		transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) var(--tls-hb-delay, 0ms);
}

/* ---------- carousel arrows ---------- */
.tls-hb__arrow {
	position: absolute;
	top: 36%;
	z-index: 5;
	width: 52px;
	height: 52px;
	padding: 0;
	display: none;
	place-items: center;
	cursor: pointer;
	background: var(--tls-hb-card);
	color: var(--tls-hb-ink);
	border: 1.5px solid var(--tls-hb-line);
	border-radius: 50%;
	box-shadow: 0 16px 32px -20px rgba(32, 32, 32, 0.7);
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
		background-color 0.35s ease, border-color 0.35s ease,
		color 0.35s ease, opacity 0.35s ease;
}

.tls-hb--has-nav .tls-hb__arrow {
	display: grid;
}

.tls-hb__arrow svg {
	width: 19px;
	height: 19px;
}

.tls-hb__arrow:hover:not(:disabled) {
	background: var(--tls-hb-sky);
	border-color: var(--tls-hb-sky);
	color: #FFFFFF;
	transform: scale(1.08);
}

.tls-hb__arrow:active:not(:disabled) {
	transform: scale(0.96);
}

.tls-hb__arrow:disabled {
	opacity: 0.28;
	cursor: default;
	box-shadow: none;
}

.tls-hb__arrow--prev {
	left: -22px;
}

.tls-hb__arrow--next {
	right: -22px;
}

@media (max-width: 1320px) {
	.tls-hb__arrow--prev {
		left: -8px;
	}

	.tls-hb__arrow--next {
		right: -8px;
	}
}

@media (max-width: 880px) {
	.tls-hb--has-nav .tls-hb__arrow {
		display: none;
	}
}

/* fade at the shelf edge, so cards read as continuing */
.tls-hb--carousel .tls-hb__viewport::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 56px;
	height: 100%;
	background: linear-gradient(90deg, rgba(248, 245, 243, 0), var(--tls-hb-bg) 82%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.tls-hb--has-more.tls-hb--carousel .tls-hb__viewport::after {
	opacity: 1;
}

/* ---------- footer button ---------- */
.tls-hb__foot {
	margin-top: 44px;
	text-align: center;
}

.tls-hb--align-left .tls-hb__foot {
	text-align: left;
}

.tls-hb__button {
	display: inline-block;
	background: var(--tls-hb-sky);
	color: #FFFFFF;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.2px;
	text-decoration: none;
	padding: 17px 42px;
	border-radius: 999px;
	box-shadow: 0 16px 34px -16px rgba(69, 168, 255, 0.95);
	transition: background-color 0.4s ease,
		transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.tls-hb__button:hover,
.tls-hb__button:focus-visible {
	background: var(--tls-hb-orchid);
	color: #FFFFFF;
	transform: translateY(-3px);
	box-shadow: 0 20px 38px -16px rgba(230, 98, 217, 0.95);
}

/* ---------- editor notice ---------- */
.tls-hb-notice {
	max-width: 640px;
	margin: 24px auto;
	padding: 16px 20px;
	border-radius: 18px;
	background: #FCE6FA;
	color: #7A2E74;
	font-size: 14.5px;
	text-align: center;
}

/* ---------- accessibility ---------- */
.tls-hb a:focus-visible,
.tls-hb button:focus-visible {
	outline: 3px solid var(--tls-hb-sky);
	outline-offset: 3px;
}

.tls-hb .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.tls-hb *,
	.tls-hb *::before,
	.tls-hb *::after {
		animation: none !important;
		transition: none !important;
	}

	.tls-hb.tls-hb--reveal .tls-hb__card {
		opacity: 1;
		transform: none;
	}

	.tls-hb--carousel .tls-hb__track {
		scroll-behavior: auto;
	}
}

@media (max-width: 680px) {
	.tls-hb {
		padding: 62px 18px 66px;
	}

	.tls-hb__head {
		margin-bottom: 30px;
	}
}
