/*
 * Steingard Financial — theme.css
 *
 * What theme.json cannot express. Read the comments: most of the odd-looking
 * rules encode a bug that already happened on the Xcelerated or ARC builds.
 * Bump Version in style.css on EVERY change here (pattern cache is keyed on it).
 *
 * Fonts: heading/body families are declared in theme.json with system
 * fallbacks (Georgia serif / system sans). Self-hosted woff2 files (Source
 * Serif 4, IBM Plex Sans) are an approved-download away — when they land in
 * assets/fonts/, add @font-face here and nothing else changes.
 */

/* ------------------------------------------------------------------ *
 *  Primitives
 * ------------------------------------------------------------------ */

/*
 * Eyebrow label — the small-caps kicker above headings. Brand blue is safe
 * at this size (8.1:1); no darkened variant needed, unlike ARC's pink.
 */
.eyebrow {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wide);
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

/* Eyebrow inside a post-terms block renders links — keep them quiet. */
.eyebrow a {
	color: inherit;
	text-decoration: none;
}
.eyebrow a:hover {
	text-decoration: underline;
}

/*
 * Tabular numbers for anything that reads like a report. The build document
 * asks for "clear tabular numbers" — apply to tables and any .sf-figures
 * container rather than globally (proportional figures read better in prose).
 */
table,
.sf-figures {
	font-variant-numeric: tabular-nums lining-nums;
}

/*
 * height:auto belongs on img/video/canvas ONLY — never iframe. An
 * iframe { height: auto } reset collapsed the Calendly embed on ARC to 150px
 * inside an 830px box. A reset aimed at images broke a revenue path.
 */
img,
video,
canvas {
	max-width: 100%;
	height: auto;
}

/*
 * Anchored headings (the Industries mega links target #ids on /industries/)
 * must clear the sticky header, or the target lands hidden behind it.
 */
[id] {
	scroll-margin-top: 120px;
}

/* Accessible focus that survives on both light and navy sections. */
:where(a, button, input, textarea, select, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}
.site-footer :where(a):focus-visible {
	outline-color: var(--wp--preset--color--surface);
}

/* ------------------------------------------------------------------ *
 *  Header
 * ------------------------------------------------------------------ */

/*
 * Sticky header: cheap trust win for a long article library — the
 * consultation CTA stays reachable 2,000 words into a bookkeeping explainer.
 *
 * Sticky lives on the TEMPLATE-PART WRAPPER, not .site-header: a sticky
 * element sticks only within its parent's box, and .site-header's parent is
 * the wrapper — exactly as tall as the header itself, so sticky on the inner
 * element never engages. (Found by scrolling and looking, not by measuring.)
 *
 * .site-header stays position:relative — it is the containing block the
 * full-width mega panels anchor to (and deliberately carries no
 * backdrop-filter: that would trap core's position:fixed mobile overlay
 * inside the header's box — the Xcelerated letterbox bug).
 */
header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

.site-header {
	position: relative;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

/* The fallback wordmark only exists for installs with no logo uploaded. */
.wp-block-site-logo + .site-header__fallback-title {
	display: none;
}

/*
 * Full-width mega menus (Services / Industries / Insights) — the ARC pattern,
 * by explicit request: built ON core's wp:navigation-submenu, not a bespoke
 * dropdown. Core keeps aria-expanded, Escape-to-close, focus management,
 * click-outside and the mobile overlay; this is CSS on top of a working
 * submenu.
 */
@media (min-width: 600px) {
	/*
	 * For the panel to span the header, EVERY ancestor between it and
	 * .site-header must be position:static — one positioned element in
	 * between silently becomes the containing block. Core nests the nav
	 * inside its responsive-overlay machinery even on desktop, and three of
	 * those wrappers are position:relative (the dialog was the one that bit
	 * on ARC). Note .site-nav IS wp-block-navigation__container — same
	 * element, not a parent — so it must be the compound selector.
	 * Desktop only: the mobile overlay genuinely needs its positioning.
	 */
	.site-header nav.wp-block-navigation,
	.site-header .wp-block-navigation__responsive-container,
	.site-header .wp-block-navigation__responsive-dialog,
	.site-header .wp-block-navigation__responsive-container-content,
	.site-header .site-nav.wp-block-navigation__container,
	.site-header .site-nav .wp-block-navigation__container,
	.site-header .site-header__right,
	.site-header .site-header__inner {
		position: static !important;
	}

	/* The li too — .site-header (sticky = positioned) is the anchor. */
	.site-nav .sf-mega {
		position: static;
	}

	/*
	 * HOVER BRIDGE: the panel starts at the header's bottom edge, ~40px below
	 * the item text, and that gap is dead — crossing it loses hover and shuts
	 * the panel. Extend the item's hover box down with padding and cancel the
	 * layout effect with an equal negative margin (net margin-box height is
	 * unchanged, so the centered flex row does not shift). Do not tidy.
	 */
	.site-header .site-nav li.sf-mega {
		padding-bottom: 44px;
		margin-bottom: -44px;
	}

	/*
	 * Specificity, learned the hard way on ARC: core ships
	 *   .wp-block-navigation .has-child .wp-block-navigation__submenu-container
	 *   { width: 0; left: -1px; }
	 * at (0,3,0). A bare `li.sf-mega > …` is (0,2,1) and LOSES — the panel
	 * keeps core's collapsed geometry no matter what the rule says.
	 * `.site-header .wp-block-navigation li.sf-mega.has-child > …` is (0,5,1)
	 * and wins outright.
	 *
	 * The padding's max() centers the panel content on the 1280px grid while
	 * the surface itself runs edge to edge.
	 */
	.site-header .wp-block-navigation li.sf-mega.has-child > .wp-block-navigation__submenu-container {
		display: grid !important;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		width: 100%;
		min-width: 0;
		border: 0;
		border-top: 1px solid var(--wp--preset--color--line);
		border-bottom: 1px solid var(--wp--preset--color--line);
		border-radius: 0;
		background: var(--wp--preset--color--surface);
		box-shadow: 0 18px 40px rgba(15, 31, 56, 0.10);
		padding: var(--wp--preset--spacing--70) max(var(--wp--preset--spacing--40), calc((100vw - 1280px) / 2 + var(--wp--preset--spacing--40)));
		gap: 1px;
		background-image: none;
	}

	/* Forgiving on the way out (a clipped corner doesn't lose the panel)... */
	.site-header .wp-block-navigation li.sf-mega.has-child > .wp-block-navigation__submenu-container {
		transition: opacity 120ms linear 220ms, visibility 0s linear 340ms;
	}

	/* ...instant on the way in. */
	.site-header .wp-block-navigation li.sf-mega.has-child:hover > .wp-block-navigation__submenu-container,
	.site-header .wp-block-navigation li.sf-mega.has-child:focus-within > .wp-block-navigation__submenu-container {
		transition: opacity 120ms linear 0s, visibility 0s linear 0s;
	}

	.site-header .wp-block-navigation li.sf-mega--services.has-child > .wp-block-navigation__submenu-container,
	.site-header .wp-block-navigation li.sf-mega--industries.has-child > .wp-block-navigation__submenu-container {
		grid-template-columns: repeat(3, 1fr);
	}

	/*
	 * Insights: 12 items (11 approved categories + All articles) over 4
	 * columns — category labels are short so they tile tighter, and 4
	 * columns keeps the panel to three rows (ARC's case-study rationale).
	 */
	.site-header .wp-block-navigation li.sf-mega--insights.has-child > .wp-block-navigation__submenu-container {
		grid-template-columns: repeat(4, 1fr);
	}

	@media (max-width: 1099px) {
		.site-header .wp-block-navigation li.sf-mega--insights.has-child > .wp-block-navigation__submenu-container {
			grid-template-columns: repeat(3, 1fr);
		}
	}

	/* Each cell: label + the description core renders from the attribute. */
	.site-nav .sf-mega .wp-block-navigation__submenu-container .wp-block-navigation-item {
		display: block;
	}

	.site-nav .sf-mega .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		/* Core renders the anchor as a flex row, which puts the description
		   beside the label and overlaps both. Stack them. */
		display: flex !important;
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
		white-space: normal;
		padding: var(--wp--preset--spacing--40);
		border-radius: var(--wp--custom--radius--md);
		font-family: var(--wp--preset--font-family--heading);
		font-size: var(--wp--preset--font-size--medium);
		font-weight: 600;
		letter-spacing: var(--wp--custom--tracking--snug);
		color: var(--wp--preset--color--foreground);
		transition: background var(--wp--custom--duration--fast) var(--wp--custom--ease--out),
		            color var(--wp--custom--duration--fast) var(--wp--custom--ease--out);
	}

	.site-nav .sf-mega .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
	.site-nav .sf-mega .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus-visible {
		background: var(--wp--preset--color--tint);
		color: var(--wp--preset--color--primary);
	}

	.site-nav .sf-mega .wp-block-navigation-item__description {
		display: block;
		margin-top: 3px;
		font-family: var(--wp--preset--font-family--body);
		font-size: var(--wp--preset--font-size--x-small);
		font-weight: 400;
		line-height: 1.45;
		color: var(--wp--preset--color--muted);
	}

	/* The "All services / All industries / All articles" row: a way out.
	   display:block, not the flex column — these have no description, and in
	   a flex column the ::after arrow becomes its own flex item on a new
	   line. Must OUT-SPECIFY the flex rule above (both are !important, so
	   specificity decides): that rule is (0,4,0), this is (0,5,0). */
	.site-nav .sf-mega .wp-block-navigation__submenu-container .sf-mega__all .wp-block-navigation-item__content {
		display: block !important;
		color: var(--wp--preset--color--primary) !important;
		font-size: var(--wp--preset--font-size--small) !important;
	}

	.site-nav .sf-mega__all .wp-block-navigation-item__content::after {
		content: " →";
	}

	/* Core's chevron, aligned with our type. */
	.site-nav .sf-mega > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon {
		margin-left: 0.3em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-header .wp-block-navigation li.sf-mega.has-child > .wp-block-navigation__submenu-container {
		transition: visibility 0s linear 220ms;
	}
}

/*
 * Mobile: core stacks submenus vertically inside the overlay and opens them
 * on tap. Descriptions are hidden there — in a narrow column they triple the
 * menu's height and bury the links they exist to clarify.
 */
@media (max-width: 599px) {
	.site-nav .sf-mega .wp-block-navigation-item__description {
		display: none;
	}
}

/* Hide the inline nav CTA duplicate on desktop where the button shows. */
@media (max-width: 599px) {
	.site-header__cta {
		display: none;
	}
}

/* ------------------------------------------------------------------ *
 *  Footer
 * ------------------------------------------------------------------ */

.site-footer__label {
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--wide);
	text-transform: uppercase;
	color: var(--wp--preset--color--surface);
	opacity: 0.7;
	margin-bottom: var(--wp--preset--spacing--30);
}

.site-footer__nav {
	list-style: none;
	padding-left: 0;
	margin: 0;
}
.site-footer__nav li {
	margin-bottom: var(--wp--preset--spacing--20);
}
.site-footer__nav a {
	text-decoration: none;
}
.site-footer__nav a:hover {
	text-decoration: underline;
	color: var(--wp--preset--color--surface);
}

.site-footer__rule {
	opacity: 0.25;
	margin-top: var(--wp--preset--spacing--70);
	margin-bottom: var(--wp--preset--spacing--50);
	border: none;
	height: 1px;
}

.site-footer__disclaimer {
	opacity: 0.75;
	max-width: 68ch;
}

.footer-legal__partner {
	text-decoration: none;
}
.footer-legal__partner:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 *  Cards & sections
 * ------------------------------------------------------------------ */

.sf-post-card {
	transition: box-shadow var(--wp--custom--duration--base) var(--wp--custom--ease--out),
		transform var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}
.sf-post-card:hover {
	box-shadow: var(--wp--preset--shadow--md);
	transform: translateY(-2px);
}
.sf-post-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--foreground);
}
.sf-post-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

/*
 * "Updated" date on articles sits after the publish date, slightly quieter.
 * The label is CSS-generated: wp:post-date has no prefix attribute, and a
 * PHP date-format literal ("\U\p\d…") did not survive the block-JSON
 * escaping round-trip — it rendered nothing. Presentation-only text, so
 * a pseudo-element is the honest tool.
 */
.sf-updated {
	opacity: 0.8;
}
.sf-updated::before {
	content: "Updated ";
}

/*
 * Report-card panel: the tint-background module used across service pages
 * and the dashboard preview. A hairline + generous radius reads "document",
 * not "app".
 */
.sf-report-card {
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--xl);
	background: var(--wp--preset--color--surface);
	box-shadow: var(--wp--preset--shadow--sm);
}

/* Outline button variant used for secondary CTAs. */
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	border: 1.5px solid var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--tint);
}

/* On navy sections, outline buttons must flip to white. */
.has-navy-background-color .wp-block-button.is-style-outline .wp-block-button__link {
	border-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--surface);
}
.has-navy-background-color .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: rgba(255, 255, 255, 0.1);
}

/* ------------------------------------------------------------------ *
 *  Homepage sections
 * ------------------------------------------------------------------ */

/* Eyebrow on navy needs the light tint, not brand blue (2.4:1 on navy). */
.sf-eyebrow--onnavy {
	color: var(--wp--preset--color--navy-muted);
}

/* Step numbers on the monthly-rhythm band: serif, oversized, quiet. */
.sf-step__num {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--metric);
	line-height: 1;
	font-weight: 600;
	color: var(--wp--preset--color--primary);
	opacity: 0.35;
	margin-bottom: var(--wp--preset--spacing--20);
}

/* Fit list: brand-blue markers, roomy items. */
.sf-fit__list li {
	margin-bottom: var(--wp--preset--spacing--30);
}
.sf-fit__list li::marker {
	color: var(--wp--preset--color--primary);
}

/* FAQ: hairline-separated disclosure rows. */
.sf-faq__item {
	border-top: 1px solid var(--wp--preset--color--line);
	padding: var(--wp--preset--spacing--40) 0;
	margin: 0;
}
.sf-faq__list > .wp-block-details:last-child {
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.sf-faq__item summary {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--large);
	cursor: pointer;
}
.sf-faq__item[open] summary {
	color: var(--wp--preset--color--primary);
}

/* Capability strip columns keep a hairline between items on desktop. */
@media (min-width: 782px) {
	.sf-capability-strip__cols > .wp-block-column + .wp-block-column {
		border-left: 1px solid rgba(255, 255, 255, 0.2);
	}
}

/* ------------------------------------------------------------------ *
 *  Related articles (the [sf_related_articles] shortcode)
 * ------------------------------------------------------------------ */

.sf-related__heading {
	font-size: var(--wp--preset--font-size--x-large);
	margin-bottom: var(--wp--preset--spacing--50);
}

.sf-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--wp--preset--spacing--40);
}

.sf-related__link {
	display: block;
	height: 100%;
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--surface);
	text-decoration: none;
	transition: box-shadow var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}
.sf-related__link:hover {
	box-shadow: var(--wp--preset--shadow--md);
}

.sf-related__title {
	display: block;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	color: var(--wp--preset--color--foreground);
}
.sf-related__link:hover .sf-related__title {
	color: var(--wp--preset--color--primary);
}

.sf-related__date {
	display: block;
	margin-top: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

.sf-related__all {
	display: inline-block;
	margin-top: var(--wp--preset--spacing--50);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}
.sf-related__all::after {
	content: " →";
}
.sf-related__all:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 *  Industries page
 * ------------------------------------------------------------------ */

/* Question lists read as questions, not features — em-dash marker. */
.sf-questions {
	list-style: none;
	padding-left: 0;
}
.sf-questions li {
	margin-bottom: var(--wp--preset--spacing--30);
	padding-left: 1.4em;
	position: relative;
}
.sf-questions li::before {
	content: "—";
	position: absolute;
	left: 0;
	color: var(--wp--preset--color--primary);
}

.sf-industry__services {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--muted);
}

/* Footer logo: cap the size; the figure margin collapses oddly otherwise. */
.site-footer__logo {
	margin: 0 0 var(--wp--preset--spacing--40);
}
.site-footer__logo img {
	width: 200px;
	height: auto;
}

/* ------------------------------------------------------------------ *
 *  Legacy article content (the 240-post library)
 * ------------------------------------------------------------------ */

/*
 * The library spans three years of classic-editor and old-theme markup.
 * These rules keep arbitrary legacy HTML readable inside the new single
 * template WITHOUT rewriting any stored content.
 */

/* Old-theme aligned images and floats behave inside the 720px column. */
.wp-block-post-content .alignleft {
	float: left;
	margin: 0 var(--wp--preset--spacing--50) var(--wp--preset--spacing--40) 0;
}
.wp-block-post-content .alignright {
	float: right;
	margin: 0 0 var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
}
@media (max-width: 600px) {
	.wp-block-post-content .alignleft,
	.wp-block-post-content .alignright {
		float: none;
		margin: var(--wp--preset--spacing--40) 0;
	}
}

/* Legacy tables: financial posts are full of them. Scroll, never overflow. */
.wp-block-post-content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
}
.wp-block-post-content table :where(td, th) {
	border: 1px solid var(--wp--preset--color--line);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	text-align: left;
}
.wp-block-post-content thead th {
	background: var(--wp--preset--color--tint);
}

/* Long URLs and code fragments in old posts must not break the column. */
.wp-block-post-content :where(p, li) {
	overflow-wrap: break-word;
}

/* Generic blockquote treatment for three years of quoted material. */
.wp-block-post-content blockquote {
	border-left: 3px solid var(--wp--preset--color--primary);
	padding-left: var(--wp--preset--spacing--50);
	color: var(--wp--preset--color--muted);
	font-style: italic;
}
