/* ============================================================
   TABEL — blokken digirehab/tabel (D22)
   WordPress' tabelblok i temaets stil. Bygget ud fra Ældrelov-oversigtens tabel
   (tidl. aeldrelov-table): grøn overskriftsrække, skiftende rækker, fremhævet
   første kolonne og kort-visning på mobil med kolonneoverskrifterne som etiketter.
   ============================================================ */

.table-section {
  background-color: var(--color-bg-card);
  padding: var(--space-3xl) var(--space-xl);
}

.table-section__header {
  max-width: var(--max-width-content);
  margin: 0 auto var(--space-2xl);
}

.table-section__intro {
  color: var(--color-text-secondary);
  line-height: var(--line-height-body);
  max-width: 720px;
  margin: var(--space-md) 0 0;
}

.table-section__table {
  max-width: var(--max-width-content);
  margin: 0 auto;
}

.table-section .wp-block-table {
  margin: 0;
  overflow-x: visible;
}

.table-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-body);
  counter-reset: table-row;
}

.table-section th,
.table-section td {
  border: none;
}

.table-section thead {
  border: none;
}

.table-section thead tr {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}

.table-section thead th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-size: var(--font-size-secondary);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
}

.table-section thead th:first-child {
  width: 24%;
}

.table-section tbody tr {
  border-bottom: 1px solid var(--color-border);
  counter-increment: table-row;
}

.table-section tbody tr:nth-child(odd) {
  background-color: var(--color-bg-card);
}

.table-section tbody tr:nth-child(even) {
  background-color: var(--color-bg-inactive);
}

.table-section tbody td {
  padding: var(--space-lg);
  vertical-align: top;
  color: var(--color-text-secondary);
  line-height: var(--line-height-body);
}

/* Første kolonne: fremhævet titel */
.table-section tbody td:first-child {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Automatisk nummerering over titlen */
.table-section--numbered tbody td:first-child::before {
  content: counter(table-row, decimal-leading-zero);
  display: block;
  font-weight: var(--font-weight-regular);
  color: var(--color-primary);
  font-size: var(--font-size-h3);
  line-height: 1;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

/* ── Mobil: hver række som et kort ── */
@media (max-width: 767px) {
  .table-section thead {
    display: none;
  }

  .table-section table,
  .table-section tbody,
  .table-section tr,
  .table-section td {
    display: block;
    width: 100%;
  }

  .table-section tbody tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
    background-color: var(--color-bg-card) !important;
  }

  .table-section tbody td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
  }

  .table-section tbody td:last-child {
    border-bottom: none;
  }

  .table-section tbody td:first-child {
    background-color: var(--color-primary);
    color: var(--color-text-white);
  }

  .table-section--numbered tbody td:first-child::before {
    color: var(--overlay-white-muted);
    font-size: var(--font-size-caption);
    opacity: 1;
    margin-bottom: var(--space-xs);
  }

  /* Kolonneoverskriften som etiket over hver celle */
  .table-section tbody td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
    color: var(--color-primary);
  }

  .table-section tbody td:nth-child(3)::before {
    color: var(--color-primary-light);
  }

  .table-section tbody td:nth-child(4)::before {
    color: var(--color-accent);
  }
}
