/*
 * Duncan Shields — homepage-specific presentation
 * Loaded after site.css on the front page only.
 */

body.home {
	--home-grid-gap: clamp(1.25rem, 2.8vw, 2.75rem);
	--home-section-space: clamp(2.75rem, 4.5vw, 4.5rem);
	--home-item-space: clamp(1.5rem, 2.5vw, 2.5rem);
	--home-interface-size: clamp(0.75rem, 0.7rem + 0.18vw, 0.875rem);
	--home-content-width: 66rem;
}

.home-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: var(--home-column-gap, var(--home-grid-gap));
}

/* Local page overrides are attached to .home-page, so they can replace the
 * inherited token values for every section without element offsets. */
body.home .home-page {
	--home-side-inset: var(--ds-home-layout-side-inset, var(--ds-home-side-inset-default));
	--home-column-gap: var(--ds-home-layout-column-gap, var(--ds-home-column-gap-default));
}

body.home .home-page .section-shell {
	width: min(calc(100% - (2 * var(--home-side-inset))), var(--ds-home-layout-content-width, var(--home-content-width)));
}

body.home .site-title,
body.home .primary-menu {
	font-size: var(--home-interface-size);
	font-weight: 500;
	letter-spacing: 0.025em;
	text-transform: none;
}

body.home .site-title {
	font-weight: 600;
}

body.home .primary-menu {
	column-gap: var(--home-grid-gap);
}

.home-hero {
	display: grid;
	min-height: clamp(30rem, calc(100svh - var(--header-height)), 44rem);
	align-items: center;
	padding-block: var(--home-section-space);
	background-color: var(--color-paper);
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

.home-hero__inner {
	align-items: center;
}

.home-premise {
	grid-column: 1 / span 5;
	max-width: none;
	margin-bottom: 0;
	font-family: var(--font-display);
	font-size: clamp(1.75rem, 3.7vw, 4rem);
	font-weight: 400;
	letter-spacing: -0.035em;
	line-height: 0.96;
}

.home-premise__statement,
.home-premise__line {
	display: block;
}

.home-premise__line {
	white-space: nowrap;
}

.home-premise__statement + .home-premise__statement {
	margin-top: 0.32em;
}

.home-introduction {
	padding-block: calc(var(--home-section-space) * var(--ds-home-intro-space, 1));
	border-block: 1px solid var(--color-rule);
}

.home-introduction__inner {
	align-items: start;
	column-gap: var(--home-column-gap);
	row-gap: calc(var(--home-column-gap) * var(--ds-home-quote-space, 1));
}

.home-introduction__lead {
	grid-column: 1 / span 3;
	margin: 0;
	font-family: var(--ds-home-intro-family, var(--font-body));
	font-size: calc(clamp(1.25rem, 1.45vw, 1.6rem) * var(--ds-home-intro-scale, 1));
	font-weight: var(--ds-home-intro-weight, 500);
	letter-spacing: -0.015em;
	line-height: var(--ds-home-intro-leading, 1.35);
	max-width: var(--ds-home-intro-measure, none);
	text-align: var(--ds-home-intro-align, left);
	text-wrap: balance;
}

.home-introduction__quote {
	grid-column: 5 / -1;
	margin: 0;
	max-width: var(--ds-home-quote-measure, none);
	text-align: var(--ds-home-quote-align, left);
}

.home-introduction__quote p {
	max-width: none;
	margin: 0;
	font-family: var(--ds-home-quote-family, var(--font-display));
	font-size: calc(clamp(1.4rem, 2vw, 2rem) * var(--ds-home-quote-scale, 1));
	font-weight: var(--ds-home-quote-weight, 400);
	letter-spacing: -0.03em;
	line-height: var(--ds-home-quote-leading, 1.15);
}

.chapter-list,
.recent-notes {
	padding-block: var(--home-section-space);
}

.chapter-list {
	padding-block: calc(var(--home-section-space) * var(--ds-home-chapter-layout-space, 1));
}

.chapter-list__grid {
	align-items: stretch;
}

.chapter-link {
	grid-column: span 3;
	min-width: 0;
	border-top: 1px solid var(--color-rule);
}

.chapter-link__target {
	display: flex;
	height: 100%;
	flex-direction: column;
	align-items: flex-start;
	padding-block: calc(var(--home-item-space) * var(--ds-home-chapter-body-space, 1));
	text-decoration: none;
}

.chapter-link__target h2 {
	max-width: none;
	margin: 0 0 calc(0.75rem * var(--ds-home-chapter-title-gap, 1));
	font-family: var(--ds-home-chapter-title-family, var(--font-display));
	font-size: calc(clamp(1.5rem, 2vw, 2.2rem) * var(--ds-home-chapter-title-scale, 1));
	font-weight: var(--ds-home-chapter-title-weight, 400);
	letter-spacing: -0.035em;
	line-height: var(--ds-home-chapter-title-leading, 1.06);
	max-width: var(--ds-home-chapter-title-measure, none);
	text-align: var(--ds-home-chapter-title-align, left);
	overflow-wrap: normal;
	text-wrap: balance;
}

.chapter-link__target:hover h2 {
	color: var(--color-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.16em;
}

.chapter-link__target > p {
	max-width: var(--ds-home-chapter-body-measure, var(--body-measure));
	margin-bottom: 0;
	font-family: var(--ds-home-chapter-body-family, var(--font-body));
	font-size: calc(var(--body-size) * var(--ds-home-chapter-body-scale, 1));
	font-weight: var(--ds-home-chapter-body-weight, 400);
	line-height: var(--ds-home-chapter-body-leading, var(--body-leading));
	text-align: var(--ds-home-chapter-body-align, left);
	flex: 1;
}

body.home .site-footer {
	font-family: var(--font-body);
	font-size: clamp(0.6875rem, 0.65rem + 0.12vw, 0.75rem);
	letter-spacing: 0.025em;
}

body.home .site-footer__inner {
	align-items: center;
	gap: var(--home-grid-gap);
	padding-block: clamp(1.125rem, 2vw, 1.5rem);
}

body.home .site-footer p {
	max-width: none;
	margin: 0;
	color: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: 1.4;
}

body.home .site-footer__name {
	font-weight: 600;
	text-transform: none;
}

/* Responsive homepage composition. The shared shell supplies all horizontal
 * geometry; these rules only change the number of columns at each state. */
@media (max-width: 64rem) {
	.home-premise {
		grid-column: 1 / span 6;
		transform: translateY(clamp(-2.5rem, -3vw, -1rem));
	}

	.home-introduction__lead {
		grid-column: 1 / span 5;
	}

	.home-introduction__quote {
		grid-column: 7 / -1;
	}

	.chapter-link {
		grid-column: span 6;
	}
}

@media (max-width: 48rem) {
	.home-hero {
		min-height: clamp(30rem, 72svh, 38rem);
		background-position: 52.5% center;
	}

	.home-premise {
		grid-column: 1 / span 8;
		font-size: clamp(2rem, 4.9vw, 3rem);
		transform: translateY(clamp(-2.5rem, -4vw, -1.25rem));
	}
}

@media (max-width: 40rem) {
	.home-premise {
		grid-column: 1 / -1;
		max-width: 62%;
		font-size: clamp(1.6rem, 6.4vw, 2rem);
		transform: translateY(clamp(-1.75rem, -4vh, -0.75rem));
	}

	.home-hero {
		min-height: clamp(26rem, 64svh, 32rem);
		background-color: #f7f4ef;
		background-position: 47% bottom;
		background-size: auto 94%;
	}

	.home-introduction__lead,
	.home-introduction__quote,
	.chapter-link {
		grid-column: 1 / -1;
	}
}

/* Keep the production-uploaded hero portrait inside the mobile frame. */
@media (max-width: 40rem) {
	.home-hero[style*="DuncanShields_HEADER_3_F"] {
		background-position: 62% bottom;
		background-size: auto 72%;
	}
}

@media (max-width: 28rem) {
	.home-hero {
		background-position: 47% bottom;
		background-size: auto 78%;
	}

	.home-hero[style*="DuncanShields_HEADER_3_F"] {
		background-position: 62% bottom;
		background-size: auto 68%;
	}
}

@media (max-width: 24rem) {
	.home-hero {
		background-size: auto 74%;
	}

	.home-hero[style*="DuncanShields_HEADER_3_F"] {
		background-position: 58% bottom;
		background-size: auto 64%;
	}
}

@media (max-width: 20rem) {
	.home-premise {
		font-size: clamp(1.35rem, 5.8vw, 1.65rem);
	}

	.home-hero {
		background-size: auto 70%;
	}

	.home-hero[style*="DuncanShields_HEADER_3_F"] {
		background-position: 59% bottom;
		background-size: auto 60%;
	}
}

@media (max-width: 19rem) {
	.home-premise__line,
	.chapter-link__target h2 {
		white-space: normal;
	}
}

/* Constrained editor-selected typography. Theme defaults remain unchanged. */
.home-premise.ds-type-family--young-serif,
.home-introduction__lead.ds-type-family--young-serif,
.home-introduction__quote.ds-type-family--young-serif p,
.chapter-link__target h2.ds-type-family--young-serif,
.chapter-link__target p.ds-type-family--young-serif {
	font-family: var(--font-display);
}

.home-premise.ds-type-family--instrument-sans,
.home-introduction__lead.ds-type-family--instrument-sans,
.home-introduction__quote.ds-type-family--instrument-sans p,
.chapter-link__target h2.ds-type-family--instrument-sans,
.chapter-link__target p.ds-type-family--instrument-sans {
	font-family: var(--font-body);
}

.home-premise.ds-type-size--small { font-size: clamp(1.5rem, 3.1vw, 3.4rem); }
.home-premise.ds-type-size--large { font-size: clamp(2rem, 4.25vw, 4.6rem); }
.home-introduction__lead.ds-type-size--small { font-size: clamp(1.0625rem, 1.2vw, 1.3rem); }
.home-introduction__lead.ds-type-size--large { font-size: clamp(1.5rem, 1.8vw, 2rem); }
.home-introduction__quote.ds-type-size--small p { font-size: clamp(1.2rem, 1.6vw, 1.6rem); }
.home-introduction__quote.ds-type-size--large p { font-size: clamp(1.7rem, 2.5vw, 2.5rem); }
.chapter-link__target h2.ds-type-size--small { font-size: clamp(1.25rem, 1.6vw, 1.75rem); }
.chapter-link__target h2.ds-type-size--large { font-size: clamp(1.8rem, 2.35vw, 2.6rem); }
.chapter-link__target p.ds-type-size--small { font-size: clamp(0.9rem, 0.85rem + 0.18vw, 1.05rem); }
.chapter-link__target p.ds-type-size--large { font-size: clamp(1.2rem, 1.1rem + 0.3vw, 1.45rem); }

@media (max-width: 40rem) {
	.home-premise.ds-type-size--small { font-size: clamp(1.2rem, 4.8vw, 1.5rem); }
	.home-premise.ds-type-size--large { font-size: clamp(1.55rem, 6.2vw, 2rem); }
}

@media print {
	.home-hero { min-height: 0; }
}
