/*
 * HClinic design system - prices
 * Price cards rendered by the HClinic Price Registry ([hc_price_table], [hc_price]) and
 * refinements for the hand-written price tables that remain (table.table-striped).
 * Loaded after content.css; content.css leaves .hc-price-table alone (:not(.hc-price-table)).
 *
 * Contrast: price value --hc-blue-primary-dark on white 6.6:1; promo badge text --hc-alert on
 * --hc-alert-surface 6.1:1; muted old price --hc-slate-muted on white 4.8:1.
 */

:root {
	--hc-price-border: rgba(15, 23, 42, .08);
	--hc-price-radius: 12px;
	--hc-price-head-bg: #f4f7fb;
	--hc-price-row-hover: #f5f9fe;
	--hc-price-accent: var(--hc-blue-primary-dark);
}

/* ---- Card ------------------------------------------------------------------------------------ */

.hc-price-card {
	margin: 1.5rem 0 2rem;
	border: 1px solid var(--hc-price-border);
	border-radius: var(--hc-price-radius);
	background: var(--hc-card-bg);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .10);
	overflow: hidden;
}

.hc-price-card__title {
	padding: 14px 18px;
	border-bottom: 1px solid var(--hc-price-border);
	background: linear-gradient(180deg, #fff, var(--hc-price-head-bg));
	color: var(--hc-navy-deep);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -.01em;
	line-height: 1.35;
}

/* ---- Table ----------------------------------------------------------------------------------- */

#content table.hc-price-table,
table.hc-price-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	background: transparent;
	table-layout: auto;
}

table.hc-price-table :is(th, td) {
	padding: 14px 18px;
	border: 0;
	border-bottom: 1px solid var(--hc-price-border);
	background: transparent;
	color: var(--hc-slate-text);
	font-size: .9375rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	vertical-align: middle;
	overflow-wrap: anywhere;
}

table.hc-price-table tbody tr:last-child > :is(th, td) {
	border-bottom: 0;
}

table.hc-price-table thead th {
	padding-block: 11px;
	background: var(--hc-price-head-bg);
	color: var(--hc-slate-muted);
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	white-space: nowrap;
}

table.hc-price-table tbody tr {
	transition: background-color var(--hc-duration-fast) var(--hc-ease-standard);
}

table.hc-price-table tbody tr:hover {
	background: var(--hc-price-row-hover);
}

table.hc-price-table .hc-price-table__num {
	width: 2.75rem;
	padding-right: 0;
	color: var(--hc-slate-muted);
	font-size: .8125rem;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

table.hc-price-table tbody .hc-price-table__name {
	font-weight: 500;
}

table.hc-price-table .hc-price-table__name strong {
	font-weight: 700;
}

table.hc-price-table .hc-price-table__name a {
	color: var(--hc-blue-primary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.hc-price-table__note {
	display: block;
	margin-top: 2px;
	color: var(--hc-slate-muted);
	font-size: .8125rem;
	font-weight: 400;
}

/* Shrink-to-fit price column, but wide enough that a unit note ("згідно цін лабораторії")
   wraps between words in 2 lines instead of breaking inside them. */
table.hc-price-table .hc-price-table__price {
	width: 1%;
	min-width: 9.5rem;
	text-align: right;
	white-space: nowrap;
	overflow-wrap: normal;
}

/* ---- Price value ----------------------------------------------------------------------------- */

.hc-price {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: flex-end;
	gap: 0 .35em;
	font-variant-numeric: tabular-nums;
}

.hc-price__value {
	color: var(--hc-price-accent);
	font-size: 1.0625rem;
	font-weight: 700;
	letter-spacing: -.01em;
}

.hc-price__from,
.hc-price__suffix {
	color: var(--hc-slate-muted);
	font-size: .8125rem;
	font-weight: 500;
}

.hc-price__suffix {
	white-space: normal;
	text-align: right;
}

.hc-price__old,
.hc-inline-price del {
	color: var(--hc-slate-muted);
	font-size: .8125rem;
	font-weight: 500;
	text-decoration-thickness: 1px;
}

.hc-price--label {
	color: var(--hc-slate-muted);
	font-size: .875rem;
	font-style: italic;
	white-space: normal;
}

/* Promo pill */
.hc-promo-badge {
	display: inline-flex;
	align-items: center;
	margin-left: .4em;
	padding: 2px 8px;
	border-radius: var(--hc-radius-pill);
	background: var(--hc-alert-surface);
	box-shadow: inset 0 0 0 1px rgba(180, 35, 24, .18);
	color: var(--hc-alert);
	font-size: .6875rem;
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1.5;
	text-transform: uppercase;
	vertical-align: .1em;
	white-space: nowrap;
}

table.hc-price-table tr.is-promo .hc-price__value {
	color: var(--hc-alert);
}

/* Inline prices in running text */
.hc-inline-price strong {
	color: var(--hc-price-accent);
	font-variant-numeric: tabular-nums;
}

.hc-price-badge {
	display: inline-flex;
	align-items: baseline;
	padding: 3px 12px;
	border-radius: var(--hc-radius-pill);
	background: var(--hc-blue-surface);
	box-shadow: inset 0 0 0 1px #bae6fd;
	white-space: nowrap;
}

.hc-price-card .screen-reader-text,
.hc-price-badge .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Phones: each row becomes a two-line block, name on top, price under it ------------------ */

@media (max-width: 639px) {
	.hc-price-card {
		margin-inline: 0;
		border-radius: 10px;
	}

	.hc-price-card__title {
		padding: 12px 14px;
	}

	table.hc-price-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	table.hc-price-table,
	table.hc-price-table tbody {
		display: block;
		width: 100%;
	}

	table.hc-price-table tbody tr {
		display: grid;
		grid-template-columns: 1fr;
		gap: 4px;
		padding: 12px 14px;
		border-bottom: 1px solid var(--hc-price-border);
	}

	/* Numbered cards: the row number sits in its own narrow column beside name and price */
	.hc-price-card:not(.hc-price-card--plain) table.hc-price-table tbody tr {
		grid-template-columns: 1.75rem 1fr;
	}

	.hc-price-card:not(.hc-price-card--plain) table.hc-price-table tbody :is(.hc-price-table__name, .hc-price-table__price) {
		grid-column: 2;
	}

	table.hc-price-table tbody tr:last-child {
		border-bottom: 0;
	}

	table.hc-price-table tbody :is(th, td) {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
		text-align: left;
	}

	table.hc-price-table tbody .hc-price-table__num {
		grid-row: 1 / span 2;
		padding-top: 1px;
		text-align: left;
	}

	/* Same specificity as the desktop rule above, so its width: 1% / min-width do not leak in */
	table.hc-price-table tbody .hc-price-table__price {
		width: auto;
		min-width: 0;
		white-space: normal;
		text-align: left;
	}

	table.hc-price-table tbody .hc-price {
		justify-content: flex-start;
	}
}

/* ---- Remaining hand-written price tables: same card language --------------------------------- */

#content :is(.entry-content, .wpb_text_column) table.table-striped {
	border-color: var(--hc-price-border);
	border-radius: var(--hc-price-radius);
}

#content :is(.entry-content, .wpb_text_column) table.table-striped td:last-child {
	color: var(--hc-price-accent);
}

#content :is(.entry-content, .wpb_text_column) table.table-striped thead th {
	background: var(--hc-price-head-bg);
	color: var(--hc-slate-muted);
}

@media (min-width: 768px) {
	#content :is(.entry-content, .wpb_text_column) table.table-striped :is(th, td) {
		padding: 14px 18px;
	}
}
