/**
 * ACAART Article Design - tables.
 *
 * Loaded only when table enhancement is enabled.
 *
 * There is no bare `table { }` rule anywhere in this file. Styling applies to
 * `.acaart-pad-table`, a class the plugin adds during the DOM pass, so tables
 * outside the article - and tables inside an excluded module - keep the
 * theme's own appearance.
 *
 * Horizontal scrolling lives on `.acaart-pad-table-wrapper` only. Nothing is
 * applied to `html` or `body`, so a wide table can never make the page scroll.
 */

.acaart-pad-article .acaart-pad-table-wrapper {
	margin-block: 1.9em;
	max-inline-size: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--acaart-border);
	border-radius: var(--acaart-radius);
	box-shadow: var(--acaart-shadow);
	scrollbar-width: thin;
}

/* Only a wrapper that really scrolls gets the edge hint. */
.acaart-pad-article .acaart-pad-table-wrapper.is-scrollable {
	background:
		linear-gradient(to right, var(--acaart-background) 30%, rgba(255, 255, 255, 0)) left center,
		linear-gradient(to left, var(--acaart-background) 30%, rgba(255, 255, 255, 0)) right center;
	background-repeat: no-repeat;
	background-size: 28px 100%;
	background-attachment: local, local;
}

.acaart-pad-article .acaart-pad-table {
	inline-size: 100%;
	margin: 0;
	border-collapse: collapse;
	background: var(--acaart-background);
	font-size: 0.95rem;
}

.acaart-pad-article .acaart-pad-table th,
.acaart-pad-article .acaart-pad-table td {
	padding-inline: 1em;
	padding-block: 0.75em;
	text-align: start;
	vertical-align: top;
	border-block-end: 1px solid var(--acaart-border);
}

.acaart-pad-article .acaart-pad-table thead th {
	background: var(--acaart-surface);
	color: var(--acaart-primary);
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
	border-block-end: 2px solid var(--acaart-border);
}

.acaart-pad-article .acaart-pad-table tbody tr:last-child td {
	border-block-end: 0;
}

.acaart-pad-article .acaart-pad-table.is-zebra tbody tr:nth-child(even) {
	background: var(--acaart-surface);
}

.acaart-pad-article .acaart-pad-table.is-hoverable tbody tr {
	transition: background-color 0.15s ease;
}

.acaart-pad-article .acaart-pad-table.is-hoverable tbody tr:hover {
	background: var(--acaart-surface);
}

/* Sticky header, for long tables. */
.acaart-pad-article .acaart-pad-table.is-sticky-header thead th {
	position: sticky;
	inset-block-start: 0;
	z-index: 2;
}

/* Sticky first column: inset-inline-start follows the reading direction. */
.acaart-pad-article .acaart-pad-table.is-sticky-first th:first-child,
.acaart-pad-article .acaart-pad-table.is-sticky-first td:first-child {
	position: sticky;
	inset-inline-start: 0;
	z-index: 1;
	background: var(--acaart-background);
	font-weight: 600;
	border-inline-end: 1px solid var(--acaart-border);
}

.acaart-pad-article .acaart-pad-table.is-sticky-first.is-zebra tbody tr:nth-child(even) td:first-child {
	background: var(--acaart-surface);
}

.acaart-pad-article .acaart-pad-table.is-sticky-first thead th:first-child {
	z-index: 3;
	background: var(--acaart-surface);
}

/* --------------------------------------------------------------------------
 * Type-specific behaviour
 * ----------------------------------------------------------------------- */

.acaart-pad-article .acaart-pad-table--specs td + td,
.acaart-pad-article .acaart-pad-table--pricing td + td,
.acaart-pad-article .acaart-pad-table--comparison td + td {
	font-variant-numeric: tabular-nums;
}

.acaart-pad-article .acaart-pad-table--specs td:first-child,
.acaart-pad-article .acaart-pad-table--comparison td:first-child {
	inline-size: 34%;
	color: var(--acaart-muted);
	font-weight: 600;
}

.acaart-pad-article .acaart-pad-table--travel td:first-child,
.acaart-pad-article .acaart-pad-table--schedule td:first-child {
	color: var(--acaart-primary);
	font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Presets
 * ----------------------------------------------------------------------- */

.acaart-pad-article .acaart-pad-table--preset-minimal {
	font-size: 0.94rem;
}

.acaart-pad-article .acaart-pad-table--preset-minimal thead th {
	background: transparent;
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.9rem;
	border-block-end: 1px solid var(--acaart-border);
}

.acaart-pad-article .acaart-pad-table--preset-minimal th,
.acaart-pad-article .acaart-pad-table--preset-minimal td {
	padding-inline: 0.75em;
	padding-block: 0.6em;
}

.acaart-pad-article .acaart-pad-table--preset-elegant thead th {
	background: transparent;
	color: var(--acaart-accent);
	font-size: 0.74rem;
	letter-spacing: 0.14em;
	border-block-end: 1px solid var(--acaart-accent);
}

.acaart-pad-article .acaart-pad-table--preset-elegant th,
.acaart-pad-article .acaart-pad-table--preset-elegant td {
	padding-block: 0.95em;
}

.acaart-pad-article .acaart-pad-table--preset-technology {
	font-size: 0.92rem;
}

.acaart-pad-article .acaart-pad-table--preset-technology th,
.acaart-pad-article .acaart-pad-table--preset-technology td {
	padding-inline: 0.9em;
	padding-block: 0.62em;
}

.acaart-pad-article .acaart-pad-table--preset-technology.acaart-pad-table--comparison th:not(:first-child),
.acaart-pad-article .acaart-pad-table--preset-technology.acaart-pad-table--comparison td:not(:first-child) {
	text-align: center;
}

.acaart-pad-article .acaart-pad-table--preset-travel thead th {
	letter-spacing: 0.08em;
}

@media (max-width: 640px) {
	.acaart-pad-article .acaart-pad-table {
		font-size: 0.9rem;
	}

	.acaart-pad-article .acaart-pad-table th,
	.acaart-pad-article .acaart-pad-table td {
		padding-inline: 0.8em;
		padding-block: 0.65em;
	}

	.acaart-pad-article .acaart-pad-table--specs td:first-child,
	.acaart-pad-article .acaart-pad-table--comparison td:first-child {
		inline-size: auto;
		min-inline-size: 8em;
	}
}
