/* "Перфо фолио по ваш дизайн" — product page (inc/custom-perfo.php). */
.mm-perfo-page {
  --pf-red: #e30613;
  --pf-ink: #181314;
  --pf-muted: #655b5e;
  --pf-line: #ebe5e6;
  --pf-soft: #f6f3f4;
  --pf-good: #15803d;
  --pf-warn: #b45309;
  --pf-bad: #c4000f;
}

/* Preview (left, sticky) + summary (right). */
.mm-perfo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
  clear: both;
  margin-bottom: 28px;
}
.mm-perfo-layout > * { min-width: 0; }
.mm-perfo-layout > .mm-perfo-stage { grid-column: 1; }
.mm-perfo-page.single-product div.product .mm-perfo-layout > div.summary {
  grid-column: 2;
  float: none !important;
  width: 100% !important;
  margin: 0;
}
.mm-perfo-layout + * { clear: both; }

.mm-perfo-stage {
  position: sticky;
  top: 90px;
  padding: 14px;
  border: 1px solid var(--pf-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #eef1f4 0%, #f8f6f4 62%, #e7e2dc 100%);
}
.mm-perfo-stage__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.mm-perfo-badge,
.mm-perfo-size {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--pf-ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.mm-perfo-size { background: var(--pf-ink); color: #fff; }
.mm-perfo-size[hidden] { display: none; }
.mm-perfo-car {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 3 / 2;
  background: #111;
}
.mm-perfo-car__photo { display: block; width: 100%; height: auto; }
/* Rear glass outline in the photo (inc/custom-perfo.php, CAR in custom-perfo.js). */
.mm-perfo-car[hidden] { display: none; }
.mm-perfo-car__note {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  display: block;
  width: clamp(130px, 34%, 230px);
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
  transition: transform .15s ease, filter .15s ease;
}
.mm-perfo-car__note img { display: block; width: 100%; height: auto; }
.mm-perfo-car__note:hover,
.mm-perfo-car__note:focus-visible { transform: scale(1.04); filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .6)); }
.mm-perfo-car__note:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 8px; }
.mm-perfo-car__zoom {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.mm-perfo-car__zoom svg { width: 15px; height: 15px; fill: none; stroke: #1b1b1b; stroke-width: 2.4; stroke-linecap: round; }
.mm-perfo-car--side .mm-perfo-glass { clip-path: polygon(17.71% 17.19%, 18.36% 16.70%, 60.55% 17.29%, 62.83% 18.36%, 65.10% 20.70%, 68.03% 24.90%, 70.64% 29.30%, 72.01% 32.03%, 72.40% 33.69%, 72.01% 35.64%, 64.45% 53.52%, 61.52% 58.40%, 60.22% 60.06%, 58.59% 60.74%, 27.34% 60.84%, 26.56% 59.77%) !important; }
.mm-perfo-car--side .mm-perfo-shade { background: linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 220, 200, .08) 52%, rgba(255, 255, 255, 0) 64%); }
.mm-perfo-glass {
  position: absolute;
  inset: 0;
  clip-path: polygon(15.82% 14.84%, 17.06% 16.60%, 18.88% 18.16%, 21.48% 18.65%, 78.78% 18.65%, 81.71% 18.07%, 83.53% 16.41%, 84.44% 14.84%, 85.68% 17.58%, 87.24% 27.34%, 89.19% 37.11%, 91.21% 51.07%, 9.38% 51.27%, 10.81% 37.11%, 12.37% 29.30%, 14.32% 22.46%);
}
.mm-perfo-foil {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 520px;
  overflow: hidden;
  transform-origin: 0 0;
}
.mm-perfo-art { position: absolute; }
.mm-perfo-art img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-position: 50% 50%;
  filter: brightness(.86) saturate(.95);
}
.mm-perfo-art[hidden] { display: none; }
/* Holes of the perforated film (in foil units, so they follow the perspective). */
.mm-perfo-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(8, 10, 14, .42) 2.2px, rgba(8, 10, 14, .12) 3.4px, transparent 4px);
  background-size: 10px 10px;
  background-color: rgba(8, 10, 14, .08);
}
.mm-perfo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .55);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: .02em;
}
.mm-perfo-placeholder[hidden] { display: none; }
/* Spoiler shadow on top + a soft reflection, as on the real glass. */
.mm-perfo-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .45) 18.5%, rgba(0, 0, 0, 0) 25%),
    linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 220, 200, .10) 52%, rgba(255, 255, 255, 0) 64%);
}
.mm-perfo-car__reflect,
.mm-perfo-car__wiper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
}
/* Reflections of the real glass (trees, sky) over the film. */
.mm-perfo-car__reflect { opacity: .45; mix-blend-mode: screen; }
/* The rear wiper sits on top of the film. */
.mm-perfo-car__wiper { clip-path: polygon(49.02% 47.66%, 49.35% 46.68%, 50.13% 46.00%, 52.08% 45.70%, 65.10% 46.00%, 70.31% 46.48%, 74.54% 47.07%, 75.00% 47.66%, 74.61% 48.34%, 71.61% 48.63%, 61.20% 49.71%, 54.04% 50.59%, 50.78% 50.88%, 49.61% 50.49%, 49.09% 49.32%); }
.mm-perfo-stage.is-raw .mm-perfo-car__reflect,
.mm-perfo-stage.is-raw .mm-perfo-dots,
.mm-perfo-stage.is-raw .mm-perfo-shade,
.mm-perfo-modal.is-raw .mm-perfo-car__reflect,
.mm-perfo-modal.is-raw .mm-perfo-dots,
.mm-perfo-modal.is-raw .mm-perfo-shade { display: none; }
.mm-perfo-stage.is-raw .mm-perfo-art img,
.mm-perfo-modal.is-raw .mm-perfo-art img { filter: none; }
.mm-perfo-stage__hint {
  margin: 6px 0 10px !important;
  color: var(--pf-muted);
  font-size: 12.5px !important;
  line-height: 1.4;
  text-align: center;
}
.mm-perfo-zoom {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.mm-perfo-zoom button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--pf-line);
  border-radius: 999px;
  background: #fff;
  color: var(--pf-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mm-perfo-zoom button.is-active { border-color: var(--pf-ink); background: var(--pf-ink); color: #fff; }

/* Controls in the add-to-cart form. */
.mm-perfo,
.mm-perfo-checks { max-width: 520px; margin: 0 0 14px; }
.mm-perfo-step {
  display: block;
  margin: 0 0 8px;
  color: var(--pf-ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.mm-perfo .mm-perfo-step + .mm-perfo-step,
.mm-perfo-file + .mm-perfo-step,
.mm-perfo-drop + .mm-perfo-file[hidden] + .mm-perfo-step { margin-top: 18px; }
.mm-perfo-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 2px dashed #d9cfd1;
  border-radius: 14px;
  background: var(--pf-soft);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mm-perfo-drop:hover,
.mm-perfo-drop.is-over { border-color: var(--pf-red); background: #fff5f5; }
.mm-perfo-drop[hidden] { display: none; }
.mm-perfo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mm-perfo-drop__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--pf-red);
}
.mm-perfo-drop__icon svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mm-perfo-drop__text b { display: block; color: var(--pf-ink); font-size: 16px; }
.mm-perfo-drop__text small { display: block; margin-top: 2px; color: var(--pf-muted); font-size: 12.5px; line-height: 1.4; }

.mm-perfo-file {
  box-sizing: border-box;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--pf-line);
  border-radius: 12px;
  background: #fff;
}
.mm-perfo-file[hidden] { display: none; }
.mm-perfo-file img {
  flex: none;
  width: 64px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  background: #f1eeee;
}
.mm-perfo-file > div { flex: 1; min-width: 0; }
.mm-perfo-file b { display: block; overflow: hidden; color: var(--pf-ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.mm-perfo-file small { display: block; color: var(--pf-muted); font-size: 12.5px; }
.mm-perfo-progress { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--pf-line); overflow: hidden; }
.mm-perfo-progress[hidden] { display: none; }
.mm-perfo-progress i { display: block; height: 100%; width: 0; background: var(--pf-red); transition: width .2s; }
.mm-perfo-remove {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--pf-soft);
  color: var(--pf-muted);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.mm-perfo-remove:hover { background: #fff1f2; color: var(--pf-bad); }
.mm-perfo-link {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--pf-soft);
  color: var(--pf-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* The perfo dimension card: its left/right switch is driven by the placement choice above. */
.mm-perfo-page .wc-pbd-switch { display: none !important; }
.mm-perfo-page .wc-pbd-card { margin-top: 0; }

.mm-perfo-checks[hidden] { display: none; }
.mm-perfo-check {
  margin: 0 0 8px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--pf-line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  line-height: 1.45;
}
.mm-perfo-check[hidden] { display: none; }
.mm-perfo-check b { display: block; margin-bottom: 2px; color: var(--pf-ink); font-size: 14px; }
.mm-perfo-check span { color: #3f3739; }
.mm-perfo-check.is-good { border-left-color: var(--pf-good); background: #f3fbf5; }
.mm-perfo-check.is-good b { color: var(--pf-good); }
.mm-perfo-check.is-warn { border-left-color: #f59e0b; background: #fffbeb; }
.mm-perfo-check.is-warn b { color: var(--pf-warn); }
.mm-perfo-check.is-bad { border-left-color: var(--pf-bad); background: #fff1f2; }
.mm-perfo-check.is-bad b { color: var(--pf-bad); }
.mm-perfo-check.is-info { border-left-color: #94a3b8; }

.mm-perfo-place {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mm-perfo-place label { position: relative; display: block; margin: 0; cursor: pointer; }
.mm-perfo-place input { position: absolute; opacity: 0; }
.mm-perfo-place span {
  display: block;
  height: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--pf-line);
  border-radius: 12px;
  background: #fff;
}
.mm-perfo-place b { display: block; color: var(--pf-ink); font-size: 14.5px; }
.mm-perfo-place small { display: block; color: var(--pf-muted); font-size: 12.5px; line-height: 1.35; }
.mm-perfo-place input:checked + span { border-color: var(--pf-red); box-shadow: 0 0 0 2px rgba(227, 6, 19, .12); }
.mm-perfo-place input:focus-visible + span { outline: 2px solid var(--pf-red); outline-offset: 2px; }
.mm-perfo-place + .mm-perfo-step,
.mm-perfo-pair-note + .mm-perfo-step { margin-top: 18px; }
.mm-perfo-pair-note {
  margin: 8px 0 0 !important;
  padding: 10px 12px;
  border: 1px solid #f59e0b;
  border-left-width: 4px;
  border-radius: 10px;
  background: #fffbeb;
  color: #3f3739;
  font-size: 13.5px !important;
  line-height: 1.45;
}
.mm-perfo-pair-note b { color: var(--pf-warn); }
.mm-perfo-pair-note[hidden] { display: none; }
.mm-perfo-fit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}
.mm-perfo-fit[hidden] { display: none; }
.mm-perfo-fit label {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}
.mm-perfo-fit input { position: absolute; opacity: 0; }
.mm-perfo-fit span {
  display: block;
  height: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--pf-line);
  border-radius: 10px;
  background: #fff;
}
.mm-perfo-fit b { display: block; color: var(--pf-ink); font-size: 13.5px; }
.mm-perfo-fit small { display: block; color: var(--pf-muted); font-size: 12px; line-height: 1.35; }
.mm-perfo-fit input:checked + span { border-color: var(--pf-red); box-shadow: 0 0 0 2px rgba(227, 6, 19, .12); }
.mm-perfo-fit input:focus-visible + span { outline: 2px solid var(--pf-red); outline-offset: 2px; }

.mm-perfo-fix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  color: var(--pf-muted);
  font-size: 13px;
}
.mm-perfo-fix[hidden] { display: none; }
.mm-perfo-fixbtn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--pf-ink);
  border-radius: 999px;
  background: #fff;
  color: var(--pf-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mm-perfo-fixbtn:hover { background: var(--pf-ink); color: #fff; }

.mm-perfo-note { margin: 0 0 8px !important; color: var(--pf-muted); font-size: 12.5px !important; }
.mm-perfo-note[hidden] { display: none; }

.mm-perfo-ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 0;
  padding: 10px 12px;
  border: 1.5px solid var(--pf-line);
  border-radius: 10px;
  background: #fff;
  color: var(--pf-ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}
.mm-perfo-ack[hidden] { display: none; }
.mm-perfo-ack b { display: block; font-size: 14px; }
.mm-perfo-ack small { display: block; margin-top: 2px; color: var(--pf-muted); font-size: 12.5px; font-weight: 500; }
.mm-perfo-ack:has(input:checked) { border-color: var(--pf-good); background: #f3fbf5; }
.mm-perfo-ack input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--pf-red); }

.mm-perfo-error {
  max-width: 520px;
  margin: 0 0 12px !important;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1f2;
  color: var(--pf-bad);
  font-size: 13.5px !important;
  font-weight: 700;
}
.mm-perfo-error[hidden] { display: none; }

.mm-perfo-cart-thumb { object-fit: contain; background: #efeaeb; }

@media (max-width: 768px) {
  .mm-perfo-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mm-perfo-page.single-product div.product .mm-perfo-layout > div.summary { grid-column: 1; }
  .mm-perfo-stage { position: relative; top: auto; padding: 10px; }
  .mm-perfo-fit { grid-template-columns: 1fr; }
}

/* ---------- Винил банер с капси: preview on a fence (mm_banner_render_stage, drawBanner in custom-perfo.js) ---------- */
.mm-banner-scene {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 1500 / 1084;
  background: #6f8fa8;
}
.mm-banner-scene__photo { display: block; width: 100%; height: auto; }
/* The slatted fence panel between the pillars (in % of the photo), with a little room for the ties. */
.mm-banner-area {
  position: absolute;
  left: 19.6%;
  top: 26.6%;
  width: 58.3%;
  height: 42.2%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mm-banner {
  position: relative;
  flex: none;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
}
/* Slight vinyl sheen and tension folds between the grommets. */
.mm-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .13) 46%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .07));
}
.mm-banner__art { position: absolute; inset: 0; overflow: hidden; }
.mm-banner__art[hidden] { display: none; }
.mm-banner__art img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-position: 50% 50%;
}
.mm-banner .mm-perfo-placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.mm-banner__grommets { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
/* Grommet: brass-grey ring with a hole; ::before is the black zip tie going out to the fence. */
.mm-banner__grommets i {
  position: absolute;
  width: var(--gd, 10px);
  height: var(--gd, 10px);
  margin: calc(var(--gd, 10px) / -2) 0 0 calc(var(--gd, 10px) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, #2a2a2a 0 34%, #d9d9d9 38%, #9a9a9a 58%, #eeeeee 72%, #7c7c7c 100%);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, .55);
}
.mm-banner__grommets i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--tie, 14px);
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: #0d0d0d;
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .18);
  transform: rotate(var(--a, 0deg));
  transform-origin: 0 50%;
  z-index: -1;
}
.mm-banner-stage .mm-perfo-car__note { z-index: 3; }
.mm-banner .mm-perfo-placeholder { color: #b4abad; font-size: clamp(14px, 2.4vw, 26px); text-align: center; }
@media (max-width: 768px) {
  .mm-perfo-stage { scroll-margin-top: 10px; }
}

/* "Примерна визия" opens the preview in a popup: the live scene is moved into it and back on close. */
.mm-perfo-modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 10, 12, .86);
  animation: mmPerfoFade .18s ease;
}
.mm-perfo-modal[hidden] { display: none; }
.mm-perfo-modal__box {
  position: relative;
  width: min(100%, 1400px, calc((100vh - 110px) * var(--r, 1.5)));
}
.mm-perfo-modal__box > .mm-perfo-car,
.mm-perfo-modal__box > .mm-banner-scene { border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.mm-perfo-modal .mm-perfo-car__note { display: none; }
.mm-perfo-modal__cap { margin: 10px 0 0; color: #fff; font-size: 14px; text-align: center; opacity: .85; }
.mm-perfo-modal__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.mm-perfo-modal__close:hover { background: #d71920; color: #fff; }
body.mm-perfo-modal-open { overflow: hidden; }
@keyframes mmPerfoFade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 768px) {
  .mm-perfo-modal { padding: 10px; }
  .mm-perfo-modal__close { top: -50px; right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .mm-perfo-modal { animation: none; }
  .mm-perfo-car__note { transition: none; }
}
