/* ============================================================
   MACCOME Blog — Comparison / data tables
   Linked from blog article pages; see generate-blog.md §4
   ============================================================ */

.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 1.125rem;
  box-shadow: 0 0 40px rgba(26, 28, 29, 0.05);
  margin: 1.375rem 0;
  /* Do NOT set overflow:hidden here — it prevents horizontal scroll
     and forces columns to shrink until CJK text breaks one char per line. */
}

.tbl {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: auto;
}

.tbl th,
.tbl td {
  padding: 0.7rem 1rem;
  vertical-align: top;
  text-align: left;
  line-height: 1.65;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

/* CJK: avoid breaking every ideograph when a column is slightly narrow */
:lang(zh) .tbl th,
:lang(zh) .tbl td,
:lang(zh-CN) .tbl th,
:lang(zh-CN) .tbl td,
:lang(zh-Hant) .tbl th,
:lang(zh-Hant) .tbl td,
:lang(ja) .tbl th,
:lang(ja) .tbl td,
:lang(ko) .tbl th,
:lang(ko) .tbl td {
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

.tbl thead tr {
  background: #eeeef0;
}

.tbl th {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(26, 28, 29, 0.45);
  background: transparent;
  white-space: nowrap;
}

.tbl td {
  color: #43474e;
  border-bottom: 1px solid rgba(193, 198, 214, 0.2);
  background: #fff;
  min-width: 7rem;
  max-width: 26rem;
}

.tbl tr:last-child td {
  border-bottom: none;
}

.tbl td strong {
  color: #1a1c1d;
  font-weight: 600;
}

.tbl td code,
.tbl th code {
  white-space: nowrap;
  word-break: keep-all;
  font-size: 0.8125rem;
}

/* First column: row labels stay on one line; sticky on horizontal scroll */
.tbl th:first-child,
.tbl td:first-child {
  white-space: nowrap;
  min-width: 5.5rem;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 2px 0 6px rgba(26, 28, 29, 0.06);
}

.tbl thead th:first-child {
  background: #eeeef0;
  z-index: 2;
}

/* Optional utility classes in markup */
.tbl .col-nowrap {
  white-space: nowrap;
  width: 1%;
  min-width: auto;
  max-width: none;
}

.tbl .col-compact {
  min-width: 4.5rem;
  max-width: 8rem;
}

.tbl .col-wide {
  min-width: 11rem;
  max-width: 32rem;
}

/* Markup: <table class="tbl tbl-comparison"> — wide multi-column matrix */
.tbl-comparison th:not(:first-child),
.tbl-comparison td:not(:first-child) {
  min-width: 11rem;
  max-width: 28rem;
}

/* Markup: <table class="tbl tbl-mapping"> — Unicode / code mapping rows */
.tbl-mapping td:first-child,
.tbl-mapping th:first-child {
  white-space: normal;
  word-break: keep-all;
  min-width: 10rem;
  max-width: 24rem;
}

.tbl-mapping th:not(:first-child),
.tbl-mapping td:not(:first-child) {
  white-space: nowrap;
  width: 1%;
  min-width: auto;
  max-width: none;
}

@media (max-width: 640px) {
  .tbl td {
    min-width: 6rem;
    max-width: 18rem;
  }
}
