/* ===== NY-2026: A4 canvas + rulers ===== */

:root{
  --a4w: 210mm;
  --a4h: 297mm;
  --bleed: 6mm;         /* вылет для фона/подложки (если понадобится) */
  --gridMinor: 5mm;
  --gridMajor: 10mm;
}

/* контейнер страницы примера */
.ny2026-wrap{
  display: grid;
  gap: 10px;
}

/* СЦЕНА: A4 */
.ny2026-stage{
  position: relative;
  width: var(--a4w);
  height: var(--a4h);

  max-width: 100%;
  aspect-ratio: 210 / 297;

  border-radius: 18px;
  overflow: hidden;

  /* “лист” */
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);

  /* чтобы лист красиво вписывался в страницу */
  margin: 0 auto;
}

/* РЕЖИМ: вписать A4 в маленький экран (лист в mm, но визуально масштабируется через браузер сам) */
@media (max-width: 900px){
  .ny2026-stage{
    width: 100%;
    height: auto;
  }
}

/* Подложка: сетка */
.ny2026-gridlayer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  z-index: 1;
}

/* 5мм сетка */
.ny2026-gridlayer.is-minor{
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.08) 1px, transparent 1px);
  background-size: var(--gridMinor) var(--gridMinor);
}

/* 10мм сетка (поверх) */
.ny2026-gridlayer.is-major{
  opacity: 0.35;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.18) 1px, transparent 1px);
  background-size: var(--gridMajor) var(--gridMajor);
}

/* Линейки (сверху и слева) */
.ny2026-ruler-top,
.ny2026-ruler-left{
  position: absolute;
  pointer-events: none;
  z-index: 2;
  opacity: 0.75;
}

.ny2026-ruler-top{
  left: 0; right: 0; top: 0;
  height: 14mm;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.85), rgba(255,255,255,0.0));
  border-bottom: 1px solid rgba(0,0,0,0.12);
}

.ny2026-ruler-left{
  top: 0; bottom: 0; left: 0;
  width: 14mm;
  background:
    linear-gradient(to right, rgba(255,255,255,0.85), rgba(255,255,255,0.0));
  border-right: 1px solid rgba(0,0,0,0.12);
}

/* штрихи (CSS-only) */
.ny2026-ruler-top::before{
  content:"";
  position:absolute; inset:0;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.25) 1px, transparent 1px);
  background-size: 1mm 100%;
  opacity: 0.35;
}
.ny2026-ruler-top::after{
  content:"";
  position:absolute; inset:0;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.55) 1px, transparent 1px);
  background-size: 10mm 100%;
  opacity: 0.35;
}

.ny2026-ruler-left::before{
  content:"";
  position:absolute; inset:0;
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,0.25) 1px, transparent 1px);
  background-size: 100% 1mm;
  opacity: 0.35;
}
.ny2026-ruler-left::after{
  content:"";
  position:absolute; inset:0;
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,0.55) 1px, transparent 1px);
  background-size: 100% 10mm;
  opacity: 0.35;
}

/* Маркер выбора */
.ny2026-outline{
  position:absolute;
  border: 2px dashed rgba(58,134,255,0.85);
  border-radius: 10px;
  pointer-events:none;
  z-index: 6;
  box-shadow: 0 0 0 6px rgba(58,134,255,0.12);
}

/* PNG */
.ny2026-img{
  position: absolute;
  z-index: var(--z, 2);

  /* Позиционирование в мм */
  left: calc(var(--xmm, 30) * 1mm);
  top:  calc(var(--ymm, 40) * 1mm);

  /* ✅ ФИКСИРОВАННЫЙ РАЗМЕР */
  width: 200px;
  height: auto;          /* сохраняем пропорции */

  transform-origin: center;
  transform: rotate(calc(var(--rot, 0) * 1deg));

  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  touch-action: none;

  max-width: none;       /* важно */
}
.ny2026-img:active{ cursor: grabbing; }

/* Панель */
.ny2026-panel{
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 10;

  width: min(340px, calc(100% - 20px));
  border-radius: 16px;
  padding: 12px;

  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
}

.ny2026-panel h3{
  margin: 0 0 10px;
  font-size: 14px;
}

.ny2026-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 12px;
}

.ny2026-row{ opacity: 0.95; }
.ny2026-row b{ opacity: 0.9; }

.ny2026-actions{
  display:flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ny2026-btn{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color:#fff;
  border-radius: 999px;
  padding: 7px 10px;
  cursor:pointer;
  font-size: 12px;
  font-weight: 600;
}
.ny2026-btn:hover{ background: rgba(255,255,255,0.12); }
.ny2026-btn--copy{ margin-left:auto; }

.ny2026-rot{ margin-top: 10px; }
.ny2026-rot__top{
  display:flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 6px;
}
.ny2026-rot__hint{ opacity: 0.7; }

.ny2026-range{ width: 100%; }

.ny2026-csshead{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.95;
}

.ny2026-css{
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  max-height: 180px;
  overflow:auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

/* Переключатели */
.ny2026-toggles{
  display:flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ny2026-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size: 12px;
  opacity: 0.95;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  cursor: pointer;
  user-select: none;
}
.ny2026-chip input{ accent-color: #3a86ff; }

