/* 인쇄 — 흑백 지면 기준.
 *
 * 두 갈래가 있다:
 *  1) [인쇄] 버튼: 선택한 조각들을 배치 그대로 A4 한 장에 담은
 *     #print-sheet만 찍는다. 흰 블록 + 검정 글자, 재단 안내는 묶음
 *     바깥 모서리의 검정 점(print-outline)만.
 *  2) 브라우저 자체 인쇄(Cmd+P): 보드 전체가 흑백 도면처럼 나온다. */

#print-sheet { display: none; }

@media print {
  /* ── 1) 인쇄 버튼 시트 ─────────────────────────────── */
  body.printing { background: #fff; }
  body.printing > *:not(#print-sheet) { display: none !important; }
  /* 종이 한가운데 정렬 (100vh를 꽉 채우면 빈 페이지가 한 장 더 나올 수 있어 98vh) */
  #print-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 98vh;
  }
  #print-sheet .print-item {
    page-break-inside: avoid;
    margin: 0;
    /* 재단 점이 상자 경계에 걸쳐 찍히므로 잘라내지 않는다 */
    overflow: visible;
  }
  #print-sheet .print-canvas {
    position: relative;
    transform-origin: 0 0;
  }
  #print-sheet .print-canvas .piece {
    position: absolute;
    top: 0; left: 0;
  }
  #print-sheet .piece {
    filter: none;
    transform-origin: 0 0;
    pointer-events: auto;
  }
  /* 흰 블록 + 검정 글자, 화면용 색·블리드 그림자 제거 */
  #print-sheet .band {
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  #print-sheet .mat-link { color: #000 !important; }
  /* 재단 점 — 묶음 바깥 모서리마다 까맣게 채워진 작은 점 */
  #print-sheet .print-outline {
    position: absolute;
    top: 0; left: 0;
    overflow: visible;
  }
  #print-sheet .print-outline circle {
    fill: #000;
    stroke: none;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── 2) 브라우저 자체 인쇄: 보드 전체를 흑백 도면으로 ── */
  body { background: #fff !important; }
  #board { background: #fff !important; }
  /* 가이드라인(연결선·선택 실루엣)과 화면 전용 UI는 숨긴다 */
  #links, .piece-outline { display: none !important; }
  #add-btn, #loader { display: none !important; }
  /* 블록: 흰 배경 · 검정 글자 · 검정 테두리 */
  .piece .band,
  .c-yellow, .c-green, .c-pink, .c-blue {
    background: #fff !important;
    color: #000 !important;
    border: 0.4px dashed #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .piece .band * { color: #000 !important; }
  .piece .band a { color: #000 !important; }
  /* 인쇄 버튼 시트에서는 밴드 개별 테두리를 지운다 —
     이어진 밴드 사이에 줄이 생기지 않게. 테두리는 print-outline 하나만. */
  body.printing .band { border: none !important; }
}
