/* 編み物の友 PDF体裁（正本: docs/design/amirobo-ui.pen P1〜P3）
   余白は@pageで5mm確保し、タイルSVGはさらに5mmオフセット＝編み図の物理位置・縮尺は従来
   （紙端から10mm）と同一。浮いた5mm帯をヘッダー・フッターに使う。 */
@media print {
  @page {
    size: A5;
    margin: 5mm;
  }
  body * {
    visibility: hidden;
  }
  .print-pages, .print-pages * {
    visibility: visible;
  }
  .print-pages {
    position: absolute;
    top: 0;
    left: 0;
    font-family: 'Hiragino Maru Gothic ProN', 'BIZ UDGothic', 'Yu Gothic', sans-serif;
    color: #222;
  }
  .print-page {
    page-break-after: always;
    position: relative;
    width: 138mm;
    height: 199mm;
    overflow: hidden;
    background: #FFF;
  }
  /* 検算シートは段数によって複数ページに流す（切り捨て禁止） */
  .print-page.print-checksheet {
    height: auto;
    min-height: 199mm;
    overflow: visible;
  }
  .print-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 7pt;
    color: #6B6B6B;
  }

  /* --- 表紙 --- */
  .print-cover {
    padding: 5mm 8mm;
    text-align: center;
  }
  .cover-band {
    background: #C0392B;
    color: #FFF;
    font-weight: 700;
    letter-spacing: 0.5em;
    font-size: 12pt;
    padding: 3.5mm 0 3.5mm 0.5em;
    margin-bottom: 6mm;
  }
  .cover-title {
    font-size: 24pt;
    font-weight: 800;
    margin: 2mm 0 4mm;
  }
  .cover-chart svg {
    display: block;
    margin: 0 auto;
    max-width: 62mm;
    max-height: 62mm;
  }
  .cover-info {
    width: 100%;
    border-collapse: collapse;
    margin: 5mm 0 0;
    font-size: 10pt;
    text-align: left;
  }
  .cover-info tr:nth-child(odd) {
    background: #F7F7F9;
  }
  .cover-info th {
    color: #6B6B6B;
    font-weight: 700;
    font-size: 9pt;
    width: 27mm;
    padding: 2mm 3mm;
    vertical-align: top;
  }
  .cover-info td {
    padding: 2mm 3mm;
  }
  .cover-memo {
    text-align: left;
    margin-top: 7mm;
  }
  .cover-memo span {
    font-size: 9pt;
    font-weight: 700;
    color: #6B6B6B;
  }
  .memo-line {
    height: 9mm;
    border-bottom: 0.3mm solid #D8D8DC;
  }

  /* --- 編み図タイル --- */
  .tile-header {
    position: absolute;
    top: 0;
    left: 5mm;
    right: 5mm;
    height: 5mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8pt;
    color: #6B6B6B;
  }
  .tile-header .tile-label {
    font-size: 11pt;
    font-weight: 800;
    color: #222;
  }
  .print-tile-svg {
    display: block;
    position: absolute;
    top: 5mm;
    left: 5mm;
    outline: 0.3mm dashed #C9C9CC;
  }
  .glue-band {
    background: #F0F0F0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2mm;
    font-size: 8pt;
    font-weight: 700;
    color: #222;
    text-align: center;
  }
  .glue-band .glue-arrow {
    font-size: 12pt;
    color: #6B6B6B;
  }
  .glue-band-left {
    position: absolute;
    top: 5mm;
    left: 5mm;
    width: 15mm;
    height: 190mm;
    writing-mode: vertical-rl;
  }
  .glue-band-left .glue-arrow {
    writing-mode: horizontal-tb;
  }
  .glue-band-top {
    position: absolute;
    top: 5mm;
    left: 5mm;
    width: 128mm;
    height: 15mm;
    flex-direction: row;
  }

  /* --- 検算シート --- */
  .print-checksheet {
    padding: 5mm 8mm;
  }
  .sheet-title {
    font-size: 16pt;
    font-weight: 800;
    margin: 0 0 1mm;
  }
  .sheet-note {
    font-size: 9pt;
    color: #6B6B6B;
    margin: 0 0 4mm;
  }
  .sheet-columns {
    column-count: 2;
    column-gap: 6mm;
  }
  .checksheet-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 9pt;
    margin: 0 0 5mm;
  }
  .checksheet-table th:nth-child(1) { width: 32%; }
  .checksheet-table th:nth-child(2) { width: 26%; }
  .checksheet-table th:nth-child(3) { width: 18%; }
  .checksheet-table th:nth-child(4) { width: 24%; }
  .checksheet-table th, .checksheet-table td {
    white-space: nowrap;
  }
  .checksheet-table caption.unit-band {
    background: #C0392B;
    color: #FFF;
    font-weight: 700;
    font-size: 10pt;
    text-align: left;
    padding: 1.5mm 3mm;
  }
  .checksheet-table th {
    background: #F4F4F6;
    color: #6B6B6B;
    font-size: 8pt;
    font-weight: 700;
    text-align: left;
    padding: 1mm 2mm;
  }
  .checksheet-table td {
    padding: 1mm 2mm;
  }
  .checksheet-table tbody tr:nth-child(even) {
    background: #F7F7F9;
  }
  .checkbox {
    display: inline-block;
    width: 3.5mm;
    height: 3.5mm;
    border: 0.3mm solid #8E8E93;
    border-radius: 0.5mm;
  }
}
