/* Forex Daily — site-wide content tables.
   Moved out of single-press-release.css (was scoped to .single-pr__body).
   Enqueued on every front-end page (functions.php). */

/* ══ Content tables — Gutenberg Table block + classic tables ═════════
   Premium, clean: rounded card, brand-gradient header, soft zebra rows,
   row hover, key/value label column. SITE-WIDE: applies to every
   Gutenberg table block and unclassed table inside <main id="main">
   (news, blog, lessons, press releases, posts, pages, reviews…).
   Tables that carry their own class are left alone. !important on cell colours/backgrounds is
   deliberate: it neutralises fills pasted from Word/Google Docs that
   break dark mode. Colours via --fxd-* so [data-theme] works. */
#main figure.wp-block-table {
  position: relative;
  margin: var(--fdt-space-4) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--fxd-primary) 16%, var(--fxd-border));
  background: var(--fxd-surface);
  box-shadow: 0 6px 20px rgba(16, 24, 40, .06);
}
#main :is(figure.wp-block-table > table, table:not([class])) {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fxd-text);
  background: var(--fxd-surface);
  table-layout: auto;
}
#main figure.wp-block-table > table.has-fixed-layout { table-layout: fixed; }
#main table:not([class]) {
  margin: var(--fdt-space-4) 0;
  border: 1px solid color-mix(in srgb, var(--fxd-primary) 16%, var(--fxd-border));
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(16, 24, 40, .06);
  overflow: hidden;
}
#main figure.wp-block-table > table { border: 0; }

#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td) {
  padding: 12px 18px;
  text-align: left;
  vertical-align: middle;
  border: 0 !important;
  border-bottom: 1px solid var(--fxd-border) !important;
  background: transparent !important;
  color: var(--fxd-text) !important;
}
#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td)[class*="has-text-align-center"] { text-align: center; }
#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td)[class*="has-text-align-right"] { text-align: right; }
#main :is(figure.wp-block-table > table, table:not([class])) tr:last-child > :is(th, td) { border-bottom: 0 !important; }
#main :is(figure.wp-block-table > table, table:not([class])) :is(tr, tbody, thead, tfoot) { background: transparent !important; }
#main figure.wp-block-table.is-style-stripes {
  background: var(--fxd-surface) !important;
  border-color: color-mix(in srgb, var(--fxd-primary) 16%, var(--fxd-border)) !important;
}

/* Zebra + hover */
#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:nth-child(even) > :is(th, td) {
  background: color-mix(in srgb, var(--fxd-primary) 4%, var(--fxd-surface)) !important;
}
#main :is(figure.wp-block-table > table, table:not([class])) tbody tr { transition: background-color .15s ease; }
#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:hover > :is(th, td) {
  background: color-mix(in srgb, var(--fxd-primary) 9%, var(--fxd-surface)) !important;
}

/* Header row: real <thead>, or a first row made only of <th> */
#main :is(figure.wp-block-table > table, table:not([class])) :is(thead, tfoot) :is(th, td),
#main :is(figure.wp-block-table > table, table:not([class])) thead + tbody tr:first-child:has(> th:only-of-type) {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
#main :is(figure.wp-block-table > table, table:not([class])) thead :is(th, td) {
  background: linear-gradient(135deg, var(--fxd-primary-fill-hover), var(--fxd-primary-fill)) !important;
  color: #fff !important;
  border-bottom: 0 !important;
  white-space: nowrap;
}
#main :is(figure.wp-block-table > table, table:not([class])) tfoot :is(th, td) {
  background: color-mix(in srgb, var(--fxd-primary) 10%, var(--fxd-surface)) !important;
  border-top: 1px solid var(--fxd-border) !important;
}

/* Key / value tables (no header row): first column reads as a label */
#main :is(figure.wp-block-table > table, table:not([class])):not(:has(thead)) tbody td:first-child,
#main :is(figure.wp-block-table > table, table:not([class])) tbody th {
  font-weight: 700;
  color: var(--fxd-primary) !important;
  background: color-mix(in srgb, var(--fxd-primary) 7%, var(--fxd-surface)) !important;
  border-right: 1px solid var(--fxd-border) !important;
  box-shadow: inset 3px 0 0 var(--fxd-primary);
}
#main :is(figure.wp-block-table > table, table:not([class])):not(:has(thead)) tbody td:first-child { min-width: 140px; }

#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td) a {
  color: var(--fxd-primary);
  font-weight: 600;
  text-decoration: none;
}
#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td) a:hover { text-decoration: underline; text-underline-offset: 3px; }
#main :is(figure.wp-block-table > table, table:not([class])) :is(th, td) :is(p, ul, ol) { margin: 0; }
#main figure.wp-block-table figcaption {
  margin: 0;
  padding: 10px 20px 14px;
  font-size: 12.5px;
  text-align: center;
  color: var(--fxd-text-muted);
  border-top: 1px solid var(--fxd-border);
  background: var(--fxd-surface);
}
/* Scrollbar on narrow screens */
#main figure.wp-block-table::-webkit-scrollbar { height: 6px; }
#main figure.wp-block-table::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--fxd-primary) 35%, transparent); border-radius: 6px; }

@media (max-width: 640px) {
  #main :is(figure.wp-block-table > table, table:not([class])) { font-size: 13px; }
  #main :is(figure.wp-block-table > table, table:not([class])) :is(th, td) { padding: 10px 13px; }
  #main figure.wp-block-table > table:not(.has-fixed-layout) { min-width: 520px; }
  #main table:not([class]) { display: block; overflow-x: auto; }
  #main :is(figure.wp-block-table > table, table:not([class])):not(:has(thead)) tbody td:first-child { min-width: 110px; }
}

/* ── Dark-mode / stripe safety net ─────────────────────────────────
   Some tables still render white rows on the odd lines (WordPress
   "stripes" style, pasted inline fills, or a plugin's table CSS) with
   light text on top → unreadable in dark mode. Re-assert the row
   backgrounds with a doubled-ID selector so nothing else can win.
   Even rows keep the green zebra tint; odd rows = card surface. */
#main#main :is(figure.wp-block-table, figure.wp-block-table > table, table:not([class])) tbody tr:nth-child(odd),
#main#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:nth-child(odd) > :is(th, td) {
  background-color: var(--fxd-surface) !important;
  background-image: none !important;
  color: var(--fxd-text) !important;
}
#main#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:nth-child(even),
#main#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:nth-child(even) > :is(th, td) {
  background-color: color-mix(in srgb, var(--fxd-primary) 4%, var(--fxd-surface)) !important;
  background-image: none !important;
  color: var(--fxd-text) !important;
}
#main#main :is(figure.wp-block-table > table, table:not([class])) tbody tr:hover > :is(th, td) {
  background-color: color-mix(in srgb, var(--fxd-primary) 9%, var(--fxd-surface)) !important;
}
/* Key/value tables (no header row): keep the tinted label column */
#main#main :is(figure.wp-block-table > table, table:not([class])):not(:has(thead)) tbody td:first-child,
#main#main :is(figure.wp-block-table > table, table:not([class])) tbody th {
  background-color: color-mix(in srgb, var(--fxd-primary) 7%, var(--fxd-surface)) !important;
  color: var(--fxd-primary) !important;
}
/* Header row stays the green gradient */
#main#main :is(figure.wp-block-table > table, table:not([class])) thead :is(th, td) {
  background-image: linear-gradient(135deg, var(--fxd-primary-fill-hover), var(--fxd-primary-fill)) !important;
  background-color: var(--fxd-primary-fill) !important;
  color: #fff !important;
}
/* Gutenberg "stripes" wrapper + any has-background fill on the block */
#main#main figure.wp-block-table,
#main#main figure.wp-block-table.is-style-stripes,
#main#main figure.wp-block-table.has-background {
  background-color: var(--fxd-surface) !important;
}
