/*
 * The sign-up card.
 *
 * Louder than the rest of the plugin on purpose: this is the one screen whose
 * job is to persuade. The points are the biggest thing on it at every step.
 * Everything else inherits the host theme's typeface so the card still belongs
 * to the site it is dropped into.
 */

.cs-join {
	--csj-ink: #16181a;
	--csj-ink-2: #63666a;
	--csj-line: rgba(0, 0, 0, 0.12);
	--csj-surface: #ffffff;
	--csj-raised: #f6f6f7;
	--csj-accent: #16181a;
	--csj-on-accent: #ffffff;
	--csj-gold: #b8860b;
	--csj-good: #1c7a35;
	--csj-bad: #b3231b;

	max-width: 440px;
	margin: 0 auto;
	color: var(--csj-ink);
}

/* Matched to the page, not to the operating system — see shop.css for why. */
.cs-join[data-scheme="dark"] {
	--csj-ink: #f2f2f3;
	--csj-ink-2: #a1a4a8;
	--csj-line: rgba(255, 255, 255, 0.16);
	--csj-surface: #1b1c1e;
	--csj-raised: #232426;
	--csj-accent: #f2f2f3;
	--csj-on-accent: #16181a;
	--csj-gold: #e8b44a;
	--csj-good: #4ee06b;
	--csj-bad: #ff6961;
}

.cs-join *, .cs-join *::before, .cs-join *::after { box-sizing: border-box; }

.cs-join-boot { padding: 40px; text-align: center; color: var(--csj-ink-2); }

.cs-join-card {
	padding: 26px 24px 22px;
	border: 1px solid var(--csj-line);
	border-radius: 16px;
	background: var(--csj-surface);
	box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.5);
}

.cs-join-card h2 { margin: 0 0 6px; font-size: 24px; }

.cs-join-lede {
	margin: 0 0 18px;
	color: var(--csj-ink-2);
	font-size: 15px;
	line-height: 1.5;
}

/* ------------------------------------------------------------- progress */

.cs-join-steps {
	display: flex;
	gap: 6px;
	margin-bottom: 16px;
}

.cs-join-steps span {
	flex: 1;
	height: 26px;
	border-radius: 999px;
	background: var(--csj-raised);
	color: var(--csj-ink-2);
	font-size: 12px;
	font-weight: 600;
	line-height: 26px;
	text-align: center;
}

.cs-join-steps .is-on {
	background: var(--csj-accent);
	color: var(--csj-on-accent);
}

.cs-join-steps .is-done {
	background: var(--csj-good);
	color: #fff;
}

/* -------------------------------------------------------------- rewards */

.cs-join-rewards {
	display: flex;
	gap: 10px;
	margin-bottom: 18px;
}

.cs-join-reward {
	flex: 1;
	padding: 12px 10px;
	border-radius: 12px;
	background: var(--csj-raised);
	text-align: center;
}

.cs-join-reward-n {
	display: block;
	font-size: 22px;
	font-weight: 700;
	color: var(--csj-gold);
	/* Tabular figures so 200 and 50 line up rather than dancing. */
	font-variant-numeric: tabular-nums;
}

.cs-join-reward-l {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--csj-ink-2);
}

/* --------------------------------------------------------------- fields */

.cs-join-field { display: block; margin-bottom: 12px; }

.cs-join-field > span {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	color: var(--csj-ink-2);
}

.cs-join-field input {
	width: 100%;
	padding: 13px 14px;
	border: 1px solid var(--csj-line);
	border-radius: 10px;
	background: var(--csj-surface);
	color: var(--csj-ink);
	font: inherit;
	/* 16px stops iOS Safari zooming the page on focus and leaving it scrolled
	   sideways with the button off-screen. */
	font-size: 16px;
}

.cs-join-field input:focus,
.cs-join-code:focus {
	outline: 2px solid var(--csj-accent);
	outline-offset: 1px;
}

.cs-join-code {
	display: block;
	width: 100%;
	margin: 6px 0 4px;
	padding: 16px;
	border: 1px solid var(--csj-line);
	border-radius: 12px;
	background: var(--csj-surface);
	color: var(--csj-ink);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 30px;
	font-weight: 700;
	letter-spacing: 0.32em;
	/* The trailing letter-space would otherwise push the digits left of centre. */
	text-indent: 0.32em;
	text-align: center;
}

/* -------------------------------------------------------------- buttons */

.cs-join-btn {
	display: inline-block;
	padding: 14px 20px;
	border: 0;
	border-radius: 11px;
	background: var(--csj-accent);
	color: var(--csj-on-accent);
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.cs-join-go { display: block; width: 100%; margin-top: 6px; }
.cs-join-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/*
 * The sign-in button usually sits next to the join button, and two buttons
 * shouting the same volume make neither of them a choice. This one is outlined:
 * clearly a button, clearly the second one.
 */
.cs-join-btn.is-quiet {
	background: transparent;
	color: var(--csj-ink);
	box-shadow: inset 0 0 0 1.5px var(--csj-line);
}

.cs-join-btn.is-quiet:hover { box-shadow: inset 0 0 0 1.5px var(--csj-accent); }

.cs-join-link {
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	color: var(--csj-ink-2);
	text-decoration: underline;
	cursor: pointer;
}

.cs-join-fine {
	margin: 14px 0 0;
	font-size: 13px;
	color: var(--csj-ink-2);
	line-height: 1.5;
}

.cs-join-alert {
	margin-bottom: 14px;
	padding: 11px 13px;
	border-radius: 10px;
	background: rgba(179, 35, 27, 0.1);
	color: var(--csj-bad);
	font-size: 14px;
}

/* Not every "no" is a mistake. "We have not met yet — join here" is a signpost,
   and red would read as a scolding for something the customer did right. */
.cs-join-alert.is-info {
	background: rgba(127, 127, 127, 0.13);
	color: var(--csj-ink);
}

/* ----------------------------------------------------------------- done */

.cs-join-done { text-align: center; }

.cs-join-pop {
	font-size: 46px;
	line-height: 1;
	margin: 4px 0 6px;
}

@media (prefers-reduced-motion: no-preference) {
	.cs-join-pop { animation: csj-pop 520ms cubic-bezier(0.2, 1.4, 0.4, 1); }
	.cs-join-bigpoints { animation: csj-rise 480ms 120ms both ease-out; }
}

@keyframes csj-pop {
	from { transform: scale(0.3) rotate(-14deg); opacity: 0; }
	to   { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes csj-rise {
	from { transform: translateY(10px); opacity: 0; }
	to   { transform: translateY(0); opacity: 1; }
}

.cs-join-bigpoints {
	margin: 6px 0 12px;
	font-size: 46px;
	font-weight: 800;
	line-height: 1;
	color: var(--csj-gold);
	font-variant-numeric: tabular-nums;
}

.cs-join-bigpoints span {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--csj-ink-2);
}

.cs-join-already {
	padding: 20px;
	border-radius: 14px;
	background: var(--csj-raised);
	text-align: center;
}

.cs-join-already p { margin: 0 0 12px; }
