/**
 * Fontrilla product page + live font tester styles — Track A (M1).
 *
 * Scope: .fon-product, .fon-tester, .fon-license, .fon-tabs, .fon-related,
 * .fon-sticky-cta. Design tokens come from assets/css/tokens.css.
 */

/* ---------- product layout ---------- */
.fon-product {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1.5rem 1rem 6rem;
}

.fon-breadcrumb {
	font-size: 0.85rem;
	margin-bottom: 1rem;
	color: var(--fon-color-muted, #666);
}

.fon-breadcrumb a {
	color: inherit;
	text-decoration: none;
}

.fon-product__header {
	margin-bottom: 1.5rem;
}

.fon-product__title {
	font-size: 2.25rem;
	line-height: 1.15;
	margin: 0 0 0.5rem;
}

.fon-product__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	color: var(--fon-color-muted, #666);
	font-size: 0.95rem;
}

.fon-product__gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1rem;
	margin-bottom: 2rem;
}

.fon-product__gallery-item {
	margin: 0;
	border: 1px solid var(--fon-color-border, #e5e5e5);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.fon-product__gallery-item img {
	display: block;
	width: 100%;
	height: auto;
}

/* ---------- tester ---------- */
.fon-tester {
	border: 1px solid var(--fon-color-border, #e5e5e5);
	border-radius: 12px;
	padding: 1.25rem;
	margin-bottom: 2rem;
	background: var(--fon-color-surface, #fafafa);
}

.fon-tester__heading {
	margin: 0 0 1rem;
	font-size: 1.35rem;
}

.fon-tester__controls {
	display: grid;
	gap: 0.9rem;
	margin-bottom: 1rem;
}

.fon-tester__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.9rem 1.5rem;
	align-items: flex-end;
}

.fon-tester__field {
	display: grid;
	gap: 0.35rem;
	font-size: 0.85rem;
}

.fon-tester__field--grow {
	flex: 1 1 240px;
}

.fon-tester__field > span,
.fon-tester__field > legend {
	font-weight: 600;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--fon-color-muted, #666);
}

.fon-tester__field textarea,
.fon-tester__field select {
	font: inherit;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--fon-color-border, #ddd);
	border-radius: 6px;
	width: 100%;
}

.fon-tester__field input[type="range"] {
	width: 100%;
	min-width: 160px;
}

.fon-tester__field input[type="color"] {
	width: 3rem;
	height: 2.2rem;
	padding: 0.15rem;
	border: 1px solid var(--fon-color-border, #ddd);
	border-radius: 6px;
	background: #fff;
}

.fon-tester__btns {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.fon-tester__btns button,
.fon-tester__style {
	font: inherit;
	padding: 0.45rem 0.8rem;
	border: 1px solid var(--fon-color-border, #ddd);
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}

.fon-tester__btns button.is-active,
.fon-tester__style.is-active,
.fon-tester-align.is-active {
	border-color: var(--fon-color-primary, #1d4ed8);
	background: var(--fon-color-primary-soft, #eff6ff);
	color: var(--fon-color-primary, #1d4ed8);
	font-weight: 600;
}

.fon-tester__styles {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.fon-tester__check {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.9rem;
	cursor: pointer;
}

.fon-tester__ot {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.2rem;
}

.fon-tester__ot-item code {
	font-size: 0.8em;
	background: var(--fon-color-code-bg, #f0f0f0);
	padding: 0.1em 0.35em;
	border-radius: 4px;
}

.fon-tester__fallback {
	font-size: 0.9rem;
	color: var(--fon-color-muted, #666);
	margin: 0.25rem 0;
}

.fon-tester__axes {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem 1.5rem;
}

.fon-tester__axis {
	display: grid;
	gap: 0.25rem;
	font-size: 0.85rem;
	min-width: 180px;
	flex: 1 1 180px;
}

.fon-tester__axis output {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.fon-tester__stage {
	position: relative;
	border: 1px solid var(--fon-color-border, #e5e5e5);
	border-radius: 8px;
	padding: 1.5rem;
	min-height: 220px;
	overflow-wrap: break-word;
}

.fon-tester__stage.is-loading .fon-tester__preview,
.fon-tester__stage.is-loading .fon-tester__waterfall,
.fon-tester__stage.is-loading .fon-tester__allstyles {
	visibility: hidden;
}

.fon-tester__loading {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	margin: 0;
	color: var(--fon-color-muted, #888);
	background: linear-gradient(100deg, #f4f4f4 40%, #ececec 50%, #f4f4f4 60%);
	background-size: 200% 100%;
	animation: fon-skeleton 1.2s linear infinite;
	border-radius: 8px;
}

@keyframes fon-skeleton {
	to { background-position: -200% 0; }
}

.fon-tester__preview {
	white-space: pre-wrap;
}

.fon-tester__waterfall-line {
	border-bottom: 1px dashed var(--fon-color-border, #e0e0e0);
	padding: 0.35rem 0;
}

.fon-tester__waterfall-line:last-child {
	border-bottom: 0;
}

.fon-tester__allstyle {
	margin-bottom: 1rem;
}

.fon-tester__allstyle-label {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--fon-color-muted, #666);
	margin-bottom: 0.25rem;
}

.fon-tester__glyphs {
	margin-top: 1rem;
}

.fon-tester__glyphs summary {
	cursor: pointer;
	font-weight: 600;
	padding: 0.5rem 0;
}

.fon-tester__glyph-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
	gap: 0.3rem;
	margin-top: 0.5rem;
}

.fon-tester__glyph {
	font-size: 1.35rem;
	line-height: 1;
	padding: 0.55rem 0;
	border: 1px solid var(--fon-color-border, #e0e0e0);
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}

.fon-tester__glyph:hover {
	border-color: var(--fon-color-primary, #1d4ed8);
	background: var(--fon-color-primary-soft, #eff6ff);
}

/* ---------- purchase: license selector + CTAs ---------- */
.fon-product__purchase {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 2rem;
	margin-bottom: 2rem;
	align-items: start;
}

.fon-license h2 {
	margin-top: 0;
	font-size: 1.35rem;
}

.fon-license__cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0.75rem;
}

.fon-license__card {
	display: grid;
	gap: 0.3rem;
	padding: 0.9rem;
	border: 2px solid var(--fon-color-border, #e0e0e0);
	border-radius: 10px;
	cursor: pointer;
	background: #fff;
	transition: border-color 0.15s ease;
}

.fon-license__card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.fon-license__card.is-selected {
	border-color: var(--fon-color-primary, #1d4ed8);
	background: var(--fon-color-primary-soft, #eff6ff);
}

.fon-license__tier {
	font-weight: 700;
	font-size: 1.05rem;
}

.fon-license__price {
	font-variant-numeric: tabular-nums;
	color: var(--fon-color-muted, #555);
}

.fon-license__note {
	font-size: 0.85rem;
	color: var(--fon-color-muted, #666);
}

.fon-license__matrix {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}

.fon-license__matrix th,
.fon-license__matrix td {
	border: 1px solid var(--fon-color-border, #e0e0e0);
	padding: 0.55rem 0.75rem;
	text-align: left;
}

.fon-license__matrix thead th {
	background: var(--fon-color-surface, #f7f7f7);
}

.fon-product__ctas {
	display: grid;
	gap: 1rem;
	position: sticky;
	top: 1rem;
}

.fon-btn {
	font: inherit;
	font-weight: 700;
	padding: 0.8rem 1.4rem;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	text-align: center;
}

.fon-btn--primary {
	background: var(--fon-color-primary, #1d4ed8);
	color: #fff;
}

.fon-btn--ghost {
	background: transparent;
	border-color: var(--fon-color-primary, #1d4ed8);
	color: var(--fon-color-primary, #1d4ed8);
}

.fon-btn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.fon-trial {
	display: grid;
	gap: 0.6rem;
	padding: 1rem;
	border: 1px dashed var(--fon-color-border, #ccc);
	border-radius: 10px;
	background: #fff;
}

.fon-trial__agree {
	display: flex;
	gap: 0.5rem;
	font-size: 0.85rem;
	align-items: flex-start;
}

.fon-trial__terms {
	font-size: 0.8rem;
	color: var(--fon-color-muted, #666);
	margin: 0;
}

/* ---------- tabs ---------- */
.fon-tabs {
	margin-bottom: 2.5rem;
}

.fon-tabs__nav {
	display: flex;
	gap: 0.25rem;
	border-bottom: 2px solid var(--fon-color-border, #e5e5e5);
	margin-bottom: 1.25rem;
}

.fon-tabs__nav [role="tab"] {
	font: inherit;
	font-weight: 600;
	padding: 0.7rem 1.2rem;
	background: none;
	border: 0;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	cursor: pointer;
	color: var(--fon-color-muted, #666);
}

.fon-tabs__nav [role="tab"][aria-selected="true"] {
	color: var(--fon-color-primary, #1d4ed8);
	border-bottom-color: var(--fon-color-primary, #1d4ed8);
}

/* ---------- related ---------- */
.fon-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem;
}

.fon-related__card {
	border: 1px solid var(--fon-color-border, #e5e5e5);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.fon-related__card a {
	color: inherit;
	text-decoration: none;
	display: block;
}

.fon-related__card img {
	display: block;
	width: 100%;
	height: auto;
}

.fon-related__card h3 {
	font-size: 1rem;
	padding: 0.6rem 0.8rem;
	margin: 0;
}

/* ---------- sticky mobile CTA (never covers the tester: hidden on desktop) ---------- */
.fon-sticky-cta {
	display: none;
}

@media (max-width: 860px) {
	.fon-product__purchase {
		grid-template-columns: 1fr;
	}

	.fon-product__ctas {
		position: static;
	}

	.fon-sticky-cta {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
		background: #fff;
		border-top: 1px solid var(--fon-color-border, #e0e0e0);
		box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
		z-index: 50;
	}

	.fon-sticky-cta__label {
		font-weight: 700;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.fon-tester__loading {
		animation: none;
	}

	.fon-license__card {
		transition: none;
	}
}
