/*
 * Shared rules for ActionText / Lexxy-rendered content.
 * Loaded by:
 *   - catalog.css (public show page, scoped via .dt-prose .lexxy-content)
 *   - admin layout (lexxy editor, scoped via lexxy-editor .lexxy-content)
 *
 * Every selector starts at .lexxy-content so the rules apply identically
 * in both contexts without leaking elsewhere.
 */

.lexxy-content {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink-2, #2b3340);
  font-weight: 400;
  letter-spacing: -0.003em;
}

.lexxy-content > p,
.lexxy-content > ul,
.lexxy-content > ol {
  max-width: 70ch;
}

.lexxy-content p {
  margin: 0 0 14px;
}

.lexxy-content b,
.lexxy-content strong {
  color: var(--ink, #0f1726);
  font-weight: 600;
}

.lexxy-content ul,
.lexxy-content ol {
  margin: 0 0 14px;
  padding-left: 1.4em;
}

.lexxy-content a {
  color: var(--brand, #1f6feb);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lexxy-content a:hover {
  color: var(--brand-deep, #144aa6);
}

.lexxy-content blockquote {
  margin: 14px 0;
  padding: 14px 18px;
  border-left: 2px solid var(--ink-5, #c7cdd6);
  background: var(--paper-3, #f4f6fa);
  border-radius: var(--radius-md, 10px);
  color: var(--ink-2, #2b3340);
}

/* ---------- Tables ---------- */

/* Unified scroll wrapper: lexxy-native <figure> and legacy WP .responsive-table */
.lexxy-content figure.lexxy-content__table-wrapper,
.lexxy-content .responsive-table {
  margin: 14px 0;
  padding: 0;
  border: 1px solid var(--line, #e3e7ee);
  border-radius: var(--radius-md, 10px);
  overflow-x: auto;
  background: var(--paper, #ffffff);
}

.lexxy-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin: 0;
}

.lexxy-content table td,
.lexxy-content table th {
  padding: 12px 14px;
  border: 1px solid var(--line, #e3e7ee);
  text-align: left;
  vertical-align: top;
}

/* Reduce paragraph spacing inside cells; kill trailing margin */
.lexxy-content table td > p,
.lexxy-content table th > p {
  margin: 0 0 6px;
}
.lexxy-content table td > p:last-child,
.lexxy-content table th > p:last-child {
  margin-bottom: 0;
}

/* Zebra striping on body rows */
.lexxy-content table tbody tr:nth-child(even) td {
  background: var(--paper-3, #f4f6fa);
}

/* Legacy band: single-cell rows act as section headers */
.lexxy-content table tr:has(td:only-child) td {
  background: var(--paper-3, #f4f6fa);
  font-weight: 600;
  color: var(--ink, #0f1726);
}

/* Label/value first-column emphasis (default behaviour) */
.lexxy-content table td:first-child {
  font-weight: 600;
  color: var(--ink, #0f1726);
}

/*
 * Header-cell detection: row 1 cells whose entire content is a single
 * <strong> wrapped in a <p>. Lexxy authors column-header cells as
 * <td><p><strong>…</strong></p></td>. Tints them + thickens the bottom
 * border so they read as a header band, even though Lexxy doesn't emit
 * semantic <th>. Nested :has() (e.g. :not(:has(:has()))) is invalid per
 * the Selectors Level 4 spec, so we avoid it and accept that mixed first
 * rows get partial banding (acceptable for the lab tables here).
 */
.lexxy-content table > tbody > tr:first-child > td:has(> p > strong:only-child) {
  background: var(--paper-3, #f4f6fa);
  font-weight: 600;
  color: var(--ink, #0f1726);
  border-bottom-width: 2px;
}

/* Nested tables (legacy WP): flat, no inner zebra, no wrapper chrome */
.lexxy-content table td table {
  margin: 6px 0 0;
  border: 1px solid var(--line, #e3e7ee);
}
.lexxy-content table td table td,
.lexxy-content table td table th {
  padding: 8px 10px;
}
.lexxy-content table td table tbody tr:nth-child(even) td {
  background: transparent;
}
.lexxy-content table td table td:first-child {
  font-weight: inherit;
  color: inherit;
}

/* Lexxy's own header-cell class wins where present */
.lexxy-content table th.lexxy-content__table-cell--header,
.lexxy-content table td.lexxy-content__table-cell--header {
  background: var(--paper-3, #f4f6fa);
  font-weight: 600;
  color: var(--ink, #0f1726);
}
