/**
 * RLMC Foundation pages
 *
 * Two things live here, both hand-written because the Tailwind build that
 * produced dist/css/theme.css is not in this repo:
 *
 *  1. The "foundation" page theme. A page whose ACF "Theme" select is set to
 *     Foundation gets body.theme-foundation (inc/vendor/acf.php) and these rules
 *     swap the green header/nav/hero chrome for the Foundation teal palette.
 *     Everything in that part is scoped to body.theme-foundation so the rest of
 *     the site is untouched.
 *
 *  2. Section styles used by the Foundation pages (CTA band, people grid, event
 *     groups, give rows, text links). These are plain pattern-* classes on core
 *     blocks, so editors can reuse them anywhere.
 *
 * Palette: dark teal #08343A, teal #1B9AAA, cream #F2F1DC, lime #ADCE73.
 */

/* ------------------------------------------------------------------ */
/* Palette classes for the two colours added to theme.json.            */
/* global-styles is dequeued on the frontend (inc/gutenberg.php), so   */
/* these mirror the compiled .has-primary-* rules by hand.             */
/* ------------------------------------------------------------------ */

.has-foundation-dark-color {
	color: #08343A !important;
}

.has-foundation-dark-background-color {
	background-color: #08343A !important;
}

.has-foundation-teal-color {
	color: #1B9AAA !important;
}

.has-foundation-teal-background-color {
	background-color: #1B9AAA !important;
}

/* Text inside a dark-teal cover reads cream, like the compiled primary rule. */
.has-foundation-dark-background-color + .wp-block-cover__inner-container {
	color: #F2F1DC;
}

/* ------------------------------------------------------------------ */
/* Page chrome: header, nav, supermenu                                  */
/* ------------------------------------------------------------------ */

/* .supermenu also carries .site-header, so one rule recolours the masthead
   and the open mega-menu overlay. */
body.theme-foundation .site-header {
	background-color: #08343A;
	color: #F2F1DC;
}

body.theme-foundation .primary-menu > li > a,
body.theme-foundation .supermenu .primary-menu > li > a {
	color: #F2F1DC;
}

body.theme-foundation .secondary-menu > li > a {
	color: #F2F1DC;
}

body.theme-foundation .supermenu .menu,
body.theme-foundation .supermenu .primary-menu,
body.theme-foundation .supermenu .primary-menu li {
	border-color: #1B9AAA;
}

body.theme-foundation .supermenu .menu-wrapper h2 a:hover {
	color: #1B9AAA;
}

/* Foundation panel in the mega-menu: the compiled .supermenu .menu rule splits
   lists into two columns, which looks sparse with only three items. */
.supermenu #foundation-menu .menu {
	column-count: 1;
}

/* Full-width blocks are sized with 100vw, which includes the scrollbar, so
   every page scrolls about 8px sideways. Clip that on Foundation pages
   (overflow-x: clip does not create a scroll container, so sticky/absolute
   children keep working). */
body.theme-foundation .site {
	overflow-x: clip;
}

/* ------------------------------------------------------------------ */
/* Hero (pattern-hero-a) on Foundation pages                           */
/* ------------------------------------------------------------------ */

/* The compiled hero dims the photo to 25% over the background colour. The
   Foundation hero shows the photo at full strength under an 80% teal wash. */
body.theme-foundation .pattern-hero-a .wp-block-media-text__media img {
	opacity: 1;
}

/* Full-bleed hero photo instead of the theme's 60/40 split. The compiled
   figure is absolutely positioned at right:0/width:60% (with a
   .page:not(.home) rule that unsets left), so these need !important. The
   text block stays absolutely positioned over the photo and overlay. */
body.theme-foundation .pattern-hero-a .wp-block-media-text__media {
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-height: none !important;
	aspect-ratio: auto !important;
}

body.theme-foundation .pattern-hero-a .wp-block-media-text__media::after {
	content: '';
	position: absolute;
	inset: 0;
	background-color: rgba(27, 154, 170, 0.8);
	pointer-events: none;
}

/* Hero headlines run ~33% larger on the Foundation pages only. The preset
   is clamp(50px, 5vw + 30px, 96px) with !important, so this scales each
   term by 1.33 and needs !important too. The compiled hero keeps the H1 on
   one line; at this size a two-word-plus title would run past the viewport,
   so wrapping is allowed and the width capped at the hero's text area. */
body.theme-foundation .pattern-hero-a .has-heading-huge-font-size {
	font-size: clamp(66px, calc(6.65vw + 40px), 128px) !important;
	white-space: normal;
	max-width: 1100px;
	line-height: 1;
}

/* Long hero headlines (Give page): a smaller step so the two lines fit. */
body.theme-foundation .pattern-hero-a .pattern-hero-a__title--long {
	font-size: clamp(53px, 6.65vw, 96px) !important;
	max-width: 1100px;
}

/* Section headings (Staff, Board, Events, Ways to Give) run ~30% larger on
   the Foundation pages only: 50px -> 65px. WP prints the preset class with
   !important, so the override needs it too. Stepped down on phones so the
   longer headings still wrap cleanly. */
body.theme-foundation .has-heading-large-font-size {
	font-size: calc(var(--wp--preset--font-size--heading-large) * 1.3) !important;
}

@media (max-width: 799px) {
	body.theme-foundation .has-heading-large-font-size {
		font-size: clamp(40px, 11vw, 65px) !important;
	}
}

/* Hero text links sit on the dark-teal band, so they read cream there. */
body.theme-foundation .pattern-hero-a .pattern-text-link .wp-block-button__link.wp-element-button {
	color: #F2F1DC;
}

/* The hero's "p{max-width:400px}" rule would squeeze a buttons row; the
   buttons block is a div so it is unaffected, but keep links on one line. */
body.theme-foundation .pattern-hero-a .pattern-text-link {
	margin-top: 32px;
}

/* ------------------------------------------------------------------ */
/* Inline links inside Foundation sections                              */
/* The compiled base rule paints every <a> lime with no underline, which */
/* is unreadable on the cream/white bands. Inherit the body colour and   */
/* underline instead.                                                    */
/* ------------------------------------------------------------------ */

.pattern-intro-a p a,
.pattern-event-group p a,
.pattern-people p a,
.pattern-join-mission p a,
.pattern-give-row p a {
	color: inherit;
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.pattern-intro-a p a:hover,
.pattern-event-group p a:hover,
.pattern-people p a:hover,
.pattern-join-mission p a:hover,
.pattern-give-row p a:hover {
	color: #1B9AAA;
}

/* ------------------------------------------------------------------ */
/* Text link: uppercase Fira Sans, 2px underline, circle-outline icon   */
/* Use: buttons block with className "is-style-link pattern-text-link". */
/* ------------------------------------------------------------------ */

.pattern-text-link .wp-block-button__link.wp-element-button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0 8px;
	background-color: transparent;
	border-radius: 0;
	border-bottom: 2px solid currentColor;
	color: #08343A;
	font-family: var(--font-alt);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	transition: opacity .15s ease;
}

/* The compiled link style draws a lime arrow-in-circle SVG on ::after and a
   lime underline on ::before. Here the icon is a plain circle outline at
   rest, and a dark-teal arrow fades in inside it on hover. */
.pattern-text-link .wp-block-button__link.wp-element-button::after {
	content: '';
	flex: 0 0 auto;
	width: 19px;
	height: 19px;
	margin: 0;
	border: 2px solid currentColor;
	border-radius: 50%;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5h6M5.2 2.2 8 5 5.2 7.8' fill='none' stroke='%2308343A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 9px 9px no-repeat;
	background-color: transparent;
	opacity: 1;
	transition: background-size .15s ease;
	background-size: 0 0;
}

.pattern-text-link .wp-block-button__link.wp-element-button:hover::after {
	background-size: 9px 9px;
}

.pattern-text-link .wp-block-button__link.wp-element-button::before {
	content: none;
}

.pattern-text-link .wp-block-button__link.wp-element-button:hover {
	background-color: transparent;
	color: inherit;
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Pill button (Donate)                                                 */
/* Use: buttons block with className "pattern-pill".                    */
/* ------------------------------------------------------------------ */

.pattern-pill .wp-block-button__link.wp-element-button {
	padding: 14px 50px;
	background-color: #1B9AAA;
	border-radius: 100px;
	color: #F2F1DC;
	font-family: var(--font-display);
	font-size: 36px;
	font-weight: 700;
	line-height: 1;
	text-transform: none;
}

.pattern-pill .wp-block-button__link.wp-element-button:hover {
	background-color: #F2F1DC;
	color: #08343A;
}

/* ------------------------------------------------------------------ */
/* Intro band (cream, lead text left, photo right)                      */
/* ------------------------------------------------------------------ */

.wp-block-cover.pattern-intro-a {
	color: #0F2107;
}

.pattern-intro-a .wp-block-image img {
	width: 100%;
	aspect-ratio: 522 / 407;
	object-fit: cover;
}

/* Give or Get Involved intro photo (the hands, 1200x630) carries the
   Foundation logo in its left third; crop from the right so it stays out
   of frame. */
body.is-page-give-or-get-involved .pattern-intro-a .wp-block-image img {
	object-position: right center;
}

/* Who We Are: the intro copy runs tall on desktop, so its portrait photo
   shows uncropped rather than squeezed into the landscape slot. */
body.is-page-foundation .pattern-intro-a .wp-block-image img {
	aspect-ratio: auto;
}

.pattern-intro-a .pattern-text-link {
	margin-top: 24px;
}

/* ------------------------------------------------------------------ */
/* CTA band (pattern-cta-b): dark teal strip, copy left, pill right     */
/* ------------------------------------------------------------------ */

.wp-block-cover.alignfull.pattern-cta-b {
	padding-top: 32px;
	padding-bottom: 32px;
}

.pattern-cta-b .wp-block-columns {
	margin-top: 0;
	margin-bottom: 0;
}

.pattern-cta-b__text {
	font-family: var(--font-display);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.35;
	color: #fff;
}

.pattern-cta-b__text.is-large {
	font-size: 38px;
	line-height: 1.1;
}

.pattern-cta-b .wp-block-buttons {
	margin: 0;
}

/* ------------------------------------------------------------------ */
/* People grid (staff / board): centred name + role, 3 per row          */
/* ------------------------------------------------------------------ */

.pattern-people {
	text-align: center;
}

.pattern-people__text {
	max-width: 970px;
	margin-left: auto !important;
	margin-right: auto !important;
}

.pattern-people-grid {
	margin-top: 32px !important;
	margin-bottom: 48px !important;
}

/* Optional centred photo under a people section. */
.pattern-people__photo {
	max-width: 720px;
	margin: 40px auto 0 !important;
}

.pattern-people__photo img {
	width: 100%;
	height: auto;
}

/* Paragraph spacing under the people grid (two board paragraphs). */
.pattern-people__text + .pattern-people__text {
	margin-top: 24px !important;
}

.pattern-people-grid__name {
	margin: 0;
	font-family: var(--font-display);
	font-size: 38px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.1;
	color: #0F2107;
}

.pattern-people-grid__role {
	margin-top: 6px;
	font-size: 18px;
}

.pattern-people-grid__email {
	margin-top: 4px;
	font-size: 16px;
}

/* Teal rule between staff and board. */
.wp-block-separator.pattern-rule {
	max-width: 847px;
	margin: 48px auto;
	border: 0;
	border-top: 2px solid #1B9AAA;
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Join Our Mission band                                                */
/* ------------------------------------------------------------------ */

.wp-block-cover.pattern-join-mission {
	color: #0F2107;
}

.pattern-join-mission__heading {
	max-width: 320px;
	font-size: 38px;
	font-weight: 700;
	letter-spacing: -.02em;
	line-height: 1.05;
	color: #08343A;
}

/* ------------------------------------------------------------------ */
/* Event group: heading + thin rule, sub-events left, photos right      */
/* ------------------------------------------------------------------ */

.pattern-event-group {
	color: #0F2107;
}

.pattern-event-group__title {
	margin: 0 0 12px;
	font-size: 38px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.1;
	color: #08343A;
}

.wp-block-separator.pattern-event-group__rule {
	margin: 0 0 32px;
	border: 0;
	border-top: 1px solid #000;
	opacity: 1;
}

.pattern-event-group__subtitle {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.2;
	color: #08343A;
}

.pattern-event-group__subtitle:not(:first-child) {
	margin-top: 32px;
}

/* The nested wide columns sit inside an already-wide group: drop the
   .alignwide side padding and its narrower max-width so the copy and photo
   line up with the group heading and rule above them. */
.pattern-event-group .pattern-event-group__columns.alignwide {
	padding-left: 0;
	padding-right: 0;
	max-width: none;
	width: 100%;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* The compiled image rule centres figures with auto side margins; pin the
   right margin so the photo sits flush with the rule's right edge. */
.pattern-event-group .wp-block-image {
	margin-left: auto;
	margin-right: 0;
	max-width: 414px;
}

.pattern-event-group .wp-block-image + .wp-block-image {
	margin-top: 24px;
}

/* ------------------------------------------------------------------ */
/* Section band: full-width cover that every white/cream section sits   */
/* in, so all sections share the cover's content box and edges.         */
/* ------------------------------------------------------------------ */

.wp-block-cover.pattern-band {
	color: #0F2107;
	min-height: 0;
}

/* Breathing room between a centred section heading and what follows. */
.pattern-section-heading + * {
	margin-top: 48px !important;
}

/* Stacked rows inside one band. */
.pattern-band .pattern-give-row + .pattern-give-row {
	margin-top: 64px !important;
}

/* ------------------------------------------------------------------ */
/* Give rows: copy left, form/embed right                               */
/* ------------------------------------------------------------------ */

.pattern-give-intro {
	max-width: 696px;
	margin-left: auto !important;
	margin-right: auto !important;
}

.pattern-give-row__title {
	margin: 0 0 12px;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.2;
	color: #08343A;
}

.pattern-give-row__embed {
	width: 100%;
	max-width: 630px;
	margin-left: auto;
	aspect-ratio: 630 / 526;
	background-color: #F2F1DC;
}

.pattern-give-row__embed iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.pattern-give-row .gform_wrapper {
	max-width: 630px;
	margin-left: auto;
}

.pattern-give-row .pattern-pill {
	margin-top: 24px;
	justify-content: flex-end;
}

/* ------------------------------------------------------------------ */
/* Mobile                                                               */
/* ------------------------------------------------------------------ */

@media (max-width: 799px) {
	.wp-block-cover.alignfull.pattern-cta-b {
		min-height: 0 !important;
		text-align: center;
	}

	.pattern-cta-b .wp-block-buttons {
		justify-content: center;
	}

	.pattern-pill .wp-block-button__link.wp-element-button {
		font-size: 28px;
		padding: 12px 36px;
	}

	.pattern-people-grid .wp-block-column + .wp-block-column {
		margin-top: 24px;
	}

	.pattern-people-grid__name {
		font-size: 32px;
	}

	.pattern-join-mission__heading {
		max-width: none;
	}

	.pattern-event-group .wp-block-image,
	.pattern-give-row__embed,
	.pattern-give-row .gform_wrapper {
		margin-left: 0;
		margin-right: auto;
	}

	.pattern-give-row .pattern-pill {
		justify-content: flex-start;
	}
}
