/* Shared title banners for inner pages only. */
.aed-page-title { grid-column: 1 / -1; margin: 0; }
.aed-page-title-band {
	--title-icon-colour: #657b69;
	--title-panel-colour: #fff;
	--title-panel-border: #dde2dc;
	--title-panel-shadow: 0 2px 5px rgba(16, 43, 60, .04);
	display: flex; align-items: center; justify-content: center; gap: 14px;
	min-height: 68px; padding: 12px 32px;
	background: var(--title-panel-colour);
	color: #173147; border-radius: 4px 32px 4px 32px;
	border: 1px solid var(--title-panel-border);
	box-shadow: var(--title-panel-shadow);
}
html[data-theme="dark"] .aed-page-title-band {
	--title-icon-colour: #c58d61;
	--title-panel-colour: #151b1d;
	--title-panel-border: #303638;
	--title-panel-shadow: none;
	color: #f1ede6;
}
.aed-page-title .aed-page-title-band h1 {
	min-width: 0; max-width: none; margin: 0; color: inherit;
	font-family: var(--font-display); font-size: clamp(2rem, 3vw, 2.25rem);
	font-weight: 400; line-height: 1.15; letter-spacing: -.015em;
	text-align: center; overflow-wrap: anywhere; text-wrap: balance;
}
/* Match the serif capitals with the bundled font's baseline-aligned 3D label. */
.aed-page-title-dimension {
	font-family: var(--font-sans); font-size: .95em;
	font-variant-numeric: lining-nums; white-space: nowrap; overflow-wrap: normal;
}
.aed-page-title-icon {
	display: inline-flex; align-items: center; justify-content: center;
	flex: 0 0 28px; width: 28px; height: 28px;
	color: var(--title-icon-colour); font-size: 1.25rem;
}
.aed-page-title-subtitle { max-width: 65ch; margin: 10px auto 0; color: var(--muted); text-align: center; font-size: 1.05rem; line-height: 1.65; }

/* Optional shared designs. Original retains the existing rules above. */
.aed-page-title--architectural, .aed-page-title--centred {
	--title-rule-colour: #cbd2c9;
	--title-wash: rgba(101, 123, 105, .075);
}
html[data-theme="dark"] .aed-page-title--architectural,
html[data-theme="dark"] .aed-page-title--centred {
	--title-rule-colour: #353b3a;
	--title-wash: rgba(197, 141, 97, .06);
}
.aed-page-title--architectural .aed-page-title-band,
.aed-page-title--centred .aed-page-title-band {
	position: relative; min-height: 72px;
	background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
.aed-page-title-group { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* A: anchor the title to the content edge; fine drafting marks balance the right. */
.aed-page-title--architectural .aed-page-title-band {
	justify-content: flex-start; padding: 10px 104px 18px 0;
	border-bottom: 1px solid var(--title-rule-colour);
}
.aed-page-title--architectural .aed-page-title-band::after {
	content: ""; position: absolute; bottom: -1px; left: 0;
	width: 52px; height: 2px; background: var(--title-icon-colour);
}
.aed-page-title--architectural .aed-page-title-band h1 { text-align: left; }
.aed-page-title--architectural .aed-page-title-subtitle { margin-left: 0; text-align: left; }
.aed-page-title-motif {
	position: absolute; top: 0; right: 0; width: 88px; height: 71px;
	color: var(--title-icon-colour); opacity: .4; pointer-events: none;
	background: linear-gradient(90deg, transparent 43px, currentColor 43px, currentColor 44px, transparent 44px), linear-gradient(0deg, transparent 14px, currentColor 14px, currentColor 15px, transparent 15px);
}
.aed-page-title-motif::before {
	content: ""; position: absolute; top: 6px; right: 6px;
	width: 56px; height: 56px; border: 1px solid currentColor; border-radius: 50%;
}
.aed-page-title-motif::after {
	content: ""; position: absolute; top: 17px; left: 6px;
	width: 70px; height: 28px; border-top: 1px solid currentColor; border-right: 1px solid currentColor;
}

/* B: flexible rules fill the sides without restricting long translated titles. */
.aed-page-title--centred .aed-page-title-band {
	gap: 24px; padding: 12px 0;
	background: radial-gradient(ellipse at center, var(--title-wash), transparent 72%);
}
.aed-page-title--centred .aed-page-title-group { flex: 0 1 auto; max-width: 960px; }
.aed-page-title--centred .aed-page-title-band::before,
.aed-page-title--centred .aed-page-title-band::after {
	content: ""; flex: 1 0 24px; height: 1px; opacity: .55;
	background: linear-gradient(90deg, transparent, var(--title-icon-colour));
}
.aed-page-title--centred .aed-page-title-band::after { transform: rotate(180deg); }

.aed-inner-page.content-area { padding: 8px 0 48px; }
/* Keep the same canvas and raised surfaces across standard and contact pages. */
.aed-inner-page.content-area, .aed-contacts { --aed-page-surface: #fff; background: #f5f4f0; }
html[data-theme="dark"] .aed-inner-page.content-area,
html[data-theme="dark"] .aed-contacts { --aed-page-surface: #151b1d; background: #0c0f10; }
.aed-inner-page > .site-shell > .aed-page-title { margin-bottom: 24px; }
.aed-inner-page > .site-shell > .content-shell { width: 100%; }
.aed-inner-page .entry-content { max-width: 900px; margin-inline: auto; }
.aed-contacts:has(.aed-page-title) { padding-top: 8px; }

/* Optional return link shares the title row; equal side columns protect its centre. */
.aed-page-title--with-back .aed-page-title-band {
	--title-back-space: 8.5rem;
	position: relative;
	display: grid; grid-template-columns: var(--title-back-space) minmax(0, 1fr) var(--title-back-space);
	column-gap: 12px; padding-inline: 20px;
}
.aed-page-title--with-back .aed-page-title-group { grid-column: 2; grid-row: 1; justify-content: center; max-width: none; }
.aed-page-title--architectural.aed-page-title--with-back .aed-page-title-group { justify-content: flex-start; }
/* Equal icon slots keep the heading centred; the icon aligns with the whole text block. */
.aed-page-title--with-back .aed-page-title-group { align-items: center; }
.aed-page-title--with-back .aed-page-title-icon { flex-shrink: 0; }
.aed-page-title--with-back .aed-page-title-band h1 { flex: 0 1 auto; }
/* A text-only project title needs no balancing slot for the absent icon. */
.aed-page-title--with-back.aed-page-title--no-icon .aed-page-title-group::after { content: none; }
/* Anchor to the inline text's visible bounds, including all its wrapped lines. */
@supports (anchor-name: --aed-title-text) and (left: anchor(left)) {
	.aed-page-title--with-back .aed-page-title-text { anchor-name: --aed-title-text; }
	.aed-page-title--with-back .aed-page-title-icon i {
		position: absolute; position-anchor: --aed-title-text;
		left: anchor(left); top: anchor(center);
		transform: translate(calc(-100% - 10px), -50%);
	}
}
.aed-page-title-back {
	grid-column: 1; grid-row: 1; justify-self: start; min-width: 0;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; max-width: 100%; padding: 0 6px;
	color: var(--title-icon-colour); font-size: .8rem; line-height: 1.35; font-weight: 500;
	text-decoration: none; border-radius: 4px;
}
.aed-page-title-back i { flex-shrink: 0; font-size: .85rem; }
.aed-page-title-back-label { text-decoration: underline; text-underline-offset: 4px; }
.aed-page-title-back:is(:hover, :focus-visible) { color: inherit; background: color-mix(in srgb, var(--title-icon-colour) 9%, transparent); }
.aed-page-title-back:focus-visible { outline: 2px solid var(--title-icon-colour); outline-offset: 2px; }
.aed-page-title--centred.aed-page-title--with-back .aed-page-title-band::before { content: none; }
.aed-page-title--centred.aed-page-title--with-back .aed-page-title-band::after { grid-column: 3; grid-row: 1; width: 100%; }

@media (max-width: 57.5rem) {
	/* The edge control shares the title's height; equal gutters keep the text centred. */
	.aed-page-title.aed-page-title--with-back .aed-page-title-band { position: relative; display: flex; justify-content: center; padding: 10px 28px; }
	.aed-page-title--with-back .aed-page-title-group { --title-icon-space: 28px; justify-content: center; width: fit-content; max-width: 100%; gap: 10px; }
	/* Match the icon's space on the right so the heading itself stays on the centreline. */
	.aed-page-title--with-back .aed-page-title-group::after { content: ''; flex: 0 0 var(--title-icon-space); width: var(--title-icon-space); }
	.aed-page-title--with-back .aed-page-title-band h1 { text-align: center; }
	.aed-page-title--with-back .aed-page-title-motif { display: none; }
	.aed-page-title-back {
		position: absolute; inset-block-start: 10px; inset-inline-start: -10px;
		width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 6px;
		border: 1px solid color-mix(in srgb, var(--title-icon-colour) 45%, transparent);
		background: color-mix(in srgb, var(--title-icon-colour) 7%, transparent);
	}
	.aed-page-title-back i { font-size: .75rem; }
	.aed-page-title-back:is(:hover, :focus-visible) { background: color-mix(in srgb, var(--title-icon-colour) 15%, transparent); }
	.aed-page-title-back:active { background: color-mix(in srgb, var(--title-icon-colour) 22%, transparent); }
	.aed-page-title-back-label { display: none; }
	.aed-page-title--centred.aed-page-title--with-back .aed-page-title-band::after { display: none; }
}
@media (max-width: 800px) {
	.aed-page-title-band { min-height: 56px; padding: 10px 20px; border-radius: 3px 28px 3px 28px; gap: 10px; }
	.aed-page-title .aed-page-title-band h1 { font-size: 1.75rem; }
	.aed-page-title-icon { flex-basis: 24px; width: 24px; height: 24px; font-size: 1.125rem; }
	.aed-page-title-subtitle { margin-top: 8px; font-size: 1rem; }
	.aed-page-title-group { gap: 10px; }
	.aed-page-title--with-back .aed-page-title-group { --title-icon-space: 24px; }
	.aed-page-title--architectural .aed-page-title-band { min-height: 56px; padding: 8px 0 14px; }
	.aed-page-title-motif { display: none; }
	.aed-page-title--centred .aed-page-title-band { min-height: 56px; padding: 10px 0; gap: 12px; }
	.aed-page-title--centred .aed-page-title-band::before,
	.aed-page-title--centred .aed-page-title-band::after { flex-basis: 8px; }
	.aed-inner-page > .site-shell > .aed-page-title { margin-bottom: 20px; }
}
@media (max-width: 480px) {
	.aed-page-title--with-back .aed-page-title-band h1 { font-size: clamp(1.35rem, 6vw, 1.75rem); }
}
@media (max-width: 360px) {
	.aed-page-title--with-back .aed-page-title-band h1 { font-size: 1.25rem; }
}
@media print {
	.aed-page-title-back { display: none; }
	.aed-page-title--with-back .aed-page-title-band { --title-back-space: 0px; column-gap: 0; }
}

/* Only the small return-link text needs stronger contrast; artwork retains its colour. */
html:not([data-theme="dark"]) .aed-page-title-back { color: #526b56; }
