/* ==========================================================================
   COF Accessible PDF — frontend styles
   ========================================================================== */

/* Wrapper injected around each PDF <a> tag */
.cof-apdf-wrapper {
	display: inline-block; /* block formatting context needed for absolute child */
	position: relative;
}

/* Accessible person button — always visible */
.cof-apdf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: absolute;   /* out of flow — won't shift surrounding text */
	left: 100%;
	top: 50%;
	transform: translateY( -50% );
	margin-left: 4px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: none !important;
	box-shadow: none !important;
	border-radius: 50%;
	background: transparent !important;
	color: #005A9C;
	cursor: pointer;
	flex-shrink: 0;
	transition: color 0.15s ease, background 0.15s ease;
}

.cof-apdf-btn svg {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background-color: white;
}

footer .cof-apdf-btn svg {
	background-color: transparent;
}

.cof-apdf-btn svg path {
	fill: currentColor;
}

.cof-apdf-btn:hover, .cof-apdf-btn:focus {
	padding: 2px;
	background: #FFD100 !important;
	scale: 1.15;
}

.cof-apdf-btn:hover svg, .cof-apdf-btn:focus svg {
	background: #FFD100 !important;
}
.cof-apdf-btn:focus,
.cof-apdf-btn:focus-visible {
	background: #FFD100 !important;
	outline: 2px solid #005A9C;
	outline-offset: 3px;
}

.cof-apdf-btn[aria-busy="true"],
.cof-apdf-btn:disabled {
	opacity: 0.5;
	cursor: wait;
}

/* Heading context — inline placement after the last letter */
.wp-block-heading .cof-apdf-wrapper {
	display: inline-flex;
	align-items: center;
}

.wp-block-heading .cof-apdf-btn {
	position: static;
	transform: none;
	top: auto;
	left: auto;
	margin-left: 4px;
}

/* Paragraph / body-text context — inline so button doesn't overlap following text */
p .cof-apdf-wrapper {
	display: inline-flex;
	align-items: center;
}

p .cof-apdf-btn {
	position: static;
	transform: none;
	top: auto;
	left: auto;
	margin-left: 4px;
}

/* Table cell context — inline so absolute button doesn't escape the cell */
td .cof-apdf-wrapper {
	display: inline-flex;
	align-items: center;
}

td .cof-apdf-btn {
	position: static;
	transform: none;
	top: auto;
	left: auto;
	margin-left: 4px;
}

/* WP block button context — btn overlays top-left corner, link never wrapped */
.cof-apdf-block {
	position: relative;
}

.cof-apdf-block .cof-apdf-btn {
	left: -5px;
	top: -5px;
	transform: scale( 1 );
	margin-left: 0;
}

.cof-apdf-block .cof-apdf-btn:focus,
.cof-apdf-block .cof-apdf-btn:focus-visible {
	outline: 2px solid #005A9C;
	outline-offset: 3px;
}

/* ==========================================================================
   Staff listing card — one button, top-right corner, slightly larger
   ========================================================================== */

/* Card needs to be the positioning anchor */
.staff-listing-root {
	position: relative;
}

/* Suppress the duplicate button on the image/icon side */
.staff-listing-root .left .cof-apdf-btn {
	display: none;
}

/* Let the heading wrapper escape its own positioning context */
.staff-listing-root .right h2 .cof-apdf-wrapper {
	position: static;
	display: inline;
}

/* Lift the button to the card's top-right corner */
.staff-listing-root .right h2 .cof-apdf-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	left: auto;
	transform: none;
	width: 28px;
	height: 28px;
	margin-left: 0;
}

/* ==========================================================================
   Footer — white icon on dark blue bg, blue icon when yellow hover bg appears
   ========================================================================== */

footer.site-footer .cof-apdf-btn {
	color: #fff;
}

footer.site-footer .cof-apdf-btn:hover,
footer.site-footer .cof-apdf-btn:focus {
	color: #005A9C;
}

footer.site-footer .cof-apdf-btn:focus,
footer.site-footer .cof-apdf-btn:focus-visible {
	outline-color: #fff;
}

/* Prevent page scroll while modal is open */
body.cof-apdf-open {
	overflow: hidden;
}

/* ==========================================================================
   Progress modal
   ========================================================================== */

#cof-apdf-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

#cof-apdf-modal[hidden] {
	display: none;
}

.cof-apdf-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
}

.cof-apdf-dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.25 );
	padding: 32px 28px 28px;
	width: min( 90vw, 380px );
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.cof-apdf-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: none;
	border-radius: 4px;
	background: transparent;
	color: #666;
	cursor: pointer;
}

.cof-apdf-close:hover { background: #f0f0f0; }

.cof-apdf-close:focus,
.cof-apdf-close:focus-visible {
	outline: 2px solid #005A9C;
	outline-offset: 2px;
}

.cof-apdf-modal-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: #222;
}

.cof-apdf-track {
	width: 100%;
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
}

.cof-apdf-fill {
	height: 100%;
	width: 0%;
	background: #005A9C;
	border-radius: 4px;
	transition: width 0.4s ease;
	min-width: 4px;
}

.cof-apdf-lbl {
	margin: 0;
	font-size: 0.85rem;
	color: #555;
}

.cof-apdf-lbl--error {
	color: #b00;
	font-size: 0.9rem;
}

.cof-apdf-open-link,
.cof-apdf-open-link a {
	display: inline-block;
	padding: 10px 20px;
	background: #005A9C;
	color: #ffffff!important;
	border-radius: 4px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.95rem;
	text-align: center;
}

.cof-apdf-open-link:hover,
.cof-apdf-open-link a:hover {
	background: #004a82;
	color: #fff;
}

.cof-apdf-open-link:focus,
.cof-apdf-open-link:focus-visible {
	outline: 2px solid #005A9C;
	outline-offset: 3px;
}

.cof-apdf-open-link[hidden] {
	display: none;
}