/*
 * Article page (single.html): a frame as wide as the text column plus a
 * side column (.personal-branding-side, filled in functions.php) with
 * "In breve" and the skills/contacts box from the end of the text.
 *
 * From 1024px: title and text on the left; on the right one column that
 * starts level with the title, "In breve" then the box right under it
 * (the box stays in view while reading). CSS only, no script.
 * Below 1024px, reading order: title → In breve → text → box (the copy
 * after the text, .personal-branding-aside--end).
 */

/* Frame: text column + gap + side column, centered in the page. */
main .personal-branding-article.alignwide {
	--personal-branding-side: 20rem;
	--personal-branding-gap: clamp(2rem, 4vw, 4rem);
	max-width: calc(var(--wp--style--global--content-size) + var(--personal-branding-gap) + var(--personal-branding-side));
}

/* Nothing in the side column: the usual single column. */
main .personal-branding-article.alignwide:not(:has(.personal-branding-side)) {
	max-width: var(--wp--style--global--content-size);
}

.personal-branding-post-header {
	max-width: var(--wp--style--global--content-size);
}

.personal-branding-article-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: var(--wp--preset--spacing--60);
}

/*
 * Not stretched to the row: a stretched item has a definite height, and
 * percentage heights inside the text (some images) would grow to it.
 */
.personal-branding-article-body > * {
	align-self: start;
	margin-block: 0;
}

/* The text keeps its own column: no extra padding or full-bleed blocks. */
.personal-branding-article-main > .wp-block-post-content {
	padding-inline: 0;
}

.personal-branding-article-main > .wp-block-post-content > .alignfull {
	margin-inline: 0;
}

/* --- Side column ---------------------------------------------------------- */
.personal-branding-side {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--50);
}

/* The card written by hand keeps its look; no outer margins in the column. */
.personal-branding-summary > .wp-block-group {
	margin: 0;
}

/* --- Skills and contacts box ---------------------------------------------- */
.personal-branding-aside {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--custom--color--surface, var(--wp--preset--color--base));
}

.personal-branding-aside > * {
	margin: 0;
}

.personal-branding-aside > .wp-block-heading {
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1.25;
}

.personal-branding-aside > p {
	font-size: var(--wp--preset--font-size--sm);
	line-height: 1.6;
}

/* The two buttons: full width, one under the other. */
.personal-branding-aside .wp-block-buttons {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--30);
}

.personal-branding-aside .wp-block-button,
.personal-branding-aside .wp-block-button__link {
	box-sizing: border-box;
	inline-size: 100%;
	text-align: center;
}

/* --- Below 1024px: one column, the box after the text --------------------- */
@media (max-width: 1023px) {

	.personal-branding-aside--side {
		display: none;
	}

	/* Only the box in the side column: nothing to show at the top. */
	.personal-branding-side:not(:has(.personal-branding-summary, .wp-block-aurora-core-brief)) {
		display: none;
	}
}

/* --- Two columns from 1024px ---------------------------------------------- */
@media (min-width: 1024px) {

	.personal-branding-aside--end {
		display: none;
	}

	.personal-branding-article-body:has(> .personal-branding-side) {
		grid-template-columns: minmax(0, var(--wp--style--global--content-size)) var(--personal-branding-side);
		grid-template-rows: auto 1fr;
		justify-content: space-between;
		column-gap: var(--personal-branding-gap);
	}

	.personal-branding-article-body:has(> .personal-branding-side) > .personal-branding-post-header {
		grid-column: 1;
		grid-row: 1;
	}

	.personal-branding-article-body:has(> .personal-branding-side) > .personal-branding-article-main {
		grid-column: 1;
		grid-row: 2;
	}

	/* The whole height of the article, so the last item can stay in view. */
	.personal-branding-article-body:has(> .personal-branding-side) > .personal-branding-side {
		grid-column: 2;
		grid-row: 1 / span 2;
		align-self: stretch;
	}

	.personal-branding-side > :last-child {
		position: sticky;
		inset-block-start: calc(var(--wp-admin--admin-bar--height, 0px) + 6rem);
	}

	/*
	 * The column is narrow: smaller text and padding in "In breve". The
	 * card written by hand may use a font size preset (e.g. "lg"), whose
	 * class is !important: overridden here, in the column only.
	 */
	.personal-branding-summary > .wp-block-group {
		padding: var(--wp--preset--spacing--40);
	}

	.personal-branding-summary :is(p, li):not(.is-style-eyebrow) {
		font-size: 0.9375rem !important;
		line-height: 1.6;
	}

	.personal-branding-side > .wp-block-aurora-core-brief {
		font-size: var(--wp--preset--font-size--sm);
	}

	.personal-branding-aside--side {
		padding: var(--wp--preset--spacing--40);
	}
}
