/**
 * Brochure download gate (parts/v3-brochure-gate.php + assets/js/v3-brochure-gate.js).
 *
 * Self-contained like the call-back dialog: own tokens and px sizes, because the dialog is moved
 * to <body>, outside .acma-v3. Follows the
 * shared field system (tokens on :root in v3-base.css): labels above fields, --v3-fld-h fields with a
 * 12px radius, the royal focus ring, --v3-danger errors. Bottom sheet on phones, centred panel from 640px.
 */

.v3-brgate, .v3-brdialog, .v3-brtoast {
	--bg-ink: #0e1622; --bg-text: #3f4a57; --bg-muted: #5f6b78; --bg-line: #dde2e8; --bg-field: #c9d0d9;
	--bg-navy: #071a33; --bg-royal: #005f9f; --bg-blue: #005f9f; --bg-danger: #b42318; --bg-surface: #f3f5f8;
	font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.v3-brgate[hidden], .v3-brgate [hidden], .v3-brtoast[hidden] { display: none !important; }

/* ── Inline home on /allbrochures/ (no script) ───────────────────────── */
.v3-brgate-home { margin-top: clamp(48px, 5vw, 88px); }
.v3-brgate-home[hidden] { display: none; }
.v3-brgate-home .v3-brgate { max-width: 760px; margin-inline: auto; padding: clamp(24px, 2.4vw, 44px); border-radius: clamp(16px, 1.4vw, 28px); background: #fff; box-shadow: 0 40px 80px -48px rgba(14, 22, 34, .35), 0 0 0 1px var(--bg-line); }

/* ── Dialog ──────────────────────────────────────────────────────────── */
html.v3-brdialog-open { overflow: hidden; }
.v3-brdialog { width: min(100vw - 32px, 640px); max-width: none; max-height: min(100dvh - 48px, 920px); margin: auto; padding: 0; border: 0; border-radius: 24px; background: #fff; color: var(--bg-ink); box-shadow: 0 50px 100px -40px rgba(4, 13, 28, .55); overflow: auto; overscroll-behavior: contain; }
.v3-brdialog::backdrop { background: rgba(4, 13, 28, .62); }
.v3-brdialog[open] { animation: v3-br-in .45s cubic-bezier(.2, .7, .1, 1); }
@keyframes v3-br-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.v3-brdialog__panel { position: relative; padding: 36px 36px 32px; }
.v3-brdialog__close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--bg-line); border-radius: 50%; background: #fff; color: var(--bg-ink); cursor: pointer; transition: background-color .25s, color .25s; }
.v3-brdialog__close svg { width: 20px; height: 20px; }
.v3-brdialog__close:hover { background: var(--bg-navy); border-color: var(--bg-navy); color: #fff; }

/* ── Content ─────────────────────────────────────────────────────────── */
.v3-brgate .v3-brgate__title { margin: 0 48px 8px 0; padding: 0; font-family: inherit; font-size: clamp(24px, .6vw + 18px, 30px); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--bg-ink); }
.v3-brgate .v3-brgate__title:focus { outline: none; }
.v3-brgate .v3-brgate__lead, .v3-brgate .v3-brgate__note { margin: 0 0 10px; font-size: 16px; line-height: 1.6; color: var(--bg-text); text-wrap: pretty; }
.v3-brgate a { color: var(--bg-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.v3-brgate a:hover { color: #004a7c; }
.v3-brgate__form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--v3-q-gap, 20px) 20px; margin-top: 22px; }
.v3-brgate__field { display: flex; flex-direction: column; gap: var(--v3-lbl-gap, 10px); min-width: 0; }
.v3-brgate__field--full { grid-column: 1 / -1; }
.v3-brgate .v3-brgate__field > label { margin: 0; font-size: var(--v3-lbl-fs, 15px); font-weight: 600; line-height: 1.4; color: var(--bg-ink); }
.v3-brgate .v3-brgate__field > label span { font-weight: 400; color: var(--bg-muted); }
.v3-brgate input[type="text"], .v3-brgate input[type="email"], .v3-brgate select {
	box-sizing: border-box; width: 100%; height: var(--v3-fld-h, 56px); margin: 0; padding: 0 16px;
	border: 1px solid var(--bg-field); border-radius: var(--v3-fld-r, 12px); background: #fff; box-shadow: none;
	font-family: inherit; font-size: var(--v3-fld-fs, 16px); font-weight: 400; color: var(--bg-ink);
	transition: border-color .2s, box-shadow .2s;
}
.v3-brgate input::placeholder { color: var(--v3-placeholder, #6b7683); opacity: 1; }
/* Legacy style.css sets `body input[type="text"]:focus` (and hover) to green with !important: outrank it. */
body .v3-brgate :is(input[type="text"], input[type="email"], select):hover { border-color: var(--v3-field-hover, #9aa5b2) !important; }
body .v3-brgate :is(input[type="text"], input[type="email"], select):focus { outline: none !important; border-color: var(--bg-royal) !important; box-shadow: var(--v3-fld-focus, 0 0 0 1px #005f9f, 0 0 0 5px rgba(0, 95, 159, .16)) !important; }
.v3-brgate [aria-invalid="true"] { border-color: var(--bg-danger) !important; box-shadow: 0 0 0 1px var(--bg-danger) !important; }
.v3-brgate__select { position: relative; display: block; }
.v3-brgate .v3-brgate__select select { padding-right: 44px; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; }
.v3-brgate__select svg { position: absolute; top: 50%; right: 16px; width: 16px; height: 16px; translate: 0 -50%; color: var(--bg-muted); pointer-events: none; }
.v3-brgate__consent { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.v3-brgate .v3-brgate__consent input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--bg-navy); }
.v3-brgate .v3-brgate__consent input:focus-visible { outline: 3px solid var(--bg-royal); outline-offset: 2px; }
.v3-brgate .v3-brgate__consent label { margin: 0; font-size: 15px; font-weight: 400; line-height: 1.55; color: var(--bg-text); }
.v3-brgate__consent .v3-brgate__err { grid-column: 2; }
.v3-brgate .v3-brgate__err { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--bg-danger); }
.v3-brgate .v3-brgate__err--form { padding: 12px 14px; border-radius: 12px; background: var(--v3-danger-bg, #f9eded); }
.v3-brgate__bot:empty { display: none; }
.v3-brgate__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.v3-brgate .v3-brgate__submit {
	position: relative; isolation: isolate; overflow: hidden;
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: clamp(52px, 3.4vw, 64px); padding: 0 clamp(24px, 1.8vw, 36px); border: 0; border-radius: 999px; /* the .v3-btn size */
	background: var(--bg-navy); color: #fff; cursor: pointer;
	font-family: inherit; font-size: clamp(15px, .3vw + 12px, 19px); font-weight: 700; line-height: 1.2;
}
.v3-brgate .v3-brgate__submit::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--bg-royal); transform: translateY(101%); transition: transform .55s cubic-bezier(.7, 0, .2, 1); }
.v3-brgate .v3-brgate__submit:is(:hover, :focus-visible)::before { transform: none; }
.v3-brgate .v3-brgate__submit:focus-visible, .v3-brdialog__close:focus-visible { outline: 3px solid var(--bg-royal); outline-offset: 3px; }
.v3-brgate .v3-brgate__submit[disabled] { cursor: progress; opacity: .8; }
.v3-brgate .v3-brgate__submit svg { width: 20px; height: 20px; flex: none; }
.v3-brgate .v3-brgate__submit--ghost { background: #fff; color: var(--bg-navy); box-shadow: inset 0 0 0 1.5px var(--bg-navy); }
.v3-brgate .v3-brgate__submit--ghost::before { background: var(--bg-navy); }
.v3-brgate .v3-brgate__submit--ghost:is(:hover, :focus-visible) { color: #fff; }
.v3-brgate .v3-brgate__fine { margin: 0; font-size: 16px; line-height: 1.5; color: var(--bg-muted); }

/* Status note for a remembered visitor (no dialog). */
.v3-brtoast { position: fixed; z-index: 9990; left: 50%; bottom: 24px; translate: -50% 0; max-width: calc(100vw - 32px); margin: 0; padding: 14px 22px; border-radius: 999px; background: var(--bg-navy); color: #fff; font-size: 16px; font-weight: 600; line-height: 1.4; box-shadow: 0 24px 50px -24px rgba(4, 13, 28, .6); }

@media (max-width: 639.98px) {
	.v3-brdialog { width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
	.v3-brdialog__panel { padding: 28px 16px 24px; }
	.v3-brgate__form { grid-template-columns: minmax(0, 1fr); }
	.v3-brgate .v3-brgate__submit { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.v3-brdialog[open] { animation: none; }
	.v3-brgate .v3-brgate__submit::before { transition: none; }
}
html:is(.translated-ltr, .translated-rtl) .v3-brgate .v3-brgate__title { line-height: 1.4; letter-spacing: normal; }

/* "Also send me": related brochures for one submission (v3-brochure-gate.js fills the list). */
.v3-brgate .v3-brgate__also { margin: 0; padding: 16px 18px; border: 1px solid var(--bg-line, #dde2e8); border-radius: 14px; background: var(--bg-surface, #f3f5f8); min-inline-size: 0; }
.v3-brgate .v3-brgate__also[hidden] { display: none; }
.v3-brgate .v3-brgate__also legend { float: left; width: 100%; margin: 0 0 10px; padding: 0; font-size: 15px; font-weight: 600; color: var(--bg-ink, #0e1622); }
.v3-brgate__also-list { clear: both; display: grid; gap: 8px; }
.v3-brgate__also-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: center; }
.v3-brgate .v3-brgate__also-item input { width: 20px; height: 20px; margin: 0; accent-color: var(--bg-navy); }
.v3-brgate .v3-brgate__also-item input:focus-visible { outline: 3px solid var(--bg-royal); outline-offset: 2px; }
.v3-brgate .v3-brgate__also-item label { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--bg-text); }
/* One link per brochure on the sent panel. */
.v3-brgate .v3-brgate__files { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.v3-brgate .v3-brgate__files a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; font-weight: 700; color: var(--bg-ink, #0e1622); text-decoration: underline; text-decoration-color: rgba(14, 22, 34, .3); text-underline-offset: 3px; }
.v3-brgate .v3-brgate__files a::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--bg-green, #7ab242); }
.v3-brgate .v3-brgate__files a:hover { text-decoration-color: currentColor; }
.v3-brgate .v3-brgate__files a:focus-visible { outline: 3px solid var(--bg-royal); outline-offset: 3px; border-radius: 4px; }
