/* Facet Jewelry Builder – front end. Everything is scoped to .fjb-builder. */
.fjb-builder {
	--fjb-accent: #8a6d3b;
	--fjb-ink: #1d1d1f;
	--fjb-muted: #6b6b70;
	--fjb-line: #e6e2dc;
	--fjb-soft: #f7f5f2;
	--fjb-card: #ffffff;
	--fjb-radius: 14px;
	container-type: inline-size;
	color: var(--fjb-ink);
	font-size: 15px;
	line-height: 1.45;
	margin: 0 0 2em;
	text-align: left;
}
.fjb-builder *,
.fjb-builder *::before,
.fjb-builder *::after { box-sizing: border-box; }
.fjb-builder button { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; box-shadow: none; }
.fjb-loading { padding: 80px 20px; text-align: center; color: var(--fjb-muted); background: var(--fjb-soft); border-radius: var(--fjb-radius); }

.fjb-shell { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 24px; align-items: start; }

/* Stage */
.fjb-stage { position: sticky; top: 24px; aspect-ratio: 1 / 1; max-height: 82vh; width: 100%; border-radius: var(--fjb-radius); overflow: hidden; background: radial-gradient(120% 90% at 50% 35%, #ffffff 0%, #f4f1ec 60%, #e9e4dc 100%); }
.fjb-canvas-wrap { position: absolute; inset: 0; }
.fjb-canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; touch-action: none; }
.fjb-canvas:active { cursor: grabbing; }
.fjb-nowebgl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--fjb-muted); }
.fjb-typeswitch { position: absolute; z-index: 2; top: 14px; left: 50%; transform: translateX(-50%); display: flex; padding: 4px; gap: 4px; background: rgba(255, 255, 255, .85); border: 1px solid var(--fjb-line); border-radius: 999px; backdrop-filter: blur(6px); }
.fjb-typeswitch button { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; }
.fjb-typeswitch button.is-active { background: var(--fjb-ink); color: #fff; }
.fjb-stage-tools { position: absolute; z-index: 2; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.fjb-tool { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--fjb-line); background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.fjb-tool span { display: none; }
.fjb-tool:hover span, .fjb-tool:focus-visible span { display: inline; }
.fjb-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fjb-tool[aria-pressed="true"] { background: var(--fjb-ink); color: #fff; border-color: var(--fjb-ink); }
.fjb-hint { position: absolute; z-index: 1; left: 14px; bottom: 14px; margin: 0; font-size: 12px; color: var(--fjb-muted); pointer-events: none; }
.fjb-engraving-preview { position: absolute; z-index: 1; left: 50%; bottom: 58px; transform: translateX(-50%); font-family: "Snell Roundhand", "Apple Chancery", "Segoe Script", cursive; font-style: italic; font-size: 20px; color: var(--fjb-accent); white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* Panel */
.fjb-panel { background: var(--fjb-card); border: 1px solid var(--fjb-line); border-radius: var(--fjb-radius); padding: 20px; }
.fjb-title { margin: 0 0 14px; font-size: 22px; line-height: 1.2; }
.fjb-steps { display: flex; gap: 4px; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.fjb-steps::-webkit-scrollbar { display: none; }
.fjb-steps button { flex: 1 0 auto; display: flex; align-items: center; gap: 6px; border: 0; border-bottom: 2px solid var(--fjb-line); background: none; padding: 8px 6px; cursor: pointer; white-space: nowrap; color: var(--fjb-muted); font-size: 13px; font-weight: 600; border-radius: 0; }
.fjb-steps button.is-active { color: var(--fjb-ink); border-bottom-color: var(--fjb-accent); }
.fjb-steps button.is-done { color: var(--fjb-ink); }
.fjb-step-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--fjb-soft); font-size: 11px; }
.fjb-steps .is-active .fjb-step-num { background: var(--fjb-accent); color: #fff; }

.fjb-step-body { min-height: 190px; }
.fjb-group { margin: 0 0 18px; }
.fjb-group-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--fjb-muted); }
.fjb-group-value { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--fjb-ink); font-size: 14px; }

.fjb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.fjb-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fjb-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fjb-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border: 1px solid var(--fjb-line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 13px; transition: border-color .15s, box-shadow .15s; }
.fjb-card:hover { border-color: #c9c2b7; }
.fjb-card.is-active { border-color: var(--fjb-accent); box-shadow: 0 0 0 1px var(--fjb-accent) inset; }
.fjb-card svg { width: 40px; height: 34px; }
.fjb-i-fill { fill: #e9e4dc; stroke: #4b4b50; stroke-width: 1; }
.fjb-i-line { fill: none; stroke: #4b4b50; stroke-width: 1; }
.fjb-i-bg { fill: #fff; }
.fjb-i-thick { fill: none; stroke: #b9b1a5; stroke-width: 4; stroke-linecap: round; }
.fjb-i-dot { fill: #fff; stroke: #4b4b50; stroke-width: .8; }
.fjb-i-dash { fill: none; stroke: #4b4b50; stroke-width: 1.2; stroke-dasharray: 2 2; }
.fjb-card.is-active .fjb-i-fill { fill: color-mix(in srgb, var(--fjb-accent) 25%, #fff); }

.fjb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fjb-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--fjb-line); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.fjb-chip.is-active { border-color: var(--fjb-accent); background: color-mix(in srgb, var(--fjb-accent) 10%, #fff); box-shadow: 0 0 0 1px var(--fjb-accent) inset; }
.fjb-chip i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); }

.fjb-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.fjb-swatch { display: flex; align-items: center; gap: 10px; border: 1px solid var(--fjb-line); border-radius: 10px; background: #fff; padding: 8px 10px; cursor: pointer; text-align: left; font-size: 14px; }
.fjb-swatch i { flex: 0 0 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0%, var(--c) 45%, color-mix(in srgb, var(--c) 60%, #000) 100%); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.fjb-swatch.is-active { border-color: var(--fjb-accent); box-shadow: 0 0 0 1px var(--fjb-accent) inset; }

.fjb-range { width: 100%; accent-color: var(--fjb-accent); margin: 4px 0; }
.fjb-select, .fjb-input, .fjb-quote-form input, .fjb-quote-form textarea { width: 100%; border: 1px solid var(--fjb-line); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: var(--fjb-ink); }
.fjb-help { margin: 6px 0 0; color: var(--fjb-muted); font-size: 13px; }

.fjb-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.fjb-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fjb-switch { position: relative; flex: 0 0 38px; height: 22px; border-radius: 999px; background: #d8d3cb; transition: background .15s; }
.fjb-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.fjb-toggle input:checked + .fjb-switch { background: var(--fjb-accent); }
.fjb-toggle input:checked + .fjb-switch::after { transform: translateX(16px); }
.fjb-toggle input:focus-visible + .fjb-switch { outline: 2px solid var(--fjb-accent); outline-offset: 2px; }

.fjb-step-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0 16px; border-bottom: 1px solid var(--fjb-line); margin-bottom: 16px; }

/* Buttons */
.fjb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; padding: 11px 20px; cursor: pointer; font-weight: 600; font-size: 15px; border: 1px solid transparent; text-decoration: none; line-height: 1.2; }
.fjb-btn:disabled { opacity: .6; cursor: progress; }
.fjb-btn-primary { background: var(--fjb-ink); color: #fff !important; }
.fjb-btn-primary:hover { background: #000; }
.fjb-btn-secondary { background: #fff; border-color: var(--fjb-ink); }
.fjb-btn-secondary:hover { background: var(--fjb-soft); }
.fjb-btn-link { background: none; padding: 8px 4px; color: var(--fjb-muted) !important; font-weight: 500; }
.fjb-btn-link:hover { color: var(--fjb-ink) !important; }
.fjb-builder :focus-visible { outline: 2px solid var(--fjb-accent); outline-offset: 2px; }

/* Summary */
.fjb-price-label { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--fjb-muted); font-weight: 600; }
.fjb-price { font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; transition: opacity .15s; }
.fjb-price.is-loading { opacity: .45; }
.fjb-price-note { font-size: 13px; color: var(--fjb-muted); }
.fjb-breakdown, .fjb-specs { margin: 12px 0 0; border-top: 1px solid var(--fjb-line); padding-top: 10px; }
.fjb-breakdown summary, .fjb-specs summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.fjb-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; }
.fjb-line span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fjb-line-muted { color: var(--fjb-muted); }
.fjb-specs-body { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: 14px; }
.fjb-specs-body dt { color: var(--fjb-muted); }
.fjb-specs-body dd { margin: 0; }
.fjb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.fjb-actions .fjb-btn-primary, .fjb-actions .fjb-btn-secondary { flex: 1 1 160px; }
.fjb-notice { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #eef6ee; color: #1f5122; font-size: 14px; }
.fjb-notice.is-error { background: #fbeeee; color: #8a1f1f; }
.fjb-notice a { color: inherit; font-weight: 600; }

/* Quote dialog */
.fjb-dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); color: var(--fjb-ink); }
.fjb-dialog::backdrop { background: rgba(20, 18, 15, .45); }
.fjb-quote-form { position: relative; display: grid; gap: 12px; padding: 24px; }
.fjb-quote-form h3 { margin: 0; font-size: 20px; }
.fjb-quote-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.fjb-quote-form .fjb-consent { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.fjb-quote-form .fjb-consent input { width: auto; margin-top: 3px; }
.fjb-muted { color: var(--fjb-muted); margin: 0; font-size: 14px; }
.fjb-quote-preview { display: flex; gap: 12px; align-items: flex-start; background: var(--fjb-soft); border-radius: 12px; padding: 10px; font-size: 13px; }
.fjb-quote-preview img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; background: #fff; }
.fjb-quote-preview dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; }
.fjb-quote-preview dt { color: var(--fjb-muted); }
.fjb-quote-preview dd { margin: 0; }
.fjb-hp { position: absolute !important; left: -9999px !important; }
.fjb-form-error { color: #8a1f1f; font-size: 14px; }
.fjb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fjb-dialog-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--fjb-muted); padding: 4px 8px; }

/* Narrow containers (sidebars, phones) */
@container (max-width: 820px) {
	.fjb-shell { grid-template-columns: 1fr; gap: 14px; }
	.fjb-stage { position: relative; top: 0; aspect-ratio: 4 / 3.4; }
	.fjb-panel { padding: 16px; }
	.fjb-step-name { display: none; }
	.fjb-steps .is-active .fjb-step-name { display: inline; }
	.fjb-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (max-width: 420px) {
	.fjb-cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.fjb-hint { display: none; }
	.fjb-quote-preview img { width: 80px; height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
	.fjb-builder * { transition: none !important; }
}
