/*
 * Affiliate program pages.
 *
 * Built on the storefront's existing tokens (--cobalt, --crimson, Bungee for
 * display, Barlow Condensed for UI) rather than a look of its own. An affiliate
 * page that does not look like the shop reads as a third-party dashboard, and
 * this one is asking people to trust us with a payout address.
 *
 * Loaded only on these pages, via the $head slot.
 */

/* ------------------------------------------------------------------ hero -- */

.aff-hero {
	background:
		radial-gradient(1200px 400px at 15% -10%, rgba(80, 96, 192, 0.55), transparent 60%),
		linear-gradient(160deg, var(--cobalt-deep) 0%, var(--cobalt) 55%, var(--cobalt-lift) 100%);
	color: #fff;
	padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem);
	position: relative;
	overflow: hidden;
}

/* Faint confectionery dots. Decorative only, hidden from assistive tech by
   virtue of being a background rather than an element. */
.aff-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		radial-gradient(circle at 82% 22%, rgba(255, 255, 255, 0.16) 0 10px, transparent 11px),
		radial-gradient(circle at 91% 68%, rgba(255, 255, 255, 0.10) 0 16px, transparent 17px),
		radial-gradient(circle at 72% 88%, rgba(255, 255, 255, 0.08) 0 7px, transparent 8px);
	pointer-events: none;
}

.aff-hero-inner { position: relative; z-index: 1; max-width: 46rem; }

.aff-eyebrow {
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 0.85rem;
	margin: 0 0 0.75rem;
	opacity: 0.85;
}

.aff-hero h1 {
	font-family: var(--display);
	font-size: clamp(1.9rem, 5.2vw, 3.1rem);
	line-height: 1.06;
	letter-spacing: -0.01em;
	margin: 0 0 1rem;
}

.aff-sub { font-size: 1.05rem; line-height: 1.65; margin: 0 0 1.75rem; opacity: 0.94; }

.aff-hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.aff-already {
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 14px;
	padding: 1.25rem 1.4rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	justify-content: space-between;
}
.aff-already p { margin: 0; }

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

.aff-btn {
	display: inline-block;
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.7rem 1.5rem;
	border-radius: 999px;
	border: 2px solid var(--crimson);
	background: var(--crimson);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.12s ease, filter 0.12s ease;
}
.aff-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.aff-btn:active { transform: translateY(0); }

.aff-btn-ghost { background: transparent; border-color: currentColor; color: inherit; }
.aff-hero .aff-btn-ghost { color: #fff; }
.aff-btn-block { width: 100%; }
.aff-btn-small { padding: 0.45rem 1rem; font-size: 0.9rem; }
.aff-btn.is-copied { background: #1f9d55; border-color: #1f9d55; }

/* --------------------------------------------------------------- numbers -- */

.aff-numbers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 1rem;
	margin: 2.5rem auto;
}

.aff-number {
	text-align: center;
	padding: 1.5rem 1rem;
	border: 2px solid #eceef5;
	border-radius: 14px;
	background: #fff;
}
.aff-number-big {
	display: block;
	font-family: var(--display);
	font-size: 1.9rem;
	color: var(--cobalt);
	line-height: 1.1;
}
.aff-number-label {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.9rem;
	color: var(--grey);
}

/* ------------------------------------------------------------------ how -- */

.aff-how, .aff-terms-summary { margin: 3rem auto; }

.aff-how h2, .aff-terms-summary h2, .aff-dash h2, .aff-narrow h2 {
	font-family: var(--display);
	font-size: clamp(1.3rem, 3vw, 1.7rem);
	letter-spacing: -0.01em;
	margin: 0 0 1.25rem;
}

.aff-steps {
	list-style: none;
	counter-reset: step;
	padding: 0;
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 1.5rem;
}
.aff-steps li { counter-increment: step; position: relative; padding-top: 2.75rem; }
.aff-steps li::before {
	content: counter(step);
	position: absolute;
	top: 0;
	left: 0;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: var(--cobalt);
	color: #fff;
	font-family: var(--ui);
	font-weight: 700;
	display: grid;
	place-items: center;
}
.aff-steps h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.aff-steps p { margin: 0; color: var(--grey); line-height: 1.6; }

.aff-terms-summary dl { margin: 0; }
.aff-terms-summary dt { font-weight: 600; margin-top: 1.25rem; }
.aff-terms-summary dd { margin: 0.35rem 0 0; color: var(--grey); line-height: 1.65; }

/* ---------------------------------------------------------------- forms -- */

.aff-forms {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
	gap: 1.5rem;
	align-items: start;
	margin: 3rem auto 4rem;
}
@media (max-width: 780px) { .aff-forms { grid-template-columns: 1fr; } }

.aff-card {
	border: 2px solid #eceef5;
	border-radius: 16px;
	padding: clamp(1.25rem, 3vw, 2rem);
	background: #fff;
	scroll-margin-top: 6rem;
}
.aff-card-quiet { background: #f7f8fc; }
.aff-card h2 { font-family: var(--display); font-size: 1.35rem; margin: 0 0 1rem; }

.aff-form { display: grid; gap: 1rem; }
.aff-form label { display: grid; gap: 0.35rem; }
.aff-form label > span { font-family: var(--ui); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.9rem; }
.aff-form input[type="text"],
.aff-form input[type="email"] {
	font: inherit;
	padding: 0.65rem 0.8rem;
	border: 2px solid #d7dbe8;
	border-radius: 10px;
	background: #fff;
	width: 100%;
}
.aff-form input:focus-visible { outline: 3px solid var(--cobalt-bright); outline-offset: 1px; border-color: var(--cobalt); }
.aff-form small { color: var(--grey); font-size: 0.82rem; }

.aff-payout { border: 2px solid #eceef5; border-radius: 12px; padding: 0.9rem 1rem; margin: 0; }
.aff-payout legend { font-family: var(--ui); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.85rem; padding: 0 0.4rem; }
.aff-radio, .aff-check { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; margin-top: 0.5rem; }
.aff-radio span, .aff-check span { font-size: 0.92rem; line-height: 1.5; }
.aff-radio input, .aff-check input { margin-top: 0.25rem; }

.aff-error {
	background: #fdecef;
	border-left: 4px solid var(--crimson);
	color: #7a0f37;
	padding: 0.8rem 1rem;
	border-radius: 8px;
	margin: 0 0 1rem;
}

/* ------------------------------------------------------------ dashboard -- */

.aff-dash { margin: 2.5rem auto 4rem; }
.aff-dash-head { margin-bottom: 2rem; }
.aff-dash-head h1 { font-family: var(--display); font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 0.5rem; }
.aff-dash-code { margin: 0; color: var(--grey); }

.aff-badge {
	display: inline-block;
	background: var(--cobalt);
	color: #fff;
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.72rem;
	padding: 0.12rem 0.5rem;
	border-radius: 999px;
	vertical-align: middle;
}

.aff-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 1rem;
	margin-bottom: 2.5rem;
}
.aff-stat { border: 2px solid #eceef5; border-radius: 14px; padding: 1.1rem 1.2rem; background: #fff; }
.aff-stat-hero { border-color: var(--cobalt); background: linear-gradient(160deg, #f4f6ff, #fff); }
.aff-stat-label { display: block; font-family: var(--ui); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--grey); }
.aff-stat-value { display: block; font-family: var(--display); font-size: 1.7rem; line-height: 1.2; margin: 0.3rem 0; }
.aff-stat-hero .aff-stat-value { color: var(--cobalt); }
.aff-stat-note { display: block; font-size: 0.8rem; color: var(--grey); line-height: 1.45; }

/* Per-store breakdown — the reason a shared program is worth having. */
.aff-bysite { margin-bottom: 2.5rem; }
.aff-bysite h2 { font-family: var(--display); font-size: 1.2rem; margin: 0 0 0.75rem; }
.aff-bysite ul { list-style: none; margin: 0; padding: 0; border: 2px solid #eceef5; border-radius: 12px; overflow: hidden; }
.aff-bysite li {
	display: grid;
	grid-template-columns: 1fr auto auto;
	gap: 1rem;
	align-items: center;
	padding: 0.7rem 1rem;
	border-bottom: 1px solid #f1f3f9;
}
.aff-bysite li:last-child { border-bottom: 0; }
.aff-bysite-name { font-weight: 600; }
.aff-bysite-orders { color: var(--grey); font-size: 0.88rem; }
.aff-bysite-amount { font-family: var(--ui); font-size: 1.05rem; font-weight: 700; }

.aff-share { margin-bottom: 2.5rem; }
.aff-share h2 { font-family: var(--display); font-size: 1.2rem; margin: 0 0 0.6rem; }
.aff-share-note { color: var(--grey); font-size: 0.9rem; margin: 0.6rem 0 0; line-height: 1.55; }

.aff-copy { display: flex; gap: 0.5rem; }
.aff-copy input {
	flex: 1 1 auto;
	min-width: 0;
	font: inherit;
	font-size: 0.9rem;
	padding: 0.6rem 0.75rem;
	border: 2px solid #d7dbe8;
	border-radius: 10px;
	background: #f7f8fc;
	color: var(--ink);
}

.aff-section { margin-bottom: 2.75rem; }
.aff-section-sub { color: var(--grey); margin: -0.5rem 0 1rem; line-height: 1.6; }

.aff-empty {
	border: 2px dashed #d7dbe8;
	border-radius: 14px;
	padding: 1.75rem;
	text-align: center;
	color: var(--grey);
}
.aff-empty p { margin: 0 0 0.5rem; }
.aff-empty p:last-child { margin: 0; }

/* Wide tables scroll inside their own container so the page body never does. */
.aff-table-scroll { overflow-x: auto; border: 2px solid #eceef5; border-radius: 12px; }
.aff-table { width: 100%; border-collapse: collapse; min-width: 44rem; }
.aff-table th, .aff-table td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid #f1f3f9; white-space: nowrap; }
.aff-table th {
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.8rem;
	color: var(--grey);
	background: #fafbfe;
}
.aff-table tr:last-child td { border-bottom: 0; }
.aff-num { text-align: right; }
.aff-strong { font-weight: 700; }
.aff-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.aff-site { color: var(--grey); font-size: 0.88rem; }

.aff-pill {
	display: inline-block;
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.72rem;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
}
.aff-pill-pending { background: #fff4d6; color: #7a5600; }
.aff-pill-ready { background: #e2f5e9; color: #17673a; }
.aff-pill-paid { background: #e6ecff; color: var(--cobalt-deep); }
.aff-pill-reversed { background: #f1f2f5; color: #6b7280; text-decoration: line-through; }
.aff-clears { display: block; font-size: 0.75rem; color: var(--grey); margin-top: 0.15rem; }

.aff-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.aff-links li { border: 2px solid #eceef5; border-radius: 12px; padding: 0.9rem 1rem; }
.aff-link-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; margin-bottom: 0.6rem; }
.aff-link-head span { color: var(--grey); font-size: 0.88rem; }

.aff-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.aff-chips a {
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	border: 2px solid #d7dbe8;
	border-radius: 999px;
	padding: 0.4rem 0.9rem;
	text-decoration: none;
	color: var(--ink);
	font-size: 0.92rem;
}
.aff-chips a:hover { border-color: var(--cobalt); color: var(--cobalt); }
.aff-chip-meta { color: var(--grey); font-size: 0.82rem; }

.aff-swatches { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.aff-swatches a {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	border-radius: 999px;
	padding: 0.45rem 1rem;
	text-decoration: none;
	font-family: var(--ui);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 0.9rem;
}
.aff-swatches span { opacity: 0.75; font-size: 0.8rem; }

.aff-account dl { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1.25rem; margin: 0 0 1rem; }
.aff-account dt { font-family: var(--ui); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.82rem; color: var(--grey); }
.aff-account dd { margin: 0; }

/* ----------------------------------------------------- short pages, legal - */

.aff-narrow { max-width: 40rem; margin: 3rem auto 4rem; }
.aff-narrow h1 { font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 1rem; }
.aff-lede { font-size: 1.08rem; line-height: 1.65; margin: 0 0 1.5rem; }
.aff-note { color: var(--grey); font-size: 0.92rem; line-height: 1.6; margin: 0.75rem 0 2rem; }

.aff-legal h2 { font-family: var(--display); font-size: 1.15rem; margin: 2rem 0 0.6rem; }
.aff-legal-meta { color: var(--grey); font-size: 0.9rem; margin: -0.5rem 0 1.5rem; }
.aff-legal li { margin-bottom: 0.5rem; line-height: 1.6; }

code {
	background: #f1f3f9;
	padding: 0.1rem 0.35rem;
	border-radius: 5px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.88em;
}

@media (prefers-reduced-motion: reduce) {
	.aff-btn { transition: none; }
	.aff-btn:hover { transform: none; }
}

/* Signed in, but no affiliate account yet. Informational, not a failure —
   styled apart from .aff-error so it does not read as something going wrong. */
.aff-notice {
	background: #eef3ff;
	border-left: 4px solid var(--cobalt);
	color: var(--cobalt-deep);
	padding: 0.8rem 1rem;
	border-radius: 8px;
	margin: 0 0 1rem;
	line-height: 1.55;
}
