/*
 * GDV Supplier Registry: the brand page.
 *
 * Buttons, cards, the grid, the call-to-action panel and the form fields are
 * gdv-public-ui's. Colours are its tokens, so the only dark-mode rule here is the
 * strength of the identity band's tint on a brand profile. Class rules repeat a class where they must outrank the
 * library, which can print before this sheet.
 */

/* ===== The shortcode's own space ===== */

/*
 * Every view (overview, brand view, gate, message) sits in .gdv-sr-brands, and
 * the page's footer band can follow it directly. Padding rather than margin, so
 * the space cannot collapse into a parent's margin.
 */
.gdv-sr-brands {
	padding-bottom: 3rem;
}

/* ===== Hidden by the script ===== */

/*
 * Every element the script shows or hides has its own [hidden] rule: a display
 * value set below would otherwise beat the attribute and leave it on screen.
 */
.gdv-sr-brands .gdv-sr-search[hidden],
.gdv-sr-brands .gdv-sr-view-switch[hidden],
.gdv-sr-brands .gdv-sr-none[hidden],
.gdv-sr-brands .gdv-sr-all-countries[hidden],
.gdv-sr-brands .gdv-sr-more-row[hidden],
.gdv-sr-brands .gdv-sr-card[hidden],
.gdv-sr-brands .gdv-sr-like.gdv-sr-like[hidden] {
	display: none;
}

/* ===== Search bar ===== */

/*
 * Aroma Deep Dive's bar above its article grid (.gdv-add-grid-search): the box
 * takes the row, the country select and the button stay as wide as their
 * content. The box and the select are drawn by gdv-public-ui's form field base.
 */
/*
 * The 6px at the top is room for the field's focus ring, which reaches 4px
 * above the field: the form opens the shortcode's output, and without it the
 * ring's top edge was cut off by whatever holds the page content.
 */
.gdv-sr-brands .gdv-sr-search {
	display: flex;
	gap: 8px;
	margin-bottom: 28px;
	padding-top: 6px;
}

.gdv-sr-search .gdv-sr-search__input {
	flex: 1;
	min-width: 0;
}

.gdv-sr-search .gdv-sr-country {
	flex: none;
}

.gdv-sr-search .gdv-sr-country__select {
	max-width: 16rem;
}

.gdv-sr-note {
	margin: 0 0 24px;
	color: var(--gdv-ui-text, #444444);
}

.gdv-sr-note p:last-child {
	margin-bottom: 0;
}

/* ===== Count, view switch ===== */

.gdv-sr-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	margin-bottom: 16px;
}

.gdv-sr-toolbar .gdv-sr-count {
	margin: 0;
}

.gdv-sr-view-switch {
	display: inline-flex;
	margin-left: auto;
	border: 1px solid var(--gdv-ui-border-strong, #797979);
	border-radius: var(--gdv-ui-radius, 8px);
	overflow: hidden;
}

.gdv-sr-view-switch .gdv-sr-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 12px;
	font-size: 1.25rem;
	line-height: 1;
	color: var(--gdv-ui-text, #444444);
	background: var(--gdv-ui-surface, #ffffff);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
}

.gdv-sr-view-switch .gdv-sr-view-btn + .gdv-sr-view-btn {
	border-left: 1px solid var(--gdv-ui-border-strong, #797979);
}

.gdv-sr-view-switch .gdv-sr-view-btn:hover {
	color: var(--gdv-ui-text, #444444);
	background: var(--gdv-ui-bg, #fafbf5);
	border-color: var(--gdv-ui-border-strong, #797979);
	box-shadow: none;
}

.gdv-sr-view-switch .gdv-sr-view-btn[aria-pressed="true"],
.gdv-sr-view-switch .gdv-sr-view-btn[aria-pressed="true"]:hover {
	color: var(--gdv-ui-surface, #ffffff);
	background: var(--gdv-ui-text, #444444);
	border-color: var(--gdv-ui-border-strong, #797979);
	box-shadow: none;
}

.gdv-sr-view-switch .gdv-sr-view-btn:focus-visible {
	outline: 3px solid var(--gdv-ui-focus, #8a6100);
	outline-offset: -3px;
	box-shadow: none;
}

.gdv-sr-none {
	margin: 0 0 16px;
	color: var(--gdv-ui-text, #444444);
}

.gdv-sr-none .gdv-sr-none__text {
	margin: 0 0 12px;
}

/* ===== The brands, grid view ===== */

.gdv-sr-brands .gdv-sr-list {
	margin: 0;
	padding: 0;
}

.gdv-sr-card .gdv-sr-card__title {
	overflow-wrap: anywhere;
}

/* "View brand", and "Edit" beside it for an administrator. */
.gdv-sr-card .gdv-sr-card__actions {
	flex-wrap: wrap;
	gap: 8px;
}

/* ===== The brands, list view ===== */

/*
 * The same markup, one row per brand: the name first, then the supplier and
 * country on the same line, wrapping under it on a phone. No button: the name
 * is the link.
 */
.gdv-sr-brands .gdv-sr-list.gdv-sr-list--rows {
	display: block;
}

.gdv-sr-list--rows .gdv-sr-card.gdv-sr-card {
	display: block;
	height: auto;
	padding: 12px 0;
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--gdv-ui-border, #d6d6d6);
	border-radius: 0;
	box-shadow: none;
}

.gdv-sr-list--rows .gdv-sr-card .gdv-ui-teaser__body {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
	padding: 0;
}

.gdv-sr-list--rows .gdv-sr-card .gdv-sr-card__title {
	order: 1;
	margin: 0;
}

.gdv-sr-list--rows .gdv-sr-card .gdv-sr-card__meta {
	order: 2;
	margin: 0;
}

.gdv-sr-list--rows .gdv-sr-card .gdv-sr-card__actions {
	display: none;
}

/* The heart closes the row, at its far end. */
.gdv-sr-brands .gdv-sr-list--rows .gdv-sr-card .gdv-sr-card__like.gdv-sr-like {
	order: 3;
	margin: 0 0 0 auto;
	align-self: center;
}

/* ===== The heart ===== */

/*
 * In the shape of gdv-aroma-blog's heart: a bare glyph and its count, the
 * colour changing and never the background. Each rule repeats the class so it
 * outranks Neve's styling of a bare button. Only the glyph takes the accent
 * when pressed: the count stays in the text colour, which keeps its contrast.
 */
.gdv-sr-brands .gdv-sr-like.gdv-sr-like {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: auto;
	max-width: max-content;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 8px;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	color: var(--gdv-ui-text, #444444);
	background: none;
	border: 0;
	border-radius: var(--gdv-ui-radius, 8px);
	box-shadow: none;
	cursor: pointer;
}

.gdv-sr-brands .gdv-sr-like.gdv-sr-like:is(:hover, :focus, :active) {
	color: var(--gdv-ui-text, #444444);
	background: none;
	border-color: transparent;
	box-shadow: none;
}

.gdv-sr-brands .gdv-sr-like.gdv-sr-like:focus-visible {
	outline: 3px solid var(--gdv-ui-focus, #8a6100);
	outline-offset: 2px;
}

.gdv-sr-brands .gdv-sr-like.gdv-sr-like[aria-disabled="true"] {
	cursor: default;
	opacity: 0.55;
}

.gdv-sr-like .gdv-sr-like__icon {
	width: 1.35rem;
	height: 1.35rem;
	flex: 0 0 auto;
	color: var(--gdv-ui-text-faint, #666666);
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
}

.gdv-sr-like:is(:hover, :focus-visible) .gdv-sr-like__icon,
.gdv-sr-like[aria-pressed="true"] .gdv-sr-like__icon {
	color: var(--gdv-ui-primary-hover, #f0605c);
}

.gdv-sr-like[aria-pressed="true"] .gdv-sr-like__icon {
	fill: currentColor;
}

.gdv-sr-like .gdv-sr-like__count {
	font-variant-numeric: tabular-nums;
}

/*
 * On a card it sits just above the actions row, which keeps the bottom of the
 * card: the row's own auto margin moves to the heart while the heart shows.
 */
.gdv-sr-brands .gdv-sr-card .gdv-sr-card__like.gdv-sr-like {
	align-self: center;
	margin-top: auto;
}

.gdv-sr-card .gdv-sr-card__like:not([hidden]) + .gdv-sr-card__actions {
	margin-top: 0;
}

/* At the end of the name's row, pulled right by its own padding to the band's edge. */
.gdv-sr-brands .gdv-sr-ident .gdv-sr-brand__like.gdv-sr-like {
	margin: 0 -8px 0 auto;
}

/*
 * One beat on the heart that was pressed. Scale only, on the glyph, so
 * nothing around it reflows.
 */
@keyframes gdv-sr-heartbeat {
	0%   { transform: scale( 1 ); }
	25%  { transform: scale( 1.28 ); }
	45%  { transform: scale( 0.94 ); }
	70%  { transform: scale( 1.16 ); }
	100% { transform: scale( 1 ); }
}

.gdv-sr-like--beat .gdv-sr-like__icon {
	animation: gdv-sr-heartbeat 0.6s ease-in-out;
}

/*
 * What a press answers, and why a press failed. One element the script appends
 * to the body, outside .gdv-sr-brands. Text and surface swap places, so it
 * keeps its contrast in dark mode too.
 */
.gdv-sr-toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	z-index: 9999;
	max-width: min(30rem, calc(100vw - 2rem));
	padding: 12px 18px;
	border-radius: var(--gdv-ui-radius, 8px);
	background: var(--gdv-ui-text, #444444);
	color: var(--gdv-ui-surface, #ffffff);
	font-size: 1rem;
	text-align: center;
	opacity: 0;
	transform: translate(-50%, 0.5rem);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.gdv-sr-toast.gdv-sr-toast--visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
	.gdv-sr-like--beat .gdv-sr-like__icon {
		animation: none;
	}

	.gdv-sr-toast {
		transition: none;
	}
}

/* ===== Show more brands ===== */

.gdv-sr-brands .gdv-sr-more-row {
	margin-top: 24px;
}

/* ===== Pills ===== */

.gdv-sr-pill {
	display: inline-block;
	padding: 2px 10px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	vertical-align: middle;
	color: var(--gdv-ui-text, #444444);
	background: transparent;
	border: 1px solid var(--gdv-ui-border-strong, #797979);
	border-radius: 999px;
}

.gdv-sr-pill--verified {
	border: 2px solid var(--gdv-ui-success, #427a7b);
}

.gdv-sr-pill--own-statement {
	border-color: var(--gdv-ui-border-strong, #797979);
}

.gdv-sr-pill--no-evidence {
	color: var(--gdv-ui-text-faint, #666666);
	border-style: dashed;
}

.gdv-sr-pill--draft {
	color: var(--gdv-ui-text-faint, #666666);
	border-style: dashed;
}

.gdv-sr-pill--cert-valid {
	border: 2px solid var(--gdv-ui-success, #427a7b);
}

.gdv-sr-pill--cert-expired,
.gdv-sr-pill--cert-withdrawn {
	color: var(--gdv-ui-text-faint, #666666);
	border-style: dashed;
}

/* ===== Brand view ===== */

.gdv-sr-brands.gdv-sr-brand {
	max-width: 75rem;
	margin-left: auto;
	margin-right: auto;
}

.gdv-sr-back {
	margin: 0 0 24px;
}

/* The arrow in "View all brands": a little larger than the 1em the icon helper
gives, so it reads beside the bold label. */
.gdv-sr-back .gdv-sr-back__icon {
	width: 1.1em;
	height: 1.1em;
	flex: 0 0 auto;
}

/*
 * A profile: the identity band, the summary, then the blocks beside a column
 * about the company. The column sits on the right once the page is 900px
 * wide, measured on the profile itself rather than the window, and under the
 * blocks below that.
 */
.gdv-sr-brand {
	container: gdv-sr-brand / inline-size;
}

/*
 * The profile's lists are layouts, not running text. neve-child gives every ul
 * a disc and a 1.375em bottom margin through a selector of six :not() classes
 * and an element (style.css), so this answers it with seven classes rather than
 * !important. The margin above a list stays with the rules below.
 */
.gdv-sr-brand.gdv-sr-brand.gdv-sr-brand.gdv-sr-brand.gdv-sr-brand.gdv-sr-brand ul:is(.gdv-sr-chips, .gdv-sr-facts, .gdv-sr-rows, .gdv-sr-certs, .gdv-sr-panel__list) {
	list-style: none;
	margin-bottom: 0;
	padding-left: 0;
}

.gdv-sr-brand .gdv-sr-ident,
.gdv-sr-brand .gdv-sr-panel {
	background: var(--gdv-ui-surface, #ffffff);
	border: 1px solid var(--gdv-ui-border, #d6d6d6);
	border-radius: var(--gdv-ui-radius-lg, 12px);
}

/*
 * The brand's own card is the one coloured surface on the profile: a light tint
 * of the green its name is set in, 6% over white (#f4f7f7) and 12% over the
 * dark page (#252c2c), where 6% would not show. The literal comes first for a
 * browser without color-mix(). Measured: body text 9.04:1 and 13.87:1, the
 * faint grey 5.33:1 and 5.06:1, the brand name 4.53:1, the chip outline 4.04:1.
 */
.gdv-sr-brand .gdv-sr-ident.gdv-sr-ident {
	background: #f4f7f7;
	background: color-mix(in srgb, var(--gdv-ui-success, #427a7b) 6%, var(--gdv-ui-surface, #ffffff));
}

@media (prefers-color-scheme: dark) {
	.gdv-sr-brand .gdv-sr-ident.gdv-sr-ident {
		background: #252c2c;
		background: color-mix(in srgb, var(--gdv-ui-success, #427a7b) 12%, var(--gdv-ui-surface, #212121));
	}
}

/* ----- The identity band ----- */

.gdv-sr-brand .gdv-sr-ident {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 24px;
}

.gdv-sr-ident .gdv-sr-ident__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
}

/*
 * Left-aligned, unlike the theme's centred headings: it opens the profile, not
 * the page. Three classes deep, here and on the block and panel headings: the
 * theme's heading rule carries two classes inside its :not() and an element.
 */
.gdv-sr-brand .gdv-sr-ident .gdv-sr-brand__name {
	margin: 0;
	text-align: left;
	overflow-wrap: anywhere;
}

.gdv-sr-ident .gdv-sr-chips,
.gdv-sr-ident .gdv-sr-facts {
	display: flex;
	flex-wrap: wrap;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gdv-sr-ident .gdv-sr-chips {
	gap: 8px;
}

.gdv-sr-chips .gdv-sr-chip {
	margin: 0;
	padding: 2px 12px;
	color: var(--gdv-ui-text, #444444);
	border: 1px solid var(--gdv-ui-border-strong, #797979);
	border-radius: 999px;
}

.gdv-sr-ident .gdv-sr-facts {
	gap: 8px 24px;
}

.gdv-sr-facts .gdv-sr-fact {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	overflow-wrap: anywhere;
}

.gdv-sr-fact .gdv-sr-fact__icon,
.gdv-sr-glance .gdv-sr-glance__icon,
.gdv-sr-row .gdv-sr-row__icon {
	width: 1.15em;
	height: 1.15em;
	flex: 0 0 auto;
}

.gdv-sr-fact .gdv-sr-fact__icon {
	color: var(--gdv-ui-text-faint, #666666);
}

/* ----- What the answers add up to ----- */

.gdv-sr-brand .gdv-sr-glance {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	gap: 12px;
	margin: 20px 0 0;
}

.gdv-sr-glance .gdv-sr-glance__cell {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	padding: 14px 16px;
	border: 1px solid var(--gdv-ui-border, #d6d6d6);
	border-radius: var(--gdv-ui-radius, 8px);
}

.gdv-sr-glance .gdv-sr-glance__num {
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.gdv-sr-glance .gdv-sr-glance__label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--gdv-ui-text-faint, #666666);
}

/* ----- The two columns ----- */

.gdv-sr-brand .gdv-sr-profile {
	display: grid;
	gap: 20px;
	margin: 24px 0 0;
}

@container gdv-sr-brand (min-width: 900px) {
	.gdv-sr-brand .gdv-sr-profile--two {
		grid-template-columns: minmax(0, 1fr) 20rem;
		align-items: start;
	}
}

.gdv-sr-profile .gdv-sr-profile__main,
.gdv-sr-profile .gdv-sr-profile__aside {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

/* ----- One block ----- */

.gdv-sr-profile .gdv-sr-block {
	margin: 0;
	padding: 20px 22px;
	border: 1px solid var(--gdv-ui-border, #d6d6d6);
	border-radius: var(--gdv-ui-radius-lg, 12px);
}

.gdv-sr-block .gdv-sr-block__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 16px;
}

.gdv-sr-profile .gdv-sr-block .gdv-sr-block__name {
	margin: 0;
	text-align: left;
	overflow-wrap: anywhere;
}

.gdv-sr-block .gdv-sr-block__meta {
	margin: 0;
	color: var(--gdv-ui-text-faint, #666666);
	font-variant-numeric: tabular-nums;
}

/* The share of this block's properties that carry an answer. */
.gdv-sr-block .gdv-sr-block__bar {
	height: 6px;
	margin: 12px 0 4px;
	border-radius: 999px;
	background: var(--gdv-ui-border, #d6d6d6);
	overflow: hidden;
}

.gdv-sr-block__bar span {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--gdv-ui-success, #427a7b);
}

.gdv-sr-block .gdv-sr-rows {
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

/*
 * The label and the verification on the first line, the value and its
 * details under the label. On a phone the verification drops under them.
 */
.gdv-sr-rows .gdv-sr-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 4px 16px;
	margin: 0;
	padding: 12px 0;
	border-top: 1px solid var(--gdv-ui-border, #d6d6d6);
}

.gdv-sr-row .gdv-sr-row__label {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.gdv-sr-row .gdv-sr-row__state {
	grid-column: 2;
	grid-row: 1;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--gdv-ui-text, #444444);
}

/*
 * The word stays in the text colour and only the tick takes the green: the
 * green is 3.30:1 on the dark page, enough for an icon and too little for text.
 */
.gdv-sr-row .gdv-sr-row__state--verified {
	font-weight: 600;
}

.gdv-sr-row__state--verified .gdv-sr-row__icon,
.gdv-sr-glance__label .gdv-sr-glance__icon--verified {
	color: var(--gdv-ui-success, #427a7b);
}

.gdv-sr-row .gdv-sr-row__state--no-evidence {
	color: var(--gdv-ui-text-faint, #666666);
}

.gdv-sr-row .gdv-sr-row__value,
.gdv-sr-row .gdv-sr-row__extra {
	grid-column: 1;
	overflow-wrap: anywhere;
}

.gdv-sr-row .gdv-sr-row__evidence-label {
	color: var(--gdv-ui-text-faint, #666666);
}

/* The unanswered properties, one sentence at the foot of the block. */
.gdv-sr-block .gdv-sr-block__missing {
	margin: 0;
	padding: 12px 0 0;
	border-top: 1px solid var(--gdv-ui-border, #d6d6d6);
	color: var(--gdv-ui-text-faint, #666666);
}

.gdv-sr-block__missing strong {
	color: var(--gdv-ui-text, #444444);
}

.gdv-sr-block .gdv-sr-rows + .gdv-sr-block__missing {
	margin-top: 0;
}

/* ----- The company column ----- */

.gdv-sr-profile .gdv-sr-panel {
	margin: 0;
	padding: 18px 20px;
	overflow-wrap: anywhere;
}

.gdv-sr-profile .gdv-sr-panel .gdv-sr-panel__title {
	margin: 0 0 8px;
	text-align: left;
}

.gdv-sr-panel p {
	margin: 0 0 4px;
}

.gdv-sr-panel .gdv-sr-panel__name {
	font-weight: 600;
}

.gdv-sr-panel .gdv-sr-panel__list,
.gdv-sr-panel .gdv-sr-certs {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gdv-sr-certs .gdv-sr-cert {
	margin: 0;
}

.gdv-sr-certs .gdv-sr-cert + .gdv-sr-cert {
	padding-top: 12px;
	border-top: 1px solid var(--gdv-ui-border, #d6d6d6);
}

.gdv-sr-cert__logo {
	display: block;
	max-width: 96px;
	max-height: 64px;
	height: auto;
	margin-bottom: 8px;
}

.gdv-sr-cert__name {
	font-weight: 600;
}

.gdv-sr-message p {
	margin: 0 0 8px;
}

@media (max-width: 600px) {
	/* The box takes the first row; the country select and the button share the second. */
	.gdv-sr-brands .gdv-sr-search {
		flex-wrap: wrap;
	}

	.gdv-sr-search .gdv-sr-search__input {
		flex: 1 1 100%;
	}

	.gdv-sr-search .gdv-sr-country {
		flex: 1 1 0;
		min-width: 0;
	}

	.gdv-sr-search .gdv-sr-country__select {
		width: 100%;
		max-width: none;
	}

	.gdv-sr-rows .gdv-sr-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.gdv-sr-row .gdv-sr-row__state {
		grid-column: 1;
		grid-row: auto;
	}

	.gdv-sr-brand .gdv-sr-ident,
	.gdv-sr-profile .gdv-sr-block {
		padding: 16px;
	}
}
