/*  ==========================================================================
Theme-aware decorations
--------------------------------------------------------------------------
Load AFTER styles.css and legacy-*.css (same selectors, later = wins).

The prototype painted its decorative lines, tints, gradients and halftone
stripes with fixed green/gold hex values and green raster/SVG artwork, so they
stayed green when Site Settings > Theme or a block's Appearance changed the
background. Here every one of them is derived from CSS variables instead:

  --section-bg        the block's background. Set by the .section--usfgreen /
                      --evergreen / --sand classes (theme tokens), or inline by
                      blockStyle() when an editor picks a background colour
                      (it then also adds .has-section-bg).
  --decoration-color  optional editor override (Appearance > Decoration colour).
                      Registered as NOT inherited, so nested blocks keep their own.
  --section-line / --section-tint / --section-glow / --section-pattern-bg
                      derived from --section-bg with relative OKLCH colour.

The OKLCH offsets were solved from the prototype's own colour pairs, so with no
override every derived value lands on the original hex (verified to the 8-bit
value):  #006747 -> line #005432, tint #80B3A4, glow #009374, pattern #006949;
#005432 -> tint #80A997, glow #009374;  #EDEBD1 -> tint #F9F9F1, glow #CFC493.
Line artwork is now an alpha mask (images/*-mask.*) filled with a variable.
==========================================================================  */

@property --decoration-color {
	syntax: "*";
	inherits: false;
}

/* Everything that derives colours needs relative colour syntax; browsers without it
   (or with the pre-2024 percentage channels) keep the original styles.css look. */
@supports (color: oklch(from red calc(l - 0.1) calc(c * 1) calc(h + 1))) {

	/*  --------------------------------------------------------------------------
	Background tokens
	--------------------------------------------------------------------------  */
	.section--usfgreen  { --section-bg: var(--color-primary-usfgreen); }
	.section--evergreen { --section-bg: var(--color-secondary-evergreen); }
	.section--sand      { --section-bg: var(--color-secondary-sand); }

	/* Derived colours. Generic (custom backgrounds) = the USF-green relationships. */
	.has-section-bg,
	.section--usfgreen {
		--section-line: oklch(from var(--section-bg) calc(l - 0.0619) calc(c * 0.9411) calc(h - 5.46));        /* #006747 -> #005432 */
		--section-tint: oklch(from var(--section-bg) calc(l + 0.2717) calc(c * 0.5966) calc(h + 10.98));       /* #006747 -> #80B3A4 */
		--section-glow: oklch(from var(--section-bg) calc(l + 0.1357) calc(c * 1.1848) calc(h + 7.52));        /* #006747 -> #009374 */
		--section-pattern-bg: oklch(from var(--section-bg) calc(l + 0.0063) calc(c * 1.0085) calc(h + 0.38)); /* #006747 -> #006949 */
	}
	.section--evergreen {
		--section-line: oklch(from var(--section-bg) calc(l - 0.0619) calc(c * 0.9411) calc(h - 5.46));
		--section-tint: oklch(from var(--section-bg) calc(l + 0.3068) calc(c * 0.5629) calc(h + 8.17));        /* #005432 -> #80A997 */
		--section-glow: oklch(from var(--section-bg) calc(l + 0.1976) calc(c * 1.2589) calc(h + 12.98));       /* #005432 -> #009374 */
		--section-pattern-bg: var(--section-bg);
	}
	.section--sand {
		--section-line: oklch(from var(--section-bg) calc(l - 0.0619) calc(c * 0.9411) calc(h - 5.46));
		--section-tint: oklch(from var(--section-bg) calc(l + 0.0451) calc(c * 0.3065) calc(h + 3.15));        /* #EDEBD1 -> #F9F9F1 */
		--section-glow: oklch(from var(--section-bg) calc(l - 0.1175) calc(c * 1.9217) calc(h - 6.49));        /* #EDEBD1 -> #CFC493 */
		--section-pattern-bg: var(--section-bg);
	}

	/* Resolve the (non-inherited) editor override here, on the block itself, so the
	   ::before / ::after pseudo-elements can read the result. */
	.has-section-bg,
	.section--usfgreen,
	.section--evergreen,
	.section--sand {
		--_deco-line: var(--decoration-color, var(--section-line));
		--_deco-tint: var(--decoration-color, var(--section-tint));
		--_deco-glow: var(--decoration-color, var(--section-glow));
	}

	/*  --------------------------------------------------------------------------
	Section borders - tint (was #80B3A4 / #80A997 / #F9F9F1)
	--------------------------------------------------------------------------  */
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--top-desc-tint:before {
		background-image: linear-gradient(1.5deg, var(--_deco-tint) 50%, transparent calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--bottom-desc-tint:after {
		background-image: linear-gradient(1.5deg, transparent 50%, var(--_deco-tint) calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--top-asc-tint:before {
		background-image: linear-gradient(-1.5deg, var(--_deco-tint) 50%, transparent calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--bottom-asc-tint:after {
		background-image: linear-gradient(-1.5deg, transparent 50%, var(--_deco-tint) calc(50% + 2px));
	}

	/*  --------------------------------------------------------------------------
	Section borders - solid (the section's own colour; now also for custom backgrounds)
	--------------------------------------------------------------------------  */
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--top-desc-solid:before {
		background-image: linear-gradient(1.5deg, var(--section-bg) 50%, transparent calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--bottom-desc-solid:after {
		background-image: linear-gradient(1.5deg, transparent 50%, var(--section-bg) calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--top-asc-solid:before {
		background-image: linear-gradient(-1.5deg, var(--section-bg) 50%, transparent calc(50% + 2px));
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--bottom-asc-solid:after {
		background-image: linear-gradient(-1.5deg, transparent 50%, var(--section-bg) calc(50% + 2px));
	}

	/*  --------------------------------------------------------------------------
	Section pattern - gradients (was teal -> green, gold -> sand)
	--------------------------------------------------------------------------  */
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--gradient-left,
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--gradient-right {
		background-image: linear-gradient(180deg, var(--_deco-glow), var(--section-bg) 15%);
	}
	@media (min-width: 768px) {
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--gradient-left {
			background-image: linear-gradient(90deg, var(--_deco-glow), var(--section-bg) 50%);
		}
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--gradient-right {
			background-image: linear-gradient(270deg, var(--_deco-glow), var(--section-bg) 50%);
		}
	}

	/*  --------------------------------------------------------------------------
	Section pattern - connected lines (was connected-lines-usfgreen.svg: #006949 + #005432 lines)
	The block keeps the original fade layer over the pattern's base colour; the lines
	are a pseudo-element filled with --_deco-line through connected-lines-mask.svg,
	using the same sizes/positions as the original background layers. ::after is
	used unless the block already uses it for a bottom border, then ::before.
	--------------------------------------------------------------------------  */
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg):is(.section--connected-lines-left, .section--connected-lines-right) {
		position: relative;
		isolation: isolate;
		background-color: var(--section-pattern-bg);
		background-image: linear-gradient(180deg, transparent, var(--section-bg) 40%);
		background-size: 200%;
	}
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg):is(.section--connected-lines-left, .section--connected-lines-right):not([class*=section--bottom-])::after,
	:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg):is(.section--connected-lines-left, .section--connected-lines-right)[class*=section--bottom-]:not([class*=section--top-])::before {
		content: "";
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: -1;
		pointer-events: none;
		background-color: var(--_deco-line);
		-webkit-mask-image: linear-gradient(180deg, #000, transparent 40%), url("../images/connected-lines-mask.svg");
		mask-image: linear-gradient(180deg, #000, transparent 40%), url("../images/connected-lines-mask.svg");
		-webkit-mask-size: 200%;
		mask-size: 200%;
		-webkit-mask-repeat: repeat;
		mask-repeat: repeat;
		-webkit-mask-position: 0% 0%;
		mask-position: 0% 0%;
		-webkit-mask-composite: source-in;
		mask-composite: intersect;
	}
	@media (min-width: 768px) {
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-left {
			background-image: linear-gradient(90deg, transparent, var(--section-bg) 50%);
			background-size: auto;
		}
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-right {
			background-image: linear-gradient(270deg, transparent, var(--section-bg) 50%);
			background-size: auto;
		}
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-left:not([class*=section--bottom-])::after,
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-left[class*=section--bottom-]:not([class*=section--top-])::before {
			-webkit-mask-image: linear-gradient(90deg, #000, transparent 50%), url("../images/connected-lines-mask.svg");
			mask-image: linear-gradient(90deg, #000, transparent 50%), url("../images/connected-lines-mask.svg");
			-webkit-mask-size: auto;
			mask-size: auto;
		}
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-right:not([class*=section--bottom-])::after,
		:is(.section--usfgreen, .section--evergreen, .section--sand, .has-section-bg).section--connected-lines-right[class*=section--bottom-]:not([class*=section--top-])::before {
			-webkit-mask-image: linear-gradient(270deg, #000, transparent 50%), url("../images/connected-lines-mask.svg");
			mask-image: linear-gradient(270deg, #000, transparent 50%), url("../images/connected-lines-mask.svg");
			-webkit-mask-size: auto;
			mask-size: auto;
		}
	}

	/*  --------------------------------------------------------------------------
	Section UI components (were #003b20 / #BAA665)
	--------------------------------------------------------------------------  */
	.section--evergreen .card,
	.section--evergreen .card--usfgreen {
		box-shadow: 3px 3px 15px var(--color-secondary-evergreen-950);
	}
	.section--sand .link-list--alt li + li {
		border-top-color: oklch(from var(--color-primary-gold) calc(l - 0.0894) calc(c * 1.3284) calc(h - 4.07)); /* #CFC493 -> #BAA665 */
	}

	/*  --------------------------------------------------------------------------
	Decoration: none (Appearance > Decoration). blockStyle() already drops the
	decoration classes; this also covers ones hard-wired into a block's markup.
	--------------------------------------------------------------------------  */
	.u-no-decoration[class*=section--top-]:before,
	.u-no-decoration[class*=section--bottom-]:after,
	.u-no-decoration[class*=section--connected-lines]:before,
	.u-no-decoration[class*=section--connected-lines]:after,
	.audience-gateway.u-no-decoration:before,
	.audience-gateway.u-no-decoration:after {
		content: none;
	}
	.u-no-decoration:is([class*=section--connected-lines], [class*=section--gradient-]) {
		background-image: none;
		background-color: var(--section-bg);
	}

	/*  ==========================================================================
	Audience gateway (was halftone-stripes-usfgreen-small.png, an opaque green
	image that hid any theme/custom background, + rgba(39,122,73,.5) glow)
	Base #0F6949, stripes #0E6E4E and glow rgba(39,122,73,.5) are derived from
	--section-bg; stripes come through halftone-stripes-mask.png.
	==========================================================================  */
	.audience-gateway {
		--section-bg: var(--color-primary-usfgreen);
		--_gw-stripe: var(--decoration-color, oklch(from var(--section-bg) calc(l + 0.0238) calc(c * 1.001) calc(h + 0.49)));   /* -> #0E6E4E */
		--_gw-glow: var(--decoration-color, oklch(from var(--section-bg) calc(l + 0.0621) calc(c * 1.1366) calc(h - 9.81)));      /* -> #277A49 */
		position: relative;
		isolation: isolate;
		background-color: oklch(from var(--section-bg) calc(l + 0.0083) calc(c * 0.9751) calc(h - 0.62));                          /* -> #0F6949 */
		background-image: none;
	}
	.audience-gateway:before,
	.audience-gateway:after {
		content: "";
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: -1;
		pointer-events: none;
	}
	.audience-gateway:before {
		background-color: var(--_gw-stripe);
		-webkit-mask-image: url("../images/halftone-stripes-mask.png");
		mask-image: url("../images/halftone-stripes-mask.png");
		-webkit-mask-position: center;
		mask-position: center;
		-webkit-mask-repeat: repeat;
		mask-repeat: repeat;
	}
	.audience-gateway:after {
		background-image: linear-gradient(90deg, color-mix(in srgb, var(--_gw-glow) 50%, transparent), transparent 80%);
		background-position: center;
	}
	/* An uploaded background image replaces the pattern, as before. */
	.audience-gateway[style*="background-image"]:before,
	.audience-gateway[style*="background-image"]:after {
		content: none;
	}

	/*  ==========================================================================
	Header (was rgba(0,103,71,.75), diagonal-lines-gold/-white/.png, wavy-lines-usfgreen.svg)
	==========================================================================  */
	/* Home overlay header: the gradient behind the logo/nav (the Header global can still override it). */
	.js .header--overlay-inner:before {
		background: linear-gradient(180deg, color-mix(in srgb, var(--color-primary-usfgreen) 75%, transparent), transparent);
	}

	/* Dropdown section heading hatch: the PNG artwork becomes an alpha mask. */
	.js .header__nav-heading:before {
		background-image: none;
		background-color: color-mix(in srgb, var(--color-primary-gold) 85%, #fff);
		-webkit-mask-image: url("../images/diagonal-lines-gold.png");
		mask-image: url("../images/diagonal-lines-gold.png");
	}
	.js .header--slate .header__nav-heading:before,
	.js .header--dark .header__nav-heading:before,
	.js .header--light .header__nav-heading:before {
		background-image: none;
		background-color: #fff;
		-webkit-mask-image: url("../images/diagonal-lines-white.png");
		mask-image: url("../images/diagonal-lines-white.png");
	}
	.js :is(.header--overlay, .header--dropdown-white) .header__nav-heading:before {
		background-image: none;
		background-color: var(--color-primary-usfgreen);
		-webkit-mask-image: url("../images/diagonal-lines.png");
		mask-image: url("../images/diagonal-lines.png");
	}

	/* White dropdown: wavy band at the bottom = solid band (::before) + masked lines (::after). */
	.js :is(.header--overlay, .header--dropdown-white) .header__nav-menu:before {
		position: absolute;
		content: "";
		height: var(--space-4);
		width: 100%;
		bottom: -2px;
		left: 0;
		border-radius: 0 0 var(--radius-sm) var(--radius-sm);
		pointer-events: none;
		background-color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0063) calc(c * 1.0085) calc(h + 0.38)); /* -> #006949 */
	}
	.js :is(.header--overlay, .header--dropdown-white) .header__nav-menu:after {
		pointer-events: none;
		background-image: none;
		background-color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0384) calc(c * 1.0506) calc(h + 0.32)); /* -> #0A7351 */
		-webkit-mask-image: url("../images/wavy-lines-mask.svg");
		mask-image: url("../images/wavy-lines-mask.svg");
		-webkit-mask-size: 50%;
		mask-size: 50%;
		-webkit-mask-repeat: repeat;
		mask-repeat: repeat;
	}

	/*  ==========================================================================
	Legacy content components (legacy-global.css / legacy-secondary.css):
	fixed USF-green shades -> derived from the Primary theme colour
	==========================================================================  */
	/* was rgba(0, 103, 71, 0.9) */
	.content .u-rotator_prev,
	.content .u-rotator_next,
	.content .u-rotator_pause,
	.content .u-rotator_play {
		background-color: color-mix(in srgb, var(--color-primary-usfgreen) 90%, transparent);
	}
	/* was #007955 */
	.content .u-rotator_controlLink.flex-active,
	.content .u-rotator_controlLink:hover,
	.content .u-rotator_controlLink:active,
	.content .u-rotator_controlLink:focus {
		background-color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0554) calc(c * 1.1129) calc(h + 0.57));
	}
	@media (min-width: 850px), print {
		.content .snippetRotator_controlLink.flex-active,
		.content .snippetRotator_controlLink:hover,
		.content .snippetRotator_controlLink:active,
		.content .snippetRotator_controlLink:focus {
			background-color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0554) calc(c * 1.1129) calc(h + 0.57));
		}
	}
	/* was #007a60 */
	.content a.skipLink:active,
	.content a.skipLink:focus,
	.content .snippetWidget .widget_calIcon {
		background-color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0612) calc(c * 1.0338) calc(h + 7.66));
	}
	.content .secondaryContent_heading {
		color: oklch(from var(--color-primary-usfgreen) calc(l + 0.0612) calc(c * 1.0338) calc(h + 7.66));
	}

} /* @supports */

/*  ==========================================================================
legacy-secondary.css generated block (proto-inline, rewritten by import:proto):
#9ccb3b borders -> Alternate accent token
==========================================================================  */
#content[data-page="admissions"] > :nth-last-child(1 of .widgetRegion:has(> .widgetRegion_heading)) > .widgetRegion_heading {
	border-left-color: var(--color-accent-apple) !important;
	border-right-color: var(--color-accent-apple) !important;
}
#content[data-page="admissions/visit"] .widgetRegion_heading,
#content[data-page="admissions/visit"] .widget_name {
	border-left-color: var(--color-accent-apple);
	border-right-color: var(--color-accent-apple);
}
#content[data-page="admissions/visit"] .widgetRegion_heading::before,
#content[data-page="admissions/visit"] .widgetRegion_heading::after,
#content[data-page="admissions/visit"] .widget_name::before,
#content[data-page="admissions/visit"] .widget_name::after {
	border-top-color: var(--color-accent-apple);
}
