/* Stocks in the Future — global escape-hatch CSS (front end + editor canvas).
 *
 * Only what theme.json and styles/*.json cannot express: keyframes, motion
 * preferences, rules spanning many block types. Never style a bare custom
 * className — expose the look as a registered style variation instead.
 */

/* ---------- Motion ---------- */

@keyframes sif-ticker {
	from { transform: translateX(0); }
	to { transform: translateX(-100%); }
}

/* Offset-shadow buttons "press" toward their shadow on hover (Elev8-style). */
.wp-element-button,
.wp-block-button__link {
	transition: box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	transform: translate(4px, 4px);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.wp-block-button.is-style-arrow .wp-block-button__link:hover {
	transform: none;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-2);
}

/* Outline buttons on light sections invert to Deep Blue instead of white. */
:where(.has-base-background-color, .is-style-card, .is-style-section-mist, .is-style-section-mist-grid, .is-style-section-lime-tint, .is-style-section-lime, .is-style-section-teal) .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--primary-2);
	border-color: var(--wp--preset--color--primary-2);
	color: var(--wp--preset--color--base);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- Highlighted words in headings ----------
 * Core "Highlight" format with a background colour → Elev8-style label boxes
 * that wrap cleanly across lines. Text-colour-only highlights are untouched. */
:where(h1, h2, h3, .wp-block-heading) mark.has-inline-color:not([style*="rgba(0, 0, 0, 0)"]):not([style*="rgba(0,0,0,0)"]) {
	padding: 0.02em 0.22em 0.06em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	border-radius: 2px;
}

/* The box is taller than the headings' tight 1.02 line, so on a wrapped heading it covered the
 * line above (Events: "Giving Tuesday: what are YOU investing in?"). Open the lines up a little. */
:where(h1, h2, h3, .wp-block-heading):has(mark.has-inline-color:not([style*="rgba(0, 0, 0, 0)"]):not([style*="rgba(0,0,0,0)"])) {
	line-height: 1.25;
}

/* Email addresses (Board & Staff cards) wrap instead of overflowing narrow cards. */
a[href^="mailto:"] {
	overflow-wrap: anywhere;
}

/* ---------- Chrome ---------- */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 50;
}

.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

/* Chrome abuts the page: template parts have no spacing controls, so the root
 * blockGap would otherwise leave a strip of page background above the footer.
 * (Sections abut via blockGap:0 on post-content in section-based templates.) */
.wp-site-blocks > footer.wp-block-template-part,
.wp-site-blocks > main,
.wp-site-blocks > .wp-block-group {
	margin-block-start: 0;
}

/* ---------- Accessibility ---------- */

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--primary-2);
}

/* ---------- Content details ---------- */

/* Covers: keep text legible above the overlay on narrow screens. */
.wp-block-cover .wp-block-cover__inner-container > * {
	text-wrap: balance;
}

:where(h1, h2, h3) {
	text-wrap: balance;
}

:where(p) {
	text-wrap: pretty;
}

/* Tables (earnings chart etc.) */
.wp-block-table table {
	border-collapse: collapse;
	width: 100%;
}

.wp-block-table table :is(th, td) {
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--neutral);
	padding: 0.85em 1em;
	text-align: left;
	vertical-align: top;
}

.wp-block-table thead {
	border-bottom: 0;
}

.wp-block-table thead th {
	background: var(--wp--preset--color--primary-2);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.wp-block-table tfoot td {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--primary-2);
	font-weight: 800;
	border-bottom: 0;
}

.wp-block-table .has-text-align-right,
.wp-block-table [data-align="right"] {
	text-align: right;
}

/* Quote mark for quotes. */
.wp-block-quote {
	position: relative;
}

.wp-block-quote::before {
	content: "\201C";
	display: block;
	font-family: Georgia, serif;
	font-size: 5em;
	font-style: normal;
	line-height: 0.6;
	height: 0.45em;
	color: var(--wp--custom--color--eyebrow);
}

.wp-block-quote.has-text-align-center::before,
.wp-block-quote[style*="text-align:center"]::before {
	text-align: center;
}

/* Post cards inside query loops: featured image flush, consistent ratio. */
.wp-block-post-featured-image img {
	object-fit: cover;
}

/* Header on small screens: compact logo + Donate button that never wraps. */
.wp-site-blocks > header .wp-block-button__link {
	white-space: nowrap;
}

@media (max-width: 600px) {
	.wp-site-blocks > header .wp-block-site-logo img {
		width: 132px !important;
		height: auto;
	}

	.wp-site-blocks > header .wp-block-button__link {
		padding: 0.7rem 1rem;
		font-size: var(--wp--preset--font-size--x-small);
		box-shadow: 4px 4px 0 0 var(--wp--custom--color--button-shadow);
	}
}

/* ---------- Pattern sections: responsive tweaks ----------
 * (WordPress drops @media inside style-variation css, so they live here.) */
@media (max-width: 781px) {
	/* Hero dots gather around the photo, which stacks below the text. */
	.wp-block-group.is-style-section-deep-dots {
		background-image:
			radial-gradient(ellipse 95% 42% at 50% 82%, rgba(0, 79, 107, 0) 0 35%, var(--wp--preset--color--primary-2) 100%),
			var(--sif-dots, none);
		background-size: auto, 22px 22px;
	}

	/* Full-video hero: text spans the screen, so the left fade becomes an even wash. */
	.wp-block-cover .wp-block-cover__background.has-hero-fade-gradient-background {
		background: linear-gradient(180deg, rgba(0, 79, 107, 0.72) 0%, rgba(0, 79, 107, 0.88) 100%) !important;
	}

	/* Quote strip narrows and the text clears it. */
	.wp-block-group.is-style-section-teal-strip {
		background-size: 44px auto, 120px 150px;
		padding-left: calc(44px + var(--wp--preset--spacing--40)) !important;
	}
}

/* A Video block with "Playback controls" off is decorative (home hero): no hover UI, clicks, or context menu. */
.wp-block-video video:not([controls]) {
	pointer-events: none;
}

/* Pink, used sparingly (client likes pink): text selection, swoosh tips, footer rule. */
::selection {
	background-color: var(--wp--preset--color--pink-2);
	color: var(--wp--preset--color--contrast);
}
