/*
Theme Name: LECGI
Theme URI: https://lecgi.us
Author: LECGI, Inc.
Author URI: https://lecgi.us
Description: Custom block theme for LECGI, Inc. — a structural engineering firm providing structural design, steel detailing, and connection design for industrial and commercial projects. Built for full Site Editor control: every page, header, and footer is editable by staff with no code.
Version: 1.1.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lecgi
Tags: block-theme, full-site-editing, one-column, custom-colors, custom-logo, editor-style
*/

/* -------------------------------------------------------------------------
 * Headings — Copperplate Gothic Bold per brand guide, with a small-caps
 * fallback so non-Copperplate systems keep the engraved, all-caps feel.
 * lining-nums keeps digits full-height (synthesized small-caps otherwise
 * shrinks numbers on some systems).
 * ---------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
	font-variant-caps: small-caps;
	font-variant-numeric: lining-nums;
	text-wrap: balance;
}

/* Big standalone numbers (stats band): never small-caps-scaled. */
.lecgi-stat-number {
	font-variant-caps: normal;
	font-variant-numeric: lining-nums tabular-nums;
	line-height: 1.05;
}

/* Uppercase eyebrow label above section headings. */
.lecgi-eyebrow {
	font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #803338;
}

.has-deep-maroon-background-color .lecgi-eyebrow,
.has-maroon-fade-gradient-background .lecgi-eyebrow,
.wp-block-cover .lecgi-eyebrow {
	color: #e8c9cb;
}

/* -------------------------------------------------------------------------
 * Accessibility — visible focus states (WCAG 2.4.7)
 * ---------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid #803338;
	outline-offset: 2px;
	border-radius: 1px;
}

.has-deep-maroon-background-color a:focus-visible,
.has-primary-background-color a:focus-visible,
.has-maroon-fade-gradient-background a:focus-visible,
.wp-block-cover a:focus-visible {
	outline-color: #ffffff;
}

/* -------------------------------------------------------------------------
 * Header — sticky with subtle glass effect.
 * The sticky lives on the template-part wrapper (a direct child of
 * .wp-site-blocks); putting position:sticky on an inner group does nothing
 * because it can only stick within its own parent's height.
 * ---------------------------------------------------------------------- */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 400;
}

/* Remove the root block gap so the header, content, and footer sit flush —
 * this is also what removes the thin white line above the footer. */
body .wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Pages whose last section is not a full-width band still get breathing
 * room before the footer. */
.wp-block-post-content > *:last-child:not(.alignfull) {
	margin-bottom: var(--wp--preset--spacing--70);
}

/* Adjacent full-width bands abut each other — no white seams between
 * colored sections. But white content meeting a band keeps a normal
 * margin (inline margins in the content, or the generous default below). */
.wp-block-post-content > .alignfull + .alignfull {
	margin-block-start: 0 !important;
}

.wp-block-post-content > .alignfull + :not(.alignfull) {
	margin-block-start: var(--wp--preset--spacing--60);
}

.lecgi-main-header {
	box-shadow: 0 1px 0 #e5dcdd, 0 4px 18px rgba(46, 46, 46, 0.07);
}

/* --- Condensed state after scrolling (html.lecgi-scrolled set by JS) --- */
.lecgi-utility-bar {
	max-height: 160px;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease;
}

html.lecgi-scrolled .lecgi-utility-bar {
	max-height: 0;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.wp-block-site-logo img {
	transition: width 0.25s ease;
}

html.lecgi-scrolled .lecgi-main-header .wp-block-site-logo img {
	width: 110px !important;
}

/* Once scrolled, collapse the inline menu into the hamburger at every
 * viewport width — the overlay menu itself works at any size. */
html.lecgi-scrolled .lecgi-main-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
	display: flex;
}

html.lecgi-scrolled .lecgi-main-header .wp-block-navigation__responsive-container:not(.is-menu-open):not(.hidden-by-default) {
	display: none;
}

/* Open overlay menu: left-align every level and remove the submenu's own
 * horizontal padding so child links sit flush with their parents. Core
 * applies the desktop justification to BOTH the container and each item,
 * so both must be overridden — items with submenus stretch full-width and
 * align their label via their own align-items. */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	align-items: flex-start !important;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	padding-left: 0 !important;
	margin-left: 0 !important;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Glass effect lives on a pseudo-element: backdrop-filter directly on the
 * header would make it the containing block for position:fixed descendants,
 * trapping the navigation's full-screen overlay menu inside the header bar. */
.lecgi-main-header.has-base-background-color {
	background-color: rgba(255, 255, 255, 0.94);
	position: relative;
}

.lecgi-main-header.has-base-background-color::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
}

.wp-block-navigation a:hover {
	color: #803338;
	text-decoration: underline;
	text-underline-offset: 6px;
	text-decoration-thickness: 2px;
}

.lecgi-utility-bar a {
	color: #ffffff;
	text-decoration: none;
}

.lecgi-utility-bar a:hover {
	text-decoration: underline;
}

/* On phones, keep only the phone/email line in the utility bar. */
@media (max-width: 599px) {
	.lecgi-utility-bar .wp-block-group > p:first-child {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * Links on maroon backgrounds must never be maroon (WCAG 1.4.3).
 * ---------------------------------------------------------------------- */
.has-maroon-fade-gradient-background a:not(.wp-block-button__link),
.has-deep-maroon-background-color a:not(.wp-block-button__link),
.has-primary-background-color a:not(.wp-block-button__link),
.wp-block-cover a:not(.wp-block-button__link) {
	color: #ffffff;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* -------------------------------------------------------------------------
 * Hero — lighter, directional overlay (dark where the text sits, the photo
 * shows through on the right), plus parallax support.
 * ---------------------------------------------------------------------- */
.lecgi-hero {
	overflow: hidden;
}

.lecgi-hero > .wp-block-cover__background {
	background: linear-gradient(100deg, rgba(26, 8, 10, 0.82) 0%, rgba(84, 20, 26, 0.55) 48%, rgba(128, 0, 0, 0.2) 100%) !important;
	opacity: 1 !important;
}

.lecgi-hero .wp-block-cover__image-background {
	will-change: transform;
}

/* Interior page banner — mini hero. */
.lecgi-page-banner {
	overflow: hidden;
}

.lecgi-page-banner .wp-block-post-title {
	font-size: var(--wp--preset--font-size--xx-large);
}

.lecgi-page-banner > .wp-block-cover__background {
	background: linear-gradient(100deg, rgba(26, 8, 10, 0.85) 0%, rgba(96, 24, 30, 0.68) 55%, rgba(128, 0, 0, 0.42) 100%) !important;
	opacity: 1 !important;
}

.lecgi-page-banner a {
	color: #ffffff;
}

.lecgi-page-banner .yoast-breadcrumbs,
.lecgi-page-banner nav {
	font-size: 0.85rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #e8c9cb;
}

/* -------------------------------------------------------------------------
 * Hero — staged entrance for the cover content
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
	.lecgi-hero .wp-block-cover__inner-container > * {
		animation: lecgi-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
	}

	.lecgi-hero .wp-block-cover__inner-container > *:nth-child(2) { animation-delay: 0.12s; }
	.lecgi-hero .wp-block-cover__inner-container > *:nth-child(3) { animation-delay: 0.24s; }
	.lecgi-hero .wp-block-cover__inner-container > *:nth-child(4) { animation-delay: 0.36s; }
}

@keyframes lecgi-rise {
	from { opacity: 0; transform: translateY(30px); }
	to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------------------
 * Scroll reveal — sections fade-rise into view. JS adds .lecgi-reveal and
 * .is-visible; without JS (or with reduced motion) everything stays visible.
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
	html.lecgi-js .lecgi-reveal {
		opacity: 0;
		transform: translateY(32px);
		transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
	}

	html.lecgi-js .lecgi-reveal.is-visible {
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------------------------------
 * Cards — equal heights via flex; buttons pinned to the bottom.
 * ---------------------------------------------------------------------- */
.is-style-lecgi-card {
	background: #ffffff;
	border: 1px solid #e2d8d9;
	border-top: 4px solid #803338;
	box-shadow: 0 2px 10px rgba(46, 46, 46, 0.05);
	transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.is-style-lecgi-card:hover {
	box-shadow: 0 14px 34px rgba(128, 51, 56, 0.18);
	border-top-color: #800000;
}

@media (prefers-reduced-motion: no-preference) {
	.is-style-lecgi-card:hover {
		transform: translateY(-4px);
	}
}

/* Equal-height treatment for card columns. */
.wp-block-column.is-style-lecgi-card {
	display: flex;
	flex-direction: column;
}

.wp-block-column.is-style-lecgi-card > .wp-block-group:last-child {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.wp-block-column.is-style-lecgi-card > .wp-block-group:last-child > * {
	width: 100%;
}

.wp-block-column.is-style-lecgi-card .wp-block-buttons:last-child {
	margin-top: auto;
	padding-top: 0.75rem;
}

/* Card images: consistent crop so rows align. */
.wp-block-column.is-style-lecgi-card > .wp-block-image:first-child img {
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */
.wp-block-button__link {
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-reduced-motion: no-preference) {
	.wp-block-button__link:hover {
		transform: translateY(-2px);
		box-shadow: 0 8px 20px rgba(128, 0, 0, 0.25);
	}
}

/* Ghost button for photo/maroon bands — translucent backing keeps it
 * legible on busy imagery (non-text contrast, WCAG 1.4.11). */
.is-style-lecgi-outline-light .wp-block-button__link {
	background: rgba(20, 6, 8, 0.35);
	border: 2px solid #ffffff;
	color: #ffffff;
}

.is-style-lecgi-outline-light .wp-block-button__link:hover,
.is-style-lecgi-outline-light .wp-block-button__link:focus {
	background: #ffffff;
	color: #800000;
}

/* Solid white button — the primary CTA on maroon or photo backgrounds. */
.is-style-lecgi-solid-light .wp-block-button__link {
	background: #ffffff;
	color: #800000;
}

.is-style-lecgi-solid-light .wp-block-button__link:hover,
.is-style-lecgi-solid-light .wp-block-button__link:focus {
	background: #f1e3e4;
	color: #800000;
}

/* -------------------------------------------------------------------------
 * Imagery
 * ---------------------------------------------------------------------- */
.wp-block-image img {
	height: auto;
}

.wp-block-gallery .wp-block-image img {
	border: 1px solid #e2d8d9;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (prefers-reduced-motion: no-preference) {
	.wp-block-gallery .wp-block-image:hover img {
		transform: scale(1.025);
		box-shadow: 0 10px 26px rgba(46, 46, 46, 0.22);
	}
}

.wp-block-image figcaption,
.wp-block-gallery figcaption {
	color: #595155;
	font-size: 0.95rem;
}

/* -------------------------------------------------------------------------
 * Careers — details/summary job listings
 * ---------------------------------------------------------------------- */
.wp-block-details {
	border: 1px solid #e2d8d9;
	border-left: 4px solid #803338;
	background: #ffffff;
	padding: 1.25rem 1.5rem;
}

.wp-block-details summary {
	font-family: 'Copperplate Gothic Bold', 'Copperplate Gothic', Copperplate, 'Palatino Linotype', Palatino, serif;
	font-variant-caps: small-caps;
	font-size: 1.35rem;
	font-weight: 700;
	color: #803338;
	cursor: pointer;
	padding: 0.25rem 0;
}

.wp-block-details summary:hover {
	color: #800000;
}

.wp-block-details summary::marker {
	color: #a0666a;
	font-size: 0.85em;
}

/* -------------------------------------------------------------------------
 * Tables
 * ---------------------------------------------------------------------- */
.wp-block-table table {
	border-collapse: collapse;
}

.wp-block-table th {
	background: #800000;
	color: #ffffff;
	text-align: left;
}

.wp-block-table th,
.wp-block-table td {
	border: 1px solid #e2d8d9;
	padding: 0.7rem 0.9rem;
	vertical-align: top;
}

.wp-block-table tbody tr:nth-child(even) {
	background: #f7f4f4;
}

/* -------------------------------------------------------------------------
 * WPForms — brand styling
 * ---------------------------------------------------------------------- */
.wpforms-container input[type="text"],
.wpforms-container input[type="email"],
.wpforms-container input[type="tel"],
.wpforms-container select,
.wpforms-container textarea {
	border: 1px solid #999999 !important;
	border-radius: 2px !important;
	font-size: 1.05rem !important;
}

.wpforms-container input:focus,
.wpforms-container select:focus,
.wpforms-container textarea:focus {
	border-color: #803338 !important;
	box-shadow: 0 0 0 2px rgba(128, 51, 56, 0.25) !important;
}

.wpforms-container button[type="submit"] {
	background-color: #803338 !important;
	border: none !important;
	border-radius: 2px !important;
	color: #ffffff !important;
	font-weight: 700 !important;
	letter-spacing: 0.05em !important;
	text-transform: uppercase !important;
	padding: 0.9rem 2rem !important;
	transition: background-color 0.2s ease !important;
}

.wpforms-container button[type="submit"]:hover,
.wpforms-container button[type="submit"]:focus {
	background-color: #800000 !important;
}

/* -------------------------------------------------------------------------
 * Misc
 * ---------------------------------------------------------------------- */
p, li, td {
	overflow-wrap: break-word;
}

/* Honor reduced-motion preferences globally (WCAG 2.3.3). */
@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;
	}
}
