/*
 * Acevedo Construction — structural styles.
 * Design tokens live in theme.json; this file covers behavior theme.json cannot express:
 * header responsiveness, sticky mobile CTA, focus visibility, cards, reduced motion, print.
 */

/* ---------------------------------------------------------------------------
 * Focus visibility (WCAG 2.4.7) — 3px copper ring, 2px offset, on every ground.
 * ------------------------------------------------------------------------- */
:focus-visible {
	outline: 3px solid var(--wp--preset--color--copper);
	outline-offset: 2px;
	border-radius: 2px;
}

.acevedo-on-dark :focus-visible,
.acevedo-footer :focus-visible,
.acevedo-sticky-bar :focus-visible {
	outline-color: var(--wp--preset--color--copper-light);
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--burgundy);
	font-weight: 600;
	padding: 0.75rem 1.25rem;
	z-index: 100001;
}

/* ---------------------------------------------------------------------------
 * Links & touch targets
 * ------------------------------------------------------------------------- */
a {
	text-underline-offset: 2px;
}

.wp-block-navigation a {
	padding: 0.5rem 0.25rem;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open a {
	padding: 0.75rem 0.5rem;
	font-size: 1.25rem;
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	min-width: 44px;
	min-height: 44px;
}

/* ---------------------------------------------------------------------------
 * Buttons — hover behavior (transforms live here so reduced-motion can remove them)
 * ------------------------------------------------------------------------- */
.wp-block-button__link {
	transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.wp-block-button__link:hover {
	transform: translateY(-2px);
}

/* Outline on light grounds (core "outline" style) */
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--charcoal);
	border: 2px solid var(--wp--preset--color--charcoal);
}

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

/* Outline for dark grounds (registered as "outline-light") */
.wp-block-button.is-style-outline-light .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--base);
	border: 2px solid rgba(255, 255, 255, 0.75);
}

.wp-block-button.is-style-outline-light .wp-block-button__link:hover {
	background: rgba(255, 255, 255, 0.12);
	color: var(--wp--preset--color--base);
}

/* Light solid for burgundy/charcoal grounds (registered as "light") */
.wp-block-button.is-style-light .wp-block-button__link {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--charcoal);
}

.wp-block-button.is-style-light .wp-block-button__link:hover {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--charcoal);
}

/* ---------------------------------------------------------------------------
 * Header
 * ------------------------------------------------------------------------- */
.acevedo-header {
	border-bottom: 3px solid var(--wp--preset--color--burgundy);
	background: var(--wp--preset--color--base);
}

.acevedo-header .wp-block-site-logo img {
	width: auto;
	height: 48px;
	max-width: 96px;
	object-fit: contain;
}

/* Two-line wordmark from the (editable) Site Title block */
.acevedo-wordmark {
	line-height: 1.1;
	max-width: 11rem;
}

.acevedo-wordmark a {
	display: inline-block;
	word-spacing: 100vw; /* each word of the site name gets its own line */
	font-size: 0.69rem;
	letter-spacing: 0.32em;
	color: var(--wp--preset--color--copper-dark);
	text-decoration: none;
	text-transform: uppercase;
}

.acevedo-wordmark a::first-line {
	font-size: 1.35rem;
	letter-spacing: 0.01em;
	color: var(--wp--preset--color--charcoal);
	font-weight: 800;
}

.acevedo-wordmark a:hover::first-line {
	color: var(--wp--preset--color--burgundy);
}

/* Quiet phone link built from a button block (so its URL/text can bind to Business Settings) */
.acevedo-phone-btn .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: transparent;
	border: none;
	padding: 0.35rem 0;
	font-weight: 600;
	color: var(--wp--preset--color--charcoal);
	min-height: 44px;
}

.acevedo-phone-btn .wp-block-button__link:hover {
	background: transparent;
	color: var(--wp--preset--color--burgundy);
	transform: none;
}

.acevedo-phone-btn .wp-block-button__link::before,
.acevedo-sticky-call .wp-block-button__link::before {
	content: "";
	width: 1.05em;
	height: 1.05em;
	flex: none;
	background-color: currentColor;
	-webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.79 19.79 0 0 1 2.08 4.18 2 2 0 0 1 4.06 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.68 2.81a2 2 0 0 1-.45 2.11L8 9.91a16 16 0 0 0 6.09 6.09l1.27-1.27a2 2 0 0 1 2.11-.45c.91.32 1.85.55 2.81.68A2 2 0 0 1 22 16.92z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') center / contain no-repeat;
	mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6A19.79 19.79 0 0 1 2.08 4.18 2 2 0 0 1 4.06 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.68 2.81a2 2 0 0 1-.45 2.11L8 9.91a16 16 0 0 0 6.09 6.09l1.27-1.27a2 2 0 0 1 2.11-.45c.91.32 1.85.55 2.81.68A2 2 0 0 1 22 16.92z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') center / contain no-repeat;
}

.acevedo-header-cta .wp-block-button__link {
	padding: 0.6rem 1.1rem;
	font-size: 1rem;
}

/* Header density: phone number text yields to the sticky bar first, then the button */
@media (max-width: 900px) {
	.acevedo-header .wp-block-button.acevedo-phone-btn {
		display: none;
	}
}

/* Tablet band: two-row header — brand + estimate button above, centered nav below */
@media (min-width: 601px) and (max-width: 900px) {
	.acevedo-header .wp-block-group.alignwide {
		flex-wrap: wrap;
	}

	.acevedo-header .wp-block-navigation {
		order: 3;
		flex-basis: 100%;
		justify-content: center;
	}
}

/* Below ~520px the fixed bottom bar already offers the estimate action.
   Selector carries three classes so it outranks core's
   `.wp-block-buttons > .wp-block-button` display declaration. */
@media (max-width: 520px) {
	.acevedo-header .wp-block-button.acevedo-header-cta {
		display: none;
	}
}

/* ---------------------------------------------------------------------------
 * Cards (service / project query loops)
 * ------------------------------------------------------------------------- */
.acevedo-card {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--medium);
	overflow: hidden;
	box-shadow: var(--wp--custom--shadow--card);
	height: 100%;
	transition: box-shadow 180ms ease, transform 180ms ease;
}

.acevedo-card:hover {
	box-shadow: var(--wp--custom--shadow--card-hover);
	transform: translateY(-2px);
}

.acevedo-card .wp-block-post-featured-image {
	border-bottom: 3px solid var(--wp--preset--color--copper);
	margin: 0;
}

/* Cards without a photo yet still get the copper brand accent */
.acevedo-card:not(:has(.wp-block-post-featured-image)) {
	border-top: 3px solid var(--wp--preset--color--copper);
}

.acevedo-card .wp-block-post-featured-image img {
	border-radius: 0;
	width: 100%;
	height: 190px;
	object-fit: cover;
	display: block;
}

.acevedo-card .wp-block-post-title {
	font-size: 1.375rem;
}

.acevedo-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--charcoal);
}

.acevedo-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--burgundy);
}

.acevedo-card .wp-block-post-excerpt {
	color: var(--wp--preset--color--muted);
	font-size: 1rem;
}

.acevedo-card .wp-block-read-more {
	font-weight: 600;
	color: var(--wp--preset--color--burgundy);
	text-decoration: none;
}

.acevedo-card .wp-block-read-more:hover {
	color: var(--wp--preset--color--copper-dark);
	text-decoration: underline;
}

/* ---------------------------------------------------------------------------
 * Eyebrow labels, process steps, facts list
 * ------------------------------------------------------------------------- */
.acevedo-eyebrow {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: 0.8125rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--copper-dark);
}

.acevedo-on-dark .acevedo-eyebrow {
	color: var(--wp--preset--color--copper-light);
}

.acevedo-step {
	border-top: 2px solid var(--wp--preset--color--border);
	padding-top: var(--wp--preset--spacing--30);
}

.acevedo-step-number {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 800;
	font-size: 2rem;
	line-height: 1;
	color: var(--wp--preset--color--copper);
}

.acevedo-fact-label {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: 0.8125rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--copper-dark);
	margin-bottom: 0.15rem;
}

.acevedo-fact-value {
	margin-top: 0;
}

/* Trust cue line (hero + footer) */
.acevedo-trust-cue {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: 0.9375rem;
	letter-spacing: 0.06em;
	color: var(--wp--preset--color--copper-light);
}

/* ---------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------- */
.acevedo-footer {
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--cream);
}

.acevedo-footer a {
	color: var(--wp--preset--color--cream);
	text-decoration: none;
}

.acevedo-footer a:hover {
	color: var(--wp--preset--color--copper-light);
	text-decoration: underline;
}

.acevedo-footer .wp-block-site-logo img {
	width: auto;
	height: 56px;
	object-fit: contain;
}

.acevedo-footer .acevedo-wordmark a {
	color: var(--wp--preset--color--copper-light);
}

.acevedo-footer .acevedo-wordmark a::first-line {
	color: var(--wp--preset--color--base);
}

.acevedo-footer .acevedo-wordmark a:hover::first-line {
	color: var(--wp--preset--color--copper-light);
}

.acevedo-footer-heading {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--base);
}

.acevedo-footer-links ul {
	list-style: none;
	padding-left: 0;
	margin: 0;
	display: grid;
	gap: 0.45rem;
	font-size: 1rem;
}

.acevedo-footer-smallprint {
	border-top: 1px solid rgba(255, 255, 255, 0.16);
	font-size: 0.875rem;
	color: rgba(247, 244, 239, 0.78);
}

.acevedo-footer-smallprint a {
	color: rgba(247, 244, 239, 0.92);
	text-decoration: underline;
}

/* ---------------------------------------------------------------------------
 * Sticky mobile CTA bar
 * ------------------------------------------------------------------------- */
.acevedo-sticky-bar {
	display: none;
}

@media (max-width: 782px) {
	.acevedo-sticky-bar {
		display: flex;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 99999;
		background: var(--wp--preset--color--charcoal);
		padding: 0.5rem;
		padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
		gap: 0.5rem;
		margin: 0;
	}

	/* Reserve room so the bar can never cover page content (incl. iPhone inset). */
	body {
		padding-bottom: calc(72px + env(safe-area-inset-bottom));
	}

	.acevedo-sticky-bar .wp-block-buttons {
		display: flex;
		flex: 1;
		gap: 0.5rem;
		margin: 0;
	}

	.acevedo-sticky-bar .wp-block-button {
		flex: 1;
		margin: 0;
	}

	.acevedo-sticky-bar .wp-block-button__link {
		width: 100%;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 0.45rem;
		padding: 0.8rem 0.5rem;
		font-size: 1rem;
		min-height: 44px;
	}

	.acevedo-sticky-call .wp-block-button__link {
		background: transparent;
		color: var(--wp--preset--color--base);
		border: 1.5px solid rgba(255, 255, 255, 0.55);
	}

	.acevedo-sticky-call .wp-block-button__link:hover {
		background: rgba(255, 255, 255, 0.1);
		color: var(--wp--preset--color--base);
	}
}

/* Never fix-position inside the editor canvas */
.editor-styles-wrapper .acevedo-sticky-bar {
	position: static;
	display: flex;
	background: var(--wp--preset--color--charcoal);
	padding: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * Forms (Forminator inherits typography; keep fields consistent with the theme)
 * ------------------------------------------------------------------------- */
.forminator-custom-form,
.forminator-custom-form * {
	font-family: var(--wp--preset--font-family--body) !important;
}

.forminator-custom-form input:focus-visible,
.forminator-custom-form select:focus-visible,
.forminator-custom-form textarea:focus-visible {
	outline: 3px solid var(--wp--preset--color--copper);
	outline-offset: 2px;
}

/* Internal placeholder note (visible until the admin replaces it; pages ship
 * as drafts). Stripped unconditionally from public output by
 * acevedo_content_strip_internal_notes() (inc/render.php) — never combine
 * this class with .acevedo-empty-category-notice, which needs to stay in
 * the DOM (for its admin-bar CSS reveal) rather than be removed outright. */
.acevedo-internal-note {
	border: 2px dashed var(--wp--preset--color--copper);
	background: var(--wp--preset--color--cream);
	padding: var(--wp--preset--spacing--30);
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--charcoal);
	font-size: 0.9375rem;
}

/* Same look, independent of .acevedo-internal-note's strip-from-public
 * filter — this one must survive in the DOM and be toggled by CSS instead
 * (see the empty-state collapse rules above). */
.acevedo-empty-category-notice {
	border: 2px dashed var(--wp--preset--color--copper);
	background: var(--wp--preset--color--cream);
	padding: var(--wp--preset--spacing--30);
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--charcoal);
	font-size: 0.9375rem;
}

/* Same look again — the estimate-form live status note (inc/render.php's
 * [acevedo_estimate_form] shortcode). Also independent of the strip filter,
 * for the same reason: this is a live environment status, not authored
 * content, and it needs the same admin-bar CSS reveal as the notice above,
 * not removal. */
.acevedo-form-setup-notice {
	border: 2px dashed var(--wp--preset--color--copper);
	background: var(--wp--preset--color--cream);
	padding: var(--wp--preset--spacing--30);
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--charcoal);
	font-size: 0.9375rem;
}

/* ---------------------------------------------------------------------------
 * Empty-state collapse (server-rendered, progressively enhanced).
 *
 * These blocks are always present in the markup so their content stays
 * genuinely dynamic per request (WordPress core blocks like core/query and
 * bound core/post-meta paragraphs render per-visit; a pattern file's own PHP
 * only runs once at pattern-registration time, which is too early to know a
 * specific project's field values or a specific category's post count). We
 * hide the empty cases with :has()/:empty rather than PHP branching in the
 * pattern. :has() is unsupported only in very old browsers; there the rule
 * is simply skipped and the row/section stays visible but empty — a minor
 * cosmetic gap, never a broken or missing-content state.
 * ------------------------------------------------------------------------- */

/* Project fact rows: hide a label+value pair when the value is empty. */
.acevedo-fact-value:empty {
	display: none;
}

.acevedo-fact-row:has(.acevedo-fact-value:empty) {
	display: none;
}

/* Before/after pair: only a genuine pair is worth showing. WordPress omits
 * a bound core/image's <figure>/<img> entirely when the bound url is null
 * (not merely an empty src), so detect the absence via the always-rendered
 * .acevedo-image-slot wrapper instead of the <img> itself.
 *
 * :has() cannot itself contain another :has() (even indirectly through
 * :not()) — `:has(X:not(:has(img)))` is invalid selector syntax and the
 * whole rule is dropped by the parser, not just false. Default hidden,
 * then positively re-show only once both slots actually contain an img —
 * two non-nested :has() calls, each valid on its own.
 *
 * !important is required on the default-hidden rule: this block is a
 * core/columns block, and WordPress's block-supports "layout" feature
 * auto-generates a per-instance display:flex rule (targeting a unique
 * .wp-container-core-columns-is-layout-XXXXX class) that otherwise wins
 * over a plain .acevedo-before-after selector regardless of source order. */
.acevedo-before-after {
	display: none !important;
}

.acevedo-before-after:has(.acevedo-before-after-col:first-child img):has(.acevedo-before-after-col:last-child img) {
	display: flex !important;
}

/* Projects hub category sections: hide entirely when that category has no
 * published projects — but reveal both the section and its notice for a
 * logged-in admin viewing the front end (WordPress adds .admin-bar to
 * <body> whenever the toolbar shows), so they know to add one. */
.acevedo-empty-category-notice {
	display: none;
}

.acevedo-category-section:has(.acevedo-empty-category-notice) {
	display: none;
}

.admin-bar .acevedo-empty-category-notice {
	display: block;
}

.admin-bar .acevedo-category-section:has(.acevedo-empty-category-notice) {
	display: block;
}

/* Estimate-form status note: same admin-bar-only reveal as the empty-category
 * notice above. Hidden from visitors (who see only the graceful call-us
 * fallback paragraph next to it); shown to a logged-in admin so they know
 * exactly what is still needed to bring the real form online. */
.acevedo-form-setup-notice {
	display: none;
}

.admin-bar .acevedo-form-setup-notice {
	display: block;
}

/* ---------------------------------------------------------------------------
 * Reduced motion: remove transitions AND the hover transforms themselves
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}

	.wp-block-button__link:hover,
	.acevedo-card:hover {
		transform: none !important;
	}
}

/* ---------------------------------------------------------------------------
 * Print
 * ------------------------------------------------------------------------- */
@media print {
	.acevedo-sticky-bar {
		display: none !important;
	}

	body {
		padding-bottom: 0 !important;
	}
}
