/**
 * Product options table.
 * Palette matches the rest of the site: red #CD4547, ink #14110F, beige #F4EFE3.
 *
 * Selectors are chained and the contested properties marked important, for the
 * same reason as the other Alcli stylesheets: Elementor's global table and link
 * styles otherwise win over these.
 */

.alcli-ot {
	--ot-red: #cd4547;
	--ot-ink: #14110f;
	--ot-soft: #57514a;
	--ot-mute: #9a938a;
	--ot-beige: #f4efe3;
	--ot-line: rgba(20, 17, 15, 0.12);
	margin: 0 0 34px;
	/* Elementor containers are flex. A widget inside one only fills the width
	   if it is told to — otherwise the box shrink wraps to its content, which
	   is why a two column table rendered a couple of hundred pixels wide
	   instead of spanning the section. */
	width: 100%;
	max-width: 100%;
}

/* The flex item is Elementor's widget wrapper, not our section, so the class
   is put on the widget in the template and matched here. align-self covers a
   container whose align-items is not stretch. */
.elementor-element.alcli-ot-widget,
.elementor-widget.alcli-ot-widget {
	width: 100%;
	max-width: 100%;
	align-self: stretch;
}

.alcli-ot-widget > .elementor-widget-container {
	width: 100%;
}

.alcli-ot *,
.alcli-ot *::before,
.alcli-ot *::after {
	box-sizing: border-box;
}

.alcli-ot__title {
	margin: 0 0 14px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--ot-ink);
}

/* The table can be wider than the page on a narrow screen. It scrolls inside
   its own box so the page itself never scrolls sideways. */
.alcli-ot__scroll {
	overflow-x: auto;
	border: 1px solid var(--ot-line);
	border-radius: 14px;
	background: #fff;
	-webkit-overflow-scrolling: touch;
}

.alcli-ot .alcli-ot__table {
	width: 100% !important;
	min-width: 100%;
	margin: 0 !important;
	border: 0 !important;
	border-collapse: collapse !important;
	font-size: 14px;
	color: var(--ot-ink);
}

.alcli-ot .alcli-ot__th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--ot-beige) !important;
	border: 0 !important;
	border-bottom: 1px solid var(--ot-line) !important;
	padding: 13px 16px !important;
	text-align: start !important;
	white-space: nowrap;
	vertical-align: middle;
}

.alcli-ot__thmain {
	display: block;
	font-size: 11.5px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--ot-ink);
}

.alcli-ot__thnote {
	display: block;
	margin-top: 2px;
	font-size: 10.5px;
	font-weight: 500;
	font-style: italic;
	text-transform: none;
	letter-spacing: 0;
	color: var(--ot-mute);
}

.alcli-ot .alcli-ot__td {
	border: 0 !important;
	border-bottom: 1px solid rgba(20, 17, 15, 0.07) !important;
	padding: 13px 16px !important;
	vertical-align: middle;
	/* Rows fade in on load, staggered by position. */
	opacity: 0;
	animation: alcli-ot-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	animation-delay: calc(min(var(--alcli-ot-i, 0), 12) * 40ms);
}

.alcli-ot .alcli-ot__row:last-child .alcli-ot__td {
	border-bottom: 0 !important;
}

.alcli-ot .alcli-ot__row {
	transition: background-color 0.18s ease;
}

.alcli-ot .alcli-ot__row[data-alcli-ot-attributes] {
	cursor: pointer;
}

.alcli-ot .alcli-ot__row[data-alcli-ot-attributes]:hover,
.alcli-ot .alcli-ot__row.is-active {
	background: rgba(205, 69, 71, 0.06);
}

.alcli-ot .alcli-ot__row.is-active {
	box-shadow: inset 3px 0 0 var(--ot-red);
}

.alcli-ot .alcli-ot__row:focus-visible {
	outline: 2px solid var(--ot-red);
	outline-offset: -2px;
}

.alcli-ot .alcli-ot__row.is-out {
	color: var(--ot-mute);
}

/* ------------------------------------------------------------- cells */

.alcli-ot__td--sku {
	font-weight: 700;
	white-space: nowrap;
}

.alcli-ot__details {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 10px;
}

.alcli-ot__detail {
	color: var(--ot-soft);
}

.alcli-ot__divider {
	color: rgba(20, 17, 15, 0.22);
	font-weight: 300;
}

.alcli-ot__td--sold_by,
.alcli-ot__td--box_qty,
.alcli-ot__td--pallet_qty {
	color: var(--ot-soft);
	white-space: nowrap;
}

.alcli-ot__td--price {
	white-space: nowrap;
}

.alcli-ot__price {
	font-weight: 700;
	color: var(--ot-red);
}

.alcli-ot__price del {
	font-weight: 500;
	color: var(--ot-mute);
	margin-inline-end: 5px;
}

.alcli-ot__price ins {
	text-decoration: none;
}

/* Signed out, the price gate swaps the number for a sign in link. */
.alcli-ot__price .alcli-price-locked {
	font-size: 13px;
	font-weight: 700;
}

.alcli-ot__empty {
	color: rgba(20, 17, 15, 0.25);
}

.alcli-ot__hint {
	margin: 10px 2px 0;
	font-size: 12.5px;
	color: var(--ot-mute);
}

@keyframes alcli-ot-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ------------------------------------------------------- small screens */

/* Below 720px the table stops being a grid and each row becomes a stacked
   card, with the column name printed beside each value. A six column table
   squeezed onto a phone is unreadable however it scrolls. */
@media (max-width: 720px) {
	.alcli-ot__scroll {
		overflow-x: visible;
		border: 0;
		background: transparent;
	}

	.alcli-ot .alcli-ot__table,
	.alcli-ot .alcli-ot__table tbody,
	.alcli-ot .alcli-ot__row,
	.alcli-ot .alcli-ot__td {
		display: block;
		width: 100%;
	}

	.alcli-ot .alcli-ot__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(1px, 1px, 1px, 1px);
		white-space: nowrap;
	}

	.alcli-ot .alcli-ot__row {
		margin-bottom: 12px;
		border: 1px solid var(--ot-line);
		border-radius: 12px;
		background: #fff;
		overflow: hidden;
	}

	.alcli-ot .alcli-ot__td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 14px;
		white-space: normal;
		padding: 10px 14px !important;
	}

	.alcli-ot .alcli-ot__td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: 10.5px;
		font-weight: 800;
		text-transform: uppercase;
		letter-spacing: 0.8px;
		color: var(--ot-mute);
	}

	.alcli-ot__details {
		justify-content: flex-end;
		text-align: end;
	}
}

@media (prefers-reduced-motion: reduce) {
	.alcli-ot .alcli-ot__td {
		opacity: 1;
		animation: none !important;
		transform: none !important;
	}

	.alcli-ot .alcli-ot__row {
		transition: none !important;
	}
}
