/*
 * Reward Co Lab — component styles.
 *
 * The editor's colour picker shows the eight brand colours by their real
 * names, straight from the 2024 brand guidelines. This file maps those brand
 * names onto the job each colour does, once, below. Components then reference
 * the role rather than the colour — so if a colour is ever reassigned, it
 * changes in one block instead of in ninety places.
 */

:root {
	/* Brand colour → role. Contrast ratios verified against WCAG 2.1 AA. */
	--rc-primary: var(--wp--preset--color--berkeley-blue);      /* #14375F */
	--rc-primary-dark: var(--wp--preset--color--oxford-blue);   /* #101D30 */
	--rc-secondary: var(--wp--preset--color--lapis-lazuli);     /* #47658F */
	--rc-accent: var(--wp--preset--color--lion);                /* #BB9C6A */
	--rc-ink: var(--wp--preset--color--oxford-blue);            /* #101D30 — 16.9:1 on white */
	--rc-ink-muted: var(--wp--preset--color--lapis-lazuli);     /* #47658F — 5.96:1 on white */
	--rc-surface: var(--wp--preset--color--alice-blue);         /* #DCE7F5 */
	--rc-line: var(--wp--preset--color--cool-grey);             /* #939AAE — decorative only, see note */
	--rc-base: var(--wp--preset--color--white);                 /* #FFFFFF */
	--rc-highlight: var(--wp--preset--color--jordy-blue);       /* #B3D2FF — 7.8:1 on Berkeley Blue */

	/*
	 * Two accessibility constraints, derived from the brand palette itself:
	 *
	 * 1. Lion (#BB9C6A) with white text is 2.60:1 — it fails AA badly. The Log
	 *    in button therefore uses Oxford Blue text on Lion (6.51:1). Do not
	 *    "fix" the button by making the text white.
	 *
	 * 2. Cool Grey (#939AAE) is 2.81:1 on white, which fails even the 3:1
	 *    non-text threshold. It is used for decorative dividers only. Form
	 *    field borders and any meaningful boundary use Lapis Lazuli instead.
	 */
	--rc-line-strong: var(--wp--preset--color--lapis-lazuli);

	--rc-ribbon-height: 48px;
	--rc-header-height: 84px;
	--rc-shadow-panel: 0 12px 28px rgba(16, 29, 48, 0.18);
	--rc-transition: 140ms ease;

	/* Logo clear space — guidelines define it as the width of the small split
	   circle, which is roughly a fifth of the mark's width. */
	--rc-logo-clear-space: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--rc-transition: 0ms;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

.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;
}

/* ---------------------------------------------------------------- Sticky shell */

.rc-sticky {
	position: sticky;
	top: 0;
	z-index: 900;
}

/* ---------------------------------------------------------------- Ribbon */

.rc-ribbon {
	background: var(--rc-primary);
	color: #fff;
	font-size: var(--wp--preset--font-size--small);
}

.rc-ribbon__inner {
	max-width: var(--wp--style--global--wide-size, 1180px);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--30);
}

.rc-ribbon__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rc-ribbon__item {
	position: relative;
}

.rc-ribbon__link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: var(--rc-ribbon-height);
	padding: 0 1rem;
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	background: none;
	border: 0;
	cursor: pointer;
	transition: background var(--rc-transition);
}

.rc-ribbon__link:hover,
.rc-ribbon__link:focus-visible,
.rc-ribbon__item--has-panel .rc-ribbon__link[aria-expanded="true"] {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	text-decoration: none;
}

.rc-ribbon__chevron {
	transition: transform var(--rc-transition);
}

.rc-ribbon__link[aria-expanded="true"] .rc-ribbon__chevron {
	transform: rotate(180deg);
}

.rc-ribbon__toggle {
	display: none;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	min-height: var(--rc-ribbon-height);
	padding: 0;
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-align: left;
	background: none;
	border: 0;
	cursor: pointer;
}

.rc-ribbon__toggle-bars {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 18px;
}

.rc-ribbon__toggle-bars span {
	display: block;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
}

/* Dropdown / mega-menu panel */

.rc-ribbon__panel {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 950;
	min-width: 320px;
	color: var(--rc-ink);
	background: var(--rc-base);
	border-top: 3px solid var(--rc-accent);
	box-shadow: var(--rc-shadow-panel);
}

.rc-ribbon__panel[hidden] {
	display: none;
}

.rc-ribbon__panel-inner {
	padding: 1.25rem 1.5rem 1.5rem;
}

.rc-ribbon__panel-lead {
	margin: 0 0 0.9rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid var(--rc-line);
}

.rc-ribbon__panel-lead a {
	display: block;
	color: var(--rc-primary);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--medium);
	text-decoration: none;
}

.rc-ribbon__panel-lead a:hover {
	text-decoration: underline;
}

.rc-ribbon__panel-lead span {
	display: block;
	margin-top: 0.15rem;
	color: var(--rc-ink-muted);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
}

.rc-ribbon__panel-list {
	display: grid;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Two columns once there are enough children to warrant a mega-menu */
.rc-ribbon__panel-list:has(> li:nth-child(5)) {
	grid-template-columns: repeat(2, minmax(220px, 1fr));
	gap: 0.25rem 1.5rem;
}

.rc-ribbon__panel-list a {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: 0 0.75rem;
	padding: 0.6rem 0.75rem;
	color: var(--rc-ink);
	text-decoration: none;
	border-radius: 4px;
	transition: background var(--rc-transition);
}

.rc-ribbon__panel-list a:hover,
.rc-ribbon__panel-list a:focus-visible {
	background: var(--rc-surface);
	color: var(--rc-ink);
}

.rc-ribbon__icon {
	grid-row: span 2;
	width: 28px;
	height: 28px;
	object-fit: contain;
}

.rc-ribbon__panel-title {
	grid-column: 2;
	font-weight: 600;
	color: var(--rc-primary);
}

.rc-ribbon__panel-tagline {
	grid-column: 2;
	margin-top: 0.1rem;
	color: var(--rc-ink-muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.45;
}

/* ---------------------------------------------------------------- Header */

.rc-header {
	background: var(--rc-base);
	border-bottom: 1px solid var(--rc-line);
}

.rc-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--40);
	min-height: var(--rc-header-height);
	max-width: var(--wp--style--global--wide-size, 1180px);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--30);
}

/*
 * Logo clear space and minimum sizing, per pages 5 and 6 of the guidelines.
 * The primary logo has a 150px minimum width, so it is never allowed to
 * shrink below that — not even at 320px viewport. Padding reserves the clear
 * space so navigation can never encroach on it.
 */
.rc-header .wp-block-site-logo {
	padding: var(--rc-logo-clear-space);
	margin-inline-start: calc(var(--rc-logo-clear-space) * -1);
}

.rc-header .wp-block-site-logo img {
	min-width: 150px;
	width: 180px;
	height: auto;
}

.rc-header nav ul {
	gap: 1.75rem;
}

/*
 * Guidelines: "The Medium weight may also be used to highlight key words
 * within headlines." Wrap the words in <span class="rc-highlight"> to get it.
 */
.rc-highlight {
	font-weight: 500;
	color: var(--rc-secondary);
}

.rc-cta-band .rc-highlight,
.rc-hero--dark .rc-highlight {
	color: var(--rc-highlight);
}

.rc-header nav a {
	color: var(--rc-primary);
	font-weight: 500;
	text-decoration: none;
}

.rc-header nav a:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* ---------------------------------------------------------------- Log in button */

/*
 * Lion is the brand's warm primary and the obvious choice for the most
 * prominent action on the page. It only works with dark text: Oxford Blue on
 * Lion is 6.51:1, white on Lion is 2.60:1 and fails.
 */
.rc-login {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.7rem 1.6rem;
	color: var(--wp--preset--color--oxford-blue);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-decoration: none;
	white-space: nowrap;
	background: var(--rc-accent);
	border: 2px solid var(--rc-accent);
	border-radius: 4px;
	transition: filter var(--rc-transition);
}

.rc-login:hover,
.rc-login:focus-visible {
	filter: brightness(0.93);
	color: var(--wp--preset--color--oxford-blue);
	text-decoration: none;
}

/* Sits on Berkeley Blue — outline only, so Lion stays unique to the header. */
.rc-login--quiet {
	color: var(--rc-base);
	background: transparent;
	border-color: var(--rc-accent);
}

.rc-login--quiet:hover {
	color: var(--wp--preset--color--oxford-blue);
	background: var(--rc-accent);
}

.rc-login--warning {
	background: #b32d2e;
	border-color: #b32d2e;
	color: #fff;
}

/* ---------------------------------------------------------------- Sections */

.rc-section {
	padding-block: var(--wp--preset--spacing--60);
}

.rc-hero {
	padding-block: var(--wp--preset--spacing--70);
	background: var(--rc-surface);
}

.rc-hero__lead {
	max-width: 34ch;
}

.rc-eyebrow {
	margin-bottom: 0.75rem;
	color: var(--rc-secondary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Product cards */

.rc-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

.rc-card {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: var(--wp--preset--spacing--40);
	background: var(--rc-base);
	border: 1px solid var(--rc-line);
	border-radius: 6px;
	transition: border-color var(--rc-transition), transform var(--rc-transition);
}

.rc-card:hover {
	border-color: var(--rc-secondary);
	transform: translateY(-2px);
}

.rc-card__icon {
	width: 40px;
	height: 40px;
	object-fit: contain;
}

.rc-card h3 {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
}

.rc-card p {
	flex: 1;
	margin: 0;
	color: var(--rc-ink-muted);
}

.rc-card a.rc-card__link {
	font-weight: 600;
	text-decoration: none;
}

.rc-card a.rc-card__link::after {
	content: " →";
}

.rc-card a.rc-card__link:hover {
	text-decoration: underline;
}

/* Steps */

.rc-steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: rc-step;
}

/*
 * The step marker echoes the monogram: a large Berkeley Blue circle with a
 * smaller Lion circle overlapping at the lower right. It is a decorative
 * motif drawn from the brand's own geometry, not a use of the logo — the
 * logo itself is never reproduced, recoloured or partially rendered here,
 * per the logo rules on page 6.
 */
.rc-step {
	position: relative;
	counter-increment: rc-step;
}

.rc-step__marker {
	position: relative;
	display: block;
	width: 52px;
	height: 52px;
	margin-bottom: 1rem;
}

.rc-step__marker::before {
	content: counter(rc-step);
	position: absolute;
	inset: 0 12px 12px 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--rc-base);
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem;
	font-weight: 700;
	background: var(--rc-primary);
	border-radius: 50%;
}

.rc-step__marker::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: 22px;
	height: 22px;
	background: var(--rc-accent);
	border-radius: 50%;
}

/* Fallback if the marker span is missing from hand-edited content. */
.rc-step:not(:has(.rc-step__marker))::before {
	content: counter(rc-step);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-bottom: 0.9rem;
	color: var(--rc-base);
	font-weight: 700;
	background: var(--rc-primary);
	border-radius: 50%;
}

.rc-step h3 {
	margin: 0 0 0.35rem;
	font-size: var(--wp--preset--font-size--large);
}

.rc-step p {
	margin: 0;
	color: var(--rc-ink-muted);
}

/* Trust strip */

.rc-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--50);
	margin: 0;
	padding: 0;
	list-style: none;
}

.rc-logos img {
	max-height: 40px;
	width: auto;
	filter: grayscale(1);
	opacity: 0.7;
}

/* CTA band */

.rc-cta-band {
	padding-block: var(--wp--preset--spacing--60);
	background: var(--rc-primary);
	color: #fff;
	text-align: center;
}

.rc-cta-band h2,
.rc-cta-band p {
	color: #fff;
}

/* Footer */

.rc-footer {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40);
	background: var(--rc-surface);
	font-size: var(--wp--preset--font-size--small);
}

.rc-footer__columns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: var(--wp--preset--spacing--40);
}

.rc-footer ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rc-footer li + li {
	margin-top: 0.5rem;
}

.rc-footer a {
	color: var(--rc-primary);
	text-decoration: none;
}

.rc-footer a:hover {
	text-decoration: underline;
}

.rc-footer__legal {
	margin-top: var(--wp--preset--spacing--40);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--rc-line);
	color: var(--rc-ink-muted);
}

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

@media (max-width: 767px) {
	.rc-ribbon__toggle {
		display: flex;
	}

	.rc-ribbon__list {
		display: none;
		flex-direction: column;
		padding-bottom: 0.5rem;
	}

	.rc-ribbon__list.is-open {
		display: flex;
	}

	.rc-ribbon__item {
		border-top: 1px solid rgba(255, 255, 255, 0.18);
	}

	.rc-ribbon__link {
		width: 100%;
		justify-content: space-between;
		padding-inline: 0;
	}

	/* Accordion, not overlay, on small screens */
	.rc-ribbon__panel {
		position: static;
		min-width: 0;
		border-top: 0;
		box-shadow: none;
		background: rgba(255, 255, 255, 0.06);
	}

	.rc-ribbon__panel-inner {
		padding: 0.75rem 0 1rem;
	}

	.rc-ribbon__panel-lead {
		border-bottom-color: rgba(255, 255, 255, 0.18);
	}

	.rc-ribbon__panel-lead a,
	.rc-ribbon__panel-title {
		color: #fff;
	}

	.rc-ribbon__panel-lead span,
	.rc-ribbon__panel-tagline {
		color: rgba(255, 255, 255, 0.82);
	}

	.rc-ribbon__panel-list a:hover,
	.rc-ribbon__panel-list a:focus-visible {
		background: rgba(255, 255, 255, 0.12);
		color: #fff;
	}

	.rc-ribbon__panel-list:has(> li:nth-child(5)) {
		grid-template-columns: 1fr;
	}

	.rc-header__inner {
		flex-wrap: wrap;
		gap: var(--wp--preset--spacing--20);
		padding-block: 0.75rem;
	}
}
