/**
 * Marquee block.
 *
 * Figma: PAC-Page-Designs, page "Home Page"
 *   1440px  node 2001:1573
 *   1199px  node 2001:1731
 *    768px  node 2001:1889
 *    390px  node 2001:2048
 *
 * Written small-screen first, so the base rules below are the 390px design and
 * each media query adds what changes above it. The 1024-1199 and 1200+ frames
 * are identical in every value, so one breakpoint at 1024px serves both.
 *
 * Most values come from theme.json as var(--wp--preset--*). A few numbers are
 * written literally: the headline sizes (40/56/72) and the two section heights
 * belong to this one section rather than to the design system, so inventing
 * tokens for them would spread this block's layout across two files. Each one
 * names the frame it was measured from.
 *
 * Letter-spacing is in em throughout. Figma states it as a percentage of the
 * font size, and at every size in this block that percentage is the same -
 * 2% on the headline, -2% on body copy, 8% on the button - so one em value
 * per element covers all four breakpoints without repeating itself.
 */


/* ------------------------------------------------------------
   Small screens - up to 767px
   Figma node 2001:2048, drawn at 390px.

   A different composition from the wider frames rather than a
   squeezed version of them: the photograph sits above the text
   instead of behind it, the panel is white, and the headline is
   blue. The markup is the same; only these rules differ.
   ------------------------------------------------------------ */

.pchs-marquee {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	/* Contains the scrim's blend mode. Without it, 'multiply'
	   would blend with whatever sits behind the whole section. */
	isolation: isolate;
	/* Past 1440 the photograph keeps filling the screen while the
	   white panel stops travelling left with it, lining up with
	   the page cap. The gutter is 0 at 1440 and below, so this is
	   a single rule rather than a breakpoint. The panel adds its
	   own 64px, which is why nothing is added here - this moves
	   the panel, not the text inside it. */
	padding-inline: var(--pchs-page-gutter);
}

.pchs-marquee__media {
	position: relative;
	width: 100%;
	/* The frame crops the photograph to this ratio at small
	   sizes rather than letting it keep its own proportions. */
	aspect-ratio: 390 / 219;
	overflow: hidden;
}

/* <picture> is an inline box by default and sizes itself to its
   content. Left alone it breaks the chain the image depends on:
   height:100% below would have no height to be a percentage of,
   and the photograph scales to the wrong size. This makes the
   wrapper fill the media area so the image can fill the wrapper. */
.pchs-marquee__media picture {
	display: block;
	width: 100%;
	height: 100%;
}

.pchs-marquee__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Set per block instance by the editor's focal point picker. render.php
	   passes both points as custom properties on the section, because which
	   one applies depends on the viewport and an inline style cannot carry a
	   media query. */
	object-position: var(--pchs-marquee-focal-mobile, 50% 50%);
}

/* The darkening wash over the photograph. Only present once the
   text moves on top of the image, so it is hidden here. */
.pchs-marquee__scrim {
	display: none;
}

.pchs-marquee__content {
	position: relative;
	display: flex;
	width: 100%;
	max-width: 1024px;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--20);
	/* The shared section padding scale from the theme stylesheet:
	   20/40 on phones, 40/64 from 768, 64/80 from 1024. Declared
	   once there because every section steps through the same
	   three values. */
	padding: var(--pchs-section-py) var(--pchs-section-px);
	background-color: var(--wp--preset--color--white);
}

.pchs-marquee__info {
	display: flex;
	width: 100%;
	max-width: 868px;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--16);
	/* Long words in the headline break rather than overflow the
	   panel on narrow phones. */
	word-break: break-word;
}

/* Both halves of the headline are the same size; only the weight
   differs. The size is set here, once, and the two spans inherit
   it - so a breakpoint changes one number rather than two that
   could fall out of step.

   Figma's generated code reports the second span as 72px at every
   breakpoint, which is wrong: it leaks the component's base value.
   The frame geometry is what settles it. The title box measures
   240px at 390 (six 40px lines), 168px at 768 (three 56px lines)
   and 216px at 1440 (three 72px lines). */
.pchs-marquee__heading {
	margin: 0;
	color: var(--wp--preset--color--blue-500);
	font-family: var(--wp--preset--font-family--title);
	font-size: 40px; /* Figma 2001:2048, title box 240px over 6 lines */
	font-weight: 300;
	line-height: 1;
	letter-spacing: var(--wp--custom--tracking--label); /* 0.02em */
	text-transform: uppercase;
}

/* The heavier weight, applied by an editor to whichever words they
   select with the Emphasis button. The designs use it for the second
   half of the headline, but nothing here requires that - any words,
   any order, any number of runs. */
.pchs-marquee__heading .pchs-em {
	font-weight: 600;
}

.pchs-marquee__body {
	margin: 0;
	color: var(--wp--preset--color--neutral-800);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--lg); /* 20px */
	font-weight: 400;
	/* Figma states this as a ratio of 1.32 but lays the text out on
	   whole pixels, so 20px copy gets 26px lines, not 26.4. Writing
	   the rounded value keeps the block the same height as the
	   frame; the ratio accumulates error down the page. */
	line-height: 26px; /* Figma 2001:2048, subcopy box 104px over 4 lines */
	letter-spacing: var(--wp--custom--tracking--tight); /* -0.02em */
}

.pchs-marquee__actions {
	display: flex;
	width: 100%;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

/* The button itself is .pchs-button in the theme stylesheet,
   shared with the other sections that use one. Nothing specific
   to the banner needs adding here. */


/* ------------------------------------------------------------
   768px and up
   Figma node 2001:1889, drawn at 768px.

   The composition changes here: the photograph becomes the
   section's background, the text sits on top of it in white, and
   the scrim appears to keep that text readable.
   ------------------------------------------------------------ */

@media (min-width: 768px) {

	.pchs-marquee {
		position: relative;
		/* Content is pinned to the bottom of the banner. */
		justify-content: flex-end;
		min-height: 680px; /* Figma 2001:1889 */
		background-color: var(--wp--preset--color--black);
	}

	.pchs-marquee__media {
		position: absolute;
		inset: 0;
		aspect-ratio: auto;
	}

	.pchs-marquee__scrim {
		position: absolute;
		display: block;
		inset: 0;
		background-image: linear-gradient(
			234.7687deg,
			rgba(0, 23, 38, 0) 30.763%,
			rgba(0, 23, 38, 0.4) 99.679%
		);
		mix-blend-mode: multiply;
	}

	.pchs-marquee__content {
		background-color: transparent;
	}

	.pchs-marquee__heading {
		color: var(--wp--preset--color--white);
		font-size: 56px; /* Figma 2001:1889, title box 168px over 3 lines */
	}

	.pchs-marquee__body {
		color: var(--wp--preset--color--white);
		font-size: var(--wp--preset--font-size--xl); /* 24px */
		line-height: 32px; /* Figma 2001:1889, subcopy box 96px over 3 lines */
	}

	.pchs-marquee__image {
		object-position: var(--pchs-marquee-focal, 50% 50%);
	}
}


/* ------------------------------------------------------------
   1024px and up
   Figma nodes 2001:1731 (drawn at 1199px) and 2001:1573 (drawn
   at 1440px). Those two frames carry identical values, so they
   share these rules.
   ------------------------------------------------------------ */

@media (min-width: 1024px) {

	.pchs-marquee {
		min-height: 800px; /* Figma 2001:1573 and 2001:1731 */
	}

	.pchs-marquee__scrim {
		background-image: linear-gradient(
			223.0117deg,
			rgba(0, 23, 38, 0) 36.257%,
			rgba(0, 23, 38, 0.4) 99.689%
		);
	}

	.pchs-marquee__heading {
		font-size: 72px; /* Figma 2001:1573, title box 216px over 3 lines */
	}

	.pchs-marquee__actions {
		max-width: 868px;
	}
}


/* Wider than the design: handled by --pchs-page-gutter on .pchs-marquee at
   the top of this file, which needs no breakpoint. */


/* ============================================================
   THE MEDIUM SIZE - .pchs-marquee--md
   Figma: PAC-Page-Designs, Holistic Nursing
     1440px  node 2934:27250 (1440 x 600)
      768px  node 2934:27522 (768 x 421)
      390px  node 2936:30085 (390 x 582)

   Everything above this line is the large banner, Marquee-Lg,
   which the home page uses. Marquee-Md is the same composition
   at a smaller height, so only what differs is written here:

     - the phone panel is deep blue with white words, where the
       large one is white with blue words
     - the headline is in the heavier weight throughout rather
       than the light-plus-Emphasis pattern
     - the words are centred in the band instead of pinned to
       its foot, and the band is shorter
     - the wash over the photograph runs left to right in black
       rather than diagonally in blue

   The headline and body SIZES are identical in both - 40/56/72
   and 20/24/24 - so they are not repeated.

   These rules are grouped by breakpoint rather than appended in
   one lump, because several of them override a rule the large
   banner sets inside a media query, and a flat block at the end
   of the file would win at every width.
   ============================================================ */

/* Up to 767px - photograph above, deep blue panel below. */

.pchs-marquee--md {
	background-color: var(--wp--preset--color--blue-500);
}

.pchs-marquee--md .pchs-marquee__content {
	background-color: transparent;
}

.pchs-marquee--md .pchs-marquee__heading {
	color: var(--wp--preset--color--white);
	/* One weight, not two. The frames set the whole headline in
	   SemiBold; .pchs-em is still honoured and simply matches. */
	font-weight: 600;
}

.pchs-marquee--md .pchs-marquee__body {
	color: var(--wp--preset--color--white);
}

/*
 * Two different gaps inside one column, so this size sets them as
 * margins instead of using the flex gap: 20px below the headline,
 * 16px below the sentence. Figma draws the dates as the second
 * paragraph of the subcopy layer, which is where that 16 comes from.
 */
.pchs-marquee--md .pchs-marquee__info {
	gap: 0;
}

.pchs-marquee--md .pchs-marquee__body {
	margin-top: var(--wp--preset--spacing--20);
}

.pchs-marquee--md .pchs-marquee__extras {
	margin-top: var(--wp--preset--spacing--16);
}

/*
 * Past 1440 the photograph fills the screen and the words stop at
 * the page cap. The large banner achieves that by insetting the
 * whole section, which also insets its photograph; here the gutter
 * is added to the content's own padding instead, so the picture
 * keeps reaching both edges. See the note on --pchs-page-gutter in
 * the theme stylesheet.
 */
.pchs-marquee--md {
	padding-inline: 0;
}

.pchs-marquee--md .pchs-marquee__content {
	padding-inline: calc(var(--pchs-section-px) + var(--pchs-page-gutter));
	/*
	 * The cap grows by the same gutter on each side, so that the room
	 * left for the words stays the same however wide the screen is.
	 *
	 * Without this the cap stayed 1024 while the padding grew, and the
	 * words were squeezed into whatever was left: at 1920, where the
	 * gutter is 240, that was 416 pixels - a three-line headline and the
	 * row of facts folded into two rows. Every measurement is taken at
	 * 1440 or below, where the gutter is 0 and this changes nothing,
	 * which is how it went unseen.
	 */
	max-width: calc(1024px + 2 * var(--pchs-page-gutter));
}


/* 768px and up - the words move on top of the photograph. */

@media (min-width: 768px) {

	.pchs-marquee--md {
		/* Centred in the band, where the large banner sits at its foot. */
		justify-content: center;
		min-height: 421px; /* Figma 2934:27522 */
	}

	.pchs-marquee--md .pchs-marquee__scrim {
		/*
		 * Figma draws this 1440 wide and centred, because that is how
		 * wide the frame is. It is left spanning the section instead:
		 * capping it would leave the far edges of a wide screen bright
		 * while the middle is dark, which is not a thing any frame
		 * shows. At 1440 and below the two are identical.
		 *
		 * The angle, stops and blend mode are Figma's own values.
		 */
		background-image: linear-gradient(
			80.7857deg,
			rgba(0, 0, 0, 0.8) 23.884%,
			rgba(0, 0, 0, 0.6) 53.191%,
			rgba(0, 0, 0, 0) 78.184%
		);
	}

	.pchs-marquee--md .pchs-marquee__info,
	.pchs-marquee--md .pchs-marquee__actions {
		max-width: 480px; /* Figma 2934:27522, content box */
	}
}


/* 1024px and up. */

@media (min-width: 1024px) {

	.pchs-marquee--md {
		min-height: 600px; /* Figma 2934:27250 */
	}

	.pchs-marquee--md .pchs-marquee__scrim {
		background-image: linear-gradient(
			79.8225deg,
			rgba(0, 0, 0, 0.8) 23.884%,
			rgba(0, 0, 0, 0.6) 53.191%,
			rgba(0, 0, 0, 0) 78.184%
		);
	}

	/*
	 * 788, not 868. The frame's content box is 868 wide and keeps 80px
	 * clear on its right, so the words themselves occupy 788 - and it
	 * is the words, not the box, that decide where a line wraps.
	 */
	.pchs-marquee--md .pchs-marquee__info,
	.pchs-marquee--md .pchs-marquee__actions {
		max-width: 788px; /* Figma 2934:27250, 868 content less 80 right */
	}
}


/* ============================================================
   THE LIGHT TONE - .pchs-marquee--tone-light
   Figma: PAC-Page-Designs, Nursing-PBSN
     1440px  node 3140:23612 (1440 x 600)
      768px  node 3140:23670 ( 768 x 490)
      390px  node 3140:23703 ( 390 x 625)

   The same banner with the photograph washed out from the left
   instead of darkened, so the words sit on the page's own colour
   and are set in blue rather than reversed out. It brings an
   eyebrow with it, and the dates under the subtitle are replaced
   by a row of facts - a Banner facts block, which is the other
   thing a banner may contain.

   The headline ramp is the same 40/56/72 as the dark tone; only
   the colours and the wash differ.
   ============================================================ */

/* Up to 767px - photograph above, pale panel below. */

.pchs-marquee--tone-light {
	background-color: var(--wp--preset--color--yellow-100);
}

.pchs-marquee--tone-light .pchs-marquee__eyebrow,
.pchs-marquee--tone-light .pchs-marquee__body {
	color: var(--wp--preset--color--neutral-800);
}

/*
 * Light again, where the Md size sets the whole headline heavy.
 *
 * This tone marks only part of it - "Bachelor of Science" light and "in
 * Nursing" heavy, node 3140:23612. Taking the heavy weight for the whole
 * thing is not only the wrong drawing: at 768 it makes the first line 531
 * wide in a 480 column, so it wraps and the banner comes out 596 against
 * its frame's 490. At 300 that line is 477.9 and the banner is 490.
 */
.pchs-marquee--tone-light .pchs-marquee__heading {
	color: var(--wp--preset--color--blue-500);
	font-weight: 300;
}

/*
 * 64 below the words on a phone where the dark tone leaves 40. The
 * extra is clearance for the jump-links bar, which straddles the foot
 * of this banner - see blocks/jumplinks.
 */
.pchs-marquee--tone-light .pchs-marquee__content {
	padding-bottom: 64px; /* Figma 3140:23703 */
}

/* 12 between the eyebrow and the headline, where everything else in
   this column is 20 apart. Only applied when there IS an eyebrow. */
.pchs-marquee__eyebrow + .pchs-marquee__heading {
	margin-top: var(--wp--preset--spacing--12);
}

/*
 * 20 below the subtitle, where the dark tone leaves 16. Figma draws
 * the dates as the second paragraph of one text layer and the facts
 * as a layer of their own, which is where the difference comes from.
 */
.pchs-marquee--tone-light .pchs-marquee__extras {
	margin-top: var(--wp--preset--spacing--20);
}


/* 768px and up - the words move on top of the photograph. */

@media (min-width: 768px) {

	.pchs-marquee--tone-light {
		background-color: var(--wp--preset--color--yellow-100);
	}

	/*
	 * A wash rather than a scrim: gold at the left edge, through
	 * yellow-100, to nothing by two thirds across - so the photograph
	 * is only visible on the right where there are no words. Figma's
	 * own angle and stops, and no blend mode on this one, unlike the
	 * dark tone's multiply.
	 */
	.pchs-marquee--tone-light .pchs-marquee__scrim {
		background-image: linear-gradient(
			76.2246deg,
			var(--wp--preset--color--yellow-500) 0%,
			var(--wp--preset--color--yellow-100) 31.117%,
			rgba(247, 241, 215, 0) 61.641%
		);
		mix-blend-mode: normal;
	}

	/*
	 * 80 below the words here, where the section scale gives 64. That is
	 * the jump-links bar's clearance again - the Library asks for 80 at
	 * this width from the component above the bar as well as the one below
	 * it - and it is what node 3140:23670 draws: content 346 tall at y64
	 * in a band of 490.
	 */
	.pchs-marquee--tone-light .pchs-marquee__content {
		padding-bottom: var(--wp--preset--spacing--80);
	}
}

/* No 1024 rules: unlike the dark tone's diagonal scrim, this wash runs
   along the banner's width and Figma draws it at the same angle and the
   same stops in both the 768 and 1440 frames. */
