/* UBC surface contract. Shared by frontend and Gutenberg.
 * Page chapters join edge to edge; reading flow keeps its own normal block gap.
 * No page IDs, visual-only full-bleed tricks, or changes to editor-owned copy.
 */
body.ubc-2026-site > .wp-site-blocks > footer.wp-block-template-part {
	margin-block: 0;
}

:where(main) > .wp-block-post-content > :is(section, .ubc-section-band, .wp-block-cover.alignfull, .wp-block-media-text.alignfull),
.editor-styles-wrapper .is-root-container > :is(section, .ubc-section-band, .wp-block-cover.alignfull, .wp-block-media-text.alignfull) {
	margin-block: 0 !important;
}

/* Informational pages stay neutral in either OS scheme; dark presentation
 * chapters, Home/FEMALE covers and team profiles retain their explicit colors. */
body.ubc-2026-site:has(main .ubc-page-intro),
.editor-styles-wrapper:has(.ubc-page-intro),
body.ubc-2026-site:has(main.ubc-editorial-page) {
	--ubc-ink: #171719;
	--ubc-paper: #f7f7f5;
	--ubc-surface: #ffffff;
	--ubc-line: #deded8;
	--ubc-muted: #646469;
	--ubc-support-bg: #dceef6;
}

:is(.ubc-page-intro, .ubc-editorial-page-header) {
	background: var(--ubc-paper) !important;
	color: var(--ubc-ink);
	border-block: 0;
}
.ubc-editorial-page-header .wp-block-post-title {
	color: var(--ubc-ink) !important;
	max-width: 24ch;
}
.ubc-editorial-page-header-inner { padding-block: 0; }
.ubc-editorial-page-featured { margin-block: 0 var(--ubc-section-space); }
.ubc-page-intro :is(h1, h2, h3, p, li, summary) {
	color: var(--ubc-ink) !important;
}
.ubc-page-intro a:not(.wp-block-button__link) {
	color: var(--ubc-purple-ink) !important;
}
.ubc-page-intro :is(.ubc-teams-jump-links, .ubc-trial-jump-links) a {
	color: var(--ubc-ink) !important;
}
.ubc-page-intro a:not(.wp-block-button__link):is(:hover, :focus-visible) {
	color: var(--ubc-ink) !important;
	text-decoration: underline;
}
.ubc-page-intro .is-style-outline .wp-block-button__link {
	color: var(--ubc-ink) !important;
	border-color: var(--ubc-ink);
}
.ubc-page-intro .is-style-outline .wp-block-button__link:is(:hover, :focus-visible) {
	background: var(--ubc-black);
	color: var(--ubc-on-dark) !important;
}
.ubc-page-intro :is(.ubc-teams-jump-links, .ubc-trial-jump-links) p {
	border-color: var(--ubc-line);
}
.ubc-page-intro .ubc-club-hero-fact { border-color: var(--ubc-line); }
.ubc-page-intro .ubc-club-hero-fact p:first-child { color: var(--ubc-purple-ink) !important; }
.ubc-page-intro .ubc-club-hero-fact p:last-child { color: var(--ubc-muted) !important; }
body:has(main .ubc-page-intro) .ubc-editorial,
.editor-styles-wrapper:has(.ubc-page-intro) .ubc-editorial { --ubc-editorial-link: var(--ubc-purple-ink); }

/* A chapter paints the viewport; the inner wide group owns readable geometry. */
.ubc-section-band {
	max-width: none;
	padding: 0;
}
.ubc-section-band > .alignwide {
	margin-block: 0;
	padding-block: var(--ubc-section-space);
}
/* Color styles also work on ordinary core groups. Chapter geometry stays with
 * ubc-section-band; selecting a color must not change the group's width. */
.wp-block-group.is-style-ubc-section-paper { background: var(--ubc-paper); color: var(--ubc-ink); }
.wp-block-group.is-style-ubc-section-white { background: var(--ubc-surface); color: var(--ubc-ink); }
.wp-block-group.is-style-ubc-section-dark { background: var(--ubc-black); color: var(--ubc-on-dark); }
.wp-block-group.is-style-ubc-section-dark :is(h1, h2, h3, h4, h5, h6, p, li) { color: var(--ubc-on-dark); }
.wp-block-group.is-style-ubc-section-dark a:not(.wp-block-button__link) { color: var(--ubc-on-dark); }
.wp-block-group.is-style-ubc-section-dark .is-style-outline .wp-block-button__link { color: var(--ubc-on-dark); border-color: currentColor; }
.ubc-section-band > .alignwide > :first-child { margin-block-start: 0; }
.ubc-section-band > .alignwide > :last-child { margin-block-end: 0; }

/* Existing white chapters have been given a true outer band; their established
 * grids, heading hierarchy and internal padding remain on the wide inner group. */
.ubc-section-band > :is(.ubc-nachwuchs-values, .ubc-nachwuchs-two-paths, .ubc-performance-intro, .ubc-protection-first-help, .ubc-protection-standards) {
	background: transparent;
}

/* Color changes already separate chapters. Row, table and accordion rules stay. */
.ubc-support-page-club,
.ubc-support-page-youth,
.ubc-games-next { border-block: 0; }

.ubc-page-intro--starter > .alignwide { padding-block: var(--ubc-masthead-space); }
.ubc-page-intro--starter h1 { margin: 0; }
.ubc-page-intro--starter p { max-width: 68ch; font-size: var(--ubc-type-intro); }

/* Compact service intro: editable native image, with a quiet reading area.
 * The photo supports the task; the navigation stays immediately below it. */
.ubc-service-photo-intro { overflow: hidden; }
.ubc-service-photo-intro > .alignwide {
	position: relative;
	isolation: isolate;
	min-height: 15rem;
	padding-block: 3rem;
}
.ubc-service-photo-intro-copy {
	position: relative;
	z-index: 1;
	max-width: 38rem !important;
	margin-block-start: 0 !important;
}
.ubc-service-photo-intro .ubc-service-photo-intro-copy h1 {
	max-width: none;
	font-size: var(--ubc-type-title) !important;
	line-height: 1.12;
	margin: 0;
}
.ubc-service-photo-intro .ubc-service-photo-intro-copy p {
	max-width: 40ch;
	font-size: var(--ubc-type-intro);
	line-height: 1.55;
	margin-block: 1rem 0;
}
.ubc-service-photo-intro .ubc-service-photo-intro-image {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-end: var(--ubc-shell-gutter);
	width: min(60%, 44rem);
	max-width: none;
	aspect-ratio: 5 / 2;
	margin: 0 !important;
	overflow: hidden;
	transform: translateY(-50%);
	opacity: 0.7;
	mask-image: linear-gradient(to right, transparent, #000 38%), linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
	mask-composite: intersect;
}
.ubc-service-photo-intro-image img {
	display: block;
	width: 100%;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
	filter: saturate(0.45);
}
/* The lower detail shows the net and hall, excluding the sponsor logo above.
 * A fixed frame ratio preserves that crop at every viewport. */
.ubc-service-photo-intro-image.ubc-photo-crop-hoop img {
	object-position: 50% 72%;
}
.editor-styles-wrapper .ubc-service-photo-intro-image .components-resizable-box__container {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
}
/* The outer Gutenberg group already owns the common page gutter. */
.ubc-games-data { margin-block-start: 0 !important; }
.ubc-games-data .ubcs {
	width: 100%;
	max-width: none;
	padding-inline: 0;
	margin-block-start: 0;
}
@media (max-width: 900px) {
	.ubc-service-photo-intro-copy { max-width: 70% !important; }
	.ubc-service-photo-intro .ubc-service-photo-intro-image {
		width: 30rem;
		inset-inline-end: -8rem;
		opacity: 0.45;
	}
}
@media (max-width: 600px) {
	.ubc-service-photo-intro > .alignwide { min-height: 11rem; padding-block: 2rem; }
	.ubc-service-photo-intro-copy { max-width: none !important; }
	.ubc-service-photo-intro .ubc-service-photo-intro-copy h1 { font-size: clamp(2rem, 8.5vw, 2.5rem) !important; }
	.ubc-service-photo-intro .ubc-service-photo-intro-copy p { font-size: 1.0625rem; }
	.ubc-service-photo-intro .ubc-service-photo-intro-image {
		width: 26rem;
		inset-inline-end: -7rem;
		opacity: 0.22;
	}
}

/* The team return links need breathing room inside their own chapter, not a
 * collapsing outer margin that appears as a stripe before the site footer. */
.ubc-team-profile-footer-nav {
	margin-block-end: 0;
	padding-block-end: var(--ubc-section-space);
}

/* Complete team portraits and funding marks retain their original proportions. */
.ubc-team-portrait { margin: 0; width: 100%; }
.ubc-team-portrait img { display: block; width: 100%; height: auto; border-radius: 8px; }
.ubc-team-portrait figcaption { color: var(--ubc-on-dark); font-size: 0.8125rem; margin-block-start: 0.5rem; }
.ubc-support-page-women--team-photo { min-height: 0; align-items: center; }
.ubc-support-page-women--team-photo .wp-block-media-text__media,
.ubc-support-page-women--team-photo .wp-block-media-text__media img {
	height: auto;
	min-height: 0;
	width: 100%;
	object-fit: contain;
}
.ubc-club-funding-content { min-width: 0; width: 100%; }
.ubc-funding-logo { margin: 1.5rem 0 0; width: min(100%, 40rem); }
.ubc-funding-logo img { display: block; width: 100%; height: auto; }
.ubc-club-media-links { align-self: center; }
.ubc-club-media-links p { margin-block: 0 1rem; }
.ubc-legal-content { overflow-wrap: anywhere; }
.ubc-legal-content h3 { font-size: 1.5rem; margin-block: 2rem 0.75rem; }
.ubc-legal-content h4 { font-family: var(--ubc-body); font-size: 1.0625rem; font-weight: 700; line-height: 1.5; margin-block: 1.5rem 0.5rem; }

/* For photos with clear space above the subjects: keep the copy off faces.
 * On narrow screens the complete landscape image sits beneath the copy. */
.ubc-feature--photo-top {
	justify-content: flex-start;
	padding: 2rem;
}
.ubc-feature--photo-top::before {
	background: linear-gradient(180deg, rgb(11 11 12 / 0.5), transparent 45%);
}
.ubc-feature--photo-top .wp-block-cover__inner-container > :is(h2, p, .wp-block-buttons) {
	max-width: none;
}
.ubc-team-lead--portrait { min-height: 40rem !important; }
.wp-block-cover.ubc-team-lead--portrait > .wp-block-cover__background.has-background-dim {
	background: linear-gradient(0deg, rgb(11 11 12 / 0.98), rgb(11 11 12 / 0.82) 22%, transparent 66%);
	/* WordPress palette utility uses !important; keep the gradient's clear end clear. */
	background-color: transparent !important;
	opacity: 1;
}
@media (max-width: 600px) {
	.ubc-feature--photo-top { padding: 1.5rem; }
	.ubc-feature--photo-top .wp-block-cover__image-background {
		object-fit: contain;
		object-position: center bottom !important;
	}
}
