/* The closing band, the email row and the footer (CB1, decision 0059; approved mockup 2026-11-29, option A). Every page
   loads this (functions.php, atotb_closing_assets). Colours come from the surface variables (0037). */

/* The band: "There's room for you on the trail." and three ways in. The rings are its ::before, decorative, mint at
   about 16%: a 35rem drawing cropped by a smaller box at the bottom right, so nothing overflows the band and the
   homepage's heading can still rise above the band's top edge. */
.atotb-closing-band {
	position: relative;
	isolation: isolate;
}
main > .atotb-closing-band,
main > .wp-block-post-content > .atotb-closing-band { margin-block-start: var(--wp--preset--spacing--80); }
.atotb-closing-band::before {
	content: "";
	position: absolute;
	z-index: -1;
	right: 0;
	bottom: 0;
	width: 30.5rem;
	height: min(26rem, 100%);
	opacity: 0.16;
	pointer-events: none;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-31 0 242 242'%3E%3Cg fill='%2396BFAE'%3E%3Cpath fill-rule='evenodd' d='M0 90a90 90 0 1 0 180 0a90 90 0 1 0 -180 0ZM24 90a66 66 0 1 0 132 0a66 66 0 1 0 -132 0ZM0 210a90 90 0 1 0 180 0a90 90 0 1 0 -180 0ZM24 210a66 66 0 1 0 132 0a66 66 0 1 0 -132 0Z'/%3E%3Cpath d='M78 58h24V132h-24Z M78 168h24V242h-24Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 35rem 35rem no-repeat;
}
/* Left, on the band's 1200 px content edge like the columns, not centred as the constrained layout would put it. */
.atotb-closing-band__title { margin-block: 0; margin-inline: max(0px, calc((100% - 75rem) / 2)) auto !important; max-width: 20ch; }
.atotb-ways {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--60);
	margin-block-start: var(--wp--preset--spacing--60) !important;
}
/* The grid's gap spaces the columns; the group's own block gap would drop the second and third by 16 px. */
.atotb-ways > .atotb-way { margin-block: 0; }
.atotb-way {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--40);
	padding-block-start: var(--wp--preset--spacing--50);
	border-block-start: 1px solid rgb(255 255 255 / 0.3);
}
.atotb-way--give { border-block-start: 2px solid var(--wp--preset--color--mint); }
.atotb-way > * { margin: 0 !important; }
.atotb-way__title { font-size: var(--wp--preset--font-size--x-large); }
.atotb-way p { color: rgb(255 255 255 / 0.86); }
.atotb-way__link a { display: inline-block; padding-block: 0.6rem; font-weight: 600; }
.atotb-way__next { display: flex; flex-direction: column; gap: 0.15rem; }
.atotb-way__next > * { margin: 0 !important; }
.atotb-way__label { font-weight: 600; }
.atotb-way__event { line-height: 1.45; }
.atotb-way__event a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.atotb-way__event-date { display: block; font-size: var(--wp--preset--font-size--small); }
@media (max-width: 781px) {
	.atotb-ways { grid-template-columns: minmax(0, 1fr); }
	.atotb-closing-band::before { width: 15.5rem; height: min(17rem, 100%); background-size: 21rem 21rem; }
}

/* The homepage: the photo, fading into the band's ink at its bottom, with the band's heading on the fade, with no box
   behind it (CB1 item 1; Ryan, 2026-12-04: "it can be on the photo but without that green box"). The fade is at least 75%
   ink where the heading sits and solid ink at the photo's edge, so the white heading keeps 4.5:1 over even an all-white
   photo (tests/homepage.spec.mjs). */
.wp-block-image.atotb-closing-photo { margin-block: 0 !important; max-width: none; position: relative; }
.wp-block-image.atotb-closing-photo img { display: block; width: 100%; height: clamp(29.5rem, 45vw, 44rem); object-fit: cover; object-position: center 75%; }
.atotb-closing-photo::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, rgb(18 35 29 / 0.12) 0, rgb(18 35 29 / 0.12) 40%, rgb(18 35 29 / 0.75) 72%, var(--wp--preset--color--ink) 94%);
	pointer-events: none;
}
/* flow-root: the heading's negative margin must lift the heading, not collapse into the band and lift the whole band. */
main .atotb-closing-photo + .atotb-closing-band { display: flow-root; margin-block-start: 0; padding-top: 0 !important; }
.atotb-closing-photo + .atotb-closing-band .atotb-closing-band__title {
	position: relative;
	/* Wider than the band's 20ch title, so on tablets and up the heading keeps to one line and "trail." is never left
	   alone on a line (900 and 1280 px checked, 2026-12-04). */
	width: min(100%, 55rem);
	max-width: none;
	/* At least as tall as it rises, so a one-line heading never floats above the band. */
	min-height: 6.5rem;
	margin-block-start: -6.5rem;
}
@media (max-width: 781px) {
	.wp-block-image.atotb-closing-photo img { height: 17.5rem; object-position: 10% 45%; }
	.atotb-closing-photo + .atotb-closing-band .atotb-closing-band__title { min-height: 4.5rem; margin-block-start: -4.5rem; }
}

/* The rings drift in once and settle (0059 item 4, under 0057 item 1): rings.js marks a band that starts off screen as
   waiting, then alive once it is on screen. The rings' place without the script is their final place. Nothing moves
   under reduced motion or on the still pages. */
@keyframes atotb-rings-drift {
	from { background-position: 3rem 2.25rem; opacity: 0; }
	30% { opacity: 0.16; }
	to { background-position: 0 0; opacity: 0.16; }
}
@media (prefers-reduced-motion: no-preference) {
	.atotb-closing-band.is-waiting::before { opacity: 0; background-position: 3rem 2.25rem; }
	.atotb-closing-band.is-alive::before { animation: atotb-rings-drift 4.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
}
.atotb-closing-band--still::before { animation: none !important; background-position: 0 0 !important; opacity: 0.16 !important; }

/* The footer (CB1 item 4): the email row, the brand column and five link columns, then the base row. */
.atotb-site-footer { border-block-start: 1px solid var(--wp--preset--color--deep-teal); }
.atotb-site-footer > * + * { margin-block-start: 0; }
.atotb-footer-news {
	gap: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
	border-radius: 8px;
}
.atotb-footer-news__text { gap: 0.25rem; }
.atotb-footer-news__text > * { margin: 0; }
.atotb-footer-news__text p { color: rgb(255 255 255 / 0.86); }
.atotb-footer-main {
	display: grid;
	grid-template-columns: 15.5rem repeat(5, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
	padding-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60);
}
.atotb-footer-main > * { margin: 0 !important; min-width: 0; }
.atotb-footer-brand > * { margin: 0; }
.atotb-footer-brand__line { color: rgb(255 255 255 / 0.86); max-width: 22ch; }
.atotb-footer-social { gap: 0 !important; }
/* Core sets the link's line height to 0, so a label that wraps would print over itself. */
.atotb-footer-social .wp-block-social-link-label { font-size: var(--wp--preset--font-size--small); line-height: 1.35; }
.atotb-footer-col__title {
	margin: 0 0 0.5rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--wp--preset--color--mint);
}
.atotb-footer-links { list-style: none; margin: 0; padding: 0; }
.atotb-footer-links li { margin: 0; }
.atotb-footer-links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--wp--preset--color--white);
	text-decoration: none;
	overflow-wrap: anywhere;
}
.atotb-footer-links a:hover,
.atotb-footer-links a:focus-visible { color: var(--wp--custom--color--link); text-decoration: underline; }
.atotb-footer-base {
	gap: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60);
	padding-block-start: var(--wp--preset--spacing--50);
	border-block-start: 1px solid var(--wp--preset--color--slate);
}
.atotb-footer-legal { gap: var(--wp--preset--spacing--50); }
.atotb-footer-legal > *,
.atotb-footer-base > * { margin: 0; }
.atotb-footer-fine { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--wp--preset--spacing--50); color: rgb(255 255 255 / 0.86); }
.atotb-footer-fine a { display: inline-block; padding-block: 0.75rem; }
@media (max-width: 1099px) {
	.atotb-footer-main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.atotb-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 781px) {
	.atotb-footer-news { padding: var(--wp--preset--spacing--50); }
	.atotb-footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40); }
	.atotb-footer-main > :last-child { grid-column: 1 / -1; }
	.atotb-footer-base { flex-direction: column; align-items: flex-start !important; }
}

/* One ask at the page end (Ryan, 2026-09-28 and 2026-11-29): where the closing band ends the page, Sign up is the
   footer's one button and its Donate hides. */
/* The old join chapter (until CB1's swap has run, or if it was skipped) asks for Donate too. */
.wp-site-blocks:has(main :is(.atotb-closing-band, .atotb-join)) .atotb-footer-donate { display: none; }

/* The old email strip (atotb/home-utility) on any page that still holds a copy: its hidden heading no longer adds the
   group's block gap above the text (CB1, "What's wrong today"). Only the strip: the proof band has a hidden heading too. */
.wp-block-group.alignfull.has-pale-mint-background-color:not(.atotb-proof) > h2.screen-reader-text:first-child + .wp-block-group { margin-block-start: 0; }
