/**
 * Base: reset, elements, typography, focus, accessibility utilities.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Leave room for the sticky header when jumping to an anchor. */
	scroll-padding-top: 6rem;
}

body {
	margin: 0;
	background-color: var(--bsl-bg);
	color: var(--bsl-text);
	font-family: var(--bsl-font-sans);
	font-size: var(--bsl-text-base);
	line-height: var(--bsl-leading-normal);
	font-synthesis-weight: none;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- headings */

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 var(--bsl-space-4);
	font-weight: var(--bsl-weight-semibold);
	line-height: var(--bsl-leading-tight);
	letter-spacing: var(--bsl-tracking-tight);
	text-wrap: balance;
}

h1 {
	font-family: var(--bsl-font-display);
	font-size: var(--bsl-text-3xl);
	font-weight: var(--bsl-weight-semibold);
}

h2 {
	font-family: var(--bsl-font-display);
	font-size: var(--bsl-text-2xl);
}

h3 {
	font-size: var(--bsl-text-lg);
	letter-spacing: var(--bsl-tracking-normal);
}

h4 {
	font-size: var(--bsl-text-md);
	letter-spacing: var(--bsl-tracking-normal);
}

h5,
h6 {
	font-size: var(--bsl-text-base);
	letter-spacing: var(--bsl-tracking-normal);
}

/* --------------------------------------------------------------- text flow */

p,
ul,
ol,
dl,
blockquote,
figure,
table,
pre {
	margin: 0 0 var(--bsl-space-5);
}

p:last-child,
ul:last-child,
ol:last-child {
	margin-bottom: 0;
}

.bsl-lead {
	font-size: var(--bsl-text-md);
	line-height: var(--bsl-leading-relaxed);
	color: var(--bsl-text-muted);
	max-width: var(--bsl-measure-narrow);
}

small,
.bsl-small {
	font-size: var(--bsl-text-sm);
}

strong,
b {
	font-weight: var(--bsl-weight-semibold);
}

/* Long words and URLs must not force a horizontal scrollbar.
 *
 * break-word, not anywhere: a word is only broken when it would overflow on its
 * own, so ordinary text keeps its natural line breaks.
 *
 * hyphens is left at `manual`. Automatic hyphenation looked wrong in both
 * languages — headings came out as "innov-ation" and "organ-isations", and menu
 * labels as "Qué hace-mos" — so words break without a hyphen only when they
 * genuinely have to. */
p,
dd,
td,
th,
h1,
h2,
h3,
.bsl-prose li {
	overflow-wrap: break-word;
	hyphens: manual;
}

/* A URL or reference number pasted into running text may still be longer than
 * its column; only those break at any character. */
.bsl-prose code,
.bsl-card__facts,
.bsl-facts dd {
	overflow-wrap: anywhere;
}

/* Navigation, buttons and badges never hyphenate or wrap mid-word. */
.bsl-nav__list a,
.bsl-mobile-nav a,
.bsl-button,
.bsl-badge,
.bsl-lang a,
.bsl-lang span,
.bsl-breadcrumbs a {
	hyphens: manual;
	overflow-wrap: normal;
	text-wrap: nowrap;
}

/* -------------------------------------------------------------------- links */

a {
	color: var(--bsl-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--bsl-duration-fast) var(--bsl-ease);
}

a:hover {
	color: var(--bsl-link-hover);
	text-decoration-thickness: 2px;
}

a:visited {
	color: var(--bsl-link-visited);
}

/* Links inside running text always stay underlined: colour alone is never the
 * only signal (WCAG 1.4.1). */
.bsl-prose a:not(.bsl-button) {
	text-decoration: underline;
}

/* ------------------------------------------------------------------- focus */

:focus {
	outline: none;
}

:focus-visible {
	outline: var(--bsl-focus-width) solid var(--bsl-focus);
	outline-offset: var(--bsl-focus-offset);
	border-radius: var(--bsl-radius-sm);
}

/* Some browsers do not support :focus-visible on older versions; make sure
 * keyboard users still see something. */
@supports not selector(:focus-visible) {
	:focus {
		outline: var(--bsl-focus-width) solid var(--bsl-focus);
		outline-offset: var(--bsl-focus-offset);
	}
}

/* ------------------------------------------------------------------- media */

img,
picture,
video,
canvas,
svg,
iframe {
	display: block;
	max-width: 100%;
}

img,
video {
	height: auto;
}

figure {
	margin-inline: 0;
}

figcaption {
	margin-top: var(--bsl-space-2);
	font-size: var(--bsl-text-sm);
	color: var(--bsl-text-muted);
}

/* ------------------------------------------------------------------- lists */

ul,
ol {
	padding-inline-start: 1.35em;
}

li + li {
	margin-top: var(--bsl-space-2);
}

/* A list used purely for layout keeps its semantics but loses its markers. */
[role="list"] {
	list-style: none;
	padding-inline-start: 0;
}

[role="list"] > li + li {
	margin-top: 0;
}

/* -------------------------------------------------------------- quotations */

blockquote {
	margin-inline: 0;
	padding-inline-start: var(--bsl-space-5);
	border-inline-start: var(--bsl-border-width-thick) solid var(--bsl-accent);
	font-size: var(--bsl-text-md);
}

/* ------------------------------------------------------------------ tables */

table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--bsl-text-sm);
}

caption {
	margin-bottom: var(--bsl-space-3);
	font-weight: var(--bsl-weight-semibold);
	text-align: start;
}

th,
td {
	padding: var(--bsl-space-3);
	text-align: start;
	vertical-align: top;
	border-bottom: var(--bsl-rule);
}

th {
	font-weight: var(--bsl-weight-semibold);
}

/* Wide tables scroll inside their own box rather than breaking the page. */
.bsl-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------- rules */

hr,
.wp-block-separator {
	height: var(--bsl-border-width);
	margin-block: var(--bsl-space-7);
	border: 0;
	background-color: var(--bsl-line-soft);
}

/* ------------------------------------------------------------------- forms */

input,
select,
textarea,
button {
	font: inherit;
	color: inherit;
}

label {
	display: block;
	margin-bottom: var(--bsl-space-2);
	font-weight: var(--bsl-weight-medium);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
	width: 100%;
	min-height: 2.75rem;
	padding: var(--bsl-space-3);
	background-color: var(--bsl-bg-raised);
	border: var(--bsl-border-width) solid var(--bsl-line);
	border-radius: var(--bsl-radius);
	color: var(--bsl-text);
}

textarea {
	min-height: 8rem;
	resize: vertical;
}

input::placeholder,
textarea::placeholder {
	color: var(--bsl-text-muted);
	opacity: 1;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
	border-color: var(--bsl-error);
	border-width: var(--bsl-border-width-thick);
}

/* Touch targets never smaller than 24x24 CSS px (WCAG 2.2 SC 2.5.8); 44px
 * where there is room. */
button,
[type="submit"],
[type="button"],
.bsl-button {
	min-height: 2.75rem;
	cursor: pointer;
}

fieldset {
	margin: 0 0 var(--bsl-space-5);
	padding: 0;
	border: 0;
}

legend {
	padding: 0;
	font-weight: var(--bsl-weight-semibold);
}

/* ----------------------------------------------------------------- utility */

.screen-reader-text {
	position: absolute !important;
	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;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	clip: auto;
	clip-path: none;
	white-space: normal;
}

/* Skip link: hidden until focused, then unmissable. */
.bsl-skip-link {
	position: absolute;
	top: var(--bsl-space-2);
	left: var(--bsl-space-2);
	z-index: var(--bsl-z-skip);
	padding: var(--bsl-space-3) var(--bsl-space-4);
	background-color: var(--bsl-teal);
	color: var(--bsl-paper);
	font-weight: var(--bsl-weight-semibold);
	text-decoration: none;
	border-radius: var(--bsl-radius);
	transform: translateY(-200%);
}

.bsl-skip-link:focus {
	transform: translateY(0);
}

.bsl-visually-hidden-focusable:not(:focus):not(:focus-within) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* The slash motif, used as a rule rather than as decoration everywhere. */
.bsl-slash-rule {
	display: block;
	width: 3.5rem;
	height: 0;
	margin-bottom: var(--bsl-space-4);
	border-top: 4px solid var(--bsl-accent);
	transform: skewX(-20deg);
	transform-origin: left center;
}

.bsl-eyebrow {
	margin: 0 0 var(--bsl-space-2);
	font-size: var(--bsl-text-xs);
	font-weight: var(--bsl-weight-semibold);
	letter-spacing: var(--bsl-tracking-wide);
	text-transform: uppercase;
	color: var(--bsl-text-muted);
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ------------------------------------------------------- forced colours */

@media (forced-colors: active) {
	.bsl-button,
	.bsl-card,
	.bsl-filter__chip {
		border: 1px solid ButtonText;
	}

	.bsl-slash-rule {
		border-top-color: CanvasText;
	}
}

/* -------------------------------------------------------------- printing */

@media print {
	.bsl-site-header,
	.bsl-site-footer,
	.bsl-filters,
	.bsl-pagination,
	.bsl-skip-link {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
		font-size: 11pt;
	}

	a::after {
		content: " (" attr(href) ")";
		font-size: 9pt;
		word-break: break-all;
	}
}


/* Nothing should ever scroll the page sideways. `clip` rather than `hidden`
   so that position:sticky inside still works. */
.bsl-main {
	overflow-x: clip;
}
