/* ==========================================================================
   Konfigurator stołu kamiennego
   ========================================================================== */

.cfg { max-width: var(--w-container); margin-inline: auto; padding: 96px 12px 24px; }
.cfg__head { max-width: 640px; margin-bottom: 40px; padding-inline: 8px; }
.cfg__kicker { margin: 0 0 12px; font-size: 20px; font-weight: 400; letter-spacing: .1px; }
.cfg__title { font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: .1px; }
.cfg__lead { margin: 16px 0 0; color: var(--c-grey); letter-spacing: .1px; }

.cfg__layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.cfg__visual { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 20px; }
.cfg__preview { position: relative; margin: 0; aspect-ratio: 3 / 2; background: var(--c-light); overflow: hidden; }
.cfg__preview-img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s ease; }
.cfg__preview-img.is-swapping { opacity: 0; }
.cfg__preview-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: 13px; font-weight: 500; letter-spacing: 0; }

/* ---- Kroki ---- */
.cfg__steps { min-width: 0; }
.cfg-step { margin: 0 0 40px; padding: 0; border: 0; min-width: 0; }
.cfg-step__title { display: block; width: 100%; margin: 0 0 14px; padding: 0; font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.2px; }
.cfg-step__options { display: grid; gap: 10px; }
.cfg-step--text .cfg-step__options, .cfg-step--swatch .cfg-step__options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cfg-step--image .cfg-step__options { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.cfg-opt { position: relative; display: block; cursor: pointer; }
.cfg-opt__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.cfg-opt__body { position: relative; display: grid; align-items: center; gap: 4px 12px; height: 100%; padding: 16px; border: 1px solid var(--c-line); background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.cfg-opt:hover .cfg-opt__body { border-color: #9a9a9a; }
.cfg-opt__input:checked + .cfg-opt__body { border-color: #000; box-shadow: inset 0 0 0 1px #000; background: #fafafa; }
.cfg-opt__input:focus-visible + .cfg-opt__body { outline: 2px solid #000; outline-offset: 2px; }
.cfg-opt__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cfg-opt__label { font-size: 16px; font-weight: 600; line-height: 1.2; letter-spacing: -.2px; }
.cfg-opt__note { font-size: 13px; line-height: 1.3; color: #707070; letter-spacing: 0; }
.cfg-opt__price { font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--c-grey); letter-spacing: 0; }
.cfg-opt__tick { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: #000; color: #fff; opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease; }
.cfg-opt__input:checked + .cfg-opt__body .cfg-opt__tick { opacity: 1; transform: none; }

/* rozmiar: tekst + cena + znacznik */
.cfg-step--text .cfg-opt__body { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text tick" "price price"; }
.cfg-step--text .cfg-opt__text { grid-area: text; }
.cfg-step--text .cfg-opt__tick { grid-area: tick; align-self: start; }
.cfg-step--text .cfg-opt__price { grid-area: price; margin-top: 6px; }

/* nóżki: miniatura + tekst */
.cfg-step--image .cfg-opt__body { grid-template-columns: minmax(0, 1fr); padding: 0 0 14px; gap: 10px; }
.cfg-step--image .cfg-opt__media { display: block; aspect-ratio: 4 / 3; background: var(--c-light); overflow: hidden; }
.cfg-step--image .cfg-opt__media img { width: 100%; height: 100%; object-fit: cover; }
.cfg-step--image .cfg-opt__text, .cfg-step--image .cfg-opt__price { padding-inline: 14px; }
.cfg-step--image .cfg-opt__tick { position: absolute; top: 8px; right: 8px; }

/* kamień: próbka koloru + tekst */
.cfg-step--swatch .cfg-opt__body { grid-template-columns: 44px minmax(0, 1fr) 18px; grid-template-areas: "sw text tick" "sw price price"; padding: 14px; }
.cfg-step--swatch .cfg-opt__swatch { grid-area: sw; grid-row: 1 / span 2; width: 44px; height: 44px; border: 1px solid rgba(0, 0, 0, .15); background-image: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .22), transparent 55%), radial-gradient(circle at 70% 70%, rgba(0, 0, 0, .12), transparent 50%); }
.cfg-step--swatch .cfg-opt__text { grid-area: text; }
.cfg-step--swatch .cfg-opt__tick { grid-area: tick; align-self: start; }
.cfg-step--swatch .cfg-opt__price { grid-area: price; }

/* ---- Podsumowanie ---- */
.cfg__summary { padding: 24px; background: var(--c-light); }
.cfg__summary-title { margin: 0 0 14px; font-size: 20px; font-weight: 600; letter-spacing: 0; }
.cfg__lines { margin: 0; }
.cfg__line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #e0e0e0; font-size: 14px; }
.cfg__line dt { margin: 0; color: var(--c-grey); }
.cfg__line dd { margin: 0; font-weight: 500; text-align: right; }
.cfg__total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; }
.cfg__total-label { font-size: 15px; font-weight: 500; }
.cfg__total-price { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -1px; }
.cfg__meta { display: flex; align-items: center; gap: 8px; margin: 10px 0 16px; font-size: 13px; color: var(--c-grey); letter-spacing: 0; }
.cfg__add { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 56px; padding: 0 20px; border: 0; border-radius: 0; background: #000; color: #fff; font-family: var(--f-main); font-size: 16px; font-weight: 500; letter-spacing: .1px; cursor: pointer; transition: background-color .2s ease; }
.cfg__add:hover, .cfg__add:focus-visible { background: var(--c-btn-hover); }
.cfg__add[disabled] { opacity: .5; cursor: not-allowed; }
.cfg__add.is-loading { opacity: .6; pointer-events: none; }
.cfg__add.is-added { background: #1a7f37; }
.cfg__ask { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--c-grey); text-decoration: underline; text-underline-offset: 2px; }
.cfg__ask:hover { color: #000; }

@media (max-width: 1100px) {
	.cfg__layout { gap: 36px; }
	.cfg-step--image .cfg-step__options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
	.cfg { padding-top: 64px; }
	.cfg__layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
	/* kolejność na telefonie: podgląd → kroki → podsumowanie */
	.cfg__visual { display: contents; }
	.cfg__preview { order: 1; }
	.cfg__steps { order: 2; }
	.cfg__summary { order: 3; }
}
@media (max-width: 767px) {
	.cfg__title { font-size: 32px; }
	.cfg-step--text .cfg-step__options, .cfg-step--swatch .cfg-step__options { grid-template-columns: minmax(0, 1fr); }
	.cfg-step--image .cfg-step__options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cfg-step__title { font-size: 20px; }
}
