/* ============================================================
   Лаборатория Safaryan Design Studio
   Интерактивные инструменты: рентген, конфигуратор, план, 3D-тур.
   Использует переменные из style.css (--bg, --gold, --text ...).
   ============================================================ */

.lab-hero { padding: 132px 0 40px; }
.lab-hero .kicker { color: var(--gold); }
.lab-lead { max-width: 720px; color: var(--text-2); margin-top: 18px; line-height: 1.7; }

.lab-stage {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.lab-hint {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; color: var(--muted); font-size: 0.9rem;
}
.lab-hint svg { width: 18px; height: 18px; stroke: var(--gold); fill: none; stroke-width: 1.5; }

.lab-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.lab-chip {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-2);
  border-radius: 999px;
  padding: 9px 17px;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.lab-chip:hover { border-color: var(--gold); color: var(--gold-soft); }
.lab-chip.is-active { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* ---------------- 1. Рентген интерьера ---------------- */
.xray {
  position: relative;
  aspect-ratio: 1448 / 1086;
  cursor: none;
  --mx: 50%; --my: 50%; --r: 240px;
  touch-action: none;
}
.xray img, .xray svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.xray-base { object-fit: cover; }

/* круг-«линза»: clip-path надёжнее mask-image - последний в ряде браузеров
   перекрывает кадр целиком, из-за чего базовое фото не видно */
.xray-layer {
  position: absolute; inset: 0;
  clip-path: circle(var(--r) at var(--mx) var(--my));
  will-change: clip-path;
  contain: paint;
  transition: opacity .3s var(--ease);
}
.xray.is-full .xray-layer { clip-path: none; }
.xray-inside { object-fit: cover; }
/* мягкая подсветка по краю линзы, чтобы переход не был резким */
.xray-layer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 60px rgba(200, 169, 106, .18);
}

.xray-lens {
  position: absolute;
  left: var(--mx); top: var(--my);
  width: calc(var(--r) * 2); height: calc(var(--r) * 2);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(200, 169, 106, .55);
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 18px 60px rgba(0,0,0,.45);
  pointer-events: none;
  transition: opacity .25s var(--ease);
}
.xray.is-full .xray-lens, .xray.is-idle .xray-lens { opacity: 0; }

.xray-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; }
.xray-legend span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; }
.xray-legend i { width: 22px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------------- 2. Конфигуратор стиля ---------------- */
.cfg { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 34px; align-items: start; }
@media (max-width: 980px) { .cfg { grid-template-columns: 1fr; } }

.cfg-step { margin-bottom: 26px; }
.cfg-step h3 {
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 12px; font-weight: 400;
}
.cfg-options { display: flex; flex-wrap: wrap; gap: 9px; }

.cfg-preview { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.cfg-preview .cfg-img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block;
  transition: opacity .45s var(--ease);
}
.cfg-preview.is-swapping .cfg-img { opacity: 0; }

.cfg-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 26px 22px;
  background: linear-gradient(to top, rgba(10,8,6,.92), rgba(10,8,6,.55) 45%, transparent);
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 30px;
}
.cfg-caption .cfg-style-name { font-size: 1.25rem; color: var(--text); }
.cfg-caption .cfg-style-desc { color: var(--text-2); font-size: .88rem; margin-top: 4px; max-width: 420px; line-height: 1.55; }

.cfg-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 20px; }
.cfg-fig { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--bg-card); }
.cfg-fig span { display: block; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.cfg-fig strong { display: block; margin-top: 7px; font-size: 1.32rem; color: var(--gold-soft); font-weight: 500; }
.cfg-fig em { display: block; margin-top: 3px; font-style: normal; font-size: .8rem; color: var(--muted); }

.cfg-swatches { display: flex; gap: 8px; margin-top: 4px; }
.cfg-swatches i { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); }

.cfg-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cfg-note { color: var(--faint); font-size: .82rem; }

/* ---------------- 3. Интерактивный план ---------------- */
/* слева план и кнопки, справа карточка комнаты - карточка занимает обе строки */
.plan {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 22px 30px;
  align-items: start;
}
.plan > .lab-stage { grid-column: 1; grid-row: 1; }
.plan > .plan-side  { grid-column: 1; grid-row: 2; }
.plan > .plan-card  { grid-column: 2; grid-row: 1 / span 2; }
@media (max-width: 980px) {
  .plan { grid-template-columns: 1fr; }
  .plan > .lab-stage, .plan > .plan-side, .plan > .plan-card { grid-column: 1; grid-row: auto; }
  .plan > .plan-card { order: -1; }
}

.plan-svg { width: 100%; height: auto; display: block; }
.plan-room { cursor: pointer; }
.plan-room .room-fill {
  fill: rgba(200, 169, 106, .05);
  stroke: rgba(238, 228, 213, .30);
  stroke-width: 2;
  transition: fill .3s var(--ease), stroke .3s var(--ease);
}
.plan-room:hover .room-fill,
.plan-room.is-active .room-fill { fill: rgba(200, 169, 106, .20); stroke: var(--gold); }
.plan-room text { fill: var(--text-2); font-size: 21px; letter-spacing: .06em; pointer-events: none; }
.plan-room .room-area { fill: var(--faint); font-size: 17px; }
.plan-room:hover text, .plan-room.is-active text { fill: var(--gold-soft); }
.plan-walls { stroke: rgba(238, 228, 213, .5); stroke-width: 7; fill: none; stroke-linecap: square; }
.plan-dot { fill: var(--gold); opacity: 0; transition: opacity .3s var(--ease); }
.plan-room:hover .plan-dot, .plan-room.is-active .plan-dot { opacity: 1; }

.plan-card { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--bg-card); }
.plan-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: opacity .4s var(--ease); }
.plan-card.is-swapping img { opacity: 0; }
.plan-card-body { padding: 22px 24px 26px; }
.plan-card-body h3 { margin: 0 0 6px; font-size: 1.3rem; }
.plan-card-body .plan-meta { color: var(--gold-soft); font-size: .84rem; letter-spacing: .08em; text-transform: uppercase; }
.plan-card-body p { color: var(--text-2); line-height: 1.65; margin: 12px 0 0; font-size: .93rem; }
.plan-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.plan-tags span { border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 13px; font-size: .78rem; color: var(--muted); }

/* ---------------- 4. 3D-тур ---------------- */
.tour-stage { position: relative; aspect-ratio: 16 / 9; background: #0d0b09; }
.tour-stage canvas { width: 100%; height: 100%; display: block; }
.tour-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(13,11,9,.35), rgba(13,11,9,.8));
  text-align: center; padding: 20px; transition: opacity .4s var(--ease);
}
.tour-overlay.is-hidden { opacity: 0; pointer-events: none; }
.tour-overlay h3 { font-size: 1.5rem; margin: 0 0 10px; }
.tour-overlay p { color: var(--text-2); max-width: 460px; margin: 0 auto 20px; line-height: 1.6; font-size: .93rem; }
.tour-keys { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.tour-keys kbd {
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 11px;
  font-family: inherit; font-size: .8rem; color: var(--text-2); background: rgba(255,255,255,.03);
}
.tour-hud {
  position: absolute; left: 18px; bottom: 18px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.tour-hud .lab-chip { backdrop-filter: blur(8px); background: rgba(13,11,9,.55); }
.tour-fps {
  position: absolute; right: 18px; bottom: 18px;
  color: var(--faint); font-size: .76rem; letter-spacing: .08em;
}

/* ---------------- хаб «Лаборатория» ---------------- */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.lab-tile {
  display: block; border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  background: var(--bg-card); text-decoration: none; color: inherit;
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.lab-tile:hover { transform: translateY(-4px); border-color: var(--gold); }
.lab-tile-media { aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-3); }
.lab-tile-media img { width: 100%; height: 100%; object-fit: cover; }
.lab-tile-body { padding: 20px 22px 24px; }
.lab-tile-body h3 { margin: 0 0 8px; font-size: 1.18rem; }
.lab-tile-body p { margin: 0; color: var(--muted); font-size: .89rem; line-height: 1.6; }
.lab-tile-tag {
  display: inline-block; margin-bottom: 12px; font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold);
}

@media (max-width: 700px) {
  .lab-hero { padding: 108px 0 30px; }
  .xray { --r: 120px; }
  .cfg-caption { padding: 20px 18px 18px; }
}

/* ---- Конфигуратор: обратная связь по классу отделки и площади ---- */
.cfg-badges {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; z-index: 2;
}
.cfg-badge {
  padding: 7px 13px; border-radius: 999px; font-size: .78rem; letter-spacing: .05em;
  background: rgba(13, 11, 9, .55); color: var(--text); backdrop-filter: blur(8px);
  border: 1px solid rgba(238, 228, 213, .18);
}
.cfg-badge--grade { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 500; }

/* класс отделки виден и по подаче кадра: премиум светлее и контрастнее */
.cfg-preview[data-grade="base"] .cfg-img    { filter: saturate(.88) brightness(.96) contrast(.98); }
.cfg-preview[data-grade="comfort"] .cfg-img { filter: none; }
.cfg-preview[data-grade="premium"] .cfg-img { filter: saturate(1.08) brightness(1.05) contrast(1.05); }

.cfg-scope {
  margin-top: 18px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg-card);
}
.cfg-scope h4 {
  margin: 0 0 8px; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); font-weight: 500;
}
.cfg-scope__desc { margin: 0 0 12px; color: var(--text-2); font-size: .92rem; line-height: 1.6; }
.cfg-scope ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.cfg-scope li { color: var(--muted); font-size: .89rem; line-height: 1.5; }
