/**
 * Bombora Topic Taxonomy — public styles.
 *
 * Values here mirror the Imaginarium theme's design system so the table looks
 * native on this site:
 *   colours     assets/src/styles/config/variables.scss
 *   type scale  assets/src/styles/globals/typography.scss   (fluid clamp())
 *   buttons     assets/src/styles/globals/buttons.scss      (.btn-main)
 *   controls    assets/src/styles/config/directory-filters.scss (42px / 7px)
 *
 * Every colour is a custom property, so the theme partial
 * (globals/topic-taxonomy.scss) re-declares them straight from the SCSS
 * variables. That keeps this file working standalone while making the theme the
 * single source of truth wherever it is active.
 *
 * Font family is deliberately never declared — it inherits from the theme
 * (Open Sans here). Form controls get `font: inherit` because they don't.
 */

.bombora-topics {
	/* Brand palette — variables.scss */
	--bombora-orange: #ec7e1e;
	--bombora-dark-orange: #cc5f00;
	--bombora-ada-orange: #ff871f;
	--bombora-ada-orange-on-white: #e67614;
	--bombora-cyan: #007daa;
	--bombora-dark-blue: #044b65;
	--bombora-midnight-blue: #022633;
	--bombora-grey: #566c73;
	--bombora-cool-grey: #d9d9d9;
	--bombora-white: #fff;

	/* Shared directory control chrome — directory-filters.scss */
	--bombora-control-height: 42px;
	--bombora-control-radius: 7px;

	--bombora-table-height: 650px;

	position: relative;
	color: var(--bombora-midnight-blue);
}

.bombora-topics *,
.bombora-topics *::before,
.bombora-topics *::after {
	box-sizing: border-box;
}

.bombora-topics__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------- Heading and intro */

/* H2 — typography.scss */
.bombora-topics__heading {
	margin: 0 0 0.5em;
	color: var(--bombora-ada-orange-on-white);
	font-size: clamp(28px, calc(1.88vw + 20.96px), 48px);
	line-height: clamp(35px, calc(2.35vw + 26.2px), 60px);
	font-weight: 700;
	letter-spacing: 0.5px;
}

/* Body Large — typography.scss */
.bombora-topics__intro {
	margin: 0 0 1.5em;
	max-width: 62ch;
	font-size: clamp(16px, calc(0.56vw + 13.89px), 22px);
	line-height: clamp(24px, calc(0.94vw + 20.48px), 34px);
	font-weight: 400;
	letter-spacing: 0.5px;
}

/* ------------------------------------------------------------------ Search */

/* Matches the directory search control used by All Partners / Core Concepts. */
.bombora-topics__search {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	height: var(--bombora-control-height);
	padding: 0 0.875rem 0 0.5rem;
	border: 1px solid var(--bombora-grey);
	border-radius: var(--bombora-control-radius);
	background: var(--bombora-white);
}

.bombora-topics__search:focus-within {
	border-color: var(--bombora-cyan);
}

.bombora-topics__search-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--bombora-midnight-blue);
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	appearance: none;
}

.bombora-topics__search-input::placeholder {
	color: var(--bombora-grey);
	opacity: 1;
}

.bombora-topics__search-input:focus {
	outline: none;
}

.bombora-topics__search-input::-webkit-search-decoration,
.bombora-topics__search-input::-webkit-search-cancel-button {
	appearance: none;
}

.bombora-topics__search-button {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0.25rem;
	border: 0;
	background: transparent;
	color: var(--bombora-grey);
	font: inherit;
	cursor: pointer;
}

.bombora-topics__search-button:hover,
.bombora-topics__search-button:focus-visible {
	color: var(--bombora-cyan);
}

/* Reserves its own line under the search box so revealing the link doesn't
   shove the rest of the page down. */
.bombora-topics__search-actions {
	display: flex;
	justify-content: flex-end;
	min-height: 1.5rem;
	margin-top: 0.5rem;
}

/* A button for semantics, painted as the theme's text link. */
.bombora-topics__clear {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--bombora-cyan);
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.5px;
	text-decoration: underline;
	cursor: pointer;
}

.bombora-topics__clear:hover,
.bombora-topics__clear:focus-visible {
	color: var(--bombora-dark-blue);
}

.bombora-topics__clear[hidden] {
	display: none;
}

/* ------------------------------------------------------------- Count/meta */

/* Body Small — typography.scss */
.bombora-topics__count,
.bombora-topics__hint {
	margin: 1em 0 0.25em;
	color: var(--bombora-grey);
	font-size: clamp(16px, calc(0.19vw + 15.3px), 18px);
	line-height: normal;
	letter-spacing: 0.02em;
}

.bombora-topics__hint {
	margin: 0 0 1em;
}

.bombora-topics__toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 0.75rem;
}

/* .btn-main — buttons.scss */
.bombora-topics__download {
	display: inline-block;
	padding: 12px 34px;
	border: 1px solid var(--bombora-ada-orange);
	border-radius: 6px;
	background-color: var(--bombora-ada-orange);
	color: var(--bombora-midnight-blue);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.5px;
	text-decoration: none !important;
}

.bombora-topics__download:hover,
.bombora-topics__download:focus-visible {
	background-color: var(--bombora-white);
	border-color: var(--bombora-orange);
	color: var(--bombora-midnight-blue);
	text-decoration: none;
}

.bombora-topics__download:active {
	opacity: 0.9;
}

/* ------------------------------------------------------------------ Table */

.bombora-topics__panel {
	position: relative;
}

/*
 * Fixed height with its own scrollbars in both axes, per the reference UI —
 * the page itself never grows as rows stream in.
 */
.bombora-topics__tablewrap {
	position: relative;
	height: var(--bombora-table-height);
	overflow: auto;
	border: 1px solid var(--bombora-cool-grey);
	border-radius: var(--bombora-control-radius);
	background: var(--bombora-white);
	overscroll-behavior: contain;
}

.bombora-topics__table {
	width: 100%;
	min-width: 900px;
	margin: 0;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.5;
	letter-spacing: 0.02em;
}

.bombora-topics__th {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 0;
	background: var(--bombora-midnight-blue);
	color: var(--bombora-white);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.32px;
	text-align: left;
	white-space: nowrap;
}

.bombora-topics__sort {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	width: 100%;
	padding: 0.85em 1em;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.bombora-topics__sort:hover,
.bombora-topics__sort:focus-visible {
	background: var(--bombora-dark-blue);
}

.bombora-topics__caret {
	flex: 0 0 auto;
	opacity: 0.55;
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.bombora-topics__th.is-sorted .bombora-topics__caret {
	opacity: 1;
}

.bombora-topics__th.is-sorted.is-desc .bombora-topics__caret {
	transform: rotate(180deg);
}

.bombora-topics__td {
	padding: 0.75em 1em;
	border-bottom: 1px solid var(--bombora-cool-grey);
	vertical-align: top;
}

.bombora-topics__td--topic_id {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.bombora-topics__td--theme,
.bombora-topics__td--category {
	white-space: nowrap;
}

.bombora-topics__td--topic_name {
	min-width: 14rem;
	font-weight: 600;
}

.bombora-topics__td--description {
	min-width: 26rem;
	color: var(--bombora-grey);
}

.bombora-topics__table tbody tr:hover {
	background: rgba(0, 125, 170, 0.04);
}

.bombora-topics__sentinel {
	height: 1px;
}

/* Empty / loading message — mirrors the directory __empty panel copy style. */
.bombora-topics__status {
	margin: 0.75em 0 0;
	color: var(--bombora-midnight-blue);
	font-size: 18px;
	letter-spacing: 0.36px;
}

.bombora-topics__status:empty {
	display: none;
}

.bombora-topics.is-loading .bombora-topics__status::after {
	content: "";
	display: inline-block;
	width: 0.7em;
	height: 0.7em;
	margin-left: 0.5em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: bombora-spin 0.7s linear infinite;
	vertical-align: -0.05em;
}

@keyframes bombora-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------- First-load loader */

/*
 * A first page — page load, gate submission, search or sort — empties the
 * table, and a blank panel that tall reads as broken rather than busy. This
 * fills it for as long as there are no rows. Later pages keep the quieter
 * status line instead, since rows are already on screen by then.
 *
 * Positioned over the scroller rather than inside it (see class-shortcode.php),
 * so it matches the scroller's box: same height, same corner radius. z-index
 * sits below the sticky header's 2, so the column labels stay visible over the
 * top of it exactly as they do over rows.
 */
.bombora-topics__loader {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 1;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: var(--bombora-table-height);
	padding: 1.5rem;
	border-radius: var(--bombora-control-radius);
	background: var(--bombora-cool-grey);
}

.bombora-topics.is-loading-first .bombora-topics__loader {
	display: flex;
}

.bombora-topics__loader-label {
	margin: 0 0 0.9rem;
	color: var(--bombora-midnight-blue);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 2.5px;
	text-align: center;
	text-transform: uppercase;
}

.bombora-topics__loader-track {
	position: relative;
	width: min(220px, 100%);
	height: 14px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--bombora-white);
}

/* Indeterminate: the REST call reports no progress to track, so the bar is
   40% wide and bounces across the remaining 60% rather than filling. */
.bombora-topics__loader-bar {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 40%;
	border-radius: 999px;
	background: var(--bombora-cyan);
	animation: bombora-loader-sweep 1.1s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

@keyframes bombora-loader-sweep {
	to {
		transform: translateX(150%);
	}
}

/* The loader carries the visual message while it is up, so the live region
   only needs to exist for screen readers — and shouldn't reserve a line that
   vanishes again the moment rows land. */
.bombora-topics.is-loading-first .bombora-topics__status {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.bombora-topics.is-loading .bombora-topics__status::after {
		animation-duration: 3s;
	}

	.bombora-topics__loader-bar {
		animation-duration: 3s;
	}

	.bombora-topics__caret {
		transition: none;
	}
}

/* ------------------------------------------------------------------- Gate */

.bombora-topics.is-gated .bombora-topics__tablewrap,
.bombora-topics.is-gated .bombora-topics__toolbar,
.bombora-topics.is-gated .bombora-topics__search-actions,
.bombora-topics.is-gated .bombora-topics__search {
	filter: blur(4px);
	opacity: 0.55;
	pointer-events: none;
	user-select: none;
}

/*
 * A gated page whose visitor may already be through: the grant is in local
 * storage but the cookie did not reach the server. The inline probe in the
 * shortcode adds is-restoring before the form is parsed, so the page paints as a
 * normal loading table instead of flashing the form up and tearing it down again
 * a moment later. Either the stored token is accepted and the form is removed
 * without ever being seen, or it is refused and the class comes off, revealing
 * the form exactly as if this had never run.
 */
.bombora-topics.is-restoring .bombora-gate {
	display: none;
}

.bombora-topics.is-restoring.is-gated .bombora-topics__tablewrap,
.bombora-topics.is-restoring.is-gated .bombora-topics__toolbar,
.bombora-topics.is-restoring.is-gated .bombora-topics__search-actions,
.bombora-topics.is-restoring.is-gated .bombora-topics__search {
	filter: none;
	opacity: 1;
	pointer-events: auto;
	user-select: auto;
}

/* Painted straight away, rather than waiting for the JS to add is-loading-first. */
.bombora-topics.is-restoring .bombora-topics__loader {
	display: flex;
}

.bombora-gate {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	z-index: 10;
	margin-bottom: 3rem
}

/* Radius and shadow match the theme's directory filter modal panel. */
.bombora-gate__card {
	width: min(34rem, 100%);
	max-height: 100%;
	overflow: auto;
	padding: 2rem;
	background: var(--bombora-white);
	border-radius: 10px;
	box-shadow: 0 6px 56px 0 rgba(2, 38, 51, 0.3);
}

.bombora-gate__heading {
	margin: 0 0 0.5em;
	color: var(--bombora-midnight-blue);
	font-size: 22px;
	font-weight: 700;
	line-height: 34px;
	letter-spacing: 0.5px;
}

.bombora-gate__intro {
	margin: 0 0 1.25em;
	color: var(--bombora-grey);
	font-size: clamp(16px, calc(0.19vw + 15.3px), 18px);
	line-height: normal;
	letter-spacing: 0.02em;
}

.bombora-gate__notice {
	margin: 0;
	padding: 0.75em 1em;
	border-left: 3px solid var(--bombora-ada-orange);
	background: #fdf4ec;
	font-size: 16px;
	letter-spacing: 0.02em;
}

/* ----------------------------------------------------------------- Footer */

.bombora-topics__cta {
	position: relative;
	z-index: 12;
	margin: 2rem 0 0;
	padding: 1.5rem 0;
	color: var(--bombora-midnight-blue);
	font-size: clamp(16px, calc(0.19vw + 15.3px), 18px);
	font-weight: 600;
	letter-spacing: 0.02em;
	text-align: center;
}

/* Links use the theme's cyan-on-white with the dark-orange hover. */
.bombora-topics__cta a {
	color: var(--bombora-cyan);
	font-weight: 600;
	text-decoration: underline;
}

.bombora-topics__cta a:hover,
.bombora-topics__cta a:focus-visible {
	color: var(--bombora-dark-orange);
}

/* ----------------------------------------------------------------- Mobile */

@media (max-width: 991px) {
	.bombora-topics {
		--bombora-table-height: 70vh;
	}

	.bombora-gate__card {
		padding: 1.5rem;
	}
}

/* -------------------------------------------------------- HubSpot gate form */

/*
 * The embed is created with `css: ''`, so HubSpot ships no stylesheet of its
 * own and these rules are the whole appearance. Selectors are HubSpot's stable
 * inline-form class names.
 *
 * A form HubSpot chooses to render in an iframe ignores all of this — nothing
 * outside the frame can reach in. Those have to be styled in HubSpot's own form
 * editor; the width rule below is the only part that still applies.
 */

.bombora-gate__hubspot {
	min-height: 3rem;
}

.bombora-gate__hubspot iframe {
	width: 100% !important;
	max-width: 100%;
	border: 0;
}

.bombora-gate__hubspot-status {
	margin: 0.75em 0 0;
	color: var(--bombora-grey);
	font-size: 15px;
	letter-spacing: 0.02em;
}

.bombora-gate__hubspot.is-failed .bombora-gate__hubspot-status {
	padding: 0.75em 1em;
	border-left: 3px solid var(--bombora-ada-orange);
	background: #fdf4ec;
	color: var(--bombora-midnight-blue);
}

.bombora-gate__hubspot .hs-form-field {
	margin: 0 0 1rem;
}

.bombora-gate__hubspot .hs-form-field > label {
	display: block;
	margin: 0 0 0.35em;
	color: var(--bombora-midnight-blue);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

/* HubSpot marks required fields with a span it also uses for legal copy. */
.bombora-gate__hubspot .hs-form-required {
	color: var(--bombora-dark-orange);
}

.bombora-gate__hubspot .hs-field-desc {
	margin: 0 0 0.5em;
	color: var(--bombora-grey);
	font-size: 14px;
}

.bombora-gate__hubspot input.hs-input:not([type='checkbox']):not([type='radio']),
.bombora-gate__hubspot select.hs-input,
.bombora-gate__hubspot textarea.hs-input {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	height: var(--bombora-control-height);
	padding: 0 0.85rem;
	border: 1px solid var(--bombora-cool-grey);
	border-radius: var(--bombora-control-radius);
	background: var(--bombora-white);
	color: var(--bombora-midnight-blue);
	font: inherit;
	font-size: 15px;
	line-height: 1.4;
	appearance: none;
}

.bombora-gate__hubspot textarea.hs-input {
	height: auto;
	min-height: 6rem;
	padding: 0.6rem 0.85rem;
	resize: vertical;
}

.bombora-gate__hubspot .hs-input::placeholder {
	color: var(--bombora-grey);
	opacity: 1;
}

.bombora-gate__hubspot .hs-input:focus {
	border-color: var(--bombora-cyan);
	outline: 2px solid transparent;
	box-shadow: 0 0 0 3px rgba(0, 125, 170, 0.18);
}

.bombora-gate__hubspot .inputs-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bombora-gate__hubspot .inputs-list li {
	margin: 0 0 0.4em;
}

.bombora-gate__hubspot .inputs-list label {
	display: flex;
	gap: 0.5em;
	align-items: flex-start;
	color: var(--bombora-grey);
	font-size: 14px;
	line-height: 1.5;
}

.bombora-gate__hubspot .legal-consent-container {
	margin: 0 0 1rem;
	color: var(--bombora-grey);
	font-size: 13px;
	line-height: 1.5;
}

.bombora-gate__hubspot .legal-consent-container a {
	color: var(--bombora-cyan);
	text-decoration: underline;
}

/* Matches the theme's .btn-main. */
.bombora-gate__hubspot .hs-button,
.bombora-gate__hubspot input[type='submit'] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--bombora-control-height);
	padding: 0 1.75rem;
	border: 0;
	border-radius: var(--bombora-control-radius);
	background: var(--bombora-ada-orange-on-white);
	color: var(--bombora-white);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-decoration: none;
	cursor: pointer;
	appearance: none;
}

.bombora-gate__hubspot .hs-button:hover,
.bombora-gate__hubspot .hs-button:focus-visible,
.bombora-gate__hubspot input[type='submit']:hover,
.bombora-gate__hubspot input[type='submit']:focus-visible {
	background: var(--bombora-dark-orange);
	color: var(--bombora-white);
}

/* Validation and the inline confirmation. */
.bombora-gate__hubspot .hs-error-msg,
.bombora-gate__hubspot .hs-error-msgs label {
	display: block;
	margin: 0.35em 0 0;
	color: var(--bombora-dark-orange);
	font-size: 14px;
}

.bombora-gate__hubspot .hs-error-msgs {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bombora-gate__hubspot .hs-input.error,
.bombora-gate__hubspot .hs-input.invalid {
	border-color: var(--bombora-dark-orange);
}

.bombora-gate__hubspot .submitted-message {
	color: var(--bombora-midnight-blue);
	font-size: 16px;
	line-height: 1.5;
}
