/**
 * Annual Reports.
 *
 * A cover-led grid: the report's own front page is the thing you scan for, the
 * year confirms it, and there is exactly one action. Scoped to the
 * `wrc-annual-reports` body class added in inc/annual-reports.php.
 *
 * Widths and gutters come from wrc-container.css, so this page sits on the same
 * alignment line as the rest of the site and needs no margins of its own.
 */

.wrc-annual-reports .wrc-ar {
	--ar-blue:      #094E9C;
	--ar-cyan:      #00AEEF;
	--ar-green:     #A9CC4F;
	--ar-ink:       #16202C;
	--ar-ink-soft:  #5A6673;
	--ar-line:      #E1E8EF;
	--ar-bg:        #F4F7FA;
	--ar-radius:    10px;
	--ar-gap:       clamp( 18px, 2vw, 34px );

	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var( --ar-ink );
}

/* -- toolbar ------------------------------------------------------------- */

.wrc-annual-reports .wrc-ar__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 22px;
	padding-bottom: 16px;
	margin-bottom: calc( var( --ar-gap ) - 4px );
	border-bottom: 1px solid var( --ar-line );
}

.wrc-annual-reports .wrc-ar__filter {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

.wrc-annual-reports .wrc-ar__filter-label {
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .10em;
	text-transform: uppercase;
	color: var( --ar-ink-soft );
}

.wrc-annual-reports .wrc-ar__select {
	appearance: none;
	min-width: 11rem;
	padding: .55rem 2.2rem .55rem .8rem;
	font: inherit;
	font-size: .92rem;
	color: var( --ar-ink );
	background-color: #fff;
	/* Chevron drawn in the border colour so there is no image request. */
	background-image: linear-gradient( 45deg, transparent 50%, var( --ar-ink-soft ) 50% ),
	                  linear-gradient( 135deg, var( --ar-ink-soft ) 50%, transparent 50% );
	background-position: calc( 100% - 20px ) 55%, calc( 100% - 14px ) 55%;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	border: 1px solid var( --ar-line );
	border-radius: 6px;
	cursor: pointer;
}

.wrc-annual-reports .wrc-ar__select:focus-visible {
	outline: 2px solid var( --ar-cyan );
	outline-offset: 2px;
}

.wrc-annual-reports .wrc-ar__count {
	margin: 0;
	font-size: .86rem;
	color: var( --ar-ink-soft );
}

/* -- grid ---------------------------------------------------------------- */

.wrc-annual-reports .wrc-ar__grid {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: var( --ar-gap );
	margin: 0;
	padding: 0;
	list-style: none;
}

@media ( min-width: 640px )  { .wrc-annual-reports .wrc-ar__grid { grid-template-columns: repeat( 3, minmax( 0, 1fr ) ); } }
@media ( min-width: 960px )  { .wrc-annual-reports .wrc-ar__grid { grid-template-columns: repeat( 4, minmax( 0, 1fr ) ); } }
@media ( min-width: 1400px ) { .wrc-annual-reports .wrc-ar__grid { grid-template-columns: repeat( 5, minmax( 0, 1fr ) ); } }

.wrc-annual-reports .wrc-ar__item { min-width: 0; }
.wrc-annual-reports .wrc-ar__item[hidden] { display: none; }

/* -- card ---------------------------------------------------------------- */

.wrc-annual-reports .wrc-ar__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid var( --ar-line );
	border-radius: var( --ar-radius );
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.wrc-annual-reports .wrc-ar__card:hover,
.wrc-annual-reports .wrc-ar__card:focus-within {
	transform: translateY( -3px );
	border-color: #C9D8E8;
	box-shadow: 0 2px 4px rgba( 9, 78, 156, .05 ), 0 14px 30px rgba( 9, 78, 156, .12 );
}

@media ( prefers-reduced-motion: reduce ) {
	.wrc-annual-reports .wrc-ar__card { transition: none; }
	.wrc-annual-reports .wrc-ar__card:hover { transform: none; }
}

/* -- cover --------------------------------------------------------------- */

/*
 * A fixed A4-ish box, so a squarer scan (1976) or a wider one cannot make its
 * row taller than the others. `object-position: top` keeps the masthead — which
 * is what identifies the report — rather than centring and cropping it away.
 */
.wrc-annual-reports .wrc-ar__cover {
	position: relative;
	display: block;
	text-decoration: none;
	aspect-ratio: 1 / 1.414;
	background: var( --ar-bg );
	border-bottom: 1px solid var( --ar-line );
	overflow: hidden;
}

.wrc-annual-reports .wrc-ar__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
}

/* Used only where a PDF has no cover page of its own to render. */
.wrc-annual-reports .wrc-ar__cover-fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .35rem;
	padding: 1rem;
	text-align: center;
	background: linear-gradient( 160deg, var( --ar-blue ), #0A3E7C );
	color: #fff;
}

.wrc-annual-reports .wrc-ar__cover-year {
	font-family: 'Playfair Display', Georgia, serif;
	font-size: clamp( 1.5rem, 2.4vw, 2.1rem );
	font-weight: 700;
	line-height: 1.05;
}

.wrc-annual-reports .wrc-ar__cover-word {
	font-size: .68rem;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var( --ar-cyan );
}

/* -- card text ----------------------------------------------------------- */

.wrc-annual-reports .wrc-ar__meta {
	display: flex;
	flex-direction: column;
	gap: .3rem;
	flex: 1 1 auto;
	padding: .95rem 1rem 1.05rem;
}

.wrc-annual-reports .wrc-ar__year {
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var( --ar-cyan );
}

.wrc-annual-reports .wrc-ar__title {
	text-decoration: none;
	font-size: .98rem;
	font-weight: 600;
	line-height: 1.3;
	color: var( --ar-blue );
	/* The year already carries the identity, so a long label may wrap once. */
	margin-bottom: .55rem;
}

/* The whole card is the link; this is the affordance, not a nested control. */
.wrc-annual-reports .wrc-ar__cta {
	display: inline-flex;
	align-items: baseline;
	gap: .5rem;
	margin-top: auto;
	align-self: flex-start;
	padding: .48rem .95rem;
	font-size: .82rem;
	font-weight: 600;
	color: var( --ar-blue );
	background: #fff;
	border: 1px solid #C3D3E6;
	border-radius: 999px;
	transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.wrc-annual-reports .wrc-ar__card:hover .wrc-ar__cta,
.wrc-annual-reports .wrc-ar__cta:focus-visible {
	color: #fff;
	background: var( --ar-blue );
	border-color: var( --ar-blue );
}

.wrc-annual-reports .wrc-ar__size {
	font-size: .72rem;
	font-weight: 500;
	opacity: .72;
}

/* -- empty state --------------------------------------------------------- */

.wrc-annual-reports .wrc-ar__empty {
	margin: 2rem 0 0;
	padding: 1.4rem;
	text-align: center;
	color: var( --ar-ink-soft );
	background: var( --ar-bg );
	border-radius: var( --ar-radius );
}

.wrc-annual-reports .wrc-ar__empty[hidden] { display: none; }

/* -- focus ---------------------------------------------------------------
 *
 * Three links share a card now — cover, title and download — so each needs a
 * ring of its own; a ring on the card would not say which one is focused.
 * ------------------------------------------------------------------------ */

.wrc-annual-reports .wrc-ar__cover:focus-visible,
.wrc-annual-reports .wrc-ar__title:focus-visible,
.wrc-annual-reports .wrc-ar__cta:focus-visible {
	outline: 2px solid var( --ar-cyan );
	outline-offset: 2px;
}

.wrc-annual-reports .wrc-ar__title:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

@media ( prefers-reduced-motion: reduce ) {
	.wrc-annual-reports .wrc-ar__card:hover,
	.wrc-annual-reports .wrc-ar__card:focus-within { transform: none; }
}

/* -- the two actions -----------------------------------------------------
 *
 * View is the primary: it opens the report in the browser's viewer, which is
 * what most people want from a 28 MB scan. Download is the deliberate choice
 * beside it, not a fallback.
 * ------------------------------------------------------------------------ */

.wrc-annual-reports .wrc-ar__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem .45rem;
	margin-top: auto;
}

.wrc-annual-reports .wrc-ar__cta--view {
	color: #fff;
	background: var( --ar-blue );
	border-color: var( --ar-blue );
}

.wrc-annual-reports .wrc-ar__card:hover .wrc-ar__cta--view,
.wrc-annual-reports .wrc-ar__cta--view:focus-visible {
	background: #0A3E7C;
	border-color: #0A3E7C;
}

/* The download pill must not also fill on card hover, or the two compete. */
.wrc-annual-reports .wrc-ar__card:hover .wrc-ar__cta--download {
	color: var( --ar-blue );
	background: #fff;
	border-color: #C3D3E6;
}

.wrc-annual-reports .wrc-ar__cta--download:hover,
.wrc-annual-reports .wrc-ar__cta--download:focus-visible {
	color: #fff;
	background: var( --ar-blue );
	border-color: var( --ar-blue );
}

.wrc-annual-reports .wrc-ar__ext {
	display: inline-flex;
	align-items: center;
	margin-left: -.15rem;
	opacity: .85;
}

/* Visible to screen readers only — the theme may not define this globally. */
.wrc-annual-reports .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}
