/*
 * Brand preview (/preview-brand). Loaded only on the "preview-brand" template.
 * Colours: CircularMate logo (#063B2D, #57C66A) and the company video palette
 * (media/company-video-final-revision/build/compose_v6.py). Type: Segoe UI, as in the video and logo.
 */
body.cmx-brand {
	--cmb-bg: #F5F8F5;
	--cmb-dark: #083B2F;
	--cmb-green: #0B5745;
	--cmb-mint: #5BC86E;
	--cmb-pale: #C8EED0;
	--cmb-ink: #142822;
	--cmb-grey: #5C6E68;
	--cmb-line: #DDE6E1;
	--cmb-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

	/* Remap the old theme palette so lower sections on this page use brand colours, not near-black. */
	--wp--preset--color--graphite: var(--cmb-dark);
	--wp--preset--color--graphite-2: var(--cmb-green);
	--wp--preset--color--signal: var(--cmb-mint);
	--wp--preset--color--signal-dark: var(--cmb-green);
	--wp--preset--color--paper: var(--cmb-bg);
	--wp--preset--color--steel: var(--cmb-grey);
	--wp--preset--color--line: var(--cmb-line);
	--wp--preset--font-family--sans: var(--cmb-font);

	background: var(--cmb-bg);
	color: var(--cmb-ink);
	font-family: var(--cmb-font);
}
body.cmx-brand :focus-visible { outline: 3px solid var(--cmb-mint); outline-offset: 3px; }
body.cmx-brand .wp-element-button { border-radius: 999px; }

/* Header */
body.cmx-brand .wp-site-blocks > header.wp-block-template-part {
	position: sticky; top: 0; z-index: 50;
	background: rgba(255, 255, 255, 0.94);
	backdrop-filter: saturate(140%) blur(8px);
	border-bottom: 1px solid var(--cmb-line);
}
body.cmx-brand.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 32px; }
body.cmx-brand .cmb-logo { margin: 0; }
body.cmx-brand .cmb-logo img { display: block; height: auto; }
body.cmx-brand .cmb-header .wp-block-navigation { font-size: 0.975rem; font-weight: 600; color: var(--cmb-dark); }
body.cmx-brand .cmb-header .wp-block-navigation a:hover { color: var(--cmb-green); text-decoration: underline; text-decoration-color: var(--cmb-mint); text-underline-offset: 0.35em; text-decoration-thickness: 2px; }
body.cmx-brand .cmb-header .wp-block-navigation__responsive-container.is-menu-open { background: #fff; color: var(--cmb-dark); }
body.cmx-brand .cmb-header-cta .wp-element-button {
	background: var(--cmb-dark); color: #fff; font-weight: 600; font-size: 0.95rem; padding: 0.6rem 1.2rem;
}
body.cmx-brand .cmb-header-cta .wp-element-button:hover { background: var(--cmb-green); }
body.cmx-brand :where(.wp-site-blocks) [id] { scroll-margin-top: 80px; }

/* Hero */
body.cmx-brand .cmb-hero { padding-top: clamp(1.75rem, 4vw, 3.5rem); padding-bottom: clamp(2rem, 4vw, 3.5rem); }
body.cmx-brand .cmb-hero__grid { gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
body.cmx-brand .cmb-title {
	margin: 0;
	color: var(--cmb-dark);
	font-family: var(--cmb-font);
	font-weight: 700;
	font-size: clamp(2.25rem, 4.2vw, 3.6rem);
	line-height: 1.06;
	letter-spacing: -0.02em;
	max-width: 16ch;
}
body.cmx-brand .cmb-lead { margin: 1.25rem 0 0; font-size: 1.125rem; line-height: 1.6; color: var(--cmb-ink); max-width: 46ch; }
body.cmx-brand .cmb-actions { margin-top: 1.75rem; gap: 0.75rem; }
body.cmx-brand .cmb-actions .wp-element-button { font-weight: 600; font-size: 1rem; padding: 0.85rem 1.5rem; }
body.cmx-brand .cmb-btn-primary .wp-element-button { background: var(--cmb-dark); color: #fff; }
body.cmx-brand .cmb-btn-primary .wp-element-button:hover { background: var(--cmb-green); }
body.cmx-brand .cmb-btn-video .wp-element-button {
	background: #fff; color: var(--cmb-dark); border: 2px solid var(--cmb-mint);
	display: inline-flex; align-items: center; gap: 0.55rem;
}
body.cmx-brand .cmb-btn-video .wp-element-button::before {
	content: ""; width: 0; height: 0;
	border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--cmb-green);
}
body.cmx-brand .cmb-btn-video .wp-element-button:hover { background: var(--cmb-pale); }

/* Status: what exists today vs. what comes next */
body.cmx-brand .cmb-status { margin-top: 1.75rem; border-top: 1px solid var(--cmb-line); padding-top: 1rem; max-width: 46ch; }
body.cmx-brand .cmb-status__row { margin: 0 0 0.6rem; font-size: 0.9375rem; line-height: 1.5; color: var(--cmb-grey); padding-left: 1.4rem; position: relative; }
body.cmx-brand .cmb-status__row strong { color: var(--cmb-dark); margin-right: 0.35rem; }
body.cmx-brand .cmb-status__row::before {
	content: ""; position: absolute; left: 0; top: 0.42em; width: 10px; height: 10px; border-radius: 50%;
}
body.cmx-brand .cmb-status__row.is-today::before { background: var(--cmb-mint); }
body.cmx-brand .cmb-status__row.is-next::before { border: 2px solid var(--cmb-mint); box-sizing: border-box; }

/* Product diagram */
body.cmx-brand .cmb-figure { margin: 0; background: #fff; border: 1px solid var(--cmb-line); border-radius: 18px; padding: clamp(0.75rem, 2vw, 1.25rem); }
body.cmx-brand .cmb-figure svg { display: block; width: 100%; height: auto; }
body.cmx-brand .cmb-figure .cmb-svg--tall { display: none; }
body.cmx-brand .cmb-figure figcaption { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--cmb-grey); }

/* One orchestrated moment: CircularMate's additions appear on the existing line. */
@media (prefers-reduced-motion: no-preference) {
	body.cmx-brand .cmb-add { animation: cmb-in 0.5s ease-out both; }
	body.cmx-brand .cmb-add--1 { animation-delay: 0.25s; }
	body.cmx-brand .cmb-add--2 { animation-delay: 0.6s; }
	body.cmx-brand .cmb-add--3 { animation-delay: 0.95s; }
	body.cmx-brand .cmb-route--active { stroke-dasharray: 700; stroke-dashoffset: 700; animation: cmb-draw 0.9s 1.35s ease-in-out forwards; }
}
@keyframes cmb-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes cmb-draw { to { stroke-dashoffset: 0; } }

/* Video band */
body.cmx-brand .cmb-videoband { background: #fff; border-top: 1px solid var(--cmb-line); border-bottom: 1px solid var(--cmb-line); padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
body.cmx-brand .cmb-videoband__grid { gap: clamp(1.5rem, 4vw, 3.5rem); }
body.cmx-brand .cmb-h2 { margin: 0; color: var(--cmb-dark); font-weight: 700; font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -0.015em; }
body.cmx-brand .cmb-muted { margin: 0.75rem 0 0; color: var(--cmb-grey); max-width: 40ch; }

.cm-video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--cmb-dark, #083B2F); }
.cm-video > video, .cm-video > iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.cm-video__play { all: unset; position: absolute; inset: 0; cursor: pointer; display: block; }
.cm-video__play img, .cm-video__play video, .cm-video__blank { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-video__play:focus-visible { outline: 3px solid var(--cmb-mint, #5BC86E); outline-offset: -3px; }
.cm-video__icon {
	position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
	border-radius: 50%; background: #fff; box-shadow: 0 6px 24px rgba(8, 59, 47, 0.25);
}
.cm-video__icon::after {
	content: ""; position: absolute; left: 31px; top: 24px;
	border-style: solid; border-width: 14px 0 14px 22px; border-color: transparent transparent transparent var(--cmb-green, #0B5745);
}
.cm-video__play:hover .cm-video__icon { background: var(--cmb-pale, #C8EED0); }
.cm-video.is-pending { background: repeating-linear-gradient(135deg, #EEF5EF 0 14px, #F5F8F5 14px 28px); border: 2px dashed var(--cmb-pale, #C8EED0); }
.cm-video__pending { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; text-align: center; padding: 1.5rem; color: var(--cmb-grey, #5C6E68); font-size: 0.9375rem; }
.cm-video__pending strong { color: var(--cmb-dark, #083B2F); font-size: 1.05rem; }
.cm-video__pending .cm-video__icon { position: relative; left: auto; top: auto; margin: 0 0 0.5rem; opacity: 0.55; box-shadow: none; }

/* Lower sections (from Home): soften the old style on this preview */
body.cmx-brand .cm-eyebrow { font-family: var(--cmb-font); text-transform: none; letter-spacing: 0; font-size: 0.95rem; }
body.cmx-brand .cm-step-number { font-family: var(--cmb-font); }
body.cmx-brand .cm-card { border-radius: 14px; border-top-width: 1px; }
body.cmx-brand .cm-badge { font-family: var(--cmb-font); text-transform: none; letter-spacing: 0; border-radius: 999px; }

/* Mobile */
@media (max-width: 781px) {
	body.cmx-brand .cmb-logo img { width: 156px !important; }
	body.cmx-brand .cmb-header-cta { display: none; }
	body.cmx-brand .cmb-actions .wp-block-button { flex: 1 1 100%; }
	body.cmx-brand .cmb-actions .wp-element-button { width: 100%; box-sizing: border-box; justify-content: center; }
}
@media (max-width: 600px) {
	body.cmx-brand .cmb-figure .cmb-svg--wide { display: none; }
	body.cmx-brand .cmb-figure .cmb-svg--tall { display: block; }
	body.cmx-brand .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 0; }
}
