/* CMM Marketing: WordPress / Elementor integration layer.
   Only adapts the approved styles.css to the WordPress page shell; it adds no design of its own. */

/* The Theme Builder header location wrapper is the element in the body flow, so it carries the sticky
   behaviour that styles.css gives .site-header (position: sticky; top: 0; z-index: 50). */
.elementor-location-header { position: sticky; top: 0; z-index: 50; }
.admin-bar .elementor-location-header { top: 32px; }
@media screen and (max-width: 782px) { .admin-bar .elementor-location-header { top: 46px; } }
@media screen and (max-width: 600px) { .admin-bar .elementor-location-header { top: 0; } }

/* Shell containers holding CMM components are layout-neutral: no padding, gap or width of their own. */
.e-con.cmm-shell { --padding-top: 0px; --padding-right: 0px; --padding-bottom: 0px; --padding-left: 0px; --gap: 0px; --row-gap: 0px; --column-gap: 0px; --flex-wrap: nowrap; }
.e-con.cmm-shell > .elementor-widget { width: 100%; }

/* ---------- Docs and Contact (Iteration 5): native containers carry the prototype's layout classes ----------
   A layout container (.cmm-layout) is a plain box: Elementor's container padding/gap/width variables are zeroed so
   the prototype classes on the same element (.docs, .docs__layout, .docs__content, .contact__grid, .cform …) decide
   display, spacing and width. Widgets inside are the grid items, so the prototype's child rules move to the
   widget wrappers below. */
.e-con.cmm-layout { --padding-top: 0px; --padding-right: 0px; --padding-bottom: 0px; --padding-left: 0px; --gap: 0px; --row-gap: 0px; --column-gap: 0px; --flex-wrap: nowrap; --width: auto; --display: block; }
.e-con.cmm-layout.docs__layout, .e-con.cmm-layout.contact__grid { --display: grid; }
.e-con.cmm-layout > .elementor-widget { width: auto; max-width: none; min-width: 0; }

/* Docs: the contents column stretches to the reading column's height so the sticky list can travel with it */
.docs__layout > .elementor-widget-cmm-docs-toc { align-self: stretch; }
@media (max-width: 1023px) { .docs__layout > .elementor-widget-cmm-docs-toc { align-self: auto; } }
/* Each doc section sits in its own widget wrapper, so ".doc:first-child" is true for all of them: restore the
   divider and spacing for every section after the first (values from pages.css .doc). */
.docs__content > .elementor-widget + .elementor-widget > .doc { padding-top: clamp(44px, 5vw, 64px); border-top: 1px solid var(--line); }

/* Contact: grid areas belong to the grid items, which are the widget wrappers */
.contact__grid > .elementor-widget-cmm-contact-intro { grid-area: intro; }
.contact__grid > .elementor-widget-cmm-contact-aside { grid-area: aside; }
/* Contact hero glow: Elementor's container overlay rule (.e-con::before) adds left: 0, which beats the glow's
   right: -12% and pins it to the left edge. Release it so styles.css .hero::before anchors right, as in the source. */
.e-con.cmm-layout.hero::before { left: auto; }

/* ---------- Contact form: Elementor Pro Form in the approved .cform/.field styles ----------
   The form keeps Elementor's markup and behaviour; these rules give its fields, labels, messages and button the
   prototype's appearance (pages.css section 13 .field, .check, .cform__result; styles.css .btn--ink). Scoped to the
   widget's CSS class `cmm-contact-form`, with enough weight to win over the widget's generated style rules. */
body.cmm .cmm-contact-form .elementor-form-fields-wrapper { margin-top: 22px; }
/* The widget's Kit-global typography (text/accent) names a font this site does not load: use the site font for
   everything Elementor prints in the form (messages, HTML fields, option labels). */
body.cmm .elementor-widget-form.cmm-contact-form .elementor-form, body.cmm .elementor-widget-form.cmm-contact-form .elementor-form * { font-family: var(--font); }
body.cmm .cmm-contact-form .elementor-field-group { align-items: flex-start; }
body.cmm .cmm-contact-form .elementor-field-group > .elementor-field-label { display: block; margin-bottom: 8px; padding: 0; font-family: var(--font); font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
body.cmm .cmm-contact-form .elementor-mark-required .elementor-field-label::after { content: "*"; margin-left: .25em; padding: 0; color: var(--dusky); }
body.cmm .cmm-contact-form .elementor-field-group .elementor-field-textual {
  width: 100%; height: 52px; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--white);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.3; color: var(--ink); box-shadow: none;
  transition: border-color var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease);
}
body.cmm .cmm-contact-form .elementor-field-group textarea.elementor-field-textual { height: auto; min-height: 156px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
body.cmm .cmm-contact-form .elementor-field-group .elementor-field-textual::placeholder { color: var(--text-3); opacity: 1; }
body.cmm .cmm-contact-form .elementor-field-group .elementor-field-textual:hover { border-color: var(--text-3); }
body.cmm .cmm-contact-form .elementor-field-group .elementor-field-textual:focus { outline: none; border-color: var(--viridian-700); box-shadow: 0 0 0 4px rgba(0, 117, 80, .2); }
body.cmm .cmm-contact-form .elementor-field-group .elementor-field-textual:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.cmm .cmm-contact-form .elementor-select-wrapper select { padding-right: 46px; appearance: none; -webkit-appearance: none; cursor: pointer; }
body.cmm .cmm-contact-form .elementor-select-wrapper { display: flex; flex-wrap: wrap; width: 100%; }
body.cmm .cmm-contact-form .elementor-select-wrapper select { flex: 1 0 100%; }
/* Elementor appends the select's error inside this wrapper: keep the caret on the field, not the wrapper's middle */
body.cmm .cmm-contact-form .elementor-select-wrapper .select-caret-down-wrapper { top: 26px; right: 16px; font-size: 14px; color: var(--text-3); }
body.cmm .cmm-contact-form .elementor-select-wrapper .select-caret-down-wrapper svg { width: 14px; height: 14px; fill: currentColor; }
/* Invalid state (Elementor marks the group .elementor-error and the input aria-invalid) */
body.cmm .cmm-contact-form .elementor-error .elementor-field-textual,
body.cmm .cmm-contact-form .elementor-field-textual[aria-invalid="true"] { border-color: var(--sienna-700); border-width: 2px; }
body.cmm .cmm-contact-form .elementor-error .elementor-field-textual:focus { box-shadow: 0 0 0 4px rgba(141, 85, 28, .18); }
body.cmm .cmm-contact-form .elementor-field-group .elementor-form-help-inline { flex-basis: 100%; width: 100%; margin: 6px 0 0; padding: 0; background: none; box-shadow: none; border-radius: 0; font-size: var(--fs-meta); font-weight: 600; line-height: 1.4; color: var(--sienna-700); }
/* Hint and privacy note (HTML fields) */
body.cmm .cmm-contact-form .field__hint { margin-top: -6px; font-size: var(--fs-meta); line-height: 1.45; color: var(--text-3); }
body.cmm .cmm-contact-form .cform__note { display: block; font-size: var(--fs-meta); line-height: 1.5; color: var(--text-2); }
body.cmm .cmm-contact-form .cform__note a { font-weight: 600; color: var(--viridian-700); text-decoration: underline; text-underline-offset: .2em; }
body.cmm .cmm-contact-form .cform__note a:hover { color: var(--dusky); }
/* Optional product-updates opt-in: the prototype's .check panel */
/* Panels and the divider sit inside the field edges: Elementor pads each field group by half the column gap
   (form setting "Columns gap" = 18px), so the panel is inset by the same 9px on each side. */
body.cmm .elementor-widget-form.cmm-contact-form .elementor-field-group.elementor-field-type-acceptance { flex-basis: calc(100% - 18px); max-width: calc(100% - 18px); margin-inline: 9px; padding: 16px 18px; border-radius: 14px; background: var(--nile-50); box-shadow: inset 0 0 0 1px #CBE6E6; }
body.cmm .cmm-contact-form .elementor-field-type-acceptance > .elementor-field-label { margin-bottom: 6px; font-size: 1.0625rem; font-weight: 700; }
body.cmm .cmm-contact-form .elementor-field-type-acceptance .elementor-field-option { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; }
body.cmm .cmm-contact-form .elementor-field-type-acceptance input[type="checkbox"] { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--viridian-700); cursor: pointer; }
body.cmm .cmm-contact-form .elementor-field-type-acceptance .elementor-field-option label { font-size: var(--fs-meta); font-weight: 400; line-height: 1.5; color: var(--text-2); cursor: pointer; }
/* Submit: .btn--ink */
/* (the widget's generated rules pad every field group by half the column gap; these two groups need their own padding) */
body.cmm .elementor-widget-form.cmm-contact-form .elementor-field-group.elementor-field-type-submit { flex-basis: calc(100% - 18px); max-width: calc(100% - 18px); margin-inline: 9px; margin-top: 6px; padding: 22px 0 0; border-top: 1px solid var(--line); justify-content: flex-end; }
body.cmm .cmm-contact-form .elementor-button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 52px; padding: 0 1.5rem; border-radius: 10px; border: 1.5px solid transparent;
  background: var(--ink); color: #fff; font-family: var(--font); font-size: 1.0625rem; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease), transform var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease);
}
body.cmm .cmm-contact-form .elementor-button[type="submit"]:hover { background: var(--dusky); box-shadow: var(--shadow-btn); transform: translateY(-1px); }
body.cmm .cmm-contact-form .elementor-button[type="submit"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.cmm .cmm-contact-form .elementor-form-waiting .elementor-button[type="submit"] { cursor: progress; }
/* Result messages: the prototype's .cform__result (success) and .cform__summary (error) panels */
body.cmm .cmm-contact-form .elementor-message { margin-top: 20px; padding: 16px 18px; border-radius: 14px; font-size: var(--fs-small); line-height: 1.55; }
body.cmm .cmm-contact-form .elementor-message::before { display: none; }
body.cmm .cmm-contact-form .elementor-message-success { background: var(--nile-50); box-shadow: inset 0 0 0 1px #CBE6E6; color: var(--ink); font-weight: 600; }
body.cmm .cmm-contact-form .elementor-message-danger:not(.elementor-help-inline) { background: var(--sienna-50); box-shadow: inset 0 0 0 1px rgba(187, 113, 37, .32); color: var(--sienna-700); font-weight: 600; }
body.cmm .cmm-contact-form .elementor-message:focus { outline: none; }
body.cmm .cmm-contact-form .elementor-message:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (max-width: 599px) {
  body.cmm .cmm-contact-form .elementor-button[type="submit"] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body.cmm .cmm-contact-form .elementor-button[type="submit"]:hover { transform: none; }
}
