/*
 * Tables that read on a phone (inc/tables.php), 0.23.0. Only tables marked agk-stack-table (four or more columns),
 * only under 640px. Content tables carry inline styles (pasted HTML), hence !important on the cell box.
 */

@media (max-width: 640px) {
  .agk-table:has(> .agk-stack-table),
  .wp-block-table:has(> .agk-stack-table) { overflow: visible; }

  .entry-content table.agk-stack-table,
  .entry-content table.agk-stack-table > tbody,
  .entry-content table.agk-stack-table > tfoot { display: block; width: 100% !important; border: 0 !important; }
  .entry-content table.agk-stack-table > thead,
  .entry-content table.agk-stack-table .agk-stack-table__head { display: none; }

  .entry-content table.agk-stack-table tr {
    display: block;
    margin: 0 0 14px;
    background: var(--white) !important;
    border: 1px solid var(--agk-line-strong) !important; /* a border, not an inset shadow: cell fills would cover it */
  }
  .entry-content table.agk-stack-table :is(td, th) {
    display: block;
    width: auto !important;
    padding: 10px 16px !important;
    text-align: left !important;
    background: none !important;
    border: 0 !important;
    border-top: 1px solid var(--agk-line) !important;
  }
  .entry-content table.agk-stack-table tr > :first-child {
    border-top: 0 !important;
    font-size: 16px;
    font-weight: 500;
    color: var(--navy);
    background: var(--wash, var(--surface)) !important;
  }
  .entry-content table.agk-stack-table tr > [data-label]:not(:first-child) {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
  }
  .entry-content table.agk-stack-table tr > [data-label]:not(:first-child)::before {
    content: attr(data-label);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--ink-muted);
  }
}
