/**
 * OptConnect form sections (PR 3.9).
 *
 * One stylesheet for the whole family — `optconnect/form-hero`,
 * `optconnect/form-band` and `optconnect/form-stacked`. They share the `.oc-form`
 * shell and the `__cols` / `__copy` / `__title` / `__text` / `__mount` parts; the
 * `--hero`, `--band` and `--stacked` modifiers differ only in surface and layout.
 *
 * It is short, and the reason is worth stating: **almost nothing inside this family
 * is ours to style.** Everything below the `.oc-form__mount` boundary is markup the
 * `leadin` plugin injects at runtime from HubSpot's own embed script, in a form
 * configured in the HubSpot portal, and — on the v2 embed the family mostly uses —
 * frequently inside an `iframe.hs-form-iframe` that no stylesheet of ours can reach
 * at all. So this file styles the container and stops. Reaching into HubSpot's class
 * names would be styling something that can change without a deploy.
 *
 * Same no-margins convention as `card-grid.css` (PR 3.1), `cta-band.css` (PR 3.2) and
 * `hero.css` (PR 3.3): nothing inside a block-gapped group gets a `margin`
 * declaration here, because core's flow layout emits
 * `.wp-container-… > * + * { margin-block-start: … }` at one-class specificity and
 * this file loads after it. Spacing between blocks is set with `blockGap` in the
 * pattern markup.
 *
 * Selectors are scoped `.oc-form <part>` rather than bare, for the same specificity
 * reason `hero.css` sets out: a part that overrides a global-styles element rule is a
 * (0,1,0) vs (0,1,0) tie decided by stylesheet order, and global styles print inline
 * in `<head>` while this file is a `<link>` enqueued on the same hook.
 *
 * **No `min-height` anywhere.** The HubSpot script is blocked by Cookiebot until
 * marketing consent is granted, so a visitor who declines never sees a form — and on
 * `optconnect.local` no consent dialog renders at all, so it never loads there
 * either. Reserving vertical space would trade one layout shift for a permanently
 * empty box that a declining visitor cannot dismiss. The mount collapses instead.
 * The cost is accepted and real: the section grows by the form's height when HubSpot
 * paints. See `patterns/form-hero.php` for the measurements behind that choice.
 */

/* --------------------------------------------------------------------------
 * Shared parts
 * ---------------------------------------------------------------------- */

/* The eyebrow labels the section above the H1. `restly_title` emits it as an `<h6>`
   for its size; kept as a paragraph, because it is a label and not a heading, and
   given the tracking that makes uppercase text readable at a small size. Matches
   `.oc-hero__eyebrow` in `hero.css` — the two families sit on the same pages. */
.oc-form .oc-form__eyebrow {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.oc-form .oc-form__title {
	line-height: 1.15;
}

/* `core/columns` ships a `:where()` `margin-bottom` that is not a block gap, so it
   escapes the no-margins rule above and has to be cleared like PR 3.3 clears it. */
.oc-form .oc-form__cols {
	margin-bottom: 0;
}

/* --------------------------------------------------------------------------
 * The form mount
 *
 * The one boundary this file defends. HubSpot's embed writes either a `.hbspt-form`
 * div (v2) or a `.hs-form-frame` div (v4) into the mount and then sizes it from its
 * own script; both can exceed a narrow column if left alone, and an `iframe` has a
 * 300px default intrinsic width that ignores its parent entirely. `min-width: 0` on
 * the mount is what lets it shrink inside a flex column at all — without it a form
 * pushes the columns wider than the content width instead of wrapping.
 * ---------------------------------------------------------------------- */
.oc-form .oc-form__mount {
	min-width: 0;
}

.oc-form .oc-form__mount .hbspt-form,
.oc-form .oc-form__mount .hs-form-frame,
.oc-form .oc-form__mount iframe {
	max-width: 100%;
}

/* --------------------------------------------------------------------------
 * Landing hero — copy beside a panelled form
 *
 * The stack comes from `core/columns`, which collapses at core's own 781px
 * breakpoint, so there is no breakpoint of ours to keep in step. The panel's fill,
 * padding and the cover's dim are all declared in the pattern markup so the Site
 * Editor's own controls stay truthful about what will render.
 * ---------------------------------------------------------------------- */

/* Router photography is shot on transparent backgrounds at wildly different pixel
   sizes. Capping the height stops a tall composite from setting the hero's height;
   `contain` keeps the whole device visible, where `cover` would crop the ports these
   photos exist to show. Same rule, same reason, as `.oc-hero--product` in
   `hero.css`. */
.oc-form--hero .oc-form__media img {
	max-height: 320px;
	width: auto;
	object-fit: contain;
}

/* HubSpot injects its own markup after paint and its labels inherit whatever colour
   the surrounding page sets — which on this panel is white already, but only for the
   v2 embed that renders inline. Declared anyway so the panel does not depend on
   inheritance surviving a HubSpot form-style change, and scoped to the dark panel so
   it can never reach the light `--stacked` band. `patterns/footer.php` carries the
   identical rule for the newsletter form on the OC Blue band.

   Note the limit honestly: when the same form renders in an `iframe.hs-form-iframe`
   this does nothing, because nothing here crosses that boundary. The panel colour is
   `accent-2` rather than the live `#0081C2` partly for that reason — it is the
   surface HubSpot's own defaults were already legible on. */
.oc-form--hero .oc-form__panel label,
.oc-form--hero .oc-form__panel legend {
	color: var(--wp--preset--color--base, #fff);
}

/* --------------------------------------------------------------------------
 * Band — copy left, bare form right
 *
 * Nothing to add. The fill, the padding and the white text are all block supports
 * declared in the pattern, and `core/columns` handles the stack.
 * ---------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
 * Stacked — the form is the section
 * ---------------------------------------------------------------------- */

/* The instruction line under the first heading. Italic in the pattern markup because
   it is an aside; sized down here so it reads as one, without becoming a caption. */
.oc-form--stacked .oc-form__note {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

/* The measure is the group's own `layout.contentSize` (800px), declared in the
   pattern, not a `max-width` here — see `patterns/form-stacked.php`. It matters more
   in this shape than in the other two, because HubSpot lays its fields out to
   whatever width it is given. A `max-width` here would also have *centred* the
   narrowed block, since core's constrained layout already gives every child
   `margin-left: auto; margin-right: auto` — which is exactly what the first
   screenshot pass caught, with the italic line sitting in the middle of an otherwise
   left-aligned band. */
