/*
 * Prachay Accessibility (WCAG 2.1 AA) - override stylesheet.
 * Loaded by the prachay-a11y must-use plugin after Divi's stylesheet.
 * No content or layout changes; only focus indicators and colour-contrast
 * corrections. Version 1.0.0.
 */

/* ==========================================================================
   Palette
   Colour-CONTRAST corrections for text, links and control fills are computed
   per element in accessibility.js. The two tokens here are used only by the
   background-independent CSS rules below (focus ring, control borders).
   ========================================================================== */

:root {
	--prachay-muted-text: #595959; /* 7:1 on white - control borders / placeholder */
	--prachay-focus: #0b4f80; /* 8.59:1 on white - keyboard focus ring */
}

/* ==========================================================================
   SC 2.4.1 Bypass Blocks - skip link
   Off-screen until focused, so it is invisible to sighted mouse users.
   ========================================================================== */

.prachay-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
	padding: 12px 20px;
	background: #ffffff;
	color: #1a1a1a;
	font-size: 16px;
	font-weight: 600;
	text-decoration: underline;
	border: 2px solid var(--prachay-focus);
	border-radius: 0 0 4px 0;
}

.prachay-skip-link:focus {
	left: 0;
}

/* The skip target receives tabindex="-1"; suppress the resulting outline. */
#main-content:focus {
	outline: none;
}

/* ==========================================================================
   SC 2.1.1 Keyboard - navigation dropdowns
   Divi reveals submenus only on mouse hover (`.nav li:hover > ul`), leaving
   them visibility:hidden - and therefore out of the tab order - for keyboard
   users. These rules mirror the hover reveal on keyboard focus so every
   dropdown link becomes reachable by Tab. Higher specificity than Divi's hide
   rule (`.nav li ul`) and hover rule, plus !important, so it always wins.
   ========================================================================== */

.nav li.menu-item-has-children:focus-within > ul,
.nav li.menu-item-has-children:focus-within > ul.sub-menu,
.et_pb_menu li.menu-item-has-children:focus-within > ul,
.et-menu li.menu-item-has-children:focus-within > ul {
	visibility: visible !important;
	opacity: 1 !important;
	display: block !important;
}

/* ==========================================================================
   SC 2.4.7 Focus Visible
   Divi suppresses focus rings on several controls. Restored here. Only ever
   painted while an element is keyboard-focused, so the resting design is
   untouched.
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.et_pb_button:focus-visible {
	outline: 3px solid var(--prachay-focus);
	outline-offset: 2px;
}

/* ==========================================================================
   SC 1.4.3 Contrast (Minimum) and SC 1.4.11 Non-text Contrast

   IMPORTANT: text/link/background COLOUR corrections are handled entirely by
   accessibility.js, element-by-element, against each element's real background.
   A blanket CSS rule such as `a { color: ... }` is deliberately NOT used here:
   it would recolour links that sit on dark panels (e.g. the footer) which
   already pass, and break them. Only background-independent, non-text control
   corrections live in CSS below.
   ========================================================================== */

/* Form control boundaries: SC 1.4.11 requires 3:1 for the control itself. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="date"],
select,
textarea,
.wpcf7-text,
.wpcf7-email,
.wpcf7-tel,
.wpcf7-textarea,
.et_pb_contact_field .input {
	border: 1px solid var(--prachay-muted-text) !important;
	color: #1a1a1a !important;
}

/* Placeholder text must also clear 4.5:1. Browsers dim it by default. */
::placeholder {
	color: var(--prachay-muted-text) !important;
	opacity: 1 !important;
}

/* ==========================================================================
   Homepage "Our Product Offerings" panels - hover legibility
   These panels have a blue (#035c98) background. Site styles turn links a dark
   blue on hover (a.smallblue/bigblue:hover -> #23528c), which is nearly
   invisible against the panel, so text appears to vanish on hover. Force the
   hovered text white so it stays legible. Scoped to the panels' own classes
   and to :hover only, so nothing at rest and no light-background links change.
   Higher specificity than the site rule + !important, so it wins.
   ========================================================================== */

.ps-FAQAdvSection a:hover,
.ps-FAQAdvSection .et_pb_toggle:hover .et_pb_toggle_title,
.ps-FAQAdvSection .et_pb_toggle_title:hover,
.ps-LightpoleSection a.smallblue:hover,
.ps-LightpoleSection a.bigblue:hover,
.ps-LightpoleSection a.small-button:hover,
.ps-adv-section2 a.smallblue:hover,
.ps-adv-section2 a.bigblue:hover,
.ps-adv-section2 a.small-button:hover {
	color: #ffffff !important;
}

/* ==========================================================================
   Testimonial "chat bubble" boxes (Advisors / Capital pages)
   The bubble is a fixed-size background image (~521px, .ps-ChatBox). The
   testimonial text column is wider than the bubble's readable area, so the
   white text spills onto the white page and looks cut off. Constrain the text
   column to sit inside the bubble and centre it. Height/overflow are left
   untouched so the swiper carousel keeps working.
   ========================================================================== */

.ps-ChatBox .sp-testimonial-free-section .sp-testimonial-content,
.ps-ChatBox .sp-testimonial-free-section .sp-testimonial-content p,
.ps-ChatBox .sp-testimonial-free-section .sp-testimonial-client-name {
	max-width: min(400px, 85%) !important;
	margin-left: auto !important;
	margin-right: auto !important;
	box-sizing: border-box !important;
	float: none !important;
}

/* ==========================================================================
   Homepage company boxes with the blue hover effect (.ps-PopupPromobox)
   - Rest: the sub-title was mid-grey (#666) - darken to black for legibility
     on the white section.
   - Hover: the box turns blue but only the heading was switched to white,
     leaving the grey sub-title invisible. Turn the sub-title white too, and
     lighten the hover blue slightly as requested (still >=4.5:1 with white).
   High specificity so these win over the theme rules regardless of load order.
   ========================================================================== */

.et_pb_section .ps-PopupPromobox .et_pb_promo_description,
.et_pb_section .ps-PopupPromobox .et_pb_promo_description * {
	color: #000000 !important;
}

.et_pb_section .et_pb_module.ps-PopupPromobox:hover {
	background: #0a6cb5 !important;
}

.et_pb_section .ps-PopupPromobox:hover .et_pb_module_header,
.et_pb_section .ps-PopupPromobox:hover .et_pb_promo_description,
.et_pb_section .ps-PopupPromobox:hover .et_pb_promo_description * {
	color: #ffffff !important;
}

/* ==========================================================================
   SC 1.4.1 Use of Colour - distinguishable links
   Links distinguished from surrounding text by colour alone need a non-colour
   cue. Scoped to contact links in tables and to blog post-meta links (category,
   tag, author) so body-copy and navigation styling is untouched.
   ========================================================================== */

td a[href^="tel:"],
td a[href^="mailto:"],
a[rel~="category"],
a[rel~="tag"],
a[rel="author"] {
	text-decoration: underline !important;
}
