/*
	Theme Name: APM Child
	Description: Child theme of Genesis Block Theme for the Anaheim Precision Manufacturing site. Hosts the hand-coded Portal Access page template and its Contact Form 7 styling.
	Author: Horizon Helix
	Author URI: https://horizonhelix.com
	Template: genesis-block-theme
	Version: 1.0.0
	Requires at least: 6.0
	Requires PHP: 7.4
	License: GNU General Public License v3 or later.
	License URI: https://www.gnu.org/licenses/gpl-3.0.html
	Text Domain: apm-child
*/

/* -------------------------------------------------------------------------
   Custom fonts

   Elementor serves these four faces as "Custom Fonts", but it only emits the
   @font-face rules inside its per-page stylesheets (e.g.
   uploads/elementor/css/post-177.css) and it hardcodes absolute production
   URLs (https://www.anaheimprecision.com/...). The Portal Access page is
   hand-coded rather than Elementor-built, so it receives none of that CSS.

   Redeclaring the faces here — with root-relative paths, so they resolve on
   both Local and production — is what keeps the page on-brand. The file names
   match the real uploads in wp-content/uploads/2023/03/.
   ------------------------------------------------------------------------- */
@font-face {
	font-family: 'ProximaNova Bold';
	font-style: normal;
	font-weight: normal;
	font-display: swap;
	src: url('/wp-content/uploads/2023/03/ProximaNova-Bold.ttf') format('truetype');
}

@font-face {
	font-family: 'ProximaNova Light';
	font-style: normal;
	font-weight: normal;
	font-display: swap;
	src: url('/wp-content/uploads/2023/03/ProximaNova-Light.ttf') format('truetype');
}

@font-face {
	font-family: 'ObjektivMk1 Light Ic';
	font-style: normal;
	font-weight: normal;
	font-display: swap;
	src: url('/wp-content/uploads/2023/03/ObjektivMk1_Trial_LtIt.ttf') format('truetype');
}

@font-face {
	font-family: 'ObjektivMk1 Thin Ic';
	font-style: normal;
	font-weight: normal;
	font-display: swap;
	src: url('/wp-content/uploads/2023/03/ObjektivMk1_Trial_ThIt.ttf') format('truetype');
}

/* -------------------------------------------------------------------------
   Design tokens

   Values lifted from the Contact page's Elementor form widget
   (page 177, element 634ad16) so the Portal Access forms are visually
   identical to the one users already know.
   ------------------------------------------------------------------------- */
:root {
	--apm-orange: #EC4722;        /* submit button background */
	--apm-orange-heading: #F16032; /* section heading colour */
	--apm-black: #000000;
	--apm-white: #ffffff;
	--apm-error: #b3261e;

	--apm-font-heading: 'ProximaNova Bold', Sans-serif;
	--apm-font-body: 'ProximaNova Light', Sans-serif;
	--apm-font-label: 'ObjektivMk1 Light Ic', Sans-serif;
	--apm-font-field: 'ObjektivMk1 Thin Ic', Sans-serif;
}

/* -------------------------------------------------------------------------
   Portal Access — page shell
   ------------------------------------------------------------------------- */
.apm-portal {
	padding: 50px 50px 70px;
	color: var(--apm-black);
}

.apm-portal__container {
	max-width: 1140px;
	margin-inline: auto;
}

.apm-portal__title {
	font-family: var(--apm-font-heading);
	font-size: 30px;
	font-weight: 600;
	color: var(--apm-orange-heading);
	margin: 0 0 20px;
}

.apm-portal__intro {
	font-family: var(--apm-font-body);
	font-size: 25px;
	font-weight: 400;
	line-height: 29px;
	color: var(--apm-black);
	margin: 0 0 40px;
	max-width: 50em;
}

/* When the intro comes from the page editor it arrives as wrapped markup. */
.apm-portal__intro p {
	font: inherit;
	color: inherit;
	margin: 0 0 1em;
}

.apm-portal__intro p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   Vendor / Customer tab switcher

   Both panels are in the DOM and visible by default; portal-tabs.js adds
   .apm-tabs--enhanced to the wrapper, which is the only thing that turns on
   the tab behaviour. Without JS the visitor simply sees both forms stacked,
   each under its own heading.
   ------------------------------------------------------------------------- */
.apm-tabs__list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 30px;
	padding: 0;
	list-style: none;
}

/* The tab buttons are meaningless until JS wires them up. */
.apm-tabs:not(.apm-tabs--enhanced) .apm-tabs__list {
	display: none;
}

.apm-tabs__tab {
	font-family: var(--apm-font-heading);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--apm-black);
	background: var(--apm-white);
	border: 1px solid var(--apm-black);
	border-radius: 0;
	padding: 10px 24px;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.apm-tabs__tab:hover,
.apm-tabs__tab:focus-visible {
	background: var(--apm-black);
	color: var(--apm-white);
}

.apm-tabs__tab[aria-selected='true'] {
	background: var(--apm-orange);
	border-color: var(--apm-orange);
	color: var(--apm-white);
}

.apm-tabs__panel {
	max-width: 860px;
}

/* Only the enhanced version hides panels — see the no-JS note above. */
.apm-tabs--enhanced .apm-tabs__panel[hidden] {
	display: none;
}

/* With JS on, each panel's own heading is redundant next to the tab label. */
.apm-tabs--enhanced .apm-tabs__panel-title {
	display: none;
}

.apm-tabs__panel-title {
	font-family: var(--apm-font-heading);
	font-size: 25px;
	font-weight: 600;
	line-height: 25px;
	color: var(--apm-black);
	margin: 0 0 24px;
}

/* -------------------------------------------------------------------------
   Vendor forms to download — sits above the Vendor form only
   ------------------------------------------------------------------------- */
.apm-docs {
	border: 1px solid var(--apm-black);
	padding: 24px 26px;
	margin: 0 0 40px;
}

.apm-docs__title {
	font-family: var(--apm-font-heading);
	font-size: 20px;
	font-weight: 600;
	line-height: 20px;
	color: var(--apm-black);
	margin: 0 0 10px;
}

.apm-docs__intro {
	font-family: var(--apm-font-body);
	font-size: 17px;
	line-height: 21px;
	color: var(--apm-black);
	margin: 0 0 20px;
}

.apm-docs__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.apm-docs__item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 16px;
	padding: 12px 0;
	border-top: 1px solid rgba( 0, 0, 0, 0.15 );
}

.apm-docs__item:first-child {
	border-top: 0;
	padding-top: 0;
}

.apm-docs__item:last-child {
	padding-bottom: 0;
}

.apm-docs__link {
	font-family: var(--apm-font-heading);
	font-size: 17px;
	color: var(--apm-orange);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.apm-docs__link:hover,
.apm-docs__link:focus-visible {
	color: var(--apm-black);
}

/* Pushed to the right of the link on desktop; wraps under it on mobile, which
   is why the gap above sets a row value as well as a column one. */
.apm-docs__email {
	margin-inline-start: auto;
	font-family: var(--apm-font-body);
	font-size: 15px;
	line-height: 19px;
	color: var(--apm-black);
}

.apm-docs__email a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	/* Long addresses must not force the panel wider than the form. */
	overflow-wrap: anywhere;
}

.apm-docs__email a:hover,
.apm-docs__email a:focus-visible {
	color: var(--apm-orange);
}

/* -------------------------------------------------------------------------
   Form — mirrors the Contact page form widget's styling
   ------------------------------------------------------------------------- */
.apm-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 24px;
}

.apm-form__field {
	margin: 0 0 20px;
}

.apm-form__field label {
	display: block;
	font-family: var(--apm-font-label);
	font-size: 15px;
	font-weight: 400;
	color: var(--apm-black);
	margin-bottom: 8px;
}

.apm-form__required {
	color: var(--apm-orange);
}

/* -------------------------------------------------------------------------
   Field notes — the "i" beside a label and the copy it reveals

   Only fields with a 'hint' in apm_portal_access_fields() get these. The
   button ships hidden and the note ships visible; apm-form-hints.js swaps
   them, so with JS off the copy is just helper text under the label.
   ------------------------------------------------------------------------- */
.apm-form__label-row {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 6px;
	margin-bottom: 8px;
}

/*
 * The parent theme sets `form label { width: 100% }` (genesis-block-theme/
 * style.css:783). As a flex item that resolves flex-basis to the full row,
 * which strands the icon against the right edge of the form instead of
 * leaving it beside the label text — so the label has to shrink-wrap here.
 * The row owns the spacing now too, hence no margin on the label.
 */
.apm-form__label-row label {
	flex: 0 1 auto;
	width: auto;
	margin-bottom: 0;
}

/* No box of its own: the icon is the button. Sized past the glyph so the
   click target clears 24px without the drawn circle growing with it. */
.apm-form__hint-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: 0;
	padding: 0;
	color: var(--apm-orange);
	background: none;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
	transition: color 0.2s ease;
}

/*
 * The parent theme paints every <button> as a solid blue pill and repaints it
 * white on :hover, :focus and :active (genesis-block-theme/style.css:424-482).
 * Those state rules outrank the single class above, so without this the icon
 * turns white-on-white the moment it is clicked and stays that way while the
 * button holds focus.
 */
.apm-form__hint-toggle:focus,
.apm-form__hint-toggle:active {
	color: var(--apm-orange);
	background: none;
	box-shadow: none;
}

/* Orange resting, black on hover or while open — the same inversion as
   .apm-docs__link. Has to follow the reset above to win on equal weight. */
.apm-form__hint-toggle:hover,
.apm-form__hint-toggle[aria-expanded='true'] {
	color: var(--apm-black);
	background: none;
	box-shadow: none;
}

.apm-form__hint-toggle:focus-visible {
	outline: 2px solid var(--apm-orange);
	outline-offset: 0;
}

/* display:inline-flex above beats the hidden attribute's own UA rule, so the
   no-JS state — button away, note on the page — needs this spelled out. */
.apm-form__hint-toggle[hidden] {
	display: none;
}

/* display:block drops the inline baseline gap under the icon. */
.apm-form__hint-icon {
	display: block;
	width: 17px;
	height: 17px;
}

/* The glyph alone carries the meaning visually; this is the button's
   accessible name, kept off screen rather than display:none so screen
   readers still reach it. */
.apm-form__hint-toggle-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	clip-path: inset( 50% );
	white-space: nowrap;
	border: 0;
}

.apm-form__hint {
	display: block;
	max-width: 44em;
	margin: 0 0 10px;
	padding: 10px 14px;
	font-family: var(--apm-font-body);
	font-size: 15px;
	line-height: 19px;
	color: var(--apm-black);
	background: var(--apm-white);
	border: 1px solid var(--apm-black);
	border-left: 3px solid var(--apm-orange);
}

/* display:block above beats the hidden attribute's own UA rule, so closing
   the note needs this to be spelled out. */
.apm-form__hint[hidden] {
	display: none;
}

.apm-form__input input,
.apm-form input.apm-form__input {
	display: block;
	width: 100%;
	font-family: var(--apm-font-field);
	font-size: 17px;
	font-weight: 400;
	color: var(--apm-black);
	background-color: var(--apm-white);
	border: 1px solid var(--apm-black);
	border-radius: 0;
	padding: 11px 14px;
	box-sizing: border-box;
}

.apm-form input.apm-form__input:focus {
	outline: 2px solid var(--apm-orange);
	outline-offset: 1px;
}

.apm-form__submit,
.apm-form input.apm-form__submit {
	font-family: var(--apm-font-heading);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--apm-white);
	background-color: var(--apm-orange);
	border: 0;
	border-radius: 0;
	padding: 10px 20px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.apm-form input.apm-form__submit:hover,
.apm-form input.apm-form__submit:focus {
	background-color: var(--apm-black);
	color: var(--apm-white);
}

/* -------------------------------------------------------------------------
   Contact Form 7 output overrides

   CF7 wraps every field in .wpcf7-form-control-wrap and injects its own
   validation tips, spinner and response output. These rules bring that
   markup in line with the styling above.
   ------------------------------------------------------------------------- */
.apm-form .wpcf7-form-control-wrap {
	display: block;
}

.apm-form .wpcf7-not-valid-tip {
	display: block;
	font-family: var(--apm-font-body);
	font-size: 14px;
	color: var(--apm-error);
	margin-top: 6px;
}

.apm-form input.wpcf7-not-valid {
	border-color: var(--apm-error);
}

/* All validation messaging is CF7's, styled by .wpcf7-not-valid-tip and
   .wpcf7-not-valid above. The theme adds no error element of its own — doing
   so stacked a second message under every field. */
.apm-form input.wpcf7-not-valid:focus {
	outline-color: var(--apm-error);
}

/* The reCAPTCHA control is rendered as an inline <span>, so the spacing has
   to live on its wrapper — margin-bottom on an inline box does nothing. */
.apm-form__captcha {
	margin: 0 0 24px;
}

/* Under reCAPTCHA v3 the [recaptcha] tag renders nothing, so don't reserve
   space for a widget that isn't there. */
.apm-form__captcha:empty {
	margin: 0;
}

.apm-form .wpcf7-recaptcha {
	display: block;
}

.apm-form__actions {
	margin: 0;
}

.apm-form .wpcf7-spinner {
	display: block;
	margin: 14px 0 0;
}

.apm-form .wpcf7-response-output {
	font-family: var(--apm-font-body);
	font-size: 17px;
	line-height: 19px;
	border: 1px solid var(--apm-black);
	border-radius: 0;
	color: var(--apm-black);
	background: var(--apm-white);
	padding: 14px 18px;
	margin: 24px 0 0;
}

.apm-form.sent .wpcf7-response-output {
	border-color: var(--apm-orange);
}

/* -------------------------------------------------------------------------
   Responsive — breakpoints and type steps match the Elementor widget
   ------------------------------------------------------------------------- */
@media ( max-width: 1024px ) {
	.apm-portal {
		padding: 50px 30px 60px;
	}

	.apm-portal__title {
		font-size: 25px;
	}

	.apm-portal__intro {
		font-size: 20px;
		line-height: 24px;
	}

	.apm-tabs__panel-title {
		font-size: 20px;
		line-height: 20px;
	}

	.apm-docs__title {
		font-size: 17px;
		line-height: 17px;
	}

	.apm-docs__intro,
	.apm-docs__link {
		font-size: 15px;
	}

	.apm-form input.apm-form__input {
		font-size: 15px;
	}

	.apm-form__submit,
	.apm-form input.apm-form__submit,
	.apm-tabs__tab {
		font-size: 13px;
	}
}

@media ( max-width: 767px ) {
	.apm-portal {
		padding: 50px 20px 50px;
	}

	.apm-portal__intro {
		font-size: 17px;
	}

	.apm-form__row {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.apm-docs {
		padding: 20px;
	}

	/* Stacked, so the email line sits directly under its own form name
	   instead of being pulled across the row by margin-inline-start: auto. */
	.apm-docs__item {
		flex-direction: column;
		align-items: flex-start;
	}

	.apm-docs__email {
		margin-inline-start: 0;
	}

	.apm-form input.apm-form__submit {
		width: 100%;
	}
}
