/* ==========================================================================
   KEC theme — supplemental front-end styles
   Only what theme.json cannot express: hero overlays, card hover, the sticky
   Resources filter bar, responsive video embeds and the email-gate modal.
   All colours come from theme.json CSS custom properties.
   ========================================================================== */

:root {
	--kec-primary: var(--wp--preset--color--primary, #ae0101);
	--kec-primary-dark: #930000;
	--kec-grey: var(--wp--preset--color--grey, #b4b4b4);
	--kec-white: var(--wp--preset--color--white, #fffefe);
	--kec-black: var(--wp--preset--color--black, #000000);
}

/* --- Global polish ------------------------------------------------------- */

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
/* Smooth, consistent button feedback site-wide. */
.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.25s ease, transform 0.1s ease, box-shadow 0.25s ease;
}
.wp-block-button__link:active {
	transform: scale(0.98);
}
/* Crisper images in cards. */
.kec-card img,
.kec-resource-thumb img {
	display: block;
}

/* --- Generic helpers ----------------------------------------------------- */

/* Small uppercase eyebrow label above section headings */
.kec-eyebrow {
	display: inline-block;
	font-size: var(--wp--preset--font-size--small, 14px);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--kec-primary);
	margin-bottom: 8px;
}

/* Short accent bar used under centred section headings */
.kec-accent-bar {
	width: 96px;
	height: 6px;
	background: var(--kec-primary);
	border-radius: 9999px;
}

/* Muted secondary text (uses Grey, darkened for AA contrast on white) */
.has-grey-color.has-text-color,
.kec-muted {
	color: #6b6b6b !important;
}

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

.wp-block-template-part.kec-header,
.kec-header {
	background: var(--kec-white);
	position: sticky;
	top: 0;
	z-index: 50;
}

/* Keep the header logo block readable and tidy */
.kec-header .wp-block-site-logo img {
	max-height: 52px;
	width: auto;
}
/* The logo image already contains the wordmark, so hide the redundant text
   Site Title whenever a logo image is present. (To show text instead, upload
   no logo, or delete this rule.) Also: never underline the brand mark. */
.kec-header:has(.wp-block-site-logo img) .wp-block-site-title {
	display: none;
}
.kec-header .wp-block-site-title a,
.kec-header .wp-block-site-logo a {
	text-decoration: none !important;
	border: 0 !important;
}

/* Highlighted "Apply" button inside the navigation */
.kec-nav-cta a {
	background: var(--kec-primary);
	color: var(--kec-white) !important;
	padding: 12px 24px;
	border-radius: 8px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 700;
}
.kec-nav-cta a:hover {
	background: var(--kec-primary-dark);
	text-decoration: none;
}

/* --- Hero ---------------------------------------------------------------- */

.kec-hero {
	position: relative;
}
/* Full-bleed background image, always covering and centred. */
.kec-hero .wp-block-cover__image-background,
.wp-block-cover .wp-block-cover__image-background {
	object-fit: cover;
	object-position: center;
}
/* NOTE: the hero overlay is controlled entirely by the Cover block's own
   "Overlay opacity" (dimRatio ~40 by default) so the editor slider works and
   the photo stays clearly visible. We deliberately do NOT force opacity here. */

/* Constrained, left-aligned hero content (doesn't stretch on wide monitors). */
.kec-hero .kec-hero-inner {
	width: 100%;
}

/* --- Scroll reveal ------------------------------------------------------ */

.kec-reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.7s ease, transform 0.7s ease;
	will-change: opacity, transform;
}
.kec-reveal.is-visible {
	opacity: 1;
	transform: none;
}
@media (prefers-reduced-motion: reduce) {
	.kec-reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* --- Cards --------------------------------------------------------------- */

.kec-card {
	background: var(--kec-white);
	border: 1px solid rgba(180, 180, 180, 0.4);
	border-radius: 16px;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.kec-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 20px 40px -12px rgba(174, 1, 1, 0.12);
	border-color: rgba(174, 1, 1, 0.3);
}

/* Icon chip used inside cards / checklists */
.kec-icon-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 12px;
	background: rgba(174, 1, 1, 0.08);
	color: var(--kec-primary);
}
.kec-icon-chip svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}

/* Numbered step circle (Why KEC) */
.kec-numbox {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 9999px;
	background: var(--kec-primary);
	color: var(--kec-white);
	font-weight: 700;
	font-size: 18px;
}

/* --- Impact stats -------------------------------------------------------- */

.kec-stat {
	border-left: 4px solid var(--kec-primary);
	background: var(--kec-white);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	padding: 32px;
}
.kec-stat .kec-stat-number {
	color: var(--kec-primary);
	font-size: var(--wp--preset--font-size--huge, 48px);
	font-weight: 700;
	line-height: 1.1;
}
/* Red-filled variant (About page) */
.kec-stat--filled {
	background: var(--kec-primary);
	border-left: 0;
	text-align: center;
	border-radius: 16px;
}
.kec-stat--filled .kec-stat-number,
.kec-stat--filled .kec-stat-label {
	color: var(--kec-white);
}

/* --- Checklists ---------------------------------------------------------- */

.kec-checklist {
	list-style: none;
	margin: 0;
	padding: 0;
}
.kec-checklist li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 16px;
}
.kec-checklist svg {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	fill: var(--kec-primary);
	margin-top: 2px;
}

/* --- Inline SVG icon sizing --------------------------------------------- */

.kec-icon {
	display: inline-block;
	vertical-align: middle;
	fill: currentColor;
}

/* --- Partner logo wall --------------------------------------------------- */

.kec-partners img {
	max-height: 40px;
	width: auto;
	filter: grayscale(1);
	opacity: 0.6;
	transition: filter 0.4s ease, opacity 0.4s ease;
}
.kec-partners img:hover {
	filter: grayscale(0);
	opacity: 1;
}

/* --- Mentor / team cards ------------------------------------------------- */

.kec-mentor-grayscale img {
	filter: grayscale(1);
	transition: filter 0.5s ease;
}
.kec-mentor-grayscale:hover img {
	filter: grayscale(0);
}

/* ==========================================================================
   Resources library
   ========================================================================== */

/* Sticky search + filter bar */
.kec-filter-bar {
	position: sticky;
	top: 0;
	z-index: 40;
	background: rgba(255, 254, 254, 0.95);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid rgba(180, 180, 180, 0.25);
}
.kec-filter-tabs {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.kec-filter-tab {
	padding: 8px 24px;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border: 0;
	border-radius: 6px;
	background: #ededed;
	color: #444;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s ease, color 0.2s ease;
}
.kec-filter-tab:hover {
	background: rgba(174, 1, 1, 0.1);
}
.kec-filter-tab.is-active {
	background: var(--kec-primary);
	color: var(--kec-white);
}
.kec-search {
	position: relative;
	width: 100%;
	max-width: 384px;
}
.kec-search input {
	width: 100%;
	padding: 10px 16px 10px 42px;
	border: 1px solid rgba(180, 180, 180, 0.5);
	border-radius: 6px;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	background: var(--kec-white);
}
.kec-search input:focus {
	outline: none;
	border-color: var(--kec-primary);
}
.kec-search svg {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	height: 18px;
	fill: #888;
	pointer-events: none;
}

/* Category cards (Videos / Blogs & Articles / E-Guides) */
.kec-category-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	margin-bottom: 56px;
}
.kec-category-card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 32px;
	background: var(--kec-white);
	border: 1px solid rgba(180, 180, 180, 0.4);
	border-radius: 16px;
	text-decoration: none;
	color: inherit;
	transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.kec-category-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 20px 40px -12px rgba(174, 1, 1, 0.12);
	border-color: rgba(174, 1, 1, 0.3);
	text-decoration: none;
}
.kec-category-card h3 {
	margin: 0;
	font-size: 24px;
}
.kec-category-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	color: var(--kec-primary);
	font-weight: 700;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.kec-category-link svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}
.kec-section-eyebrow {
	max-width: 1280px;
	margin-left: auto;
	margin-right: auto;
}
@media (max-width: 781px) {
	.kec-category-grid {
		grid-template-columns: 1fr;
	}
}

/* Resource grid + cards */
.kec-resource-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 24px;
}
.kec-resource-card {
	display: flex;
	flex-direction: column;
	background: var(--kec-white);
	border: 1px solid rgba(180, 180, 180, 0.4);
	border-radius: 12px;
	overflow: hidden;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.kec-resource-card:hover {
	box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.18);
	transform: translateY(-4px);
}
.kec-resource-card.is-hidden {
	display: none;
}
.kec-resource-thumb {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f1f1f1;
	position: relative;
}
.kec-resource-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}
.kec-resource-card:hover .kec-resource-thumb img {
	transform: scale(1.05);
}
.kec-resource-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px;
	flex: 1 1 auto;
}
.kec-type-tag {
	align-self: flex-start;
	background: var(--kec-primary);
	color: var(--kec-white);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	padding: 4px 10px;
	border-radius: 4px;
}
.kec-resource-card h3 {
	font-size: 20px;
	margin: 4px 0 0;
}
.kec-resource-desc {
	color: #5d5d5d;
	font-size: 16px;
	margin: 0;
	flex: 1 1 auto;
}
.kec-resource-card .kec-resource-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 12px;
	padding: 12px 16px;
	background: var(--kec-primary);
	color: var(--kec-white);
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
}
.kec-resource-card .kec-resource-btn:hover {
	background: var(--kec-primary-dark);
	text-decoration: none;
}
.kec-resource-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* "No results" message */
.kec-no-results {
	display: none;
	padding: 48px 0;
	text-align: center;
	color: #6b6b6b;
}
.kec-no-results.is-visible {
	display: block;
}

/* Play overlay for video cards */
.kec-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}
.kec-play span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 9999px;
	background: var(--kec-primary);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.kec-play svg {
	width: 32px;
	height: 32px;
	fill: #fff;
}

/* --- Example form preview (placeholder on form-embed pages) ------------- */

.kec-form-example {
	border: 1px solid rgba(180, 180, 180, 0.5);
	border-radius: 12px;
	padding: 28px;
	background: var(--kec-white);
	max-width: 560px;
}
.kec-form-example__flag {
	margin: 0 0 16px;
	padding: 8px 12px;
	background: #fff6f6;
	border-left: 4px solid var(--kec-primary);
	color: #6b6b6b;
	font-size: 13px;
}
.kec-form-example label {
	display: block;
	margin: 14px 0 6px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.kec-form-example input,
.kec-form-example textarea {
	width: 100%;
	padding: 12px;
	border: 1px solid var(--kec-grey);
	border-radius: 6px;
	font-size: 16px;
	background: #fafafa;
	color: #999;
}
.kec-form-example button {
	margin-top: 18px;
	padding: 12px 28px;
	background: var(--kec-primary);
	color: var(--kec-white);
	border: 0;
	border-radius: 8px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.7;
}

/* --- Responsive video embed (single-resource video) --------------------- */

.kec-video-embed {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
}
.kec-video-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ==========================================================================
   Email-gate modal
   ========================================================================== */

.kec-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.6);
}
.kec-modal.is-open {
	display: flex;
}
.kec-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 460px;
	background: var(--kec-white);
	border-radius: 12px;
	padding: 32px;
	box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}
.kec-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	border: 0;
	background: transparent;
	cursor: pointer;
	border-radius: 9999px;
	color: var(--kec-black);
}
.kec-modal__close:hover {
	background: rgba(0, 0, 0, 0.06);
}
.kec-modal__close svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}
.kec-modal h2 {
	margin: 0 0 6px;
	font-size: 24px;
}
.kec-modal p.kec-modal__intro {
	margin: 0 0 20px;
	color: #5d5d5d;
	font-size: 16px;
}
.kec-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 16px;
}
.kec-field label {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.kec-field input[type="text"],
.kec-field input[type="email"] {
	width: 100%;
	padding: 12px;
	border: 1px solid var(--kec-grey);
	border-radius: 6px;
	font-size: 16px;
}
.kec-field input:focus {
	outline: none;
	border-color: var(--kec-primary);
}
/* Honeypot — visually hidden but present in the DOM for bots */
.kec-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.kec-consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	font-size: 13px;
	color: #5d5d5d;
	margin-bottom: 20px;
}
.kec-consent input {
	margin-top: 3px;
}
.kec-modal__submit {
	width: 100%;
	padding: 14px;
	background: var(--kec-primary);
	color: var(--kec-white);
	border: 0;
	border-radius: 8px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	cursor: pointer;
}
.kec-modal__submit:hover {
	background: var(--kec-primary-dark);
}
.kec-modal__submit:disabled {
	opacity: 0.6;
	cursor: progress;
}
.kec-modal__status {
	margin-top: 14px;
	font-size: 14px;
	text-align: center;
	min-height: 1.2em;
}
.kec-modal__status.is-error {
	color: var(--kec-primary);
}
.kec-modal__status.is-success {
	color: #1a7a1a;
}

/* ==========================================================================
   Mobile responsiveness (designed for small screens, not a shrunk desktop)
   Breakpoints: <=781px tablet/phone, <=480px small phone.
   ========================================================================== */

/* Prevent any accidental horizontal scrolling on phones. */
@media (max-width: 781px) {
	:where(body) {
		overflow-x: hidden;
	}

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

	/* Keep the top bar on one tidy row: logo left, hamburger + Apply right. */
	.kec-header .wp-block-group {
		flex-wrap: nowrap;
	}
	.kec-header .wp-block-site-logo img {
		max-height: 44px;
	}
	/* Trim the Apply button so it sits comfortably next to the menu toggle. */
	.kec-header .kec-header-cta .wp-block-button__link {
		padding: 10px 16px;
		font-size: 13px;
	}

	/* --- Mobile navigation overlay (the slide-out menu) ------------------ */

	/* The open overlay becomes a clean, left-aligned, full-width vertical list.
	   Reset any desktop right-alignment so nothing is clipped at the edge. */
	.wp-block-navigation__responsive-container.is-menu-open {
		padding: 0;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		width: 100%;
		padding: 72px 24px 32px;
		align-items: stretch;
		justify-content: flex-start;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
		align-items: flex-start;
		justify-content: flex-start;
		width: 100%;
		gap: 4px;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		width: 100%;
	}
	/* Generous tap targets (>= 44px) and left-aligned labels. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item a {
		display: block;
		width: 100%;
		padding: 12px 0;
		min-height: 44px;
		font-size: 18px;
		text-align: left;
	}

	/* --- General alignment resets --------------------------------------- */

	.wp-block-columns {
		gap: 24px;
	}
	/* Tighten oversized section padding on phones (heroes excluded — they use
	   viewport-height). Targets the full-width section groups in our patterns. */
	.wp-block-group.alignfull:not(.kec-hero) {
		padding-top: 48px !important;
		padding-bottom: 48px !important;
	}
	.kec-hero .wp-block-cover__inner-container {
		padding-top: 28px;
		padding-bottom: 28px;
	}

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

	/* Even, tidy stack — remove the dead gap above the first column. */
	.kec-footer .wp-block-columns {
		gap: 36px;
	}
	.kec-footer .wp-block-column {
		flex-basis: 100% !important;
	}
	.kec-footer .wp-block-group[style*="justify-content"] {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		text-align: left;
	}

	/* --- Resource library ------------------------------------------------ */

	.kec-filter-bar .kec-filter-bar__inner {
		flex-direction: column;
		align-items: stretch;
	}
	.kec-search {
		max-width: 100%;
	}
	.kec-resource-grid {
		grid-template-columns: 1fr;
	}

	/* --- Cards / images -------------------------------------------------- */

	/* Consistent image framing inside team / mentor / resource cards. */
	.kec-mentor-grayscale img,
	.kec-resource-thumb img {
		width: 100%;
		object-fit: cover;
	}

	/* Buttons shouldn't run edge-to-edge awkwardly. */
	.wp-block-button__link {
		white-space: normal;
	}
}

/* Keep the brand mark from crowding the menu toggle on phones. */
@media (max-width: 600px) {
	.kec-header .wp-block-site-title {
		font-size: 16px;
		line-height: 1.15;
	}
	.kec-header .wp-block-site-title a {
		display: inline-block;
		max-width: 56vw;
	}
}
/* Very small phones: hide the text title only if a logo image is also present. */
@media (max-width: 359px) {
	.kec-header:has(.wp-block-site-logo img) .wp-block-site-title {
		display: none;
	}
}
