/*
 * Adinkra tables. Content tables (and tables pasted from Word) get class .gaec-tbl.
 * Colours and spacing come from Customize > Tables through CSS variables.
 */
.gaec-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1.75em; }
.gaec-table-wrap:focus-visible { outline: 2px solid var(--gaec-primary, #0B4F8A); outline-offset: 2px; }
.wp-block-table .gaec-table-wrap { margin: 0; }

.gaec-tbl,
.editor-styles-wrapper .wp-block-table table {
	--t-head-bg: var(--gaec-tbl-head-bg, var(--gaec-primary-dark, #083F77));
	--t-head-fg: var(--gaec-tbl-head-fg, #fff);
	--t-border: var(--gaec-tbl-border, #DEE2E6);
	--t-stripe: var(--gaec-tbl-stripe, #F5F7FA);
	--t-pad: var(--gaec-tbl-pad, 12px 16px);
	width: 100%; border-collapse: collapse; border-spacing: 0; margin: 0;
	font-size: var(--gaec-tbl-size, 15px); line-height: 1.5; color: inherit; background: transparent; table-layout: auto;
}
.gaec-tbl caption { caption-side: bottom; text-align: left; padding-top: 8px; font-size: .85em; color: var(--gaec-muted, #6C757D); }
.gaec-tbl th, .gaec-tbl td,
.editor-styles-wrapper .wp-block-table th, .editor-styles-wrapper .wp-block-table td {
	padding: var(--t-pad); text-align: left; vertical-align: top; border: 0; border-bottom: 1px solid var(--t-border); word-break: normal; overflow-wrap: anywhere;
}
.gaec-tbl thead th, .gaec-tbl thead td,
.editor-styles-wrapper .wp-block-table thead th {
	background: var(--t-head-bg); color: var(--t-head-fg); font-weight: 600; border-bottom: 0; vertical-align: bottom;
}
.gaec-tbl thead a { color: inherit; }
.gaec-tbl tbody th { font-weight: 600; }
.gaec-tbl td > :first-child, .gaec-tbl th > :first-child { margin-top: 0; }
.gaec-tbl td > :last-child, .gaec-tbl th > :last-child { margin-bottom: 0; }
.gaec-tbl tfoot td { font-weight: 600; border-top: 2px solid var(--t-border); }
.gaec-tbl tbody tr:hover > * { background-color: color-mix(in srgb, var(--t-stripe) 60%, transparent); }

/* Lines (default): IAEA-like, rule under each row */
.gaec-tbl--lines thead th { background: transparent; color: inherit; border-bottom: 2px solid var(--t-head-bg); }
/* Striped */
.gaec-tbl--striped tbody tr:nth-child(even) > * { background-color: var(--t-stripe); }
.gaec-tbl--striped td, .gaec-tbl--striped tbody th { border-bottom: 0; }
/* Grid: every cell boxed */
.gaec-tbl--grid th, .gaec-tbl--grid td { border: 1px solid var(--t-border); }
.gaec-tbl--grid thead th { border-color: var(--t-head-bg); }
/* Minimal: no colours, light rules */
.gaec-tbl--minimal thead th { background: transparent; color: inherit; border-bottom: 1px solid currentColor; }
.gaec-tbl--minimal td { border-bottom-color: color-mix(in srgb, var(--t-border) 60%, transparent); }

/* Block editor: per-table styles (Table block > Styles). These beat the site-wide style. */
.wp-block-table.is-style-gaec-lines thead th { background: transparent; color: inherit; border-bottom: 2px solid var(--t-head-bg); }
.wp-block-table.is-style-gaec-striped thead th, .wp-block-table.is-style-gaec-grid thead th { background: var(--t-head-bg); color: var(--t-head-fg); }
.wp-block-table.is-style-gaec-striped tbody tr:nth-child(even) > * { background-color: var(--t-stripe); }
.wp-block-table.is-style-gaec-striped td { border-bottom: 0; }
.wp-block-table.is-style-gaec-grid th, .wp-block-table.is-style-gaec-grid td { border: 1px solid var(--t-border); }
.wp-block-table.is-style-gaec-minimal thead th { background: transparent; color: inherit; border-bottom: 1px solid currentColor; }
.wp-block-table.is-style-gaec-compact th, .wp-block-table.is-style-gaec-compact td { padding: 6px 10px; font-size: .92em; }
/* Colours chosen on the block itself win. */
.wp-block-table table.has-background thead th { background: transparent; color: inherit; }

/* Phones: stacked cards ("Column: value") for tables set to Stack */
@media (max-width: 640px) {
	.gaec-tbl--stack.has-labels thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.gaec-tbl--stack.has-labels, .gaec-tbl--stack.has-labels tbody, .gaec-tbl--stack.has-labels tr, .gaec-tbl--stack.has-labels td, .gaec-tbl--stack.has-labels tbody th { display: block; width: 100%; }
	.gaec-tbl--stack.has-labels tr { border: 1px solid var(--t-border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
	.gaec-tbl--stack.has-labels tbody tr:nth-child(even) > * { background: transparent; }
	.gaec-tbl--stack.has-labels { display: flex; flex-direction: column; }
	.gaec-tbl--stack.has-labels caption { display: block; order: 2; }
	.gaec-tbl--stack.has-labels td, .gaec-tbl--stack.has-labels tbody th { position: relative; padding-left: calc(38% + 20px); min-height: 1.5em; border: 0; border-bottom: 1px solid var(--t-border); text-align: left !important; }
	.gaec-tbl--stack.has-labels tr > :last-child { border-bottom: 0; }
	.gaec-tbl--stack.has-labels td::before, .gaec-tbl--stack.has-labels tbody th::before { content: attr(data-label); position: absolute; left: 14px; width: 38%; font-weight: 600; color: var(--gaec-muted, #6C757D); overflow-wrap: anywhere; }
	.gaec-tbl--stack.has-labels td:not([data-label]), .gaec-tbl--stack.has-labels tbody th:not([data-label]) { padding-left: 14px; }
	.gaec-tbl--stack.has-labels td:not([data-label])::before { content: none; }
	.gaec-tbl--scroll { min-width: 560px; }
	.gaec-table-wrap:has(.gaec-tbl--scroll) { background: linear-gradient(to right, #fff 30%, rgba(255,255,255,0)), linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) 100% 0, radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.14), transparent), radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.14), transparent) 100% 0; background-repeat: no-repeat; background-size: 30px 100%, 30px 100%, 12px 100%, 12px 100%; background-attachment: local, local, scroll, scroll; }
}
@media print {
	.gaec-table-wrap { overflow: visible; }
	.gaec-tbl thead th { background: #eee !important; color: #000 !important; }
}
.gaec-tbl--firstcol tbody td:first-child { font-weight: 600; }
.gaec-tbl--fixed { table-layout: fixed; }
.gaec-table-sec .gaec-table-wrap { margin-bottom: 0; overflow: auto; }
