/* TM Kaubad – seinatähtede kalkulaator. Kasutab teema värve, kui need on olemas. */
.tmk-calc {
	--c-ink: var(--wp--preset--color--tint, #161817);
	--c-muted: var(--wp--preset--color--grafiit, #4A504C);
	--c-line: var(--wp--preset--color--joon, #C9CFC7);
	--c-paper: var(--wp--preset--color--paber, #F6F7F4);
	--c-accent: var(--wp--preset--color--plaat, #A8803A);
	--c-error: var(--wp--preset--color--viga, #B3261E);
	--c-ok: var(--wp--preset--color--korras, #2E6B45);
	--ease: cubic-bezier(.2, .7, .2, 1);
	color: var(--c-ink);
}
.tmk-calc *, .tmk-calc *::before, .tmk-calc *::after { box-sizing: border-box; }

.tmk-calc__form {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
	gap: clamp(1.5rem, 4vw, 3.5rem);
	align-items: start;
}
.tmk-calc--compact .tmk-calc__form { grid-template-columns: 1fr; }

/* Sammud */
.tmk-calc__step {
	border: 0;
	margin: 0 0 2rem;
	padding: 0;
	min-width: 0;
}
.tmk-calc__step legend {
	font-family: var(--wp--preset--font-family--kuva, inherit);
	font-weight: 700;
	font-size: 1.375rem;
	letter-spacing: -.01em;
	margin-bottom: .75rem;
	padding: 0;
}
.tmk-calc__hint { margin: .6rem 0 0; font-size: .875rem; color: var(--c-muted); }
.tmk-calc__msg {
	margin: .6rem 0 0;
	font-size: .9375rem;
	color: var(--c-error);
	font-weight: 500;
}

.tmk-calc__input {
	width: 100%;
	font: inherit;
	font-size: 1.25rem;
	padding: .9rem 1rem;
	border: 1.5px solid var(--c-line);
	border-radius: 6px;
	background: #fff;
	color: var(--c-ink);
	transition: border-color .2s;
}
.tmk-calc__input:focus { outline: none; border-color: var(--c-ink); box-shadow: 0 0 0 3px rgba(168, 128, 58, .35); }
.tmk-calc__input[aria-invalid="true"] { border-color: var(--c-error); }

/* Filtrid */
.tmk-calc__filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.tmk-chip {
	font: inherit;
	font-size: .875rem;
	padding: .4rem .85rem;
	border-radius: 999px;
	border: 0;
	background: #fff;
	box-shadow: inset 0 0 0 1px var(--c-line);
	color: var(--c-ink);
	cursor: pointer;
}
.tmk-chip.is-active { background: var(--c-ink); color: #fff; box-shadow: none; }

/* Fondid */
.tmk-calc__fonts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: .5rem;
}
.tmk-calc--compact .tmk-calc__fonts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tmk-font {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: .2rem;
	padding: .8rem .85rem .75rem;
	background: #fff;
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--c-line);
	cursor: pointer;
	transition: box-shadow .15s, transform .15s var(--ease);
	min-height: 5.25rem;
}
.tmk-font[hidden] { display: none; }
.tmk-font input, .tmk-swatch input, .tmk-height input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}
.tmk-font__name { font-size: 1.5rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmk-font__style { font-size: .75rem; color: var(--c-muted); line-height: 1.3; }
.tmk-font:hover { box-shadow: inset 0 0 0 1.5px var(--c-ink); }
.tmk-font:has(input:checked) { box-shadow: inset 0 0 0 2px var(--c-ink), 0 0 0 3px var(--c-paper), 0 0 0 4px var(--c-accent); }
.tmk-font:has(input:focus-visible), .tmk-swatch:has(input:focus-visible), .tmk-height:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 3px; }

.tmk-calc__sheet-link { margin: .6rem 0 0; }
.tmk-link {
	font: inherit;
	font-size: .875rem;
	background: none;
	border: 0;
	padding: 0;
	color: var(--c-ink);
	text-decoration: underline;
	text-underline-offset: .2em;
	cursor: pointer;
}

/* Värvid */
.tmk-calc__colors { display: flex; flex-wrap: wrap; gap: .5rem; }
.tmk-swatch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	padding: .55rem 1rem .55rem .6rem;
	background: #fff;
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px var(--c-line);
	cursor: pointer;
	font-weight: 500;
}
.tmk-swatch__dot {
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	background: var(--dot);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}
.tmk-swatch:has(input:checked) { box-shadow: inset 0 0 0 2px var(--c-ink); }
.tmk-calc__other-color { display: inline-block; margin-left: .25rem; color: var(--c-ink); text-underline-offset: .2em; }

/* Kõrgused */
.tmk-calc__heights {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: .5rem;
}
.tmk-height {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: .1rem;
	padding: .75rem .85rem;
	background: #fff;
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--c-line);
	cursor: pointer;
}
.tmk-height__cm { font-family: var(--wp--preset--font-family--kuva, inherit); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.tmk-height__price { font-size: .8125rem; color: var(--c-muted); }
.tmk-height__price .woocommerce-Price-amount { color: inherit; }
.tmk-height__why { font-size: .75rem; color: var(--c-error); line-height: 1.3; margin-top: .2rem; }
.tmk-height:hover { box-shadow: inset 0 0 0 1.5px var(--c-ink); }
.tmk-height:has(input:checked) { box-shadow: inset 0 0 0 2px var(--c-ink), 0 0 0 3px var(--c-paper), 0 0 0 4px var(--c-accent); }
.tmk-height.is-disabled { background: transparent; box-shadow: inset 0 0 0 1px var(--c-line); }
.tmk-height.is-disabled .tmk-height__cm, .tmk-height.is-disabled .tmk-height__price { opacity: .45; }
.tmk-height.is-disabled:has(input:checked) { box-shadow: inset 0 0 0 2px var(--c-error); }

/* Külgpaneel */
.tmk-calc__side {
	position: sticky;
	top: 6rem;
	display: grid;
	gap: 1rem;
}
.tmk-calc--compact .tmk-calc__side { position: static; }

.tmk-calc__preview {
	--wall: #ECEDE9;
	position: relative;
	border-radius: 10px;
	background-color: var(--wall);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	padding: 1rem 1rem 1.1rem;
	overflow: hidden;
	transition: background-color .35s;
}
.tmk-calc__preview[data-wall="wood"] {
	background-image:
		repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 26px),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .6' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.tmk-calc__walls { position: absolute; top: .75rem; right: .75rem; display: flex; gap: .35rem; z-index: 2; }
.tmk-calc__walls button {
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	border: 2px solid #fff;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.tmk-calc__walls [data-wall="light"] { background: #ECEDE9; }
.tmk-calc__walls [data-wall="sage"] { background: #9AA697; }
.tmk-calc__walls [data-wall="dark"] { background: #3A3F3C; }
.tmk-calc__walls [data-wall="wood"] { background: #9A7652; }
.tmk-calc__walls [aria-pressed="true"] { outline: 2px solid var(--c-accent); outline-offset: 1px; }

.tmk-calc__stage {
	aspect-ratio: 16 / 9;
	display: grid;
	place-items: center;
	text-align: center;
	overflow: hidden;
}
.tmk-calc--compact .tmk-calc__stage { aspect-ratio: 16 / 8; }
.tmk-calc__text {
	margin: 0;
	line-height: 1.05;
	max-width: 100%;
	overflow-wrap: anywhere;
	transition: color .3s;
}
.tmk-calc__text.is-placeholder { opacity: .45; }
.tmk-calc__measure {
	display: grid;
	justify-items: center;
	gap: .3rem;
	margin: .5rem 0 0;
	font-size: .875rem;
	color: var(--c-ink);
	min-height: 1.6em;
}
.tmk-calc__preview[data-wall="dark"] .tmk-calc__measure,
.tmk-calc__preview[data-wall="wood"] .tmk-calc__measure { color: #fff; }
.tmk-calc__measure-line {
	display: block;
	height: 9px;
	max-width: 100%;
	border-left: 1px solid currentColor;
	border-right: 1px solid currentColor;
	background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
	opacity: .7;
	transition: width .3s var(--ease);
}

.tmk-calc__summary {
	margin: 0;
	display: grid;
	gap: .1rem;
	font-size: .9375rem;
}
.tmk-calc__summary > div {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: .45rem 0;
	border-bottom: 1px solid var(--c-line);
}
.tmk-calc__summary dt { color: var(--c-muted); }
.tmk-calc__summary dd { margin: 0; text-align: right; font-weight: 500; }
.tmk-calc__summary .tmk-calc__total { border-bottom: 0; padding-top: .7rem; }
.tmk-calc__summary .tmk-calc__total dt { color: var(--c-ink); font-weight: 600; }
.tmk-calc__summary .tmk-calc__total dd {
	font-family: var(--wp--preset--font-family--kuva, inherit);
	font-weight: 700;
	font-size: 1.75rem;
	line-height: 1.1;
}
.tmk-calc__note { margin: 0; font-size: .875rem; color: var(--c-muted); }
.tmk-calc__note:empty { display: none; }

.tmk-calc__buy { display: flex; align-items: center; gap: .75rem; }
.tmk-calc__buy-total { display: none !important; }
.tmk-calc__add {
	flex: 1;
	min-height: 56px;
	font-size: 1.0625rem !important;
	cursor: pointer;
}
.tmk-calc__add[aria-disabled="true"] { opacity: .55; }
.tmk-calc__add:disabled { cursor: progress; opacity: .7; }
.tmk-calc__status { margin: 0; padding: .75rem 1rem; border-radius: 6px; background: #E6F0E9; color: var(--c-ok); font-size: .9375rem; }
.tmk-calc__status.is-error { background: #F8E5E3; color: var(--c-error); }
.tmk-calc__status a { color: inherit; font-weight: 600; text-underline-offset: .2em; }
.tmk-calc__small { margin: 0; font-size: .8125rem; color: var(--c-muted); }

/* Dialoogid */
.tmk-calc__dialog {
	border: 0;
	border-radius: 12px;
	padding: 1.75rem;
	max-width: min(92vw, 34rem);
	color: var(--c-ink);
	box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .45);
}
.tmk-calc__dialog::backdrop { background: rgba(22, 24, 23, .55); }
.tmk-calc__dialog h2 { margin: 0 0 .75rem; font-size: 1.5rem; }
.tmk-calc__dialog form { margin: 0; }
.tmk-calc__confirm-text { font-size: 1.0625rem; line-height: 1.55; }
.tmk-calc__dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.tmk-btn-ghost {
	font: inherit;
	font-weight: 600;
	background: transparent;
	border: 0;
	box-shadow: inset 0 0 0 1.5px var(--c-ink);
	border-radius: 4px;
	padding: .8rem 1.2rem;
	cursor: pointer;
	color: var(--c-ink);
}
.tmk-calc__sheet { max-width: min(94vw, 52rem); }
.tmk-calc__sheet-grid p { font-size: clamp(1.4rem, 3.4vw, 2.3rem); line-height: 1.35; margin: 0 0 .6rem; word-break: break-all; }

.tmk-calc-missing { padding: 1rem; border: 1px dashed var(--c-error); color: var(--c-error); }
.tmk-calc-placeholder { padding: 2rem; border: 1px dashed #999; text-align: center; }

/* Mobiil: hind ja nupp kleepuvad ekraani alla */
@media (max-width: 900px) {
	.tmk-calc__form { grid-template-columns: 1fr; }
	.tmk-calc__side { position: static; }
	.tmk-calc__controls { order: 2; }
	.tmk-calc__side { order: 1; display: contents; }
	.tmk-calc__preview { order: 1; position: sticky; top: 4.5rem; z-index: 3; box-shadow: 0 10px 24px -18px rgba(0,0,0,.5); }
	.tmk-calc__summary, .tmk-calc__note, .tmk-calc__status, .tmk-calc__small { order: 3; }
	.tmk-calc__buy {
		order: 4;
		position: sticky;
		bottom: 0;
		z-index: 5;
		margin: 0 calc(-1 * clamp(1rem, 4vw, 3rem));
		padding: .75rem clamp(1rem, 4vw, 3rem) calc(.75rem + env(safe-area-inset-bottom));
		background: rgba(246, 247, 244, .94);
		backdrop-filter: blur(8px);
		border-top: 1px solid var(--c-line);
	}

	.tmk-calc__fonts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tmk-calc__stage { aspect-ratio: 16 / 7; }
}
@media (max-width: 420px) {
	.tmk-calc__heights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tmk-font__name { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
	.tmk-calc * { transition: none !important; }
}

/* Viimistlus: matt / läikiv */
.tmk-calc__finishes { display: flex; flex-wrap: wrap; gap: .5rem; }
.tmk-finish {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	padding: .55rem 1rem .55rem .6rem;
	background: #fff;
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px var(--c-line);
	cursor: pointer;
	font-weight: 500;
}
.tmk-finish input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tmk-finish:has(input:checked) { box-shadow: inset 0 0 0 2px var(--c-ink); }
.tmk-finish:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 3px; }
.tmk-finish__chip { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #2a2c2c; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.tmk-finish:not(.tmk-finish--matt) .tmk-finish__chip {
	background: radial-gradient(circle at 32% 28%, #fff 0 8%, #9aa0a0 22%, #2a2c2c 58%, #0e0f0f 100%);
}
.tmk-finish__extra { font-size: .8125rem; color: var(--c-muted); }

/* Läikiv eelvaade: valgusriba, mis libiseb üle tähtede */
.tmk-calc__text { position: relative; }
.tmk-calc__text.is-gloss::after {
	content: attr(data-text);
	position: absolute;
	inset: 0;
	color: transparent;
	text-shadow: none;
	background: linear-gradient(105deg, transparent 0 38%, rgba(255, 255, 255, .7) 47%, rgba(255, 255, 255, .15) 52%, transparent 60% 100%) 0 0 / 300% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	mix-blend-mode: screen;
	pointer-events: none;
	animation: tmk-sheen 4.5s ease-in-out infinite;
}
.tmk-calc__preview[data-color="valge"] .tmk-calc__text.is-gloss::after { mix-blend-mode: normal; opacity: .9; }
@keyframes tmk-sheen { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .tmk-calc__text.is-gloss::after { animation: none; background-position: 40% 0; } }

/* Fondi tähtede eelvaade hiirega (ilmub fondikaardi kõrvale) */
.tmk-font-peek {
	position: fixed;
	z-index: 9999;
	left: 0;
	top: 0;
	width: min(560px, calc(100vw - 24px));
	padding: 1rem 1.25rem .6rem;
	border-radius: 14px;
	background: #fff;
	color: var(--c-ink, #161817);
	box-shadow: 0 0 0 1px rgba(22, 24, 23, .08), 0 24px 48px -20px rgba(22, 24, 23, .45);
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .18s ease, transform .18s ease;
	visibility: hidden;
}
.tmk-font-peek.is-on { opacity: 1; transform: none; visibility: visible; }
.tmk-font-peek__name { margin: 0 0 .4rem; font-size: .8125rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #6b716d; }
.tmk-font-peek__row { margin: 0 0 .45rem; font-size: 1.55rem; line-height: 1.3; word-break: break-all; }
@media (prefers-reduced-motion: reduce) { .tmk-font-peek { transition: none; } }

/* Suured ja väikesed tähed */
.tmk-calc__case { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .85rem; }
.tmk-calc__case[hidden] { display: none; }
.tmk-calc__case-label { font-size: .875rem; font-weight: 600; margin-right: .2rem; }
.tmk-calc__case .tmk-chip { padding: .35rem .8rem; }
.tmk-calc__case-note { margin: .5rem 0 0; font-size: .8125rem; color: var(--c-muted); }

/* Kujundid (1.9.0): nupud teksti all ja kujundid eelvaates */
.tmk-calc__shapes { margin-top: 1rem; }
.tmk-calc__shapes[hidden], .tmk-calc__shapes-note[hidden] { display: none; }
.tmk-calc__shapes .tmk-calc__case-label { display: block; margin-bottom: .45rem; }
.tmk-calc__shape-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .4rem; max-width: 640px; }
.tmk-shape-btn {
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: #fff;
	box-shadow: inset 0 0 0 1px var(--c-line);
	color: var(--c-ink);
	cursor: pointer;
	transition: box-shadow .2s, transform .2s, background-color .2s;
}
.tmk-shape-btn svg { width: 58%; height: 58%; }
.tmk-shape-btn:hover { box-shadow: inset 0 0 0 1.5px var(--c-ink); transform: translateY(-1px); }
.tmk-shape-btn:active { transform: scale(.94); background: var(--c-paper); }
.tmk-shape-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
@media (max-width: 480px) { .tmk-calc__shape-btns { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.tmk-calc__word { display: inline-block; white-space: nowrap; }
.tmk-calc__shape {
	display: inline-block;
	vertical-align: baseline;
	height: .7em;
	width: calc(var(--a, 1) * .7em);
	overflow: visible;
	filter: var(--tmk-shape-shadow, none);
}
@supports (height: 1cap) {
	.tmk-calc__shape { height: 1cap; width: calc(var(--a, 1) * 1cap); }
}
.tmk-calc__text.is-placeholder .tmk-calc__shape { filter: none; }
/* Läige kujunditega tekstis: iga tähejada eraldi */
.tmk-calc__text.has-shapes.is-gloss::after { content: none; }
.tmk-calc__text.has-shapes .tmk-calc__run { position: relative; }
.tmk-calc__text.has-shapes.is-gloss .tmk-calc__run::after {
	content: attr(data-text);
	position: absolute;
	inset: 0;
	color: transparent;
	text-shadow: none;
	background: linear-gradient(105deg, transparent 0 38%, rgba(255, 255, 255, .7) 47%, rgba(255, 255, 255, .15) 52%, transparent 60% 100%) 0 0 / 300% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	mix-blend-mode: screen;
	pointer-events: none;
	animation: tmk-sheen 4.5s ease-in-out infinite;
}

/* Värvid 1.9.1: pruun ja kuld, kuld ainult läikiv */
.tmk-swatch__note { font-size: .75rem; font-weight: 400; color: var(--c-muted); margin-left: -.2rem; }
.tmk-swatch__dot { background: var(--dot); }
.tmk-calc__colors .tmk-swatch:has(input[value="kuld"]) .tmk-swatch__dot {
	background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .75), transparent 42%), var(--dot);
}
.tmk-finish.is-disabled { background: transparent; cursor: not-allowed; }
.tmk-finish.is-disabled .tmk-finish__chip, .tmk-finish.is-disabled .tmk-finish__label { opacity: .4; }
.tmk-finish.is-disabled input { cursor: not-allowed; }
.tmk-calc__finish-note { color: var(--c-ink); font-weight: 500; }
