/*
 * Building blocks (W2-TR-02): label, buttons, action link, chips, form fields, notices, section heading, "what you
 * get" table, search. The product card is WooCommerce's own, styled in woocommerce.css. Styled from tokens only. The .is-hover and .is-focus classes show
 * those states on the design-system page.
 */

/* Type label */
.cc-label,
.cc-hero__brand {
	margin: 0 0 var(--cc-space-1);
	color: var(--cc-grey-600);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-label);
	font-weight: 600;
	letter-spacing: var(--cc-tracking-label);
	line-height: 1.4;
	text-transform: uppercase;
}

/* Buttons: solid for the main action, outline for everything else */
.cc-button,
.cc-card a.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--cc-control-height);
	padding: 0 var(--cc-space-5);
	border: var(--cc-line) solid var(--cc-ink);
	border-radius: var(--cc-radius);
	background: var(--cc-white);
	color: var(--cc-ink);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-card);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.cc-button--solid {
	background: var(--cc-ink);
	color: var(--cc-white);
}

.cc-button--solid:hover,
.cc-button--solid.is-hover {
	background: var(--cc-white);
	color: var(--cc-ink);
}

.cc-button--outline:hover,
.cc-button--outline.is-hover,
.cc-card a.button:hover {
	background: var(--cc-ink);
	color: var(--cc-white);
}

/* On black (footer, post sidebar): white outline and words; white fill on hover and focus */
.cc-button--invert {
	border-color: var(--cc-white);
	background: var(--cc-ink);
	color: var(--cc-white);
}

.cc-button--invert:is(:hover, :focus-visible) {
	background: var(--cc-white);
	color: var(--cc-ink);
}

.cc-button.is-focus {
	outline: var(--cc-focus) solid var(--cc-ink);
	outline-offset: var(--cc-focus);
}

.cc-button:disabled,
.cc-button[aria-disabled="true"] {
	border-color: var(--cc-grey-200);
	background: var(--cc-grey-200);
	color: var(--cc-grey-600);
	cursor: not-allowed;
}

/* A link that stands alone as an action ("View all") */
.cc-link-action {
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-card);
	font-weight: 600;
}

/* Phones: a 44px tall tap area, from padding, so the line looks the same */
@media (max-width: 899px) {
	.cc-link-action {
		display: inline-block;
		padding-block: calc((var(--cc-control-height) - 1lh) / 2);
	}
}

.cc-link-action::after {
	content: " →" / "";
}

/* Category chips */
.cc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cc-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cc-chip {
	display: inline-flex;
	align-items: center;
	min-height: 2.25rem;
	padding: 0 var(--cc-space-3);
	border: var(--cc-line) solid var(--cc-ink);
	border-radius: var(--cc-radius);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-small);
	font-weight: 500;
	text-decoration: none;
}

.cc-chip:hover {
	box-shadow: inset 0 0 0 var(--cc-line) var(--cc-ink);
}

/* Phones and tablets: the chip row scrolls sideways; a fade at the right edge shows there is more. Chips are 44px
   tall for fingers. */
@media (max-width: 1023px) {
	.cc-chips-nav {
		position: relative;
	}

	.cc-chip {
		min-height: var(--cc-control-height);
	}

	.cc-chips-nav::after {
		content: "";
		position: absolute;
		top: 0;
		right: calc(-1 * var(--cc-gutter));
		bottom: 0;
		width: 2.5rem;
		background: linear-gradient(to right, transparent, var(--cc-white));
		pointer-events: none;
	}
}

.cc-chip[aria-current] {
	background: var(--cc-ink);
	color: var(--cc-white);
}

/* Form fields */
.cc-field {
	margin-bottom: var(--cc-space-5);
}

.cc-field__label {
	display: block;
	margin-bottom: var(--cc-space-1);
	font-weight: 600;
}

.cc-field__input {
	width: 100%;
	min-height: var(--cc-control-height);
	padding: 0 var(--cc-space-3);
	border: var(--cc-line) solid var(--cc-grey-500);
	border-radius: var(--cc-radius);
	background: var(--cc-white);
	color: var(--cc-ink);
	font: inherit;
}

.cc-field__input:hover {
	border-color: var(--cc-ink);
}

.cc-field__input[aria-invalid="true"] {
	border: var(--cc-line-strong) solid var(--cc-ink);
}

.cc-field__help,
.cc-field__error {
	margin: var(--cc-space-1) 0 0;
	font-size: var(--cc-size-small);
}

.cc-field__help {
	color: var(--cc-grey-600);
}

.cc-field__error {
	padding-left: var(--cc-space-2);
	border-left: var(--cc-line-strong) solid var(--cc-ink);
	font-weight: 600;
}

.cc-field--check {
	display: flex;
	align-items: center;
	gap: var(--cc-space-3);
}

.cc-field--check input {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	accent-color: var(--cc-ink);
}

/* Search */
.cc-search {
	display: flex;
	gap: var(--cc-space-2);
	max-width: 40rem;
}

.cc-search .cc-field__input {
	flex: 1;
	min-width: 0;
}

/* No browser clear (×) button in search boxes; one focus ring around the header's box and its button together */
.cc-search input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.cc-search--compact {
	gap: 0;
	max-width: none;
}

.cc-search--compact:focus-within {
	outline: var(--cc-focus) solid var(--cc-ink);
	outline-offset: var(--cc-focus);
}

.cc-search--compact :focus-visible {
	outline: none;
}

/* Page not found: on phones the header's search box is right above, so the page's own is left out */
@media (max-width: 767px) {
	.cc-search--page {
		display: none;
	}
}

.cc-search--compact .cc-field__input,
.cc-search--compact .cc-button {
	min-height: 2.5rem;
}

/* Phones: the full 44px for fingers */
@media (max-width: 767px) {
	.cc-search--compact .cc-field__input,
	.cc-search--compact .cc-button {
		min-height: var(--cc-control-height);
	}
}

.cc-search--compact .cc-field__input {
	border-right: 0;
	border-radius: var(--cc-radius) 0 0 var(--cc-radius);
	font-size: var(--cc-size-small);
}

.cc-search--compact .cc-button {
	padding-inline: var(--cc-space-4);
	border-radius: 0 var(--cc-radius) var(--cc-radius) 0;
	font-size: var(--cc-size-small);
}

/* Page sections. A product row inside a section drops the shop list's own bottom margin, so sections (and the
   last one before the footer) are always one step apart. */
.cc-section {
	margin-bottom: var(--cc-space-8);
}

.cc-section .woocommerce ul.products {
	margin-bottom: 0;
}

/* Notices: told apart by their words and lines, never by colour */
.cc-notice {
	margin-bottom: var(--cc-space-3);
	padding: var(--cc-space-3) var(--cc-space-4);
	border: var(--cc-line) solid var(--cc-grey-200);
	border-left: 4px solid var(--cc-ink);
}

.cc-notice p {
	margin: 0;
}

.cc-notice--problem {
	border: var(--cc-line-strong) solid var(--cc-ink);
	border-left-width: 4px;
}

/* Section heading */
.cc-section-heading {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--cc-space-2) var(--cc-space-4);
	margin-bottom: var(--cc-space-5);
	padding-bottom: var(--cc-space-3);
	border-bottom: var(--cc-line) solid var(--cc-grey-200);
}

.cc-section-heading__title {
	margin: 0;
	font-size: var(--cc-size-h2);
}

/* "What you get" table */
.cc-facts {
	width: 100%;
	max-width: var(--cc-content);
	border-collapse: collapse;
	border-top: var(--cc-line) solid var(--cc-ink);
}

.cc-facts__caption {
	margin-bottom: var(--cc-space-3);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-size-h4);
	font-weight: 600;
	text-align: left;
}

.cc-facts th,
.cc-facts td {
	padding: var(--cc-space-3) 0;
	border-bottom: var(--cc-line) solid var(--cc-grey-200);
	text-align: left;
	vertical-align: top;
}

.cc-facts th {
	width: 32%;
	padding-right: var(--cc-space-4);
	color: var(--cc-grey-600);
	font-size: var(--cc-size-small);
	font-weight: 600;
}

/* Phones: each label above its value */
@media (max-width: 599px) {
	.cc-facts th,
	.cc-facts td {
		display: block;
		width: auto;
	}

	.cc-facts th {
		padding-bottom: 0;
		border-bottom: 0;
	}

	.cc-facts td {
		padding-top: var(--cc-space-1);
	}
}
