/**
 * COA Manager — storefront styles (v1.2 "lab report" design).
 *
 * Built on the Woodmart theme's own design tokens (--wd-*, --btn-accented-*)
 * so the certificate card speaks the site's language: Geologica titles, Cabin
 * body, black pill buttons, 16px card corners. Every token has a literal
 * fallback, so the plugin still renders cleanly under any other theme.
 *
 * Every selector is scoped under .coa-storefront, .coa-lookup or .coa-lightbox.
 * Interactive elements are double-scoped (e.g. `.coa-lookup .coa-lookup__submit`)
 * on purpose: the theme styles bare `button`, `[type=submit]` and
 * `input[type=search]`, and the plugin has to win without !important.
 */

/* ==========================================================================
   Tokens
   ========================================================================== */

.coa-storefront,
.coa-lookup,
.coa-lightbox {
	--coa-ink: var(--wd-title-color, #242424);
	--coa-text: var(--wd-text-color, #767676);
	--coa-muted: #9a9a9a;
	--coa-primary: var(--btn-accented-bgcolor, var(--wd-primary-color, #000));
	--coa-primary-hover: var(--btn-accented-bgcolor-hover, #333);
	--coa-on-primary: var(--btn-accented-color, #fff);
	--coa-pill: var(--btn-accented-brd-radius, 35px);
	--coa-radius: var(--wd-brd-radius, 16px);
	--coa-surface: #fff;
	--coa-soft: #f7f7f7;
	--coa-softer: #fafafa;
	--coa-line: #e6e6e6;
	--coa-line-strong: #d4d4d4;
	--coa-field: var(--wd-form-brd-color, #b3b3b3);
	--coa-ok: #85b951;
	--coa-ok-soft: #f1f7eb;
	--coa-err: var(--prs-error, #c0392b);
	--coa-err-soft: #fff8f7;
	--coa-font-title: var(--wd-title-font, inherit);
	--coa-font-text: var(--wd-text-font, inherit);
	--coa-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 40px -22px rgba(0, 0, 0, 0.22);
	--coa-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--coa-dots: radial-gradient(rgba(0, 0, 0, 0.075) 1px, transparent 1.3px);
}

.coa-storefront,
.coa-storefront *,
.coa-storefront *::before,
.coa-storefront *::after,
.coa-lookup,
.coa-lookup *,
.coa-lookup *::before,
.coa-lookup *::after,
.coa-lightbox,
.coa-lightbox * {
	box-sizing: border-box;
}

.coa-storefront .coa-icon,
.coa-lookup .coa-icon,
.coa-lightbox .coa-icon {
	display: inline-block;
	flex: none;
	width: 1.15em;
	height: 1.15em;
	vertical-align: middle;
	pointer-events: none;
}

/* The accessible name of every View control depends on this class, so do not
   assume the theme defines it. */
.coa-storefront .screen-reader-text,
.coa-lookup .screen-reader-text,
.coa-lightbox .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   Section (product tab / [coa_certificates])
   ========================================================================== */

.coa-storefront {
	display: grid;
	gap: 14px;
	margin: 0 0 2em;
	font-family: var(--coa-font-text);
	color: var(--coa-text);
	line-height: 1.5;
}

.coa-storefront__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
}

.coa-storefront .coa-storefront__heading {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-family: var(--coa-font-title);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--coa-ink);
}

.coa-storefront .coa-storefront__heading::before {
	content: "";
	width: 8px;
	height: 8px;
	background: var(--coa-primary);
	border-radius: 2px;
}

.coa-storefront .coa-storefront__lookup {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	font-weight: 500;
	color: var(--coa-ink);
	text-decoration: none;
}

.coa-storefront .coa-storefront__lookup span {
	background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
	transition: background-size 0.3s var(--coa-ease);
}

.coa-storefront .coa-storefront__lookup:hover span,
.coa-storefront .coa-storefront__lookup:focus-visible span {
	background-size: 100% 1px;
}

.coa-storefront__body {
	position: relative;
	display: grid;
	gap: 12px;
	min-width: 0;
}

/* Busy: a shimmer sweeps over whatever is on screen while the next
   variation's certificate loads. */
.coa-storefront[aria-busy="true"] .coa-storefront__body > * {
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

.coa-storefront[aria-busy="true"] .coa-storefront__body::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	border-radius: var(--coa-radius);
	background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 0) 70%) 0 0 / 250% 100%;
	animation: coa-shimmer 1.1s linear infinite;
	pointer-events: none;
}

@keyframes coa-shimmer {
	from { background-position: 125% 0; }
	to { background-position: -125% 0; }
}

/* ==========================================================================
   The lab report card (latest certificate)
   ========================================================================== */

.coa-card {
	overflow: hidden;
	background: var(--coa-surface);
	border: 1px solid var(--coa-line);
	border-radius: var(--coa-radius);
	box-shadow: var(--coa-shadow);
}

.coa-card__strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding: 12px 24px;
	background: var(--coa-primary);
	color: var(--coa-on-primary);
}

.coa-card__strip-title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-family: var(--coa-font-title);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.coa-card__strip-title .coa-icon {
	width: 20px;
	height: 20px;
}

.coa-card__badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 11px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 99px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.coa-card__badge::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--coa-ok);
	box-shadow: 0 0 0 3px rgba(133, 185, 81, 0.25);
}

.coa-card__main {
	display: grid;
	grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
	gap: 32px;
	padding: 28px;
}

.coa-card__preview,
.coa-result__preview {
	display: grid;
	place-items: center;
	align-self: start;
	padding: 24px 20px;
	border-radius: calc(var(--coa-radius) - 4px);
	background: var(--coa-dots) 0 0 / 14px 14px, var(--coa-soft);
}

.coa-card__placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	max-width: 170px;
	aspect-ratio: 1000 / 1294;
	border: 1.5px dashed var(--coa-line-strong);
	border-radius: 6px;
	background: var(--coa-surface);
	color: var(--coa-muted);
}

.coa-card__placeholder .coa-icon {
	width: 30px;
	height: 30px;
}

.coa-card__info {
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-width: 0;
}

.coa-storefront .coa-card__eyebrow {
	margin: 0 0 -12px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--coa-text);
}

.coa-storefront .coa-card__lot {
	margin: 0;
	font-family: var(--coa-font-title);
	font-size: clamp(26px, 3.2vw, 38px);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--coa-ink);
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.coa-card__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
}

/* ---------- freshness line ---------- */

.coa-storefront .coa-age {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin: -4px 0 0;
	font-size: 13px;
	color: var(--coa-text);
}

.coa-storefront .coa-age[hidden] {
	display: none;
}

.coa-age__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--coa-field);
}

.coa-age.is-fresh .coa-age__dot {
	background: var(--coa-ok);
	animation: coa-pulse 2.4s ease-out infinite;
}

@keyframes coa-pulse {
	0% { box-shadow: 0 0 0 0 rgba(133, 185, 81, 0.45); }
	70%, 100% { box-shadow: 0 0 0 7px rgba(133, 185, 81, 0); }
}

/* ==========================================================================
   Facts (spec-sheet grid) — shared by the card and lookup results
   ========================================================================== */

.coa-storefront .coa-facts,
.coa-lookup .coa-facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--coa-line);
	border-radius: 12px;
	background: var(--coa-surface);
}

.coa-storefront .coa-facts__cell,
.coa-lookup .coa-facts__cell {
	min-width: 0;
	margin: 0;
	padding: 13px 16px;
	/* Hairline dividers that stay correct however the grid wraps: every cell
	   draws its right and bottom edge; the outer ones are clipped by overflow. */
	box-shadow: 1px 0 0 var(--coa-line), 0 1px 0 var(--coa-line);
}

.coa-storefront .coa-facts__label,
.coa-lookup .coa-facts__label {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 4px;
	padding: 0;
	font-family: var(--coa-font-text);
	font-size: 11px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--coa-text);
}

.coa-storefront .coa-facts__label .coa-icon,
.coa-lookup .coa-facts__label .coa-icon {
	width: 14px;
	height: 14px;
	color: var(--coa-muted);
}

.coa-storefront .coa-facts__value,
.coa-lookup .coa-facts__value {
	margin: 0;
	padding: 0;
	font-family: var(--coa-font-title);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	color: var(--coa-ink);
	overflow-wrap: anywhere;
}

.coa-facts__value--mono {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

/* ==========================================================================
   View controls
   ========================================================================== */

/* ---------- primary: black pill ---------- */

.coa-storefront .coa-view--primary,
.coa-lookup .coa-view--primary {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: var(--wd-form-height, 48px);
	padding: 0 26px;
	border: 0;
	border-radius: var(--coa-pill);
	background: var(--coa-primary);
	color: var(--coa-on-primary);
	font-family: var(--btn-font-family, var(--coa-font-title));
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	text-transform: var(--btn-transform, none);
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.coa-storefront .coa-view--primary:hover,
.coa-lookup .coa-view--primary:hover {
	background: var(--coa-primary-hover);
	color: var(--coa-on-primary);
	box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.45);
}

.coa-view--primary .coa-view__arrow {
	width: 18px;
	height: 18px;
	transition: transform 0.25s var(--coa-ease);
}

.coa-view--primary:hover .coa-view__arrow,
.coa-view--primary:focus-visible .coa-view__arrow {
	transform: translateX(4px);
}

/* ---------- link: text + arrow ---------- */

.coa-storefront .coa-view--link,
.coa-lookup .coa-view--link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--coa-font-title);
	font-size: 14px;
	font-weight: 500;
	color: var(--coa-ink);
	text-decoration: none;
	white-space: nowrap;
}

.coa-view--link .coa-view__label {
	background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
	transition: background-size 0.3s var(--coa-ease);
}

.coa-view--link:hover .coa-view__label {
	background-size: 0 1px;
	background-position: 100% 100%;
}

.coa-view--link .coa-view__arrow {
	width: 15px;
	height: 15px;
	transition: transform 0.25s var(--coa-ease);
}

.coa-view--link:hover .coa-view__arrow {
	transform: translateX(3px);
}

/* ---------- thumb: the certificate's first page as a paper preview ---------- */

.coa-storefront .coa-view--thumb,
.coa-lookup .coa-view--thumb {
	position: relative;
	display: block;
	width: 100%;
	max-width: 170px;
	text-decoration: none;
	cursor: zoom-in;
}

/* Sheets fanned out behind page one when the certificate has more pages. */
.coa-view--stack::before,
.coa-view--stack::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 1px solid var(--coa-line);
	border-radius: 6px;
	background: var(--coa-surface);
	box-shadow: 0 6px 16px -10px rgba(0, 0, 0, 0.3);
	transition: transform 0.35s var(--coa-ease);
}

.coa-view--stack::before {
	transform: rotate(4deg) translate(6px, 2px);
}

.coa-view--stack::after {
	transform: rotate(1.5deg) translate(3px, 1px);
}

.coa-view__paper {
	position: relative;
	z-index: 1;
	display: block;
	overflow: hidden;
	border-radius: 6px;
	background: var(--coa-surface);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 14px 28px -12px rgba(0, 0, 0, 0.35);
	transform: rotate(-2deg);
	transition: transform 0.35s var(--coa-ease), box-shadow 0.35s var(--coa-ease);
}

.coa-storefront .coa-view__img,
.coa-lookup .coa-view__img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	aspect-ratio: 1000 / 1294;
	margin: 0;
	object-fit: cover;
	object-position: top center;
	border-radius: 0;
}

.coa-view__zoom {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0);
	transition: background-color 0.3s ease;
}

.coa-view__zoom .coa-icon {
	width: 46px;
	height: 46px;
	padding: 12px;
	border-radius: 50%;
	background: var(--coa-surface);
	color: var(--coa-ink);
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 0.25s ease, transform 0.3s var(--coa-ease);
}

.coa-view__pages {
	position: absolute;
	left: 10px;
	bottom: 10px;
	z-index: 2;
	padding: 3px 10px;
	border-radius: 99px;
	background: var(--coa-primary);
	color: var(--coa-on-primary);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.coa-view--thumb:hover .coa-view__paper {
	transform: rotate(0deg) translateY(-4px) scale(1.02);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 24px 40px -16px rgba(0, 0, 0, 0.4);
}

.coa-view--thumb:hover::before {
	transform: rotate(7deg) translate(12px, 4px);
}

.coa-view--thumb:hover::after {
	transform: rotate(3deg) translate(6px, 2px);
}

.coa-view--thumb:hover .coa-view__zoom {
	background: rgba(0, 0, 0, 0.28);
}

.coa-view--thumb:hover .coa-view__zoom .coa-icon {
	opacity: 1;
	transform: scale(1);
}

/* ---------- shared focus ring ---------- */

.coa-storefront a:focus-visible,
.coa-storefront button:focus-visible,
.coa-storefront summary:focus-visible,
.coa-lookup a:focus-visible,
.coa-lookup button:focus-visible {
	outline: 2px solid var(--coa-primary);
	outline-offset: 3px;
}

/* ---------- notes ---------- */

.coa-storefront .coa-note,
.coa-lookup .coa-note {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
	color: var(--coa-text);
}

.coa-note .coa-icon {
	width: 18px;
	height: 18px;
	margin-top: 1px;
}

/* ---------- no-JS page links (inside <noscript>) ---------- */

.coa-storefront .coa-pagelinks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.coa-storefront .coa-pagelinks__item {
	margin: 0;
}

.coa-storefront .coa-pagelinks__link {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid var(--coa-line-strong);
	border-radius: 99px;
	font-size: 13px;
	color: var(--coa-ink);
	text-decoration: none;
}

/* ==========================================================================
   History — previous batches as a timeline
   ========================================================================== */

.coa-history {
	overflow: hidden;
	background: var(--coa-surface);
	border: 1px solid var(--coa-line);
	border-radius: var(--coa-radius);
}

.coa-storefront .coa-history__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	list-style: none;
	cursor: pointer;
	font-family: var(--coa-font-title);
	font-size: 15px;
	font-weight: 500;
	color: var(--coa-ink);
	transition: background-color 0.2s ease;
}

.coa-history__toggle::-webkit-details-marker,
.coa-history__toggle::marker {
	display: none;
	content: "";
}

.coa-history__toggle:hover {
	background: var(--coa-softer);
}

.coa-history__count {
	display: inline-grid;
	place-items: center;
	min-width: 24px;
	height: 24px;
	margin-inline-start: 8px;
	padding: 0 7px;
	border-radius: 99px;
	background: var(--coa-soft);
	font-size: 12px;
	font-weight: 600;
	color: var(--coa-ink);
	font-variant-numeric: tabular-nums;
}

.coa-history__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 32px;
	height: 32px;
	border: 1px solid var(--coa-line);
	border-radius: 50%;
	transition: transform 0.3s var(--coa-ease), background-color 0.2s ease, color 0.2s ease;
}

.coa-history__icon .coa-icon {
	width: 16px;
	height: 16px;
}

.coa-history[open] .coa-history__icon {
	transform: rotate(45deg);
	background: var(--coa-primary);
	border-color: var(--coa-primary);
	color: var(--coa-on-primary);
}

.coa-storefront .coa-history__list {
	position: relative;
	margin: 0;
	padding: 4px 24px 18px;
	list-style: none;
	border-top: 1px solid var(--coa-line);
}

/* The timeline spine. */
.coa-storefront .coa-history__list::before {
	content: "";
	position: absolute;
	top: 28px;
	bottom: 34px;
	left: 28.5px;
	width: 1px;
	background: var(--coa-line-strong);
}

.coa-storefront .coa-history__item {
	position: relative;
	margin: 0;
	padding: 0 0 0 26px;
}

.coa-storefront .coa-history__item::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	width: 10px;
	height: 10px;
	margin-top: -5px;
	border: 2px solid var(--coa-ink);
	border-radius: 50%;
	background: var(--coa-surface);
	z-index: 1;
}

.coa-history[open] .coa-history__item {
	animation: coa-rise 0.35s var(--coa-ease) both;
}

.coa-history[open] .coa-history__item:nth-child(2) { animation-delay: 0.04s; }
.coa-history[open] .coa-history__item:nth-child(3) { animation-delay: 0.08s; }
.coa-history[open] .coa-history__item:nth-child(4) { animation-delay: 0.12s; }
.coa-history[open] .coa-history__item:nth-child(n+5) { animation-delay: 0.16s; }

@keyframes coa-rise {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

.coa-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 20px;
	padding: 12px 14px;
	border-radius: 10px;
	transition: background-color 0.2s ease;
}

.coa-row:hover {
	background: var(--coa-softer);
}

.coa-row__date {
	flex: 0 0 9.5em;
	font-size: 13px;
	color: var(--coa-text);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* Fixed lot column so the lab names line up down the timeline. */
.coa-row__lot {
	display: inline-flex;
	flex: 0 0 13em;
	align-items: baseline;
	gap: 6px;
	min-width: 0;
	font-family: var(--coa-font-title);
	font-size: 15px;
	font-weight: 500;
	color: var(--coa-ink);
}

.coa-row__lot-label {
	font-family: var(--coa-font-text);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--coa-muted);
}

.coa-row__lot-value {
	overflow-wrap: anywhere;
	font-variant-numeric: tabular-nums;
}

.coa-row__lab {
	flex: 1 1 8em;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	color: var(--coa-text);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.coa-row__action {
	margin-inline-start: auto;
}

.coa-row__unavailable {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 99px;
	background: var(--coa-soft);
	font-size: 12px;
	color: var(--coa-text);
}

/* ==========================================================================
   States — prompt / empty / error
   ========================================================================== */

.coa-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 40px 24px;
	text-align: center;
	border: 1.5px dashed var(--coa-line-strong);
	border-radius: var(--coa-radius);
	background: var(--coa-dots) 0 0 / 16px 16px, var(--coa-softer);
}

.coa-state__icon {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border: 1px solid var(--coa-line);
	border-radius: 50%;
	background: var(--coa-surface);
	color: var(--coa-ink);
	box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.35);
}

.coa-state__icon .coa-icon {
	width: 24px;
	height: 24px;
}

.coa-state--prompt .coa-state__icon .coa-icon {
	animation: coa-nudge 1.8s var(--coa-ease) infinite;
}

@keyframes coa-nudge {
	0%, 100% { transform: translateY(2px); }
	50% { transform: translateY(-3px); }
}

.coa-state--error {
	border-color: rgba(192, 57, 43, 0.35);
	background: var(--coa-err-soft);
}

.coa-state--error .coa-state__icon {
	border-color: rgba(192, 57, 43, 0.25);
	color: var(--coa-err);
}

.coa-storefront .coa-state p {
	max-width: 34em;
	margin: 0;
	font-size: 15px;
	color: var(--coa-ink);
}

.coa-storefront .coa-state .coa-state__sub {
	font-size: 13px;
	color: var(--coa-text);
}

.coa-storefront .coa-state .coa-state__actions {
	margin-top: 4px;
}

.coa-storefront .coa-storefront__retry.button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	height: auto;
	padding: 0 22px;
	border: 1.5px solid var(--coa-primary);
	border-radius: var(--coa-pill);
	background: transparent;
	box-shadow: none;
	color: var(--coa-primary);
	font-family: var(--coa-font-title);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.coa-storefront .coa-storefront__retry.button:hover {
	background: var(--coa-primary);
	color: var(--coa-on-primary);
}

.coa-storefront__retry .coa-icon {
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Lookup page — "Verify your batch"
   ========================================================================== */

.coa-lookup {
	display: grid;
	gap: 40px;
	max-width: 1200px;
	margin: 0 auto 3em;
	font-family: var(--coa-font-text);
	color: var(--coa-text);
	line-height: 1.5;
}

.coa-lookup__hero {
	position: relative;
	padding: clamp(36px, 6vw, 72px) clamp(18px, 4vw, 56px);
	overflow: hidden;
	text-align: center;
	border: 1px solid var(--coa-line);
	border-radius: calc(var(--coa-radius) + 8px);
	background:
		radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%),
		linear-gradient(180deg, rgba(247, 247, 247, 0) 40%, var(--coa-soft) 100%),
		var(--coa-dots) 0 0 / 18px 18px,
		var(--coa-soft);
}

.coa-lookup__hero > * {
	max-width: 720px;
	margin-inline: auto;
}

.coa-lookup .coa-lookup__eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	margin: 0 auto 20px;
	padding: 6px 14px 6px 10px;
	border: 1px solid var(--coa-line);
	border-radius: 99px;
	background: var(--coa-surface);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--coa-ink);
}

.coa-lookup__eyebrow .coa-icon {
	width: 17px;
	height: 17px;
}

.coa-lookup .coa-lookup__title {
	margin: 0 auto 14px;
	font-family: var(--coa-font-title);
	font-size: clamp(30px, 4.6vw, 50px);
	font-weight: 600;
	line-height: 1.06;
	letter-spacing: -0.02em;
	color: var(--coa-ink);
}

.coa-lookup .coa-lookup__lead {
	max-width: 34em;
	margin: 0 auto 32px;
	font-size: 17px;
	color: var(--coa-text);
}

.coa-lookup__form {
	max-width: 640px;
	text-align: start;
}

.coa-lookup .coa-lookup__label {
	display: block;
	margin: 0 0 8px 24px;
	font-size: 13px;
	font-weight: 500;
	color: var(--coa-ink);
}

.coa-lookup__controls {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px;
	border: 1.5px solid var(--coa-field);
	border-radius: 99px;
	background: var(--coa-surface);
	box-shadow: 0 16px 36px -20px rgba(0, 0, 0, 0.3);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.coa-lookup__controls:focus-within {
	border-color: var(--prs-primary, var(--coa-primary));
	box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.07), 0 16px 36px -20px rgba(0, 0, 0, 0.3);
}

.coa-lookup__field {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	min-width: 0;
}

.coa-lookup .coa-lookup__field-icon {
	position: absolute;
	left: 18px;
	width: 20px;
	height: 20px;
	color: var(--coa-muted);
}

.coa-lookup .coa-lookup__input {
	width: 100%;
	min-width: 0;
	height: 52px;
	margin: 0;
	padding: 0 14px 0 48px;
	border: 0;
	border-radius: 99px;
	background: transparent;
	box-shadow: none;
	outline: none;
	font-family: var(--coa-font-title);
	font-size: 17px;
	letter-spacing: 0.02em;
	color: var(--coa-ink);
	-webkit-appearance: none;
	appearance: none;
}

.coa-lookup .coa-lookup__input::placeholder {
	color: var(--coa-muted);
	opacity: 1;
}

.coa-lookup .coa-lookup__input:focus {
	border: 0;
	box-shadow: none;
	outline: none;
}

.coa-lookup .coa-lookup__submit {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	height: 52px;
	min-height: 0;
	margin: 0;
	padding: 0 28px;
	border: 0;
	border-radius: 99px;
	background: var(--coa-primary);
	box-shadow: none;
	color: var(--coa-on-primary);
	font-family: var(--btn-font-family, var(--coa-font-title));
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	text-transform: var(--btn-transform, none);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.coa-lookup .coa-lookup__submit:hover {
	background: var(--coa-primary-hover);
	color: var(--coa-on-primary);
}

.coa-lookup__submit .coa-icon {
	width: 18px;
	height: 18px;
	transition: transform 0.25s var(--coa-ease);
}

.coa-lookup__submit:hover .coa-icon {
	transform: translateX(3px);
}

.coa-lookup .coa-lookup__hint {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 0 24px;
	font-size: 13px;
	color: var(--coa-text);
}

.coa-lookup__hint .coa-icon {
	width: 16px;
	height: 16px;
}

.coa-lookup .coa-lookup__trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 32px auto 0;
	padding: 0;
	list-style: none;
}

.coa-lookup .coa-lookup__trust-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px 15px;
	border: 1px solid var(--coa-line);
	border-radius: 99px;
	background: var(--coa-surface);
	font-size: 13px;
	color: var(--coa-ink);
}

.coa-lookup__trust-item .coa-icon {
	width: 16px;
	height: 16px;
	color: var(--coa-text);
}

/* ---------- results ---------- */

.coa-lookup__results {
	display: grid;
	gap: 20px;
}

.coa-lookup__results:empty {
	display: none;
}

.coa-lookup__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--coa-line);
}

.coa-lookup .coa-lookup__count {
	margin: 0;
	font-family: var(--coa-font-title);
	font-size: 22px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--coa-ink);
}

.coa-lookup .coa-lookup__note {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 13px;
	color: var(--coa-text);
}

.coa-lookup__note .coa-icon {
	width: 16px;
	height: 16px;
}

.coa-lookup .coa-lookup__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.coa-lookup .coa-lookup__item {
	margin: 0;
}

/* Preview + title side by side; the spec grid and the button span the card.
   .coa-result__body is flattened with display: contents so its children join
   this grid directly — no template change needed. */
.coa-result {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	grid-template-rows: auto auto 1fr;
	align-items: start;
	gap: 16px 18px;
	height: 100%;
	padding: 18px;
	background: var(--coa-surface);
	border: 1px solid var(--coa-line);
	border-radius: var(--coa-radius);
	transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s var(--coa-ease);
}

.coa-result:hover {
	border-color: var(--coa-line-strong);
	box-shadow: var(--coa-shadow);
	transform: translateY(-2px);
}

.coa-result__preview {
	padding: 14px 12px;
}

.coa-lookup .coa-result__preview .coa-card__placeholder {
	max-width: 100%;
}

.coa-result__body {
	display: contents;
}

.coa-result__head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	min-width: 0;
	padding-top: 4px;
}

.coa-lookup .coa-result .coa-facts,
.coa-result__actions {
	grid-column: 1 / -1;
}

.coa-lookup .coa-result__title {
	margin: 0;
	font-family: var(--coa-font-title);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--coa-ink);
}

.coa-result__sku {
	padding: 3px 9px;
	border-radius: 99px;
	background: var(--coa-soft);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--coa-text);
}

.coa-lookup .coa-result .coa-facts {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.coa-lookup .coa-result .coa-facts__cell {
	padding: 10px 12px;
}

.coa-lookup .coa-result .coa-facts__cell--wide {
	grid-column: 1 / -1;
}

.coa-lookup .coa-result .coa-facts__value {
	font-size: 14px;
}

.coa-result__actions {
	align-self: end;
}

.coa-lookup .coa-result .coa-view--primary {
	min-height: 42px;
	padding: 0 20px;
	font-size: 14px;
}

/* ---------- messages ---------- */

.coa-lookup__message {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
	padding: 20px 22px;
	border: 1px solid var(--coa-line);
	border-radius: var(--coa-radius);
	background: var(--coa-surface);
}

.coa-lookup__message-icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--coa-soft);
	color: var(--coa-ink);
}

.coa-lookup__message-icon .coa-icon {
	width: 21px;
	height: 21px;
}

.coa-lookup .coa-lookup__message-text p {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	color: var(--coa-ink);
}

.coa-lookup .coa-lookup__message-text .coa-lookup__message-sub {
	margin-top: 4px;
	font-size: 14px;
	font-weight: 400;
	color: var(--coa-text);
}

.coa-lookup__message--error {
	border-color: rgba(192, 57, 43, 0.3);
	background: var(--coa-err-soft);
}

.coa-lookup__message--error .coa-lookup__message-icon {
	background: var(--coa-surface);
	color: var(--coa-err);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.coa-lightbox {
	position: fixed;
	inset: 0;
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: transparent;
	color: #fff;
	font-family: var(--coa-font-text);
}

.coa-lightbox[open] {
	display: flex;
	flex-direction: column;
}

.coa-lightbox::backdrop {
	background: rgba(12, 12, 12, 0.88);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.coa-lightbox__bar {
	display: flex;
	flex: none;
	align-items: center;
	gap: 14px;
	padding: 14px clamp(14px, 3vw, 28px);
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.coa-lightbox__title {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-family: var(--coa-font-title);
	font-size: 15px;
	font-weight: 500;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.coa-lightbox__counter {
	flex: none;
	padding: 5px 12px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.1);
	font-size: 12px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.coa-lightbox__controls {
	display: flex;
	flex: none;
	gap: 8px;
}

.coa-lightbox .coa-lightbox__btn {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.24);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	box-shadow: none;
	color: #fff;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.coa-lightbox .coa-lightbox__btn:hover {
	border-color: #fff;
	background: #fff;
	color: #000;
}

.coa-lightbox .coa-lightbox__btn--close {
	border-color: #fff;
	background: #fff;
	color: #000;
}

.coa-lightbox .coa-lightbox__btn--close:hover {
	background: #dcdcdc;
}

.coa-lightbox .coa-lightbox__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.coa-lightbox .coa-lightbox__btn .coa-icon {
	width: 20px;
	height: 20px;
}

/* JS toggles [hidden] for single-page certificates; the display rules above
   would otherwise override the attribute. */
.coa-lightbox [hidden] {
	display: none !important;
}

.coa-lightbox__stage {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 6px clamp(12px, 3vw, 32px) 28px;
	overflow: auto;
}

.coa-lightbox .coa-lightbox__img {
	display: block;
	width: auto;
	max-width: min(100%, 1000px);
	height: auto;
	max-height: 100%;
	margin: auto;
	object-fit: contain;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
	animation: coa-pop 0.3s var(--coa-ease) both;
}

@keyframes coa-pop {
	from { opacity: 0; transform: scale(0.98) translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 767px) {
	.coa-card__main {
		grid-template-columns: 1fr;
		gap: 22px;
		padding: 20px;
	}

	.coa-card__strip {
		padding: 11px 20px;
	}

	.coa-card__preview {
		padding: 22px;
	}

	.coa-storefront .coa-view--thumb {
		max-width: 150px;
	}

	.coa-storefront .coa-card__actions .coa-view--primary {
		width: 100%;
	}

	.coa-storefront .coa-history__toggle {
		padding: 14px 18px;
	}

	.coa-storefront .coa-history__list {
		padding: 4px 12px 14px 18px;
	}

	.coa-storefront .coa-history__list::before {
		left: 22.5px;
	}

	.coa-row {
		padding: 12px 8px;
	}

	.coa-row__date {
		flex-basis: 100%;
		font-size: 12px;
	}

	.coa-row__lot {
		flex: 0 1 auto;
	}

	.coa-row__lab {
		flex-basis: 100%;
		order: 3;
	}

	.coa-lookup__controls {
		flex-direction: column;
		align-items: stretch;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: transparent;
		box-shadow: none;
	}

	.coa-lookup__controls:focus-within {
		box-shadow: none;
	}

	.coa-lookup__field {
		border: 1.5px solid var(--coa-field);
		border-radius: 99px;
		background: var(--coa-surface);
		transition: border-color 0.2s ease, box-shadow 0.2s ease;
	}

	.coa-lookup__field:focus-within {
		border-color: var(--prs-primary, var(--coa-primary));
		box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.07);
	}

	.coa-lookup .coa-lookup__submit {
		width: 100%;
		margin-top: 4px;
	}

	.coa-lookup .coa-lookup__label,
	.coa-lookup .coa-lookup__hint {
		margin-inline-start: 4px;
	}

	.coa-lookup__hint {
		align-items: flex-start;
	}

	.coa-lightbox[open] {
		flex-direction: column-reverse;
	}

	.coa-lightbox__bar {
		flex-wrap: wrap;
		padding-bottom: max(14px, env(safe-area-inset-bottom));
		background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
	}

	.coa-lightbox__title {
		flex-basis: 100%;
		order: -1;
		font-size: 14px;
	}

	.coa-lightbox__controls {
		margin-inline-start: auto;
	}

	.coa-lightbox__stage {
		padding: 16px 12px 4px;
	}
}

@media (max-width: 479px) {
	.coa-result {
		grid-template-columns: 84px minmax(0, 1fr);
		gap: 14px;
		padding: 14px;
	}

	.coa-result__preview {
		padding: 10px 8px;
	}

	.coa-lookup .coa-result .coa-view--primary {
		width: 100%;
	}

	.coa-lookup__message {
		padding: 16px;
	}
}

/* ==========================================================================
   Motion & print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.coa-storefront *,
	.coa-storefront *::before,
	.coa-storefront *::after,
	.coa-lookup *,
	.coa-lookup *::before,
	.coa-lookup *::after,
	.coa-lightbox * {
		animation: none !important;
		transition: none !important;
	}
}

@media print {
	/* Customers do print certificates — force the history list open. What
	   prints is the lot/date record; the scans only live in the lightbox. */
	.coa-history:not([open]) > .coa-history__list {
		display: block !important;
	}

	.coa-history::details-content {
		content-visibility: visible;
	}

	.coa-card,
	.coa-history,
	.coa-result {
		box-shadow: none;
	}

	.coa-card__strip {
		border-bottom: 1px solid #000;
		background: none;
		color: #000;
	}

	.coa-storefront__prompt,
	.coa-storefront__retry,
	.coa-storefront__lookup,
	.coa-history__icon,
	.coa-view--primary,
	.coa-view--link,
	.coa-view__zoom,
	.coa-lookup__form,
	.coa-lookup__trust,
	.coa-lightbox {
		display: none;
	}
}
