/*
 * Typing Practice Pro - certificate.
 *
 * Kept in its own file because the certificate appears on the certificates
 * page, inside the [typing_certificate] shortcode and in the result screen -
 * none of which reliably load the typing workspace stylesheet. See print.css
 * for the printed layout, which is the form most people will actually see.
 */

/* ==========================================================================
   Certificate
   ==========================================================================
   Designed to be printed. The scores are rendered as keycaps because that is
   the one motif unmistakably tied to a typing site, and it survives being
   reduced to black and white on a home printer. Colours are set with
   print-color-adjust so browsers do not strip the brand fills.
   ========================================================================== */

.tpp-certificate {
	padding: var(--tpp-space-5) var(--tpp-space-4);
	background: var(--tpp-bg-alt);
	border-radius: var(--tpp-radius);
	overflow-x: auto;
}

.tpp-cert {
	--cert-ink: #0f172a;
	--cert-muted: #64748b;
	--cert-line: #cbd5e1;

	position: relative;
	width: min(100%, 900px);
	margin-inline: auto;
	padding: clamp(1.75rem, 4vw, 3.25rem) clamp(1.25rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.5rem);
	background: #fff;
	color: var(--cert-ink);
	border: 1px solid var(--cert-line);
	border-top: 6px solid var(--tpp-primary);
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
	text-align: center;
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
}

/* Two opposing corner rules, rather than a full ornate frame. */
.tpp-cert-corner {
	position: absolute;
	width: 34px;
	height: 34px;
	border: 2px solid var(--tpp-primary);
}

.tpp-cert-corner-tl {
	top: 18px;
	left: 18px;
	border-right: 0;
	border-bottom: 0;
}

.tpp-cert-corner-br {
	right: 18px;
	bottom: 18px;
	border-left: 0;
	border-top: 0;
}

/* ---- Head ---------------------------------------------------------- */

.tpp-cert-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); }

.tpp-cert-logo {
	display: block;
	margin: 0 auto var(--tpp-space-3);
	max-height: 54px;
	width: auto;
}

.tpp-cert-site {
	margin: 0 0 var(--tpp-space-3);
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.28em;
	color: var(--cert-muted);
}

.tpp-cert-title {
	margin: 0;
	font-size: clamp(1.4rem, 3.6vw, 2.15rem);
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--cert-ink);
}

.tpp-cert-flourish {
	display: block;
	width: 64px;
	height: 3px;
	margin: var(--tpp-space-3) auto 0;
	background: var(--tpp-primary);
	border-radius: 2px;
}

/* ---- Recipient ------------------------------------------------------ */

.tpp-cert-presented,
.tpp-cert-statement {
	margin: 0;
	font-size: 0.95rem;
	color: var(--cert-muted);
}

.tpp-cert-statement {
	max-width: 54ch;
	margin: var(--tpp-space-2) auto 0;
	line-height: 1.6;
}

.tpp-cert-statement strong { color: var(--cert-ink); }

.tpp-cert-name {
	margin: var(--tpp-space-3) auto var(--tpp-space-4);
	padding: 0 var(--tpp-space-5) var(--tpp-space-3);
	display: inline-block;
	max-width: 90%;
	font-size: clamp(1.6rem, 4.5vw, 2.6rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
	border-bottom: 2px solid var(--cert-line);
	overflow-wrap: break-word;
}

/* ---- Score keycaps --------------------------------------------------- */

.tpp-cert-keys {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: clamp(0.75rem, 2vw, 1.5rem);
	list-style: none;
	margin: clamp(1.5rem, 3vw, 2.25rem) 0;
	padding: 0;
}

.tpp-cert-key {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.2rem;
	min-width: clamp(6rem, 15vw, 8.5rem);
	padding: var(--tpp-space-4) var(--tpp-space-3);
	background: #f8fafc;
	border: 1px solid var(--cert-line);
	/* The thicker bottom edge is what reads as a physical keycap. */
	border-bottom: 4px solid var(--tpp-primary);
	border-radius: 10px;
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
}

.tpp-cert-key b {
	font-family: var(--tpp-font-mono);
	font-size: clamp(1.5rem, 4vw, 2.2rem);
	font-weight: 700;
	line-height: 1;
	color: var(--tpp-primary);
	font-variant-numeric: tabular-nums;
}

.tpp-cert-key b i {
	font-style: normal;
	font-size: 0.6em;
}

.tpp-cert-key span {
	font-size: 0.66rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--cert-muted);
}

/* ---- Signature row ---------------------------------------------------- */

.tpp-cert-foot {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: end;
	gap: var(--tpp-space-4);
	margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.tpp-cert-block {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	padding-top: var(--tpp-space-2);
	border-top: 1px solid var(--cert-line);
	text-align: center;
}

.tpp-cert-value {
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--cert-ink);
}

.tpp-cert-caption {
	font-size: 0.64rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--cert-muted);
}

/* A keycap seal, matching the score tiles. */
.tpp-cert-seal-key {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	background: var(--tpp-primary);
	border-radius: 12px;
	box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
}

.tpp-cert-seal-mark {
	color: #fff;
	font-size: 1.7rem;
	line-height: 1;
}

/* ---- Verification ------------------------------------------------------ */

.tpp-cert-verify {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--tpp-space-2) var(--tpp-space-5);
	margin-top: clamp(1.25rem, 3vw, 2rem);
	padding-top: var(--tpp-space-4);
	border-top: 1px dashed var(--cert-line);
}

.tpp-cert-verify p {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	font-size: 0.72rem;
}

.tpp-cert-verify span {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--cert-muted);
	font-size: 0.6rem;
}

.tpp-cert-verify code {
	background: none;
	padding: 0;
	font-family: var(--tpp-font-mono);
	font-size: 0.78rem;
	letter-spacing: 0.06em;
	color: var(--cert-ink);
	overflow-wrap: anywhere;
}

.tpp-cert-disclaimer {
	max-width: 62ch;
	margin: var(--tpp-space-4) auto 0;
	font-size: 0.64rem;
	line-height: 1.5;
	color: var(--cert-muted);
}

@media (max-width: 520px) {
	.tpp-cert-foot { grid-template-columns: 1fr; justify-items: center; }
	.tpp-cert-block { width: min(100%, 16rem); }
}

