/*
 * FoA Cleaner — CV Page Template & cv-md/1.1 Markdown Stylesheet
 * Conditionally loaded on the `page-cv` template or when `.is-style-cv` is present,
 * and inside the Block/Site Editor for WYSIWYG parity.
 */

/* --------------------------------------------------------------------------
 * 1. CV Header & Contact Metadata Strip
 * -------------------------------------------------------------------------- */

.foa-cv-header {
	padding-bottom: var(--wp--preset--spacing--lg);
	border-bottom: 1px solid var(--foa-border);
	margin-bottom: var(--wp--preset--spacing--xl);
}

.foa-cv-header__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--lg);
}

.foa-cv-header__top > .wp-block-group {
	flex: 1 1 20rem;
	min-width: 0;
}

.foa-cv-header__top > .wp-block-buttons {
	flex: 0 0 auto;
	margin-left: auto;
}

.foa-cv-header__name {
	margin: 0;
	letter-spacing: -0.03em;
	line-height: 1.08;
}

.foa-cv-header__headline {
	margin: 0.375rem 0 0;
	color: var(--foa-text-secondary);
}

.foa-cv-header__meta {
	margin-top: var(--wp--preset--spacing--md);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.65;
	color: var(--foa-text-secondary);
	letter-spacing: 0.01em;
}

.foa-cv-header__meta a {
	color: var(--foa-text);
	text-decoration: underline;
	text-decoration-color: var(--foa-border-strong);
	text-underline-offset: 0.2em;
	transition: color var(--foa-transition), text-decoration-color var(--foa-transition);
}

.foa-cv-header__meta a:hover {
	color: var(--foa-accent);
	text-decoration-color: var(--foa-accent);
}

/* --------------------------------------------------------------------------
 * 2. Scoped CV Document Typography (cv-md/1.1 + Jetpack Markdown + Core Blocks)
 * -------------------------------------------------------------------------- */

:is(.foa-cv, .is-style-cv) {
	color: var(--foa-text);
	font-size: 0.96875rem;
	line-height: 1.62;
}

:is(.foa-cv, .is-style-cv) .wp-block-jetpack-markdown > :first-child {
	margin-top: 0;
}

/* Canonical Section Headings (## Summary, ## Experience, ## Skills, etc.) */
:is(.foa-cv, .is-style-cv) h2 {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--foa-text-muted);
	margin-top: var(--wp--preset--spacing--xl);
	margin-bottom: var(--wp--preset--spacing--md);
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--foa-border);
	line-height: 1.4;
}

/* Role / Project / Education Entry Headings (### Role — Company) */
:is(.foa-cv, .is-style-cv) h3 {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.3;
	color: var(--foa-text);
	margin-top: 1.625rem;
	margin-bottom: 0.25rem;
}

:is(.foa-cv, .is-style-cv) h2 + h3 {
	margin-top: 0;
}

/* Promotion / Sub-Role Headings (#### Role Title *(YYYY-MM – YYYY-MM)*) */
:is(.foa-cv, .is-style-cv) h4 {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.35;
	color: var(--foa-text);
	margin-top: 1rem;
	margin-bottom: 0.375rem;
}

:is(.foa-cv, .is-style-cv) h4 em {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 400;
	font-style: normal;
	letter-spacing: 0.02em;
	color: var(--foa-text-muted);
	margin-left: 0.25rem;
}

/* Date Range & Location Line (*YYYY-MM – Present | City, Country*) */
:is(.foa-cv, .is-style-cv) h3 + p:has(> em:only-child) {
	margin-top: 0.125rem;
	margin-bottom: 0.625rem;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: var(--foa-text-muted);
}

:is(.foa-cv, .is-style-cv) h3 + p:has(> em:only-child) > em {
	font-style: normal;
}

:is(.foa-cv, .is-style-cv) h3 + p:has(> em:only-child) a {
	color: var(--foa-text-secondary);
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

:is(.foa-cv, .is-style-cv) h3 + p:has(> em:only-child) a:hover {
	color: var(--foa-accent);
}

/* Optional 1-line company context paragraph right below the metadata line */
:is(.foa-cv, .is-style-cv) h3 + p:has(> em:only-child) + p {
	margin-top: 0;
	margin-bottom: 0.625rem;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--foa-text-secondary);
}

/* Paragraphs & Bullet Lists */
:is(.foa-cv, .is-style-cv) p {
	margin-top: 0;
	margin-bottom: 0.75rem;
	color: var(--foa-text);
}

:is(.foa-cv, .is-style-cv) ul {
	margin-top: 0.375rem;
	margin-bottom: 1rem;
	padding-left: 1.15rem;
}

:is(.foa-cv, .is-style-cv) li {
	margin-bottom: 0.4rem;
	color: var(--foa-text-secondary);
}

:is(.foa-cv, .is-style-cv) li::marker {
	color: var(--foa-border-strong);
}

:is(.foa-cv, .is-style-cv) li strong {
	color: var(--foa-text);
	font-weight: 600;
}

:is(.foa-cv, .is-style-cv) hr {
	border: none;
	border-top: 1px solid var(--foa-border);
	margin-block: var(--wp--preset--spacing--lg);
}

/* --------------------------------------------------------------------------
 * 3. Hide Trailing ## Facts Section (cv-md/1.1 Markdown-Only Archive)
 *    Tagged server-side on frontend via inc/cv.php; stays editable in editor.
 * -------------------------------------------------------------------------- */

:is(.foa-cv, .is-style-cv) .foa-cv-facts-heading,
:is(.foa-cv, .is-style-cv) .foa-cv-facts-heading ~ * {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * 4. Print / Save-as-PDF Stylesheet (A4 & Letter Ready)
 * -------------------------------------------------------------------------- */

@media print {
	@page {
		margin: 14mm 16mm;
	}

	body.page-template-page-cv {
		background: #ffffff !important;
		color: #0f0e0c !important;
	}

	body.page-template-page-cv .foa-site-header,
	body.page-template-page-cv .foa-site-footer,
	body.page-template-page-cv .skip-link,
	body.page-template-page-cv .architrave-panel-opener,
	body.page-template-page-cv .architrave-panel-rows,
	body.page-template-page-cv #wpadminbar,
	.foa-cv-no-print {
		display: none !important;
	}

	body.page-template-page-cv .foa-site-main.foa-cv-page {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
		min-height: 0 !important;
	}

	:is(.foa-cv, .is-style-cv) {
		--foa-bg: #ffffff;
		--foa-surface: #f7f6f2;
		--foa-text: #0f0e0c;
		--foa-text-secondary: #3f3d39;
		--foa-text-muted: #6b6760;
		--foa-border: #d9d6cf;
		--foa-border-strong: #b8b4ab;
		--foa-accent: #0f0e0c;
		font-size: 9.5pt;
		line-height: 1.48;
	}

	.foa-cv-header {
		padding-bottom: 10pt;
		margin-bottom: 14pt;
	}

	:is(.foa-cv, .is-style-cv) h2 {
		margin-top: 16pt;
		margin-bottom: 8pt;
		padding-bottom: 3pt;
		break-after: avoid;
		page-break-after: avoid;
	}

	:is(.foa-cv, .is-style-cv) h3,
	:is(.foa-cv, .is-style-cv) h4 {
		break-after: avoid;
		page-break-after: avoid;
	}

	:is(.foa-cv, .is-style-cv) h3 {
		margin-top: 11pt;
		font-size: 11pt;
	}

	:is(.foa-cv, .is-style-cv) li {
		margin-bottom: 2.5pt;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	:is(.foa-cv, .is-style-cv) a {
		color: #0f0e0c !important;
		text-decoration: none !important;
	}
}
