:root {
	--ink: #141820;
	--gold: #a68942;
	--line: #ddd;
	--muted: #666;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Source Sans Pro", sans-serif;
	color: var(--ink);
	background: #f4f2ee;
	overflow-x: hidden;
	max-width: 100%;
}

.cert {
	background: #fff;
	margin: 1rem auto;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
	max-width: 100%;
}

.cert-head {
	text-align: center;
	padding: 1.5rem 1rem 1rem;
	border-bottom: 2px solid var(--gold);
}

.cert-head h1 {
	margin: 0;
	font-family: "Playfair Display", serif;
	font-size: 1.35rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.cert-trust {
	margin: 0.25rem 0 0;
	font-size: 0.55rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	line-height: 1.35;
	color: rgba(160, 130, 70, 0.72);
}

.cert-brand-link {
	color: inherit;
	text-decoration: none;
}

.cert-brand-link:hover {
	color: var(--gold);
}

.cert-head p {
	margin: 0.35rem 0 0;
	font-size: 0.75rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--muted);
}

.cert-body {
	padding: 1.25rem 1.5rem 2rem;
}

.cert-grid {
	display: grid;
	grid-template-columns: 180px 1fr;
	gap: 1.5rem;
	align-items: start;
}

.cert-photo img {
	width: 100%;
	max-width: 180px;
	border: 1px solid var(--line);
}

.cert-photo-multi {
	display: grid;
	gap: 0.5rem;
}

.cert-photo-multi img {
	width: 100%;
	max-width: 180px;
	display: block;
}

.cert-gallery {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	width: 100%;
	max-width: 180px;
}

.cert-gallery-main {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	margin: 0;
	line-height: 0;
	border: 1px solid var(--line);
	background: #faf8f4;
	cursor: zoom-in;
	overflow: hidden;
}

.cert-included-mark {
	display: inline-block;
	margin: 0 0 0.75rem;
	padding: 0.4rem 0.7rem;
	background: #c9ad72;
	border: 1px solid #b89a5c;
	color: #111;
	font-family: "Source Sans Pro", sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.25;
}

.cert-included-mark.is-online {
	background: transparent;
	border: 1px solid var(--line);
	color: #666;
	font-weight: 600;
}

.cert-gallery-main-img,
.cert-gallery-main img {
	width: 100%;
	height: 100%;
	max-width: none !important;
	display: block;
	object-fit: cover;
	object-position: center;
	border: 0;
	aspect-ratio: auto;
}

.cert-gallery-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
	gap: 0.3rem;
}

.cert-gallery-thumb {
	display: block;
	padding: 0;
	margin: 0;
	line-height: 0;
	border: 1px solid var(--line);
	background: #faf8f4;
	cursor: zoom-in;
	overflow: hidden;
	aspect-ratio: 1 / 1;
}

.cert-gallery-thumb.is-on,
.cert-gallery-thumb:hover {
	border-color: var(--gold);
}

.cert-gallery-thumb img {
	width: 100%;
	height: 100%;
	max-width: none !important;
	object-fit: cover;
	object-position: center;
	display: block;
	border: 0;
}

.cert-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	background: rgba(0, 0, 0, 0.88);
	cursor: zoom-out;
}

.cert-lightbox[hidden] {
	display: none !important;
}

.cert-lightbox img {
	max-width: min(96vw, 920px);
	max-height: 90vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid rgba(201, 173, 114, 0.45);
	cursor: default;
}

.cert-lightbox-close {
	position: absolute;
	top: 0.75rem;
	right: 0.9rem;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
}

.cert-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	border: 0;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 999px;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cert-lightbox-prev {
	left: 0.6rem;
}

.cert-lightbox-next {
	right: 0.6rem;
}

.cert-lightbox-nav[hidden] {
	display: none !important;
}

body.cert-lightbox-open {
	overflow: hidden;
}

.weight-toggle {
	display: inline;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-decoration-color: rgba(166, 137, 66, 0.55);
	text-underline-offset: 0.18em;
}

.weight-toggle:hover,
.weight-toggle:focus-visible {
	color: var(--gold, #a68942);
	text-decoration-color: currentColor;
	outline: none;
}

button.kog-price,
.kog-price {
	display: inline;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-decoration: none;
}

.kog-price-wrap {
	display: inline-flex;
	flex-wrap: nowrap;
	align-items: baseline;
	gap: 0.35em 0.75em;
	max-width: 100%;
}

.kog-price-wrap .kog-price,
.kog-price-wrap button.kog-price {
	display: inline;
	width: auto;
	white-space: nowrap;
}

.kog-price-old,
button.kog-price.kog-price-old,
.kog-price-wrap .kog-price-old {
	color: #c62828 !important;
	text-decoration: line-through !important;
	opacity: 0.95;
}

.kog-price-sale,
button.kog-price.kog-price-sale,
.kog-price-wrap .kog-price-sale {
	color: #2e7d32 !important;
	font-weight: 600;
	text-decoration: none !important;
}

.kog-price-wrap .kog-price-old:hover,
.kog-price-wrap .kog-price-old:focus-visible,
button.kog-price.kog-price-old:hover,
button.kog-price.kog-price-old:focus-visible {
	color: #b71c1c !important;
	text-decoration: line-through !important;
}

.kog-price-wrap .kog-price-sale:hover,
.kog-price-wrap .kog-price-sale:focus-visible,
button.kog-price.kog-price-sale:hover,
button.kog-price.kog-price-sale:focus-visible {
	color: #1b5e20 !important;
	text-decoration: none !important;
}

.kog-price:hover,
.kog-price:focus-visible {
	color: inherit;
	text-decoration: none;
	outline: none;
}

@media print {
	.weight-toggle,
	.kog-price {
		text-decoration: none;
		cursor: default;
		color: inherit;
	}
}

.cert-photo--text {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
}

.cert-text-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 180px;
	min-height: 120px;
	padding: 1rem;
	border: 1px solid var(--line);
	background: #faf8f4;
	font-family: "Playfair Display", serif;
	font-size: 1.15rem;
	font-weight: 500;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	color: var(--gold);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	overflow-wrap: anywhere;
}

a.cert-text-logo:hover {
	color: var(--ink);
}

.cert-table {
	width: 100%;
	border-collapse: collapse;
}

.cert-table th,
.cert-table td {
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--line);
	font-size: 0.92rem;
	text-align: left;
	vertical-align: top;
}

.cert-table th {
	width: 38%;
	background: #faf8f4;
	font-weight: 600;
}

.cert-note {
	margin: 1.25rem 0 0;
	font-size: 0.82rem;
	line-height: 1.55;
	color: var(--muted);
}

.cert-legal {
	margin: 1.25rem 0 0;
	padding: 0;
	width: 100%;
	font-size: 0.78rem;
	line-height: 1.55;
	color: var(--muted);
	text-align: justify;
}

.cert-legal p {
	margin: 0 0 0.65rem;
}

.cert-foot:empty {
	display: none;
}

.cert-foot {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: start;
	gap: 0;
	width: 100%;
	margin: 1.5rem 0 0;
	padding: 0.55rem 0;
	border: 0;
	background: #f2f2f2;
	font-size: 0.65rem;
	line-height: 1.45;
	color: #222;
}

.cert-foot p {
	margin: 0;
	min-width: 0;
	padding: 0 0.65rem;
	overflow-wrap: anywhere;
	word-break: break-word;
	text-align: left;
}

.cert-foot p:last-child {
	text-align: right;
	border-left: 1px solid #bbb;
}

.cert-foot a,
.cert-foot a:visited,
.cert-foot a:hover,
.cert-foot a:active {
	color: inherit;
	text-decoration: none;
}

.cert-actions {
	text-align: center;
	padding: 1rem;
}

.cert-back {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem 1.25rem;
	margin: 0.75rem 0 0;
	padding: 0 1rem;
}

.lang-switch {
	display: inline-flex;
	align-items: center;
}

.lang-switch a,
.lang-switch-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4rem;
	padding: 0.3rem 0.55rem;
	border: 1px solid var(--line);
	color: var(--gold);
	font-size: 0.72rem;
	font-weight: 600;
	text-decoration: none;
}

.lang-switch a.is-on,
.lang-switch-toggle.is-on {
	border-color: var(--gold);
	color: var(--gold);
}

html[lang="ar"] body {
	font-family: "Cairo", "Source Sans Pro", sans-serif;
}

html[lang="ar"] .cert-back a,
html[lang="ar"] .cert-print-btn,
html[lang="ar"] .cert-add-cart,
html[lang="ar"] .cert-share-copy,
html[lang="ar"] .cert-share-wa,
html[lang="ar"] .cert-sub {
	letter-spacing: 0;
	text-transform: none;
}

.cert-back a {
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--muted);
	text-decoration: none;
}

.cert-back a:hover {
	color: var(--gold);
}

.cert-id-text,
.cert-id-text a,
a.cert-id-text {
	color: inherit !important;
	text-decoration: none !important;
	pointer-events: none;
}

.cert-no {
	margin: 0 0 0.85rem;
}

.cert-actions a,
.cert-actions button {
	display: inline-block;
	margin: 0.25rem;
	padding: 0.55rem 1rem;
	border: 1px solid var(--gold);
	background: #fff;
	color: var(--ink);
	text-decoration: none;
	font: inherit;
	font-size: 0.75rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.cert-add-cart.is-added {
	background: rgba(201, 173, 114, 0.12);
}

.nav-count {
	font-weight: 700;
	margin-left: 2px;
}

.admin-cert-bar {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
	padding: 8px 12px;
	background: #333;
	font-size: 12px;
}

.admin-cert-bar a {
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.cert-queue-msg {
	text-align: center;
	margin: 0.5rem 0 0;
	font-size: 0.8rem;
	font-weight: 600;
	color: #1b7a3d;
}

.cert-queue-err {
	color: #a11;
}

.cert-share-wa {
	background: rgba(37, 211, 102, 0.12);
	border-color: rgba(37, 211, 102, 0.45);
}

.cert-natural .cert-head {
	border-bottom-color: #2e7d32;
}

.cert-natural .cert-origin-tag {
	color: #1b5e20;
	background: rgba(46, 125, 50, 0.14);
	font-weight: 600;
}

.cert-synthetic .cert-head {
	border-bottom-color: #c62828;
}

.cert-synthetic .cert-origin-tag {
	color: #b71c1c;
	background: rgba(198, 40, 40, 0.14);
	font-weight: 600;
}

.cert-actions a.is-active {
	background: rgba(166, 137, 66, 0.15);
}

.cert--report {
	display: flex;
	flex-direction: column;
	max-width: 210mm;
	min-height: 297mm;
}

.cert--report .cert-body {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.cert--report .cert-foot {
	margin-top: auto;
}

.cert--card {
	width: 85.6mm;
	height: 53.98mm;
	padding: 4mm;
	margin: 1rem auto;
	overflow: hidden;
}

.cert--card .cert-head {
	padding: 0;
	border: 0;
	text-align: left;
}

.cert--card .cert-head h1 {
	font-size: 0.58rem;
}

.cert--card .cert-head p {
	font-size: 0.48rem;
}

.cert--card .cert-grid {
	grid-template-columns: 18mm 1fr;
	gap: 3mm;
}

.cert--card .cert-photo img {
	max-width: 18mm;
}

.cert--card .cert-table th,
.cert--card .cert-table td {
	padding: 0.15rem 0.25rem;
	font-size: 0.48rem;
}

.cert--card .cert-table th {
	width: 42%;
}

.cert--card .cert-note,
.cert--card .cert-legal,
.cert--card .cert-foot,
.cert--card .cert-actions {
	display: none;
}

.cert--auth {
	max-width: 210mm;
	min-height: 180mm;
}

.cert--auth .cert-badge {
	font-size: 1.5rem;
	margin: 0 0 0.5rem;
}

.cert--auth .cert-lead {
	margin: 0 0 1.25rem;
	font-size: 1rem;
}

.cert--auth .cert-grid {
	grid-template-columns: 1fr;
	justify-items: center;
}

.cert--auth .cert-photo img {
	max-width: 280px;
}

.cert--auth .cert-gallery {
	max-width: 280px;
}

.cert--auth .cert-table {
	max-width: 420px;
	margin: 1rem auto 0;
}

.cert--auth .cert-table td {
	text-align: center;
}

@media (max-width: 768px) {
	.cert {
		margin: 0;
		width: 100%;
	}

	.cert--report,
	.cert--auth {
		max-width: 100%;
		width: 100%;
		min-height: auto;
	}

	.cert--report .cert-foot {
		margin-top: 1.5rem;
	}

	.cert-head h1 {
		font-size: 1.05rem;
		overflow-wrap: break-word;
	}

	.cert-body {
		padding: 1rem;
	}

	.cert-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.cert-photo {
		text-align: center;
	}

	.cert-gallery {
		max-width: min(100%, 280px);
		margin: 0 auto;
	}

	.cert-gallery .cert-gallery-main-img,
	.cert-gallery .cert-gallery-main img,
	.cert-gallery .cert-gallery-thumb img {
		max-width: none !important;
		width: 100%;
		height: 100%;
	}

	.cert-photo img {
		max-width: min(100%, 220px);
	}

	.cert-table {
		table-layout: fixed;
	}

	.cert-table th,
	.cert-table td {
		font-size: 0.78rem;
		padding: 0.35rem;
		overflow-wrap: break-word;
	}

	.cert-actions {
		padding: 0.75rem;
	}

	.cert-actions a,
	.cert-actions button {
		display: block;
		width: 100%;
		margin: 0.3rem 0;
		text-align: center;
		box-sizing: border-box;
	}

	.cert-foot {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 0;
		font-size: 0.52rem;
		line-height: 1.4;
	}

	.cert-foot p {
		padding: 0 0.45rem;
	}

	.cert--card {
		width: 100%;
		max-width: 100%;
		height: auto;
		padding: 1rem;
	}

	.cert--auth .cert-badge {
		font-size: 1.15rem;
	}

	.cert--auth .cert-photo img {
		max-width: min(100%, 220px);
	}
}

@media print {
	body {
		background: #fff;
	}

	.cert-actions,
	.cert-back,
	.cert-print-btn,
	.cert-queue-form,
	.cert-queue-msg,
	.admin-cert-bar,
	.thermal-screen-actions {
		display: none !important;
	}

	.cert {
		margin: 0;
		box-shadow: none;
	}

	.cert--report,
	.cert--auth {
		width: 210mm;
		max-width: none;
		min-height: auto;
		page-break-after: avoid;
	}

	.cert--card {
		width: 85.6mm;
		height: 53.98mm;
		margin: 0;
		page-break-after: avoid;
	}

	@page {
		size: A4;
		margin: 10mm;
	}

	body.print-card {
		page: card;
	}

	body.print-thermal {
		page: thermal;
	}
}

@page card {
	size: 85.6mm 53.98mm;
	margin: 0;
}

@page thermal {
	size: 90mm 297mm;
	margin: 0;
}
