/* ═══════════════════════════════════════════════════════════════════════════
   ВИЗУАЛИЗАТОР ФАСАДА — стили
   ═══════════════════════════════════════════════════════════════════════════ */

.visualizer {
  padding: clamp(2rem, 5vw, 4rem) 0;
  background:
    linear-gradient(180deg, var(--c-bg-deep) 0%, var(--c-bg) 100%);
}

.vz {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(380px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* ─── ПРЕВЬЮ ───────────────────────────────────────────────────────────── */
.vz__preview {
  position: sticky; top: 100px;
  display: flex; flex-direction: column; gap: 1rem;
}

.vz__canvas-wrap {
  position: relative;
  aspect-ratio: 3/2;
  background: var(--c-card-warm);
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-md);
}
.vz__canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* «До/после» разделитель */
.vz__split {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.vz__split.is-active { pointer-events: auto; }
.vz__split-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.2);
  cursor: ew-resize;
}
.vz__split-handle::before,
.vz__split-handle::after {
  content: '';
  position: absolute;
  top: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.vz__split-handle::after {
  content: '⇆';
  font-size: 1rem;
  color: var(--c-ink);
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
}
.vz__split-handle::before { display: none; }
.vz__split-handle span {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; color: var(--c-ink);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.vz__split-handle span::after { content: '⇆'; }

.vz__compare-btn {
  position: absolute;
  right: 14px; top: 14px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: .6rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-ink);
  backdrop-filter: blur(6px);
  z-index: 2;
}
.vz__compare-btn:hover { background: #fff; }
.vz__compare-btn[aria-pressed="true"] { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }

/* ─── СВОДКА (выбранный кирпич + шов) ─────────────────────────────────── */
.vz__summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}
.vz__summary > div {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: .9rem 1rem;
  display: flex; gap: .8rem; align-items: center;
}
.vz__summary img {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--c-card-warm);
  flex: 0 0 56px;
}
.vz__summary strong { font-size: .95rem; }
.vz__summary span { font-size: .8rem; color: var(--c-muted); }
.vz__summary em {
  display: inline-block;
  font-size: .9rem;
  color: var(--c-red);
  font-weight: 700;
  font-style: normal;
}

/* ─── ПАНЕЛЬ УПРАВЛЕНИЯ ────────────────────────────────────────────────── */
.vz__panel {
  display: flex; flex-direction: column; gap: 1.2rem;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: var(--r-xl);
  padding: clamp(1.2rem, 2vw, 1.8rem);
  box-shadow: var(--shadow-sm);
}

.vz__step { position: relative; padding-left: 2.4rem; }
.vz__step-num {
  position: absolute;
  left: 0; top: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--c-red);
  color: #fff;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.vz__step h3 {
  margin: 0 0 .8rem;
  font-size: 1.05rem;
  font-weight: 700;
}

/* Фильтры кирпича */
.vz__filters {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-bottom: .8rem;
}
.vz__filters button {
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-ink-soft);
  border-radius: 999px;
  padding: .35rem .8rem;
  font-size: .8rem;
  font-weight: 500;
}
.vz__filters button.is-active {
  background: var(--c-ink); color: #fff; border-color: var(--c-ink);
}

/* Сетка кирпичей */
.vz__bricks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: .5rem;
  max-height: 320px;
  overflow-y: auto;
  padding: .3rem;
  border: 1px dashed var(--c-line);
  border-radius: var(--r-md);
}
.vz__brick {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-card-warm);
  position: relative;
  aspect-ratio: 1;
  transition: transform .15s, border-color .15s;
}
.vz__brick:hover { transform: scale(1.05); }
.vz__brick.is-active { border-color: var(--c-red); }
.vz__brick img { width: 100%; height: 100%; object-fit: cover; }
.vz__brick-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.7));
  color: #fff; font-size: .65rem; font-weight: 600;
  padding: 12px 4px 4px;
  text-align: center;
  line-height: 1.1;
  opacity: 0;
  transition: opacity .15s;
}
.vz__brick:hover .vz__brick-name,
.vz__brick.is-active .vz__brick-name { opacity: 1; }

/* Toggle тип шва */
.vz__toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  background: var(--c-card-warm);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: .35rem;
}
.vz__toggle-btn {
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: .7rem .8rem;
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; gap: 2px;
  transition: background .15s;
}
.vz__toggle-btn span { font-size: .92rem; font-weight: 600; color: var(--c-ink); }
.vz__toggle-btn small { font-size: .72rem; color: var(--c-muted); }
.vz__toggle-btn.is-active { background: #fff; box-shadow: var(--shadow-sm); }
.vz__toggle-btn.is-active span { color: var(--c-red); }

/* Палитра швов */
.vz__swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: .5rem;
  max-height: 280px;
  overflow-y: auto;
  padding: .3rem;
}
.vz__swatch {
  cursor: pointer;
  background: var(--c-card-warm);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color .15s, transform .15s;
}
.vz__swatch:hover { transform: scale(1.04); }
.vz__swatch.is-active { border-color: var(--c-red); background: #fff; }
.vz__swatch-color {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.vz__swatch-name {
  font-size: .65rem;
  color: var(--c-ink-soft);
  text-align: center;
  line-height: 1.1;
  font-weight: 500;
}

/* Расчёт комплекта */
.vz__area {
  display: flex; align-items: center; gap: .7rem;
  background: var(--c-card-warm);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: .7rem .9rem;
  margin-bottom: .8rem;
}
.vz__area span { font-size: .82rem; color: var(--c-muted); }
.vz__area input {
  border: none; background: transparent;
  font: inherit; font-weight: 700; font-size: 1.05rem;
  color: var(--c-ink);
  width: 100%; text-align: right;
  outline: none;
}

.vz__pack {
  background: linear-gradient(180deg, var(--c-card-warm), #fff);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 1rem;
  margin-bottom: 1rem;
  display: grid;
  gap: .6rem;
}
.vz__pack-row {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: .92rem;
}
.vz__pack-row span { color: var(--c-muted); }
.vz__pack-row strong { font-weight: 700; }
.vz__pack-total {
  border-top: 1px dashed var(--c-line);
  padding-top: .6rem;
  font-size: 1.1rem;
}
.vz__pack-total strong { color: var(--c-red); font-size: 1.2rem; font-weight: 800; }

/* ─── АДАПТИВ ──────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .vz { grid-template-columns: 1fr; }
  .vz__preview { position: static; }
  .vz__bricks { max-height: 220px; }
  .vz__swatches { max-height: 220px; }
}
@media (max-width: 600px) {
  .vz__summary { grid-template-columns: 1fr; }
  .vz__toggle { grid-template-columns: 1fr; }
}
