/* Affiliate Hub – Frontend. Override the variables in your theme to restyle every site at once. */
.afh-box, .afh-list, .afh-table-wrap, .afh-carousel, .afh-disclaimer, .afh-admin-notice {
	--afh-accent: #e8590c;
	--afh-accent-hover: #c2410c;
	--afh-accent-text: #fff;
	--afh-deal: #d6336c;
	--afh-ok: #2b8a3e;
	--afh-border: rgba(0, 0, 0, .12);
	--afh-muted: rgba(0, 0, 0, .58);
	--afh-surface: #fff;
	--afh-soft: rgba(0, 0, 0, .035);
	--afh-radius: 14px;
	box-sizing: border-box;
	font-size: 16px;
	line-height: 1.45;
}
.afh-box *, .afh-list *, .afh-table-wrap *, .afh-carousel * { box-sizing: border-box; }

/* ---------- Box ---------- */
.afh-box {
	position: relative;
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 24px;
	margin: 1.6em 0;
	padding: 22px;
	background: var(--afh-surface);
	border: 1px solid var(--afh-border);
	border-radius: var(--afh-radius);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
	color: inherit;
}
.afh-box--vertical { grid-template-columns: 1fr; max-width: 360px; }
.afh-box--fallback { grid-template-columns: 1fr; }
.afh-box__media { display: flex; align-items: center; justify-content: center; }
.afh-box__media .afh-img { max-height: 200px; }
.afh-img { display: block; max-width: 100%; height: auto; object-fit: contain; margin: 0 auto; }
.afh-img-link { display: block; }
.afh-box__body { display: flex; flex-direction: column; min-width: 0; }
.afh-brand { font-size: .78em; letter-spacing: .06em; text-transform: uppercase; color: var(--afh-muted); margin-bottom: 2px; }
.afh-box .afh-title { font-size: 1.15em; font-weight: 700; line-height: 1.3; margin: 0 0 10px; }
.afh-title a { color: inherit; text-decoration: none; }
.afh-title a:hover { text-decoration: underline; }
.afh-features { margin: 0 0 14px; padding: 0; list-style: none; font-size: .92em; }
.afh-features > div { position: relative; padding-left: 22px; margin: 0 0 5px; }
.afh-features > div::before {
	content: ""; position: absolute; left: 2px; top: .45em; width: 11px; height: 6px;
	border-left: 2px solid var(--afh-ok); border-bottom: 2px solid var(--afh-ok); transform: rotate(-45deg);
}
.afh-features--compact { font-size: .85em; margin: 0; }
.afh-box__footer { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-top: auto; }

/* ---------- Badge ---------- */
.afh-badge {
	position: absolute; top: -11px; left: 18px;
	background: var(--afh-deal); color: #fff;
	font-size: .78em; font-weight: 700; letter-spacing: .02em;
	padding: 4px 11px; border-radius: 999px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.afh-badge--inline { position: static; display: inline-block; margin-bottom: 8px; box-shadow: none; }

/* ---------- Price ---------- */
.afh-price-block { display: flex; flex-direction: column; gap: 1px; }
.afh-price { font-size: 1.6em; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.afh-price sup { font-size: .45em; font-weight: 400; top: -1.1em; margin-left: 1px; }
.afh-price--check { font-size: .95em; font-weight: 600; color: var(--afh-muted); }
.afh-list-price { font-size: .85em; color: var(--afh-muted); }
.afh-savings { font-size: .85em; font-weight: 600; color: var(--afh-deal); }
.afh-ppu { font-size: .78em; color: var(--afh-muted); }

/* ---------- Button ---------- */
a.afh-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 0 22px;
	background: var(--afh-accent); color: var(--afh-accent-text) !important;
	font-weight: 700; font-size: .95em; text-decoration: none !important;
	border-radius: 10px; transition: background .15s, transform .15s;
	white-space: nowrap;
}
a.afh-btn::after { content: "→"; font-weight: 400; transition: transform .15s; }
a.afh-btn:hover { background: var(--afh-accent-hover); }
a.afh-btn:hover::after { transform: translateX(3px); }
a.afh-btn:focus-visible { outline: 3px solid var(--afh-accent); outline-offset: 2px; }

.afh-meta { margin-top: 12px; font-size: .74em; color: var(--afh-muted); }

/* ---------- List ---------- */
.afh-list { margin: 1.6em 0; }
.afh-list__heading, .afh-carousel__heading { font-size: 1.25em; font-weight: 700; line-height: 1.3; }
.afh-list__heading { margin: 0 0 12px; }
.afh-list__items { margin: 0; padding: 0; border: 1px solid var(--afh-border); border-radius: var(--afh-radius); overflow: hidden; background: var(--afh-surface); }
.afh-list__item { display: grid; grid-template-columns: auto 84px 1fr auto; align-items: center; gap: 16px; padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--afh-border); }
.afh-list__item:last-child { border-bottom: 0; }
.afh-rank { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--afh-soft); font-weight: 800; }
.afh-rank--top { background: var(--afh-accent); color: var(--afh-accent-text); }
.afh-list__media .afh-img { max-height: 84px; }
.afh-list__title { font-weight: 600; margin-bottom: 4px; }
.afh-list__title a { color: inherit; text-decoration: none; }
.afh-list__body .afh-price { font-size: 1.2em; }
.afh-list__body .afh-price-block { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }

/* ---------- Table ---------- */
.afh-table-wrap { margin: 1.6em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.afh-table { width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--afh-surface); border: 1px solid var(--afh-border); border-radius: var(--afh-radius); overflow: hidden; }
.afh-table th, .afh-table td { padding: 14px; text-align: center; vertical-align: top; border-bottom: 1px solid var(--afh-border); border-right: 1px solid var(--afh-border); font-weight: normal; }
.afh-table tr > *:last-child { border-right: 0; }
.afh-table tbody tr:last-child td { border-bottom: 0; }
.afh-table th .afh-img { max-height: 140px; }
.afh-table .afh-row-title a { color: inherit; font-weight: 600; text-decoration: none; }
.afh-table .afh-features { text-align: left; }
.afh-table .afh-price-block { align-items: center; }
.afh-table .afh-price { font-size: 1.3em; }
.afh-table .afh-btn { padding: 0 14px; font-size: .88em; white-space: normal; text-align: center; }
.afh-table .afh-hl { background: rgba(232, 89, 12, .06); background: color-mix(in srgb, var(--afh-accent) 9%, transparent); }
.afh-table th.afh-hl { box-shadow: inset 0 3px 0 var(--afh-accent); }

/* ---------- Misc ---------- */
.afh-inline-price { font-weight: 700; white-space: nowrap; }
.afh-inline-stamp { font-size: .8em; color: var(--afh-muted); }
.afh-disclaimer { font-size: .74em; color: var(--afh-muted); margin: -.8em 0 1.6em; }
.afh-admin-notice { padding: 12px 16px; border: 1px dashed var(--afh-deal); border-radius: 8px; font-size: .9em; margin: 1em 0; }

/* ---------- Carousel ---------- */
.afh-carousel { margin: 1.6em 0; }
.afh-carousel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.afh-carousel__heading { margin: 0; }
.afh-carousel__nav { display: flex; gap: 8px; margin-left: auto; }
.afh-carousel__btn {
	width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--afh-border);
	background: var(--afh-surface); color: inherit; font-size: 24px; line-height: 1; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; padding: 0 0 3px;
	transition: background .15s, opacity .15s;
}
.afh-carousel__btn:hover:not(:disabled) { background: var(--afh-accent); color: var(--afh-accent-text); border-color: var(--afh-accent); }
.afh-carousel__btn:disabled { opacity: .35; cursor: default; }
.afh-carousel--static .afh-carousel__nav { display: none; }
.afh-carousel__track {
	display: flex; gap: 16px; margin: 0; padding: 12px 2px 14px;
	overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.afh-card {
	position: relative; flex: 0 0 220px; scroll-snap-align: start; margin: 0;
	display: flex; flex-direction: column; gap: 10px; padding: 16px;
	background: var(--afh-surface); border: 1px solid var(--afh-border); border-radius: var(--afh-radius);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .05);
}
.afh-badge--card { top: -9px; left: 12px; font-size: .72em; padding: 3px 9px; }
.afh-card__media { height: 160px; display: flex; align-items: center; justify-content: center; }
.afh-card__media .afh-img-link { height: 100%; display: flex; align-items: center; }
.afh-card__media .afh-img { max-height: 160px; }
.afh-card__title { font-weight: 600; font-size: .92em; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.afh-card__title a { color: inherit; text-decoration: none; }
.afh-card__foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.afh-card .afh-price { font-size: 1.25em; }
.afh-card .afh-price--check { font-size: .85em; }
.afh-card a.afh-btn { width: 100%; min-height: 40px; padding: 0 12px; font-size: .88em; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	.afh-box { grid-template-columns: 1fr; padding: 18px; gap: 14px; }
	.afh-box__media .afh-img { max-height: 180px; }
	.afh-box__footer { flex-direction: column; align-items: stretch; }
	.afh-box a.afh-btn { width: 100%; }
	.afh-list__item { grid-template-columns: auto 64px 1fr; padding: 12px; gap: 12px; }
	.afh-list__cta { grid-column: 1 / -1; }
	.afh-list__cta a.afh-btn { width: 100%; }
	.afh-card { flex-basis: 72%; }
	.afh-carousel__nav { display: none; }
}

/* ---------- Dark themes ---------- */
@media (prefers-color-scheme: dark) {
	.is-dark-theme .afh-box, .is-dark-theme .afh-list, .is-dark-theme .afh-table-wrap, .is-dark-theme .afh-carousel {
		--afh-surface: #1c1c1e; --afh-border: rgba(255, 255, 255, .14); --afh-muted: rgba(255, 255, 255, .62); --afh-soft: rgba(255, 255, 255, .07);
	}
}
