/* Sidebar layout (ahan-sidebar-layout) — generic: a side column + a main column.
   DOM: side first (right in RTL), then main. One column below 1025px, where the main column is shown FIRST
   (order: -1: content before the sidebar); from there 30% / 70% with the side column sticky. Cards inside the main column: .ahan-card.
   The side <aside> also carries ahan_sticky_attrs() (inc/sticky-sidebar.php): sticky-sidebar.js then keeps a column taller than the window
   from hiding its end. The plain sticky below is the same behaviour without JS. */
.ahan-sidebar-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--gap);
	max-width: var(--container-box);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

.ahan-sidebar-layout__side,
.ahan-sidebar-layout__main {
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	min-width: 0;
}

/* Narrow screens: the content comes before the sidebar (the blog layout does the same in blog.css). The templates also carry the
   Tailwind class max-[1024px]:order-first (app.css, in the head): this component file is printed in the body and a late stylesheet
   would show the sidebar first and then jump it below the content (a huge layout shift). */
.ahan-sidebar-layout__main {
	order: -1;
}

.ahan-card {
	padding: var(--gap);
	border-radius: var(--radius);
	background: var(--c-surface);
	box-shadow: var(--shadow);
}

@media (min-width: 1025px) {
	.ahan-sidebar-layout {
		grid-template-columns: minmax(0, 3fr) minmax(0, 7fr);
		align-items: start;
	}

	.ahan-sidebar-layout__main {
		order: 0;
	}

	.ahan-sidebar-layout__side {
		position: sticky;
		top: calc(var(--ahan-sticky-top, 0px) + var(--ahan-sidebar-top, 150px));
	}

	.ahan-card {
		padding: var(--gap-lg);
	}
}
