@charset "UTF-8";

/**
 * tables.css 1.2.0
 * Author: hybrid.
 * Type: core
 * Load: optional
 *
 * Table styles: neutral table (CORE), .table.flex variant (horizontal scroll),
 * and the Gutenberg table (figure.table > table).
 *
 * Sections
 * TABLE         — neutral table, thead/tbody/tfoot, tr, th/td
 * ALIGNMENT     — modifiers .is-top/middle/bottom (vertical) and .is-left/center/right (horizontal)
 * FLEX          — .table.flex, wide table with horizontal scroll
 * GUTENBERG     — figure.table (core/table block)
 * ACCESSIBILITY — caption visually hidden, still available to screen readers
 *
 * Dependencies
 * --stroke-width                  defined in reset.css
 * --theme-rgb                     defined in colors.css (RGB triplet, e.g. "255, 255, 255")
 * --font-weight-bold              defined in fonts.css
 *
 * Tokens defined here
 * --table-footer-font-size / --table-footer-font-weight / --table-cell-padding
 * --table-font-size
 * --table-stroke-width       inner strokes (row/cell separators), overridable per instance
 * --table-border             outer table border, overridable independently
 * --table-background-color   overridable per instance (e.g. table.dark { --table-background-color: var(--dark-rgb); })
 *
 * Notes
 * ACF tables (repeater, relationship) are not excluded here: the exclusion lives in the project WP section (styles.css).
 * `figure.table table { min-width: ... }` removed: `table` already forces `width: 100%`,
 * so the constraint on the Gutenberg wrapper is redundant by default. If a table ever fails to take the
 * full width (very narrow content?), bring it back here:
 * figure.table table { min-width: calc(var(--content-max-width) * 2 / 3); }
 * TODO — expose `.table.flex` as an option of the core/table block (boolean attribute `table_responsive`,
 * adds the `flex` class to the wrapper), like the toggles already in place on core/gallery.
 */



/* ================================================================================================== */
/* ============================================= CONFIG ============================================= */
/* ================================================================================================== */

:root {
	--table-font-size: 1em;
	--table-footer-font-size: 1.5em;
	--table-footer-font-weight: var(--font-weight-bold, 500);
	--table-cell-padding: 1em;
	--table-stroke-width: var(--stroke-width, .125em); /* inner strokes: rows, cell separators */
	--table-border: var(--stroke-width, .125em);       /* outer table border */
}

table {
	--table-background-color: var(--theme-rgb, var(--bright-rgb));
}



/* ================================================================================================ */
/* ============================================= CORE ============================================= */
/* ================================================================================================ */


/* ============================== TABLE ============================== */

/*
 * No display:grid/flex on table, thead, tbody, tfoot or tr: these are the only elements that
 * must keep their native display (table/table-row-group/table-row) for colspan/rowspan to work.
 * display:flex is safe only inside a th/td (it does not affect its participation in the table grid).
 */

table {
	table-layout: fixed;
	border-collapse: collapse;
	width: 100%;
	line-height: inherit;
	padding: 0;
	border: solid calc(var(--table-border) * 2);
}


/* =============== THEAD / TBODY / TFOOT =============== */

table thead,
table tfoot {
	background: rgba(var(--table-background-color), 1);
}
table tfoot {
	font-size: var(--table-footer-font-size);
	font-weight: var(--table-footer-font-weight);
}


/* =============== TR =============== */

table thead tr {
	border-bottom: solid calc(var(--table-stroke-width) * 2);
}
table tbody tr:not(:last-child) {
	border-bottom: solid calc(var(--table-stroke-width) / 2);
}
table tbody tr {
	background: rgba(var(--table-background-color), 1);
}
table tbody tr:nth-child(even) {
	background: rgba(var(--table-background-color), .5);
}


/* =============== TH / TD =============== */

table th,
table td {
	display: flex;
	flex-direction: column;
	justify-content: center;
	text-align: left;
	padding: var(--table-cell-padding);
	border: 0;
	border-right: solid calc(var(--table-stroke-width) / 2);
}
table tr > *:last-child {
	border-right: none;
}
table td > * {
	margin: 0;
}


/* ============================== ALIGNMENT ============================== */

/* Vertical — justify-content, main axis of the cell (flex-direction: column) */

table td.is-top {
	justify-content: flex-start;
}
table td.is-middle {
	justify-content: center;
}
table td.is-bottom {
	justify-content: flex-end;
}

/* Horizontal — text-align + align-items, cross axis */

table td.is-left {
	align-items: flex-start;
	text-align: left;
}
table td.is-center {
	align-items: center;
	text-align: center;
}
table td.is-right {
	align-items: flex-end;
	text-align: right;
}


/* ============================== FLEX ============================== */

/*
 * No display touched anywhere (table/thead/tbody/tfoot/tr/th/td stay 100% native), so
 * colspan, rowspan and tfoot work without exceptions. The table keeps its natural width
 * (or exceeds it) instead of being squeezed to 100%, which triggers the wrapper's
 * horizontal scroll when the content is wider than its container.
 */

.table.flex {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.table.flex table {
	width: max-content;
	min-width: 100%;
}


/* ============================== GUTENBERG ============================== */

figure.table {
	display: inline-block;
	font-size: var(--table-font-size);
	overflow-x: auto;
}
/* figure.table table {
	min-width: calc(var(--content-max-width) * 2 / 3);
} */


/* ============================== ACCESSIBILITY ============================== */

table caption {
	position: absolute;
	width: 0;
	height: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	white-space: nowrap;
}
