/**
 * ClosetPay, customer facing. "Soft Luxe".
 *
 * Warm greige, generous curves, one sage accent, no serif anywhere. Calm and
 * modern rather than formal, and easy on a phone, which is where most of these
 * payments happen.
 *
 * The payment panel is served without the theme, so nothing here may lean on
 * theme CSS being present. No web fonts either: the page loads from the shop's
 * own server and asks no one else for anything, which is the whole point of the
 * plugin, so the type is built from faces every machine already has.
 *
 * One rule is not negotiable: the QR stays black on white, whatever the design
 * does around it, or scanners start refusing it.
 */

.closetpay-body,
.closetpay-overlay {
	--cp-ink: #2c2a26;
	--cp-ink-soft: #4f4a42;
	--cp-muted: #857f76;
	--cp-surface: #fffdfb;
	--cp-sand: #f2ede6;
	--cp-sand-deep: #e9e2d8;
	--cp-line: #e6dfd5;
	--cp-accent: #6b7259;
	--cp-accent-ink: #565c47;
	--cp-accent-soft: #eef0e9;
	--cp-warn-bg: #fdf6e9;
	--cp-warn-ink: #7a5f22;
	--cp-warn-line: #d8b877;
	--cp-good: #4a7a5c;
	--cp-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--cp-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.closetpay-body {
	margin: 0;
	background: var(--cp-sand);
	color: var(--cp-ink);
	font-family: var(--cp-sans);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

.cp-wrap {
	max-width: 520px;
	margin: 0 auto;
	padding: 26px 18px 48px;
}

/* the band across the top */

.cp-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 15px 20px;
	background: var(--cp-sand);
	border-radius: 18px 18px 0 0;
}

.cp-logo { max-height: 30px; width: auto; }

.cp-brand { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }

.cp-order { font-size: 11.5px; color: var(--cp-muted); }

.cp-card {
	background: var(--cp-surface);
	border-radius: 0 0 18px 18px;
	padding: 24px 20px 22px;
	box-shadow: 0 14px 34px rgba(44, 42, 38, .1);
}

/* type */

.cp-title {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -.02em;
	margin: 0 0 5px;
}

.cp-lead {
	margin: 0 0 18px;
	color: var(--cp-muted);
	font-size: 13.5px;
}

.cp-eyebrow {
	display: block;
	font-size: 11.5px;
	color: var(--cp-muted);
	margin-bottom: 6px;
}

.cp-chip {
	display: inline-block;
	margin-right: 8px;
	padding: 4px 11px;
	border-radius: 999px;
	background: var(--cp-accent-soft);
	color: var(--cp-accent);
	font-size: 11px;
	font-weight: 600;
}

.cp-error {
	margin: 0 0 16px;
	padding: 12px 14px;
	background: #fdf0ee;
	border-radius: 12px;
	color: #8a3b32;
	font-size: 13.5px;
}

/* choosing a coin */

.cp-nets { display: flex; flex-direction: column; gap: 9px; }

.cp-net {
	display: flex;
	align-items: center;
	gap: 13px;
	width: 100%;
	padding: 14px 15px;
	border: 1px solid var(--cp-line);
	border-radius: 14px;
	background: var(--cp-surface);
	text-align: left;
	font: inherit;
	color: var(--cp-ink);
	cursor: pointer;
	transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.cp-net:hover,
.cp-net:focus-visible {
	border-color: var(--cp-accent);
	background: var(--cp-accent-soft);
	transform: translateY(-1px);
	outline: none;
}

.cp-net.is-busy { opacity: .55; cursor: progress; transform: none; }

.cp-net-icon { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; max-width: none; }

.cp-net-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.cp-net-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cp-net-label { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }

.cp-net-chip {
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--cp-accent-soft);
	color: var(--cp-accent);
	font-size: 10.5px;
	font-weight: 600;
}

.cp-net-note { font-size: 12px; line-height: 1.45; color: var(--cp-muted); }

.cp-net-go { flex: 0 0 auto; color: var(--cp-accent); font-size: 19px; line-height: 1; }

/* the amount */

.cp-amount-block { padding: 2px 0 16px; }

.cp-amount { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }

.cp-amount-icon { width: 34px; height: 34px; border-radius: 50%; max-width: none; }

.cp-amount-value {
	font-size: 33px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.025em;
	font-variant-numeric: tabular-nums;
	word-break: break-all;
}

.cp-amount-asset {
	font-size: 12px;
	font-weight: 600;
	color: var(--cp-muted);
	align-self: flex-end;
	padding-bottom: 6px;
}

.cp-network { margin: 13px 0 0; font-size: 13px; color: var(--cp-muted); }

/* the address */

.cp-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 15px;
	margin-bottom: 10px;
	background: var(--cp-sand);
	border-radius: 12px;
}

.cp-row-label { flex: 0 0 58px; font-size: 11.5px; color: var(--cp-muted); }

.cp-row-value {
	flex: 1 1 auto;
	min-width: 0;
	font-family: var(--cp-mono);
	font-size: 12.5px;
	line-height: 1.5;
	word-break: break-all;
	color: var(--cp-ink);
}

.cp-copy {
	flex: 0 0 auto;
	padding: 8px 15px;
	border: 0;
	border-radius: 999px;
	background: var(--cp-accent-soft);
	color: var(--cp-accent);
	font: inherit;
	font-size: 11.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.cp-copy:hover { background: var(--cp-accent); color: #fff; }
.cp-copy.is-done { background: var(--cp-accent); color: #fff; }

.cp-copy-amount { align-self: flex-end; margin-bottom: 5px; margin-left: auto; }

/* the code, on its own white tile so every scanner is happy */

.cp-qr { margin: 16px 0 0; text-align: center; }

.cp-qr-img {
	display: inline-block;
	padding: 16px;
	background: #fff;
	border-radius: 16px;
	line-height: 0;
	box-shadow: 0 6px 18px rgba(44, 42, 38, .08);
}

.cp-qr svg { width: 180px; height: 180px; background: #fff; display: block; }

.cp-qr-note { margin: 10px 0 0; font-size: 12px; color: var(--cp-muted); }

.cp-warn {
	margin: 16px 0 0;
	padding: 12px 14px;
	background: var(--cp-warn-bg);
	border-radius: 12px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--cp-warn-ink);
}

/* waiting */

.cp-status {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 14px 0 0;
	padding: 13px 15px;
	background: var(--cp-accent-soft);
	border-radius: 12px;
	font-size: 13px;
	color: var(--cp-accent-ink);
}

.cp-dot {
	flex: 0 0 8px;
	width: 8px;
	height: 8px;
	margin-top: 5px;
	border-radius: 50%;
	background: var(--cp-accent);
	animation: cp-pulse 1.8s ease-in-out infinite;
}

.cp-dot.is-pending,
.cp-dot.is-partial { background: var(--cp-warn-line); }

@keyframes cp-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: .35; transform: scale(.85); }
}

.cp-timer {
	height: 4px;
	margin: 12px 0 0;
	background: var(--cp-sand);
	border-radius: 999px;
	overflow: hidden;
}

.cp-timer-bar {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--cp-accent);
	border-radius: 999px;
	transition: width 1s linear;
}

.cp-meta {
	margin: 8px 0 0;
	font-size: 11.5px;
	color: var(--cp-muted);
	font-variant-numeric: tabular-nums;
}

.cp-link {
	display: inline-block;
	margin: 16px 0 0;
	padding: 8px 15px;
	border: 1px solid var(--cp-line);
	border-radius: 999px;
	background: none;
	color: var(--cp-muted);
	font: inherit;
	font-size: 12.5px;
	text-decoration: none;
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease;
}

.cp-link:hover { border-color: var(--cp-accent); color: var(--cp-accent); }

/* paid */

.cp-paid { text-align: center; padding: 8px 0 4px; }

.cp-tick {
	width: 58px;
	height: 58px;
	margin: 0 auto 16px;
	border-radius: 50%;
	background: var(--cp-accent-soft);
	color: var(--cp-good);
	font-size: 26px;
	line-height: 58px;
}

.cp-paid .cp-title { font-size: 24px; }

.cp-button {
	display: inline-block;
	margin: 10px 0 0;
	padding: 13px 26px;
	background: var(--cp-accent);
	color: #fff;
	border-radius: 999px;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
}

.cp-foot {
	margin: 16px 0 0;
	font-size: 12.5px;
	color: var(--cp-muted);
	text-align: center;
}

.cp-foot a { color: var(--cp-accent); }

@media (prefers-reduced-motion: reduce) {
	.cp-dot { animation: none; }
	.cp-net, .cp-timer-bar, .cp-copy { transition: none; }
}

@media (max-width: 480px) {
	.cp-card { padding: 20px 16px 18px; }
	.cp-amount-value { font-size: 28px; }
	.cp-row { flex-wrap: wrap; }
	.cp-row-label { flex-basis: 100%; }
}

/* ------------------------------------------------- the panel over a checkout */

.closetpay-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px;
	background: rgba(44, 42, 38, .45);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	overflow-y: auto;
	animation: cp-fade .22s ease-out;
}

@keyframes cp-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.closetpay-panel {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--cp-surface);
	border-radius: 20px;
	box-shadow: 0 26px 60px rgba(44, 42, 38, .3);
	animation: cp-rise .26s cubic-bezier(.2, .7, .3, 1);
}

/* dvh where it exists, so a phone's shrinking toolbar does not clip the panel */
@supports (max-height: 100dvh) {
	.closetpay-panel { max-height: calc(100dvh - 40px); }
}

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

.closetpay-close {
	position: absolute !important;
	top: 10px !important;
	right: 10px !important;
	left: auto !important;
	bottom: auto !important;
	z-index: 3;
	display: flex !important;
	align-items: center;
	justify-content: center;
	float: none !important;
	width: 32px !important;
	height: 32px !important;
	min-width: 0 !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba(44, 42, 38, .09);
	color: var(--cp-ink);
	font-family: var(--cp-sans);
	font-size: 18px;
	line-height: 1;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}

.closetpay-close:hover {
	background: rgba(44, 42, 38, .18);
	transform: rotate(90deg);
}

.closetpay-frame {
	display: block;
	flex: 1 1 auto;
	width: 100%;
	height: 560px;
	min-height: 0;
	border: 0;
	border-radius: 20px;
}

body.closetpay-open { overflow: hidden; }

@media (max-width: 560px) {
	.closetpay-overlay { padding: 8px; }
	.closetpay-panel { max-height: calc(100vh - 16px); border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.closetpay-overlay, .closetpay-panel { animation: none; }
	.closetpay-close:hover { transform: none; }
}

/* the same page when it is shown inside that panel */

.closetpay-body.is-embedded { background: var(--cp-surface); }

.closetpay-body.is-embedded .cp-wrap { padding: 0; max-width: none; }

.closetpay-body.is-embedded .cp-head { border-radius: 16px 16px 0 0; }

.closetpay-body.is-embedded .cp-card {
	border-radius: 0;
	box-shadow: none;
	padding: 16px 16px 12px;
}

/* Everything below keeps the type at full size and buys the height back from
   spacing instead, so the whole panel fits a laptop screen without scrolling. */
.closetpay-body.is-embedded .cp-head { border-radius: 0; padding: 12px 52px 12px 16px; }
.closetpay-body.is-embedded .cp-title { font-size: 21px; margin-bottom: 3px; }
.closetpay-body.is-embedded .cp-lead { margin-bottom: 11px; }
.closetpay-body.is-embedded .cp-nets { gap: 6px; }
.closetpay-body.is-embedded .cp-net { padding: 9px 12px; gap: 11px; }
.closetpay-body.is-embedded .cp-net-note { font-size: 11.5px; line-height: 1.35; }
.closetpay-body.is-embedded .cp-amount-block { padding: 0 0 12px; }
.closetpay-body.is-embedded .cp-network { margin-top: 10px; }
.closetpay-body.is-embedded .cp-row { padding: 11px 13px; margin-bottom: 0; }
.closetpay-body.is-embedded .cp-qr { margin-top: 12px; }
.closetpay-body.is-embedded .cp-qr-img { padding: 11px; border-radius: 14px; }
.closetpay-body.is-embedded .cp-qr svg { width: 148px; height: 148px; }
.closetpay-body.is-embedded .cp-qr-note { margin-top: 7px; }
.closetpay-body.is-embedded .cp-warn { margin-top: 12px; padding: 10px 12px; }
.closetpay-body.is-embedded .cp-status { margin-top: 10px; padding: 11px 13px; }
.closetpay-body.is-embedded .cp-timer { margin-top: 9px; }
.closetpay-body.is-embedded .cp-link { margin-top: 12px; padding: 7px 14px; }

/* On a short screen the payment step is the tall one, so the code and the gaps
   give way first. The type never shrinks.
   These key off a class the checkout sets from the real window height, not off
   a media query, because the frame is sized to this page and a query on its own
   height would chase itself smaller and smaller. */
.closetpay-body.is-tight .cp-card { padding: 14px 16px 10px; }
.closetpay-body.is-tight .cp-amount-block { padding-bottom: 9px; }
.closetpay-body.is-tight .cp-network { margin-top: 8px; }
.closetpay-body.is-tight .cp-qr { margin-top: 9px; }
.closetpay-body.is-tight .cp-qr-img { padding: 9px; border-radius: 12px; }
.closetpay-body.is-tight .cp-qr svg { width: 118px; height: 118px; }
.closetpay-body.is-tight .cp-qr-note { display: none; }
.closetpay-body.is-tight .cp-warn { margin-top: 9px; padding: 8px 11px; }
.closetpay-body.is-tight .cp-status { margin-top: 8px; padding: 9px 12px; }
.closetpay-body.is-tight .cp-timer { margin-top: 7px; }
.closetpay-body.is-tight .cp-meta { margin-top: 5px; }
.closetpay-body.is-tight .cp-link { margin-top: 9px; }
.closetpay-body.is-tight .cp-row { padding: 9px 12px; }

/* The warning stays even here. It is the line that stops someone sending the
   wrong coin, so the room comes out of the code and the gaps instead. */
.closetpay-body.is-tighter .cp-qr svg { width: 88px; height: 88px; }
.closetpay-body.is-tighter .cp-qr-img { padding: 7px; border-radius: 10px; }
.closetpay-body.is-tighter .cp-qr { margin-top: 7px; }
.closetpay-body.is-tighter .cp-warn { margin-top: 7px; padding: 7px 10px; }
.closetpay-body.is-tighter .cp-status { margin-top: 6px; padding: 8px 11px; }
.closetpay-body.is-tighter .cp-timer { margin-top: 6px; }
.closetpay-body.is-tighter .cp-link { margin-top: 7px; }
.closetpay-body.is-tighter .cp-card { padding: 12px 14px 9px; }
.closetpay-body.is-tighter .cp-nets { gap: 5px; }
.closetpay-body.is-tighter .cp-net { padding: 8px 11px; }

/* ------------------------------------------- coin badges beside the checkout */

.closetpay-icons {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: 8px;
	vertical-align: middle;
}

.closetpay-icons img {
	width: 20px;
	height: 20px;
	max-width: none;
	box-shadow: none;
	border: 0;
	border-radius: 50%;
	display: inline-block;
}

.closetpay-label { display: inline-flex; align-items: center; }

/* the shop-side badge */

.closetpay-badge {
	margin: 0 0 14px;
	font-size: 14px;
	color: #857f76;
}

.closetpay-badge strong { color: #2c2a26; }
