/*
Theme Name: Engraving Digital ClientOS Base
Author: Engraving Digital
Description: A reusable service-business foundation with native blocks, editable component styles, responsive patterns and complete WordPress templates.
Version: 1.1.2
Update URI: false
Requires at least: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: engraving-clientos-base
Tags: full-site-editing, block-patterns, custom-colors, editor-style, wide-blocks
*/

/* All brand values and design tokens are defined in theme.json. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100svh;
}

.admin-bar .wp-site-blocks {
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px));
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 32px));
}

.wp-site-blocks > .clientos-main {
	flex: 1 0 auto;
}

.wp-site-blocks > * {
	margin-block-start: 0;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(img, video, iframe, audio) {
	max-width: 100%;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(img, video) {
	height: auto;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(p, li, dd, dt, label, figcaption) {
	overflow-wrap: anywhere;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-column, .wp-block-group) {
	min-width: 0;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(h1, h2, h3, h4, h5, h6) {
	text-wrap: balance;
	overflow-wrap: break-word;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--text);
	outline-offset: 3px;
	box-shadow: 0 0 0 3px var(--wp--preset--color--background);
}

.clientos-header {
	padding-block: var(--wp--preset--spacing--lg);
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.clientos-main {
	padding-block: var(--wp--preset--spacing--section);
}

/* Section patterns own their spacing; reading pages keep the standard template. */
.clientos-main--sections {
	padding-block: 0;
}

.clientos-section {
	box-sizing: border-box;
}

.clientos-brand {
	flex: 1 1 0;
	min-width: 0;
}

.clientos-brand .wp-block-site-logo {
	flex-shrink: 0;
}

.clientos-brand .wp-block-site-title {
	min-width: 0;
	overflow-wrap: anywhere;
}

.clientos-header .wp-block-navigation {
	flex: 0 0 auto;
}

.clientos-footer {
	padding-block: var(--wp--preset--spacing--xxl) var(--wp--preset--spacing--lg);
	border-top: 1px solid var(--wp--preset--color--border);
}

.clientos-footer-columns {
	align-items: flex-start;
}

.clientos-footer-columns > .wp-block-column > :first-child {
	margin-block-start: 0;
}

.clientos-footer-columns .wp-block-site-title {
	overflow-wrap: anywhere;
}

.clientos-footer-description {
	max-width: 32ch;
}

.clientos-footer .wp-block-navigation-item__content {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

.clientos-footer-contact > p {
	margin-block-start: var(--wp--preset--spacing--xs);
}

.clientos-footer-bottom {
	border-block-start: 1px solid var(--wp--preset--color--border);
	padding-block-start: var(--wp--preset--spacing--lg);
}

.clientos-footer-bottom .wp-block-site-title {
	font-weight: 400;
	overflow-wrap: anywhere;
}

.clientos-footer-bottom > * {
	min-width: 0;
}

@media (min-width: 782px) {
	.clientos-footer-columns > .wp-block-column:first-child { flex-grow: 1.35; }
	.clientos-footer-columns > .wp-block-column:nth-child(2) { flex-grow: 0.75; }
	.clientos-footer-columns > .wp-block-column:last-child { flex-grow: 1.1; }
}

@media (max-width: 781px) {
	.clientos-footer-columns > .wp-block-column + .wp-block-column {
		padding-block-start: var(--wp--preset--spacing--lg);
		border-block-start: 1px solid var(--wp--preset--color--border);
	}

	.clientos-footer-columns .wp-block-navigation__container {
		flex-direction: row;
		flex-wrap: wrap;
		column-gap: var(--wp--preset--spacing--lg);
	}
}

.clientos-legal-links:empty {
	display: none;
}

.wp-block-social-links.clientos-social-links .wp-social-link {
	color: var(--wp--preset--color--primary);
}

.wp-block-social-links.clientos-social-links .wp-social-link a {
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.clientos-icon {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: var(--wp--custom--icon--size);
	min-height: var(--wp--custom--icon--size);
	border-radius: var(--wp--custom--radius--control);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1;
}

.clientos-stat-value {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 700;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.clientos-logo-strip > .clientos-logo-tile {
	flex: 1 1 8rem;
	max-width: 12rem;
	margin: 0;
}

.clientos-logo-tile img {
	display: block;
	width: 100%;
	height: auto;
}

.clientos-featured-review .clientos-testimonial p {
	font-size: var(--wp--preset--font-size--lg);
}

/* Equal card surfaces within these optional grids; native Columns handle stacking. */
.clientos-card-grid > .wp-block-column {
	display: flex;
	flex-direction: column;
}

.clientos-card-grid > .wp-block-column > :is(.is-style-clientos-card, .is-style-clientos-card-outline, .is-style-clientos-card-raised) {
	box-sizing: border-box;
	flex: 1;
}

.clientos-media {
	margin: 0;
}

:where(.clientos-media img) {
	display: block;
	width: 100%;
	border-radius: var(--wp--custom--radius--card);
}

.clientos-testimonial {
	margin-inline: 0;
	padding: 0;
	border: 0;
}

.clientos-testimonial cite {
	display: block;
	margin-block-start: var(--wp--preset--spacing--lg);
	color: var(--wp--preset--color--muted-text);
	font-size: var(--wp--preset--font-size--sm);
	font-style: normal;
}

.clientos-disclosure {
	border-block-start: 1px solid var(--wp--preset--color--border);
	padding-block: var(--wp--preset--spacing--sm);
}

.clientos-disclosure > summary {
	box-sizing: border-box;
	min-height: 44px;
	padding-block: var(--wp--preset--spacing--xs);
	cursor: pointer;
	font-weight: 600;
}

.clientos-disclosure[open] {
	padding-block-end: var(--wp--preset--spacing--lg);
}

.wp-block-button__link {
	box-sizing: border-box;
	min-height: 44px;
	transition: background-color var(--wp--custom--motion--duration) ease,
		color var(--wp--custom--motion--duration) ease,
		border-color var(--wp--custom--motion--duration) ease;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.wp-site-blocks .wp-block-navigation .wp-block-navigation-item__content {
	padding-block: var(--wp--preset--spacing--xs);
}

.wp-site-blocks .wp-block-navigation :where(.wp-block-navigation__responsive-container-open, .wp-block-navigation__responsive-container-close) {
	min-width: 44px;
	min-height: 44px;
	align-items: center;
	justify-content: center;
}

/* Default mobile overlay only. Custom navigation overlays keep their own styles. */
.clientos-header .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	box-sizing: border-box;
	padding-block: var(--wp--preset--spacing--lg);
	padding-inline-start: max(var(--wp--custom--gutter), env(safe-area-inset-left, 0px));
	padding-inline-end: max(var(--wp--custom--gutter), env(safe-area-inset-right, 0px));
}

.clientos-header .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	background-color: var(--wp--preset--color--background);
}

.clientos-header .wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	color: var(--wp--preset--color--text);
}

.clientos-header .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) .wp-block-navigation__responsive-container-content {
	--navigation-layout-justify: flex-start;
	--navigation-layout-justification-setting: flex-start;
	box-sizing: border-box;
	width: 100%;
	padding-top: calc(44px + var(--wp--preset--spacing--lg));
	align-items: flex-start;
	text-align: start;
}

.clientos-header .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) .wp-block-navigation__responsive-container-content > :is(.wp-block-navigation__container, .wp-block-page-list) {
	box-sizing: border-box;
	width: 100%;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--xs);
}

.clientos-header .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) .wp-block-navigation-item__content {
	overflow-wrap: anywhere;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], input[type="number"], input[type="password"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea) {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 44px;
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
	border: 1px solid var(--wp--preset--color--muted-text);
	border-radius: var(--wp--custom--radius--control);
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--text);
	font: inherit;
}

:where(.wp-site-blocks, .editor-styles-wrapper) textarea {
	min-height: 8rem;
	resize: vertical;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input[type="checkbox"], input[type="radio"], input[type="range"]) {
	accent-color: var(--wp--preset--color--primary);
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input, select, textarea):disabled {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--muted-text);
	cursor: not-allowed;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input, textarea)[readonly] {
	background-color: var(--wp--preset--color--surface);
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input, select, textarea)[aria-invalid="true"] {
	border-color: var(--wp--preset--color--error);
}

.clientos-field-help,
.clientos-field-error {
	display: block;
	margin-block-start: var(--wp--preset--spacing--xs);
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--muted-text);
}

.clientos-field-error {
	color: var(--wp--preset--color--error);
}

/* Fluent Forms uses the Base controls and tokens, scoped to ClientOS forms. */
.fluentform.clientos-form {
	color: var(--wp--preset--color--text);
	font: inherit;
}

.fluentform.clientos-form .ff-el-form-control {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 44px;
	height: auto;
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
	border: 1px solid var(--wp--preset--color--muted-text);
	border-radius: var(--wp--custom--radius--control);
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--text);
	box-shadow: none;
	font: inherit;
}

.fluentform.clientos-form textarea.ff-el-form-control { min-height: 8rem; resize: vertical; }
.fluentform.clientos-form .ff-el-group { margin-block-end: var(--wp--preset--spacing--lg); }
.fluentform.clientos-form .ff-el-input--label { margin-block-end: var(--wp--preset--spacing--xs); }
.fluentform.clientos-form .ff-el-input--label label { font: inherit; font-weight: 600; }
.fluentform.clientos-form .ff-el-input--content { min-width: 0; }
.fluentform.clientos-form .ff-el-help-message,
.fluentform.clientos-form .ff-el-form-check-label { font: inherit; }
.fluentform.clientos-form .ff-el-help-message { font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--muted-text); }
.fluentform.clientos-form .ff-btn-submit {
	min-height: 44px;
	max-width: 100%;
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--lg);
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius--control);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	white-space: normal;
	cursor: pointer;
}
.fluentform.clientos-form .ff-btn-submit:hover {
	background: var(--wp--preset--color--secondary);
	border-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--on-secondary);
}
.fluentform.clientos-form .ff-el-form-control:focus { border-color: var(--wp--preset--color--primary); box-shadow: none; }
.fluentform.clientos-form :is(input, select, textarea, button):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
	box-shadow: none;
}
.fluentform.clientos-form .ff-el-is-error .ff-el-form-control,
.fluentform.clientos-form .ff-el-form-control[aria-invalid="true"] { border-color: var(--wp--preset--color--error); }
.fluentform.clientos-form .error,
.fluentform.clientos-form .text-danger,
.fluentform.clientos-form .ff-errors-in-stack { color: var(--wp--preset--color--error); }
.fluentform.clientos-form .ff-btn-submit:disabled { opacity: .65; cursor: wait; }

.clientos-form-preview fieldset {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--control);
	padding: var(--wp--preset--spacing--lg);
	margin-block: var(--wp--preset--spacing--lg);
}

.clientos-form-preview legend {
	font-weight: 600;
	padding-inline: var(--wp--preset--spacing--xs);
}

.clientos-form-preview .clientos-choice {
	display: flex;
	align-items: baseline;
	gap: var(--wp--preset--spacing--sm);
	min-height: 44px;
}

.clientos-choice :is(input[type="checkbox"], input[type="radio"]) {
	flex-shrink: 0;
	width: 1.125rem;
	height: 1.125rem;
}

.clientos-control-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--sm);
}

.clientos-form-preview .wp-element-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.clientos-notice {
	padding: var(--wp--preset--spacing--lg);
	border-inline-start: 4px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--radius--control);
	background-color: var(--wp--preset--color--surface);
}

.clientos-notice--success { border-inline-start-color: var(--wp--preset--color--success); }
.clientos-notice--warning { border-inline-start-color: var(--wp--preset--color--warning); }
.clientos-notice--error { border-inline-start-color: var(--wp--preset--color--error); }

.wp-block-search .wp-block-search__input {
	min-width: 0;
}

.wp-block-search .wp-block-search__button,
.wp-block-post-comments-form .submit,
.post-password-form input[type="submit"] {
	box-sizing: border-box;
	min-height: 44px;
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--lg);
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius--control);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--md);
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

.wp-block-search .wp-block-search__button:hover,
.wp-block-post-comments-form .submit:hover,
.post-password-form input[type="submit"]:hover {
	border-color: var(--wp--preset--color--secondary);
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--on-secondary);
}

.wp-block-query-pagination,
.wp-block-comments-pagination,
.clientos-post-navigation {
	margin-block-start: var(--wp--preset--spacing--xl);
	padding-block-start: var(--wp--preset--spacing--lg);
	border-block-start: 1px solid var(--wp--preset--color--border);
}

:where(.wp-block-query-pagination, .wp-block-comments-pagination) :where(a, .current) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	padding: var(--wp--preset--spacing--xs);
}

:where(.wp-block-query-pagination, .wp-block-comments-pagination) .current {
	background-color: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--control);
	font-weight: 700;
}

.clientos-post-navigation > * {
	flex: 1 1 14rem;
	overflow-wrap: anywhere;
}

.clientos-comments {
	margin-block-start: var(--wp--preset--spacing--xxl);
}

.clientos-comment {
	padding-block: var(--wp--preset--spacing--lg);
	border-block-start: 1px solid var(--wp--preset--color--border);
}

.wp-block-comment-template .children {
	padding-inline-start: var(--wp--preset--spacing--lg);
}

.wp-block-list {
	padding-inline-start: var(--wp--preset--spacing--xl);
}

.wp-block-list li + li {
	margin-block-start: var(--wp--preset--spacing--xs);
}

.wp-block-table {
	max-width: 100%;
	overflow-x: auto;
}

.wp-block-table :is(td, th) {
	border-color: var(--wp--preset--color--border);
	padding: var(--wp--preset--spacing--sm);
	overflow-wrap: anywhere;
}

.wp-block-table thead {
	border-bottom: 2px solid var(--wp--preset--color--border);
}

.wp-block-code,
.wp-block-preformatted {
	box-sizing: border-box;
	max-width: 100%;
	overflow-x: auto;
	padding: var(--wp--preset--spacing--lg);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--control);
	background-color: var(--wp--preset--color--surface);
	font-size: var(--wp--preset--font-size--sm);
}

.clientos-input-preview label {
	display: block;
	margin-block-end: var(--wp--preset--spacing--xs);
}

.clientos-input-preview p + p {
	margin-block-start: var(--wp--preset--spacing--lg);
}

.post-password-form label {
	display: block;
	margin-block-end: var(--wp--preset--spacing--md);
}

:where(.wp-site-blocks, .editor-styles-wrapper) .wp-block-file__button {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	box-sizing: border-box;
}

@media (forced-colors: active) {
	:where(.wp-site-blocks, .editor-styles-wrapper) :where(a, button, input, select, textarea, summary):focus-visible {
		outline-color: Highlight;
		box-shadow: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-button__link {
		transition: none;
	}
}
