/*
 * CCP catalogue <-> theme conflict overrides (Bootstrap 5 / Moderat theme).
 * Linked by the catalogue templates after the theme and plugin stylesheets,
 * so these rules win. Scoped to .ccp-* so the rest of the site is untouched.
 */

/* --- Pagination --------------------------------------------------------
   The theme styles .pagination expecting the page links to be its direct
   flex children, but WordPress wraps them in .nav-links — so each 40px
   flex link stacked vertically. Lay them out in a centred row. */
.ccp-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
}
.ccp-pagination .page-numbers { margin: 0; }
.ccp-pagination .page-numbers.prev,
.ccp-pagination .page-numbers.next { width: auto; padding: 0 .5rem; }
.ccp-pagination .screen-reader-text {
	position: absolute;
	clip: rect(0, 0, 0, 0);
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* --- Headings ----------------------------------------------------------
   Inside the catalogue use the CCP palette and the body font for compact
   spec/filter labels, instead of the theme's display font and colours. */
.ccp-item h5, .ccp-grid h5,
.ccp-spec h5, .ccp-band h5,
.ccp-filters h3, .ccp-filters h4, .ccp-filters h5,
.ccp-solver-access h5 {
	font-family: inherit;
	color: #222425 !important;
	margin-bottom: .25rem;
}
.ccp-sidebar h3, .ccp-sidebar h4 {
	color: #3d6ca8 !important;
	font-family: inherit;
}
.ccp-sections h2, .ccp-section-title { color: #3d6ca8 !important; }
.ccp-card h2 {
	color: #3d6ca8 !important;
	font-family: inherit;
	font-size: 1.05rem;
	margin: 0 0 .2rem;
}
.ccp-grid .ccp-title, .ccp-item .ccp-title {
	color: #222425;
	font-size: clamp(1.7rem, 3vw, 2.5rem);
	font-weight: 500;
}

/* --- Chips -------------------------------------------------------------- */
.ccp-chips { padding-left: 0; }          /* undo Bootstrap ul padding */
.ccp-chips li:empty { display: none; }   /* hide chips that have no value */

/* --- Links --------------------------------------------------------------
   Bootstrap underlines every link; keep the catalogue chrome clean and
   underline only body-text links and hovers. */
.ccp-grid a, .ccp-item a { text-decoration: none; }
.ccp-description a, .ccp-sections a, .ccp-links a { text-decoration: underline; }
.ccp-card a:hover h2 { text-decoration: underline; }
.ccp-type-tabs a:hover { text-decoration: none; }

/* --- Lists -------------------------------------------------------------- */
.ccp-filters ul,
.ccp-links,
.ccp-contributors__list {
	padding-left: 0;
	list-style: none;
}

/* --- Buttons & search ---------------------------------------------------- */
.ccp-button,
.ccp-search input[type="search"] { border-radius: 0; }
.ccp-search input[type="search"]:focus { outline: 2px solid #3d6ca8; }

/* --- Colour contrast (WCAG AA) ------------------------------------------
   The plugin's accent (#477aba) and mid grey (#909090) fail 4.5:1 with
   white text. Darken the two CSS variables the plugin derives everything
   from — tabs, buttons, chips, counts, muted text all inherit the fix —
   and assert text colours explicitly in case the theme repaints them. */
.ccp-item, .ccp-grid {
	--ccp-blue: #3d6ca8;   /* white on this: 5.4:1 */
	--ccp-mid:  #6e6e6e;   /* white on this: 5.0:1; as text on white: 5.0:1 */
}

/* Type tabs */
.ccp-type-tabs a {
	background: #e8e8e8;
	color: #222425 !important;
}
.ccp-type-tabs a span { color: #444 !important; }
.ccp-type-tabs a.is-current {
	background: var(--ccp-blue, #3d6ca8) !important;
	color: #fff !important;
}
.ccp-type-tabs a.is-current span { color: #ecf1f8 !important; }

/* Chips */
.ccp-chips li { color: #222425; }
.ccp-chips--mid li {
	background: var(--ccp-mid, #6e6e6e) !important;
	border-color: var(--ccp-mid, #6e6e6e) !important;
	color: #fff !important;
}
.ccp-chips--mid li a { color: #fff !important; }

/* Buttons and pagination current page */
.ccp-button {
	background: var(--ccp-blue, #3d6ca8) !important;
	color: #fff !important;
}
.ccp-button:hover { background: var(--ccp-mid, #6e6e6e) !important; }
.ccp-pagination .page-numbers.current { color: #fff !important; }

/* --- FacetWP in the catalogue ------------------------------------------- */
.ccp-search--facet { background: #eeeeee; padding: .6rem; margin: 1.25rem 0 1.5rem; }
.ccp-search--facet .facetwp-facet { margin: 0; }
.ccp-search--facet .facetwp-search,
.ccp-search--facet .facetwp-input-wrap,
.ccp-search--facet input[type="text"] {
	width: 100%;
	box-sizing: border-box;
}
.ccp-search--facet .facetwp-search,
.ccp-search--facet input[type="text"] {
	border: 1px solid #dddddd;
	background: #fff;
	padding: .6rem .8rem;
	font-size: 1rem;
}
.ccp-filters .facetwp-facet { margin: 0 0 .6rem; }
.ccp-filters .facetwp-checkbox { font-size: .9rem; padding: .12rem 0 .12rem 22px; }
.ccp-filters .facetwp-counter { color: #6e6e6e; }
.ccp-filters .facetwp-toggle,
.ccp-filters .facetwp-link { color: #3d6ca8; font-size: .85rem; }
.ccp-filters .facetwp-depth { margin-left: 14px; }
.ccp-pagination .facetwp-pager { margin-top: .5rem; }

/* --- Active filters bar + Clear all (WCAG 2.2) --------------------------- */
.ccp-active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .75rem;
	margin: 0 0 1.25rem;
}
.ccp-active-filters__label { font-weight: 600; }
.ccp-active-filters .facetwp-selections ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}
/* Each removable filter chip: >=24px target (SC 2.5.8) */
.ccp-active-filters .facetwp-selection-value {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	min-height: 32px;
	padding: .25rem .65rem;
	background: #e8e8e8;
	color: #222425;
	cursor: pointer;
}
.ccp-active-filters .facetwp-selection-value:hover { background: #d9d9d9; }
/* Clear-all: real button, 40px target, 5.4:1 contrast */
.ccp-reset {
	min-height: 40px;
	padding: .45rem 1.1rem;
	background: #3d6ca8;
	color: #fff;
	border: 0;
	cursor: pointer;
	font-size: .95rem;
	font-weight: 600;
}
.ccp-reset:hover { background: #2d5182; }

/* Screen-reader-only live region */
.ccp-grid .screen-reader-text {
	position: absolute;
	clip-path: inset(50%);
	width: 1px;
	height: 1px;
	overflow: hidden;
	white-space: nowrap;
}

/* Visible focus indicator on everything interactive in the catalogue
   (SC 2.4.7 Focus Visible / 2.4.11 Focus Not Obscured) */
.ccp-grid a:focus-visible,
.ccp-item a:focus-visible,
.ccp-grid button:focus-visible,
.ccp-grid input:focus-visible,
.ccp-grid [tabindex]:focus-visible,
.ccp-grid .facetwp-checkbox:focus-visible,
.ccp-grid .facetwp-selection-value:focus-visible {
	outline: 3px solid #1a3c66;
	outline-offset: 2px;
}

/* --- Breadcrumbs (WAI pattern) ------------------------------------------- */
.ccp-crumbs--full { font-size: .9rem; margin: 0 0 1.25rem; }
.ccp-crumbs--full ol {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .3rem;
}
.ccp-crumbs--full li {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
}
.ccp-crumbs--full li + li::before {
	content: "\203A";      /* › separator, decorative */
	color: #6e6e6e;
}
.ccp-crumbs--full a {
	color: #3d6ca8;        /* 5.4:1 on white */
	text-decoration: none;
}
.ccp-crumbs--full a:hover { text-decoration: underline; }
.ccp-crumbs--full a:focus-visible {
	outline: 3px solid #1a3c66;
	outline-offset: 2px;
}
.ccp-crumbs--full [aria-current="page"] {
	color: #222425;
	font-weight: 600;
}
/* Only one breadcrumb on catalogue pages: hide the theme's own trail.
   (The plugin's trail is removed from the HTML in single-catalogue.php.) */
.single-catalogue .breadcrumbs,
.post-type-archive-catalogue .breadcrumbs,
.tax-ccp_type .breadcrumbs,
.tax-ccp_application_area .breadcrumbs,
.tax-ccp_modelling_approach .breadcrumbs,
.tax-ccp_physics .breadcrumbs,
.tax-ccp_tag .breadcrumbs { display: none; }
