/**
 * Investičná kalkulačka (bullioncore/investment-calculator).
 *
 * Drawn in the Auron theme's vocabulary — square corners, 1 px hairlines,
 * serif titles, small gold kickers, the obsidian/champagne call to action —
 * from the theme's semantic tokens (assets/css/dark-mode.css), so light and
 * dark follow without a rule of their own here. Each token has the light
 * value as a fallback for any other theme.
 *
 * Link colours go through --auron-link / --auron-link-hover: the theme paints
 * every link in <main> from those two (a 0-2-2 rule), so a component re-points
 * the tokens rather than out-specifying it.
 *
 * Two columns once the block itself is 680 px wide (a container query, not a
 * viewport one: it sits in the 720 px reading column of the guide).
 */

.bc-calc {
	--bc-calc-bg: var(--auron-card-bg, #FFFFFF);
	--bc-calc-fg: var(--auron-page-fg, #0C0C0C);
	--bc-calc-ink: var(--auron-page-bg, #E6E2DC);
	--bc-calc-rule: var(--auron-rule, #D6D3D1);
	--bc-calc-soft: var(--auron-muted-bg, #F8F9FA);
	--bc-calc-subtle: var(--auron-subtle-fg, #4A4A4A);
	--bc-calc-dim: var(--auron-muted-fg, #64748B);
	--bc-calc-gold: var(--auron-accent-text, #75603F);
	--bc-calc-accent: var(--wp--preset--color--accent, #BEA98E);
	--bc-calc-plate: var(--auron-plate, #FFFFFF);
	--bc-calc-error: var(--auron-down, #C0392B);
	--bc-calc-cta-bg: var(--auron-cta-bg, #0C0C0C);
	--bc-calc-cta-fg: var(--auron-cta-fg, #FFFFFF);
	--bc-calc-cta-hover-bg: var(--auron-cta-hover-bg, #2C2C2C);
	--bc-calc-cta-hover-fg: var(--auron-cta-hover-fg, #BEA98E);
	--bc-calc-serif: var(--wp--preset--font-family--serif, Georgia, "Times New Roman", serif);

	container-type: inline-size;
	border: 1px solid var(--bc-calc-rule);
	background-color: var(--bc-calc-bg);
	color: var(--bc-calc-fg);
	font-size: 1rem;
	line-height: 1.5;
}

/* Resets carry no specificity, so every class rule below wins over them. */
:where(.bc-calc) :where(*, *::before, *::after) {
	box-sizing: border-box;
}

:where(.bc-calc) :where(p, ul, dl, dd, fieldset, legend, h2) {
	margin: 0;
	padding: 0;
}

:where(.bc-calc) :where(fieldset) {
	min-width: 0;
	border: 0;
}

:where(.bc-calc) :where(button, input) {
	margin: 0;
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
	border-radius: 0;
}

.bc-calc :is(a, button, input):focus-visible,
.bc-calc .bc-calc__radio:focus-visible + * {
	outline: 2px solid var(--bc-calc-gold);
	outline-offset: 2px;
}

/* --- panels --------------------------------------------------------------- */

/* The wrapper is the query container; a container query cannot restyle the
   container itself, so the columns live on this inner grid. */
.bc-calc__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

.bc-calc__panel {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	min-width: 0;
	padding: 1.5rem 1.25rem;
}

.bc-calc__panel--result {
	border-top: 1px solid var(--bc-calc-rule);
}

@container (min-width: 680px) {
	.bc-calc__grid {
		grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
	}

	.bc-calc__panel {
		padding: 2rem 1.75rem;
	}

	.bc-calc__panel--result {
		border-top: 0;
		border-left: 1px solid var(--bc-calc-rule);
	}
}

.bc-calc__kicker {
	color: var(--bc-calc-gold);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.bc-calc__kicker + .bc-calc__title {
	margin-top: -0.75rem;
}

.bc-calc .bc-calc__title {
	color: var(--bc-calc-fg);
	font-family: var(--bc-calc-serif);
	font-size: clamp(1.5rem, 1.25rem + 1.2cqi, 1.875rem);
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1.2;
	text-transform: none;
}

.bc-calc__lead {
	margin-top: -0.5rem;
	color: var(--bc-calc-subtle);
	font-size: 0.9375rem;
}

/* --- metal switch --------------------------------------------------------- */

.bc-calc__metals {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	border: 1px solid var(--bc-calc-rule);
}

.bc-calc__metal {
	position: relative;
	display: block;
	cursor: pointer;
}

.bc-calc__metal + .bc-calc__metal {
	border-left: 1px solid var(--bc-calc-rule);
}

.bc-calc__metal-label {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0 1rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bc-calc__radio:checked + .bc-calc__metal-label {
	background-color: var(--bc-calc-fg);
	color: var(--bc-calc-ink);
}

/* The native radios stay in the tab order and keep their arrow keys; only
   their box is swapped for the label next to them. */
.bc-calc__radio {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

/* --- amount --------------------------------------------------------------- */

.bc-calc__label {
	margin-bottom: -0.75rem;
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.bc-calc__amount {
	position: relative;
	display: flex;
	align-items: center;
	border: 1px solid var(--bc-calc-rule);
	background-color: var(--bc-calc-bg);
	transition: border-color 0.15s ease;
}

.bc-calc__amount:focus-within {
	border-color: var(--bc-calc-gold);
}

.bc-calc .bc-calc__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 3.5rem;
	padding: 0 3rem 0 1rem;
	border: 0;
	background: transparent;
	color: var(--bc-calc-fg);
	font-family: var(--bc-calc-serif);
	font-size: 1.75rem;
	font-variant-numeric: tabular-nums lining-nums;
	line-height: 1;
}

.bc-calc .bc-calc__input:focus-visible {
	outline: 0; /* The field's frame turns gold instead (:focus-within). */
}

.bc-calc__input[aria-invalid="true"] {
	color: var(--bc-calc-error);
}

.bc-calc__amount:has(.bc-calc__input[aria-invalid="true"]) {
	border-color: var(--bc-calc-error);
}

.bc-calc__currency {
	position: absolute;
	right: 1rem;
	color: var(--bc-calc-dim);
	font-family: var(--bc-calc-serif);
	font-size: 1.5rem;
	pointer-events: none;
}

.bc-calc__hint {
	margin-top: -0.75rem;
	color: var(--bc-calc-dim);
	font-size: 0.8125rem;
}

.bc-calc__message {
	margin-top: -1rem;
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
	font-weight: 600;
}

.bc-calc__message:empty {
	display: none;
}

.bc-calc__message.is-error {
	color: var(--bc-calc-error);
}

/* --- quick amounts -------------------------------------------------------- */

.bc-calc__chips {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem;
}

@container (min-width: 380px) {
	.bc-calc__chips {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@container (min-width: 680px) {
	.bc-calc__chips {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.bc-calc .bc-calc__chip {
	min-height: 2.75rem;
	padding: 0 0.5rem;
	border: 1px solid var(--bc-calc-rule);
	background-color: transparent;
	color: var(--bc-calc-fg);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.bc-calc .bc-calc__chip:hover {
	border-color: var(--bc-calc-gold);
}

.bc-calc .bc-calc__chip[aria-pressed="true"] {
	border-color: var(--bc-calc-fg);
	background-color: var(--bc-calc-fg);
	color: var(--bc-calc-ink);
}

/* --- priorities ----------------------------------------------------------- */

.bc-calc__options {
	display: grid;
	gap: 0.5rem;
}

.bc-calc__legend {
	margin-bottom: 0.75rem;
	font-family: var(--bc-calc-serif);
	font-size: 1.125rem;
	line-height: 1.3;
}

.bc-calc__option {
	position: relative;
	display: block;
	cursor: pointer;
}

.bc-calc__option-box {
	position: relative;
	display: grid;
	gap: 0.15rem;
	padding: 0.85rem 1rem 0.85rem 2.75rem;
	border: 1px solid var(--bc-calc-rule);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* A square marker — every control in the theme is square. */
.bc-calc__option-box::before {
	content: "";
	position: absolute;
	top: 1.05rem;
	left: 1rem;
	width: 0.875rem;
	height: 0.875rem;
	border: 1px solid var(--bc-calc-dim);
	background-color: transparent;
	box-shadow: inset 0 0 0 3px var(--bc-calc-bg);
}

.bc-calc__option:hover .bc-calc__option-box {
	border-color: var(--bc-calc-gold);
}

.bc-calc__radio:checked + .bc-calc__option-box {
	border-color: var(--bc-calc-gold);
	background-color: var(--bc-calc-soft);
	box-shadow: inset 3px 0 0 var(--bc-calc-accent);
}

.bc-calc__radio:checked + .bc-calc__option-box::before {
	border-color: var(--bc-calc-gold);
	background-color: var(--bc-calc-gold);
	box-shadow: inset 0 0 0 3px var(--bc-calc-soft);
}

.bc-calc__option-title {
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
}

.bc-calc__option-text {
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
	line-height: 1.4;
}

/* Without JavaScript the proposal is recomputed by the server; once the view
   module has the offer, it recomputes as the visitor types. */
.bc-calc .bc-calc__recalc {
	min-height: 2.75rem;
	padding: 0 1rem;
	border: 1px solid var(--bc-calc-fg);
	background: transparent;
	color: var(--bc-calc-fg);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
}

.bc-calc.is-ready .bc-calc__recalc {
	display: none;
}

/* --- proposal ------------------------------------------------------------- */

.bc-calc__lines {
	display: grid;
	list-style: none;
	border-bottom: 1px solid var(--bc-calc-rule);
}

.bc-calc__line {
	display: grid;
	grid-template-columns: 3.5rem minmax(0, 1fr) auto;
	grid-template-areas:
		"thumb body sum"
		"thumb body qty";
	align-items: start;
	column-gap: 0.9rem;
	padding: 0.9rem 0;
	border-top: 1px solid var(--bc-calc-rule);
}

.bc-calc__thumb {
	grid-area: thumb;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	border: 1px solid var(--bc-calc-rule);
	background-color: var(--bc-calc-plate);
}

.bc-calc__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.bc-calc__line-body {
	grid-area: body;
	display: grid;
	gap: 0.2rem;
	min-width: 0;
}

.bc-calc .bc-calc__line-name {
	--auron-link: var(--bc-calc-fg);
	--auron-link-hover: var(--bc-calc-gold);
	color: var(--bc-calc-fg);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.35;
	text-decoration: none;
}

.bc-calc .bc-calc__line-name:hover,
.bc-calc .bc-calc__line-name:focus-visible {
	color: var(--bc-calc-gold);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.bc-calc__line-meta {
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
	line-height: 1.4;
}

.bc-calc__line-sum {
	grid-area: sum;
	font-size: 0.9375rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.bc-calc__line-qty {
	grid-area: qty;
	color: var(--bc-calc-gold);
	font-size: 0.875rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.bc-calc__empty {
	padding: 1rem;
	border: 1px solid var(--bc-calc-rule);
	color: var(--bc-calc-subtle);
	font-size: 0.9375rem;
}

.bc-calc__empty[hidden],
.bc-calc__vat[hidden],
.bc-calc__to-cart[hidden] {
	display: none;
}

/* The lines list draws its own bottom rule; with nothing in it, that rule
   would sit alone above the empty-state box. */
.bc-calc__lines:not(:has(.bc-calc__line)) {
	display: none;
}

/* --- summary -------------------------------------------------------------- */

.bc-calc__summary {
	display: grid;
	padding: 1rem 1.25rem;
	border: 1px solid var(--bc-calc-rule);
	border-top: 2px solid var(--bc-calc-accent);
	background-color: var(--bc-calc-soft);
}

.bc-calc__sum {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	padding: 0.45rem 0;
}

.bc-calc__sum + .bc-calc__sum {
	border-top: 1px solid var(--bc-calc-rule);
}

.bc-calc__sum dt {
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.bc-calc__sum dd {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

.bc-calc__sum--total dt {
	color: var(--bc-calc-fg);
}

.bc-calc__sum--total dd {
	font-family: var(--bc-calc-serif);
	font-size: 1.625rem;
	font-weight: 500;
	line-height: 1.2;
}

.bc-calc__vat {
	margin-top: -0.5rem;
	color: var(--bc-calc-subtle);
	font-size: 0.8125rem;
}

/* --- add to cart ---------------------------------------------------------- */

.bc-calc__cart {
	margin: 0;
}

.bc-calc .bc-calc__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 3.25rem;
	padding: 0.75rem 1.25rem;
	border: 1px solid var(--bc-calc-cta-bg);
	background-color: var(--bc-calc-cta-bg);
	color: var(--bc-calc-cta-fg);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.3;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bc-calc .bc-calc__cta:hover:not(:disabled) {
	border-color: var(--bc-calc-cta-hover-bg);
	background-color: var(--bc-calc-cta-hover-bg);
	color: var(--bc-calc-cta-hover-fg);
}

.bc-calc .bc-calc__cta:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.bc-calc .bc-calc__cta[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

.bc-calc__status {
	display: grid;
	gap: 0.75rem;
	margin-top: -0.5rem;
}

.bc-calc__status:not(:has(:not([hidden]):not(:empty))) {
	display: none;
}

.bc-calc__status-text {
	font-size: 0.9375rem;
}

.bc-calc__status-text:empty {
	display: none;
}

.bc-calc__status-text.is-error {
	color: var(--bc-calc-error);
}

.bc-calc .bc-calc__to-cart {
	--auron-link: var(--bc-calc-fg);
	--auron-link-hover: var(--bc-calc-gold);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0 1rem;
	border: 1px solid var(--bc-calc-fg);
	color: var(--bc-calc-fg);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	transition: border-color 0.15s ease;
}

.bc-calc .bc-calc__to-cart::after {
	content: "→";
}

.bc-calc .bc-calc__to-cart:hover,
.bc-calc .bc-calc__to-cart:focus-visible {
	border-color: var(--bc-calc-gold);
}

.bc-calc__note {
	padding-top: 1rem;
	border-top: 1px solid var(--bc-calc-rule);
	color: var(--bc-calc-dim);
	font-size: 0.8125rem;
	line-height: 1.55;
}

.bc-calc__note strong {
	color: var(--bc-calc-subtle);
	font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
	.bc-calc *,
	.bc-calc *::before {
		transition: none;
	}
}
