/* =====================================================================
   PILINA.CZ — náhled gravírování
   Soubor: /user/documents/upload/theme/pilina-engraving.css
   Načítat AŽ ZA pilina-sc.css / pilina-sc-dark.css (kvůli --pl-*).
   ===================================================================== */

/* =====================================================================
   SPOUŠTĚČ
   ===================================================================== */

.engTrigger { margin-top: 18px; }
.engTrigger label { cursor: pointer; }
.engTrigger__note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--pl-muted, #6b5e4c);
}

/* =====================================================================
   MODAL
   ===================================================================== */

.engLock { overflow: hidden; }

.engModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 21, 12, .72);
}
.engModal[hidden] { display: none; }

.engModal__box {
  position: relative;
  width: 100%;
  max-width: 940px;
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .38);
}

.engModal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--pl-line, #e6dccb);
}
.engModal__title {
  margin: 0;
  font: 500 20px var(--pl-serif, Georgia, serif);
  color: var(--pl-ink, #2c2317);
}

/* zavírací křížek — dost velký, aby byl na mobilu trefitelný */
.engModal__close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--pl-sand, #f6f0e5);
  font-size: 26px;
  line-height: 1;
  color: var(--pl-ink, #2c2317);
  cursor: pointer;
}
.engModal__close:hover { background: var(--pl-line, #e6dccb); }

.engModal__grid {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 22px;
  padding: 22px;
}

/* =====================================================================
   PLÁTNO
   ===================================================================== */

.engStage {
  position: relative;
  align-self: start;
  border-radius: 8px;
  overflow: hidden;
  background: var(--pl-sand, #f6f0e5);
  user-select: none;
  touch-action: none;
}
.engStage__base {
  display: block;
  width: 100%;
  height: auto;
}
.engStage__hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(36, 28, 18, .78);
  color: #f4ece0;
  font-size: 11.5px;
}

/* plocha gravírování — motiv se mimo ni nedostane */
.engZone {
  position: absolute;
  outline: 1px dashed rgba(44, 35, 23, .45);
  outline-offset: 0;
}

.engOverlay {
  position: absolute;
  top: 15%;
  left: 15%;
  width: 70%;
  cursor: move;
  touch-action: none;
}
.engOverlay__img {
  display: block;
  width: 100%;
  opacity: .8;
  pointer-events: none;
  /* vzhled výpalu: potlačí barvy a přidá kontrast, aby motiv
     nevypadal jako nalepená fotka, ale jako vypálená kresba */
  mix-blend-mode: multiply;
  filter: grayscale(1) contrast(1.35) brightness(.92) sepia(.35);
}
.engOverlay__handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid var(--pl-ink, #2c2317);
  border-radius: 3px;
  cursor: nwse-resize;
}

/* =====================================================================
   PANEL VPRAVO
   ===================================================================== */

.engSide { display: flex; flex-direction: column; gap: 10px; }

.engSide__label {
  margin: 6px 0 0;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8a6636;
}

.engPicker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.engPick { display: block; cursor: pointer; }
.engPick input { position: absolute; opacity: 0; pointer-events: none; }

.engPick__box {
  display: block;
  border: 2px solid var(--pl-line, #e6dccb);
  border-radius: 7px;
  overflow: hidden;
  background: var(--pl-sand, #f6f0e5);
  transition: border-color .15s ease;
}
.engPick__box img {
  display: block;
  width: 100%;
  height: 66px;
  object-fit: cover;
}
.engPick__name {
  display: block;
  padding: 5px 7px;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--pl-body, #5b4f40);
}

.engPick input:checked + .engPick__box {
  border-color: var(--pl-green, #3d5233);
}
.engPick input:focus-visible + .engPick__box {
  outline: 2px solid var(--pl-gold, #b0873f);
  outline-offset: 2px;
}

.engSide input[type="range"] { width: 100%; }

/* =====================================================================
   RESPONZIVITA
   ===================================================================== */

@media (max-width: 767px) {
  .engModal { padding: 0; }
  .engModal__box {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .engModal__grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  .engPicker { grid-template-columns: repeat(4, 1fr); }
  .engPick__name { display: none; }

  /* větší úchyt pro prst */
  .engOverlay__handle {
    width: 26px;
    height: 26px;
    right: -13px;
    bottom: -13px;
  }
}
