/* «Примерить в комнате»: инструмент примерки. Общие стили сайта — в site.css. */

/* Свой акцент из утверждённого макета; шапка и подвал остаются в фирменном бирюзовом. */
.tool, .perks, .order-sticky {
  --accent: #0b85c3;
  --accent-dark: #0a71a7;
  --accent-soft: #edf6fa;
  --navy: #1a2240;
  --text: #2a2f3d;
}
.container--wide { max-width: 1434px; }
/* :where — сброс без веса, иначе он перебивает классы кнопок (фон «До / после», «На весь экран» и др.) */
:where(.tool) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.tool img, .perks img { display: block; max-width: 100%; }
.tool svg, .perks svg, .order-sticky svg { flex-shrink: 0; }

/* ---------- инструмент ---------- */
.tool {
  display: grid; grid-template-columns: 165px minmax(0, 1fr) 385px; gap: 0 28px;
  padding-top: 38px; padding-bottom: 24px; align-items: start;
}
.filters { padding-top: 6px; }
.filter-group { padding: 0 0 12px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.filter-group:last-of-type { border-bottom: 0; }
.filter-group h4 { margin: 0 0 8px; color: var(--navy); font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.filter-list { list-style: none; margin: 0; padding: 0; }
.filter-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 10px; margin-left: -10px;
  border-left: 2px solid transparent; font-size: 14px; color: #3d4250; text-align: left;
}
.filter-list button:hover { color: var(--accent); }
.filter-list button.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--navy); }
.filter-list.brands button.active { font-weight: 600; }
.filter-list.brands button, .filter-list.colors button { padding-top: 2.5px; padding-bottom: 2.5px; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 10px; padding: 2.5px 0; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.filter-list button.active .dot { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--accent); }
.reset { color: var(--accent); font-size: 13px; font-weight: 500; }
.reset:hover { text-decoration: underline; }

.stage { min-width: 0; }
.tool h1 { margin: 0 0 12px; color: var(--navy); font-size: 31px; line-height: 1.2; font-weight: 600; letter-spacing: -.3px; }
.tool-lead { margin: 0 0 24px; max-width: 720px; color: #4f5563; font-size: 15px; }

.viewer {
  position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: #e9e6e1;
  user-select: none; -webkit-user-select: none;
}
.viewer .backdrop {
  position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); max-width: none;
  object-fit: cover; filter: blur(28px) brightness(.85);
}
/* Жесты блокируем только при увеличении (чтобы двигать фото), иначе палец прокручивает страницу. */
.canvas { position: absolute; inset: 0; overflow: hidden; touch-action: pan-x pan-y pinch-zoom; }
.canvas.zoomed { cursor: grab; touch-action: none; }
.canvas.dragging { cursor: grabbing; }
.canvas img {
  width: 100%; height: 100%; object-fit: contain; transform-origin: center center;
  transition: opacity .25s ease; will-change: transform;
}
.canvas img.fading { opacity: .35; }
.overlay-pill {
  position: absolute; display: flex; align-items: center; gap: 10px; border-radius: 10px;
  background: rgba(24, 28, 40, .72); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.area { left: 20px; bottom: 20px; padding: 9px 14px 9px 12px; }
.area small { display: block; font-size: 11px; opacity: .85; line-height: 1.2; }
.area strong { font-size: 15px; font-weight: 600; }
.area { cursor: text; }
.area-value { display: flex; align-items: baseline; gap: 4px; font-size: 15px; font-weight: 600; }
.area input {
  width: 3ch; min-width: 0; padding: 0; border: 0; border-bottom: 1px dashed rgba(255,255,255,.6); border-radius: 0;
  background: transparent; color: #fff; font: 600 16px/1.25 "Montserrat", sans-serif;  /* 16px — иначе iPhone приближает страницу */
}
.area input:focus { outline: none; border-bottom: 1px solid #fff; }
.zoom { right: 76px; bottom: 20px; padding: 4px; gap: 0; }
.zoom button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; }
.zoom button:hover { background: rgba(255,255,255,.12); }
.zoom span { min-width: 52px; text-align: center; font-weight: 600; font-size: 14px; }
.fullscreen { right: 20px; bottom: 20px; width: 46px; height: 46px; justify-content: center; }
.loading {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: rgba(20, 24, 36, .45); color: #fff; text-align: center; padding: 20px;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.loading b { font-size: 16px; font-weight: 600; }
.loading small { font-size: 13px; opacity: .85; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 80%;
  padding: 14px 18px; border-radius: 10px; background: rgba(24, 28, 40, .72); color: #fff; text-align: center; font-weight: 500;
}
.toast {
  position: absolute; left: 50%; top: 20px; transform: translateX(-50%); max-width: calc(100% - 40px);
  padding: 10px 16px; border-radius: 8px; background: #fff; color: #b3261e; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast.info { color: var(--navy); }
.viewer:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; background: #000; }
.viewer:fullscreen .backdrop { display: none; }
.viewer.is-fullscreen {
  position: fixed !important; inset: 0; z-index: 1000; margin: 0 !important; width: 100vw; height: 100vh; height: 100dvh;
  aspect-ratio: auto; border-radius: 0; background: #000;
}
.viewer.is-fullscreen .backdrop { display: none; }
.viewer-close { display: none; left: 16px; top: calc(16px + env(safe-area-inset-top)); width: 44px; height: 44px; justify-content: center; }
.viewer.is-fullscreen .viewer-close, .viewer:fullscreen .viewer-close { display: flex; }
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }

/* ---------- плашка с выбранным покрытием и примерным расчётом ---------- */
.summary {
  display: flex; align-items: center; gap: 14px; margin-top: 24px; padding: 10px 10px 10px 12px;
  border-radius: 6px; background: #f4f6f9;
}
.summary-thumb { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.summary-product { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.summary-product b { color: var(--navy); font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-product span, .summary-calc span { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.summary-calc { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; cursor: help; }
.summary-calc b { color: var(--navy); font-size: 16px; font-weight: 700; white-space: nowrap; }
.order-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 4px;
  background: #25d366; color: #fff; font-size: 14.5px; font-weight: 600; white-space: nowrap; transition: background .15s;
}
.order-btn:hover { background: #1ebe5a; }
.order-sticky { display: none; }
.examples-title { margin: 26px 0 14px; color: var(--navy); font-size: 15px; font-weight: 600; }
.examples {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 36px) / 4); gap: 12px;
  overflow-x: auto; padding: 4px; margin: -4px; scrollbar-width: thin;
}
.example {
  position: relative; aspect-ratio: 16 / 9.6; border-radius: 3px; overflow: hidden; outline: 2px solid transparent;
  outline-offset: 2px; transition: outline-color .15s;
}
.example img { width: 100%; height: 100%; object-fit: cover; }
.example:hover { outline-color: var(--line); }
.example.active { outline-color: var(--accent); }
.example span {
  position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 6px;
  background: rgba(24,28,40,.72); color: #fff; font-size: 11.5px; font-weight: 500;
}

.picker { min-width: 0; }
.upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 48px;
  border-radius: 3px; background: var(--accent); color: #fff; font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background .15s;
}
.upload-btn:hover { background: var(--accent-dark); }
.upload-note { margin: 12px 0 22px; color: var(--muted); font-size: 12.5px; text-align: center; }
.cat-tabs { display: flex; justify-content: space-around; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.cat-tabs button { position: relative; padding: 16px 4px 15px; font-size: 14px; color: #4f5563; white-space: nowrap; }
.cat-tabs button:hover { color: var(--accent); }
.cat-tabs button.active { color: var(--accent); font-weight: 600; }
.cat-tabs button.active::after { content: ""; position: absolute; left: -16px; right: -16px; bottom: -1px; height: 2px; background: var(--accent); }
.filters-toggle { display: none; }
.grid-wrap {
  overflow-y: auto; padding: 3px 6px 28px 3px; margin: -3px -6px 0 -3px; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
}
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.product { position: relative; min-width: 0; }
.card-main { display: block; width: 100%; text-align: left; }
.card-img { display: block; aspect-ratio: 1 / .94; border-radius: 3px; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; background: #eee; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card-main:hover .card-img img { transform: scale(1.04); }
.product.active .card-img { outline-color: var(--accent); }
.card-name { display: block; margin-top: 8px; font-size: 12.5px; line-height: 1.3; color: var(--text); }
.card-price { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--navy); }
.fav {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center;
  color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.fav.on { color: #ff5a6a; }
.fav.on svg path { fill: currentColor; }
.empty { grid-column: 1 / -1; padding: 30px 10px; text-align: center; color: var(--muted); }
.empty button { color: var(--accent); font-weight: 500; }

/* ---------- преимущества ---------- */
.perks { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); padding-top: 26px; padding-bottom: 36px; }
.perk { display: flex; gap: 18px; padding: 4px 28px; border-left: 1px solid var(--line); }
.perk:first-child { border-left: 0; padding-left: 0; }
.perk svg { color: var(--navy); }
.perk b { display: block; color: var(--navy); font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.perk p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }


  @media (max-width: 1240px) {
  .tool { grid-template-columns: 170px minmax(0, 1fr) 320px; gap: 0 28px; }
}
@media (max-width: 1060px) {

  .tool { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 22px; }
  .stage, .picker { display: contents; }
  .tool h1 { order: 1; font-size: 24px; }
  .tool-lead { order: 2; font-size: 14px; margin-bottom: 16px; }
  .upload-btn { order: 3; }
  .upload-note { order: 4; margin: 8px 0 14px; }
  .viewer { order: 5; position: sticky; top: 0; z-index: 5; margin: 0 -24px; border-radius: 0; }
  .examples-title { order: 6; margin-top: 18px; }
  .summary { display: none; }
  /* На телефоне выбранное покрытие и кнопка заказа всегда внизу экрана. */
  .order-sticky {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -4px 18px rgba(0,0,0,.12);
  }
  .order-sticky img { width: 44px; height: 44px; border-radius: 3px; object-fit: cover; }
  .order-sticky div { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
  .order-sticky b { color: var(--navy); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .order-sticky div span { color: var(--navy); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .order-sticky .order-btn { padding: 0 14px; }
  body.has-order { padding-bottom: 76px; }
  .examples { order: 7; display: flex; overflow-x: auto; gap: 10px; padding-bottom: 4px; }
  .example { flex: 0 0 150px; }
  .cat-tabs { order: 9; margin: 22px 0 12px; }
  .filters-toggle {
    order: 10; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; margin-bottom: 14px;
    border: 1px solid var(--line); border-radius: 3px; font-weight: 500; color: var(--navy);
  }
  .filters { order: 11; display: none; padding-top: 0; }
  .filters.open { display: block; }
  .grid-wrap { order: 12; max-height: none !important; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .area, .zoom, .fullscreen { transform: scale(.86); }
  .area { left: 10px; bottom: 10px; transform-origin: left bottom; }
  .zoom { right: 62px; bottom: 10px; transform-origin: right bottom; }
  .fullscreen { right: 10px; bottom: 10px; transform-origin: right bottom; }
  .perks { grid-template-columns: 1fr 1fr; gap: 24px 0; }
  .perk:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 620px) {
  .wa-long { display: none; }
  .viewer { margin: 0 -16px; }
  .zoom { display: none; }
  .product-grid { gap: 14px 10px; }
  .perks { grid-template-columns: 1fr; }
  .perk { border-left: 0; padding-left: 0; }
}
