@font-face {
  font-family: 'Jibang Calligraphy';
  src: url('./assets/fonts/LXGWWenKaiKR-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* A reusable artifact; the caller owns its surrounding preview and A4 sheet. */
.jibang-tablet {
  position: relative;
  box-sizing: border-box;
  container-type: inline-size;
  display: block;
  width: 100%;
  max-width: 60mm;
  aspect-ratio: 60 / 220;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: #fff;
  color: #171717;
  direction: ltr;
  writing-mode: horizontal-tb;
}

.jibang-tablet .jibang-outline {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.jibang-tablet .jibang-slots {
  position: absolute;
  inset: 8.1818181818% 11.6666666667%; /* 18 mm top/bottom, 7 mm sides */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  direction: ltr;
}

.jibang-tablet .jibang-slot {
  display: flex;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.jibang-tablet .jibang-slot--male { grid-column: 1; }
.jibang-tablet .jibang-slot--female { grid-column: 2; }
.jibang-tablet .jibang-slots--single .jibang-slot { grid-column: 1 / -1; }

/* Explicit groups keep their supplied order, including repeated genders. */
.jibang-tablet .jibang-slots--explicit {
  grid-template-columns: repeat(var(--jibang-column-count), minmax(0, 1fr));
}

.jibang-tablet .jibang-slots--explicit .jibang-slot {
  grid-column: auto;
}

.jibang-tablet .jibang-inscription {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Jibang Calligraphy', 'Noto Serif CJK KR', 'Batang', serif;
  font-size: 16.6666666667cqw; /* 10 mm on a 60 mm tablet */
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
}

.jibang-tablet .jibang-inscription > span {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.jibang-tablet .jibang-notice {
  position: absolute;
  right: 5%;
  bottom: 2%;
  left: 5%;
  margin: 0;
  color: #7d2920;
  font: 400 12px/1.5 sans-serif;
  text-align: center;
  word-break: keep-all;
}

/* Page size/margins and the active printable panel belong to print.css. */
@media print {
  .jibang-tablet {
    width: 60mm;
    min-width: 60mm;
    max-width: 60mm;
    height: 220mm;
    min-height: 220mm;
    max-height: 220mm;
    aspect-ratio: auto;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    color: #000;
    flex-shrink: 0;
  }

  .jibang-tablet .jibang-inscription { font-size: 10mm; }
}
