/*
 * 对标 · 3-tier industry comparison table.
 * Wise-style: rounded card container, ring border, bold numbers, green highlight on mine column.
 */

.compare-wrap {
  background: var(--bg-card);
  border-radius: 30px;
  padding: 8px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}

.compare-row {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 1fr 1fr 1fr;  /* 评测项 + M60 Pro (mine, slightly wider) + 3 其他牌号 */
  border-bottom: 1px solid var(--line-soft);
}

.compare-row:last-child { border-bottom: none; }

.compare-row .cell {
  padding: 20px 22px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

/* Header row — subtle bg, uppercase small caps */
.compare-row.head {
  background: var(--bg-soft);
  border-radius: 22px 22px 0 0;
}

.compare-row.head .cell {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 18px 22px;
}

.compare-row.head .cell.mine {
  color: var(--accent-dark);
  font-size: 14px;
  text-transform: none;
  letter-spacing: -0.005em;
}

/* Metric name cell (first column in data rows) */
.compare-row .cell.metric-name {
  font-weight: 600;
  color: var(--text);
}

.compare-row .cell .sub {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0;
}

/* MINE — MATLEX column highlighted in mint green */
.compare-row .cell.mine {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 16px;
}

.compare-row.head .cell.mine {
  background: var(--accent);
  color: var(--accent-on);
}

.compare-row:last-child .cell.mine {
  border-radius: 0 0 22px 22px;
}

/* Inline pill badge (主力, 本方案 etc) — dark navy chip on the accent header.
   In the column-flex head cell it sits flush-left under the grade name, so we
   zero the inline margin that was shifting it visually off-axis. */
.pill {
  display: inline-flex;
  padding: 3px 10px;
  background: var(--accent-dark);
  color: var(--accent-on);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 0;
  align-self: flex-start;
}

/* Swipe hint — shown only on mobile, sits just under the scrollable table. */
.compare-swipe-hint {
  display: none;
  margin: 14px auto 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.06em;
}

/* === Mobile compare table =================================================
   Previous behaviour hid 3 of the 4 grade columns on mobile, which defeated
   the whole point of a comparison. Instead we keep every column visible and
   let the user swipe horizontally. The first column (metric name) is sticky
   so users never lose context of which row they're reading.
   ===========================================================================*/
@media (max-width: 860px) {
  .compare-wrap {
    padding: 0;
    border-radius: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* Hint the user there's more to scroll: subtle right-edge fade */
    mask-image: linear-gradient(to right, black 0%, black 92%, rgba(0,0,0,0.6) 100%);
    -webkit-mask-image: linear-gradient(to right, black 0%, black 92%, rgba(0,0,0,0.6) 100%);
  }
  .compare-row {
    /* Fixed min-width per column so all 5 cells always lay out horizontally,
       forcing the container to overflow and scroll. */
    grid-template-columns: 108px repeat(4, 118px);
    width: max-content;
    min-width: 100%;
  }
  .compare-row .cell {
    padding: 12px 14px;
    font-size: 13px;
    scroll-snap-align: start;
  }
  .compare-row.head .cell {
    padding: 14px;
    font-size: 11px;
  }
  .compare-row.head .cell.mine {
    font-size: 13px;
  }
  /* The metric-name column stays pinned while other columns scroll past it. */
  .compare-row .cell.metric-name,
  .compare-row.head .cell:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 2;
    box-shadow: 1px 0 0 var(--line-soft);
  }
  .compare-row.head .cell:first-child { background: var(--bg-soft); }
  .compare-row .cell.mine {
    font-size: 14px;
  }
  .compare-row .cell .sub { font-size: 11px; }
  .compare-row .cell.mine {
    /* don't re-corner rounded — the whole table lives inside .compare-wrap
       which already has border-radius + overflow:hidden inherited by rows. */
    border-radius: 0;
  }
  /* Small nudge hint the first time the user sees the table */
  .compare-wrap::-webkit-scrollbar { height: 4px; }
  .compare-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

  .compare-swipe-hint { display: block; }
}
