/* Timapuun hintalaskuri */

.thl {
	--thl-dark: #1e1d1c;
	--thl-text: #2b2a28;
	--thl-muted: #6d6b66;
	--thl-line: #d9d7d2;
	--thl-soft: #f4f4f0;
	--thl-accent: #ffe600;
	--thl-accent-dark: #e9b92c;
	--thl-sel: #6b7a3a;
	--thl-sel-bg: #eef0e5;
	--thl-radius: 8px;
	--thl-heading: "pt-sans-pro-narrow", "PT Sans Narrow", sans-serif;

	margin: 0 auto;
	padding: 2rem 0 3rem;
	color: var(--thl-text);
	line-height: 1.5;
	box-sizing: border-box;
}

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

.thl img {
	max-width: 100%;
	height: auto;
}

.thl button {
	font: inherit;
	color: inherit;
}

.thl-rich p {
	margin: 0 0 0.75em;
}

.thl-rich p:last-child {
	margin-bottom: 0;
}

/* Murupolku */

.thl-stepper {
	margin: 0 0 1.5rem;
}

.thl-stepper ol {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
}

.thl-stepper__step {
	flex: 1 1 0;
	position: relative;
	text-align: center;
	margin: 0;
}

.thl-stepper__step::before {
	content: "";
	position: absolute;
	top: 17px;
	left: -50%;
	right: 50%;
	height: 2px;
	background: var(--thl-dark);
}

.thl-stepper__step:first-child::before {
	display: none;
}

.thl-stepper__step button {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	width: 100%;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
}

.thl-stepper__step button:disabled {
	cursor: default;
}

.thl-stepper__num {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 2px solid var(--thl-dark);
	border-radius: 50%;
	background: #fff;
	font-weight: 700;
	transition: background 0.15s, box-shadow 0.15s;
}

.thl-stepper__label {
	font-size: 0.8rem;
	line-height: 1.2;
	color: var(--thl-muted);
}

.thl-stepper__step.is-current .thl-stepper__num {
	background: var(--thl-accent);
	border-color: var(--thl-accent-dark);
	box-shadow: 0 0 0 4px rgba(255, 230, 0, 0.35);
}

.thl-stepper__step.is-current .thl-stepper__label {
	color: var(--thl-text);
	font-weight: 700;
}

.thl-stepper__step.is-done .thl-stepper__num {
	background: var(--thl-dark);
	color: #fff;
}

.thl-stepper__step.is-skipped {
	opacity: 0.35;
}

.thl-stepper__step button:not(:disabled):hover .thl-stepper__num,
.thl-stepper__step button:focus-visible .thl-stepper__num {
	box-shadow: 0 0 0 4px rgba(30, 29, 28, 0.15);
}

@media (max-width: 600px) {
	.thl-stepper__label {
		display: none;
	}

	.thl-stepper__step.is-current .thl-stepper__label {
		display: block;
		position: absolute;
		top: 42px;
		white-space: nowrap;
	}

	.thl-stepper {
		margin-bottom: 2.5rem;
	}
}

.thl-step-title {
	font-family: var(--thl-heading);
	font-size: 1.5rem;
	font-weight: 700;
	margin: 1.5rem 0 1rem;
}

/* Kortit */

.thl-grid {
	display: grid;
	gap: 12px;
	margin-bottom: 1.5rem;
}

.thl-grid--buildings {
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.thl-grid--sizes {
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.thl-grid--options {
	grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
}

.thl-card {
	--thl-card-bg: #fff;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-align: center;
	padding: 12px;
	background: var(--thl-card-bg);
	border: 1px solid var(--thl-line);
	border-radius: var(--thl-radius);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

button.thl-card:hover,
button.thl-card:focus-visible {
	border-color: var(--thl-dark);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.thl-card.is-selected {
	--thl-card-bg: var(--thl-sel-bg);
	border: 2px solid var(--thl-sel);
	background: var(--thl-sel-bg);
	padding: 11px;
}

.thl-card.is-disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.thl-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 110px;
	margin-bottom: 8px;
}

.thl-card__media img {
	max-height: 110px;
	width: auto;
	object-fit: contain;
	transition: filter 0.2s;
}

.thl-card.is-grayscale .thl-card__media img {
	filter: grayscale(1) contrast(0.9);
}

.thl-card.is-grayscale:hover .thl-card__media img {
	filter: none;
}

.thl-card__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.thl-card__title,
.thl-card__desc,
.thl-final__label {
	overflow-wrap: anywhere;
	hyphens: auto;
}

.thl-card__title {
	font-weight: 700;
	line-height: 1.25;
}

.thl-grid--buildings .thl-card__title {
	font-family: var(--thl-heading);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.thl-card__descwrap {
	display: block;
}

.thl-card__desc {
	position: relative;
	display: block;
	max-height: calc(1.35em * 5);
	overflow: hidden;
	font-size: 0.85rem;
	color: var(--thl-muted);
	line-height: 1.35;
}

.thl-card__desc.is-open {
	max-height: none;
}

/* Häivytys kortin taustaväriin kertoo, että teksti jatkuu. */
.thl-card__desc.is-clamped::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 2.7em;
	background: linear-gradient(to bottom, transparent, var(--thl-card-bg));
	pointer-events: none;
}

.thl-card__more {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 22px;
	margin: 2px auto 0;
	cursor: pointer;
}

.thl-card__more::before {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--thl-dark);
	border-bottom: 2px solid var(--thl-dark);
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.15s;
}

.thl-card__more.is-open::before {
	transform: translateY(2px) rotate(-135deg);
}

.thl-card__price {
	margin-top: auto;
	padding-top: 4px;
	font-size: 0.95rem;
	font-weight: 700;
}

.thl-card__note {
	font-size: 0.8rem;
	font-style: italic;
	color: var(--thl-sel);
}

.thl-card.is-compact {
	text-align: left;
	padding: 8px 12px;
}

.thl-card.is-compact.is-selected {
	padding: 7px 11px;
}

.thl-card.is-compact .thl-card__price {
	padding-top: 0;
}

.thl-links {
	font-size: 0.9rem;
	color: var(--thl-muted);
}

/* Valintaryhmät */

.thl-group {
	margin-bottom: 1.75rem;
}

.thl-group__title {
	font-size: 1rem;
	font-style: italic;
	font-weight: 400;
	margin: 0 0 0.5rem;
}

.thl-group__desc {
	font-size: 0.9rem;
	color: var(--thl-muted);
	margin: -0.25rem 0 0.75rem;
}

.thl-subgroups {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
}

.thl-subgroup__media {
	display: flex;
	justify-content: center;
	height: 195px;
}

.thl-subgroup__media img {
	max-height: 195px;
	width: auto;
}

.thl-subgroup__title {
	text-align: center;
	font-size: 1rem;
	font-weight: 400;
	margin: 0.5rem 0;
}

.thl-subgroup__list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Kappalemäärä */

.thl-card--qty {
	cursor: default;
}

.thl-qty {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 6px;
}

.thl-qty__btn {
	position: relative;
	flex: none;
	width: 32px;
	height: 32px;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 1px solid var(--thl-dark);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
}

/* Merkit piirretään viivoina, jotta ne ovat fontista riippumatta keskellä. */
.thl-qty__btn::before,
.thl-qty__btn--plus::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 2px;
	background: var(--thl-dark);
	transform: translate(-50%, -50%);
}

.thl-qty__btn--plus::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.thl-qty__btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.thl-qty input {
	width: 3.5em;
	height: 32px;
	text-align: center;
	border: 1px solid var(--thl-line);
	border-radius: 4px;
	-moz-appearance: textfield;
}

.thl-qty input::-webkit-inner-spin-button,
.thl-qty input::-webkit-outer-spin-button {
	-webkit-appearance: none;
}

.thl-qty__unit {
	font-size: 0.85rem;
}

/* Kattoikkunat ja lisäsiivet */

.thl-interactive {
	display: grid;
	grid-template-columns: 165px 1fr;
	gap: 12px;
	align-items: start;
}

.thl-interactive__panel {
	display: grid;
	grid-template-columns: minmax(180px, 260px) 1fr;
	gap: 20px;
	align-items: center;
	padding: 16px;
	border: 1px solid var(--thl-line);
	border-radius: var(--thl-radius);
}

.thl-interactive__panel.is-selected {
	border: 2px solid var(--thl-sel);
	background: var(--thl-sel-bg);
	padding: 15px;
}

.thl-interactive__info h4 {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
}

.thl-interactive__info p {
	margin: 0 0 0.5rem;
	font-size: 0.9rem;
}

.thl-interactive__count strong {
	font-size: 1.2rem;
}

.thl-interactive__total {
	font-weight: 700;
}

@media (max-width: 700px) {
	.thl-interactive,
	.thl-interactive__panel {
		grid-template-columns: 1fr;
	}

	.thl-poly {
		max-width: 260px;
		margin: 0 auto;
	}
}

.thl-poly {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.thl-poly__base {
	fill: #555;
	stroke: #333;
	stroke-width: 1.5;
}

.thl-poly__building {
	fill: #646464;
	stroke: #000;
	stroke-width: 1.3;
	pointer-events: none;
}

.thl-poly__facet {
	stroke: #000;
	stroke-width: 0.65;
	pointer-events: none;
}

.thl-poly__chimney {
	fill: #d7d7d7;
	stroke: #000;
	stroke-width: 1.3;
	pointer-events: none;
}

.thl-poly__flue {
	fill: #000;
	pointer-events: none;
}

.thl-poly__center {
	fill: #111;
	stroke: #888;
	stroke-width: 3;
	pointer-events: none;
}

.thl-poly__door {
	fill: var(--thl-dark);
}

.thl-poly__seg {
	cursor: pointer;
	outline: none;
}

.thl-poly__seg.is-locked {
	cursor: default;
}

.thl-poly__roof {
	fill: #666;
	stroke: #3d3d3d;
	stroke-width: 1.2;
	transition: fill 0.15s;
}

.thl-poly__seg:not(.is-locked):hover .thl-poly__roof,
.thl-poly__seg:focus-visible .thl-poly__roof {
	fill: #7a7a7a;
}

.thl-poly__seg.is-entrance .thl-poly__roof {
	fill: #4b4b4b;
}

.thl-poly__window {
	fill: none;
	stroke: #bbb;
	stroke-width: 1.2;
	stroke-dasharray: 4 3;
	pointer-events: none;
}

.thl-poly__seg.is-entrance .thl-poly__window {
	display: none;
}

.thl-poly__seg.is-on .thl-poly__window {
	fill: #eef3f5;
	stroke: #fff;
	stroke-dasharray: none;
}

.thl-poly__seg:focus-visible .thl-poly__roof,
.thl-poly__seg:focus-visible .thl-poly__wing {
	stroke: var(--thl-accent-dark);
	stroke-width: 3;
}

.thl-poly__hit {
	fill: transparent;
}

.thl-poly__wing {
	fill: transparent;
	stroke: #969696;
	stroke-width: 1.3;
	stroke-dasharray: 5;
	transition: fill 0.15s;
}

.thl-poly__valley {
	fill: none;
	stroke: #969696;
	stroke-width: 1.3;
	stroke-dasharray: 5;
	pointer-events: none;
}

.thl-poly__seg:not(.is-locked):hover .thl-poly__wing {
	fill: #ececec;
	stroke: #333;
}

.thl-poly__seg.is-on .thl-poly__wing {
	fill: #646464;
	stroke: #000;
	stroke-dasharray: none;
}

.thl-poly__seg.is-on .thl-poly__valley,
.thl-poly__seg.is-locked:not(.is-on) {
	display: none;
}

.thl-poly__ridge polygon {
	fill: #646464;
	stroke: none;
}

.thl-poly__ridge line,
.thl-poly__ridge polygon {
	stroke: #000;
	stroke-width: 0.65;
	pointer-events: none;
}

.thl-choices {
	border: 0;
	margin: 0 0 0.5rem;
	padding: 0;
}

.thl-choices legend {
	font-size: 0.9rem;
	font-weight: 700;
	padding: 0;
}

.thl-choices label,
.thl-choices__addon {
	display: block;
	font-size: 0.9rem;
	margin: 0.2rem 0;
	cursor: pointer;
}

.thl-choices__price {
	color: var(--thl-muted);
}

.thl-choices__desc {
	display: block;
	margin-left: 1.5rem;
	font-size: 0.8rem;
	color: var(--thl-muted);
}

/* Ohjeet */

.thl-info {
	margin: 1.5rem 0;
	border: 1px solid var(--thl-line);
	border-radius: var(--thl-radius);
	background: #fff;
}

.thl-info__toggle {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	padding: 12px 16px;
	background: none;
	border: 0;
	text-align: left;
	cursor: pointer;
}

.thl-info__icon {
	flex: none;
	width: 48px;
	height: 48px;
}

.thl-info__title {
	flex: 1;
	font-weight: 700;
}

.thl-info__chevron {
	flex: none;
	width: 14px;
	height: 14px;
	border-right: 2px solid var(--thl-dark);
	border-bottom: 2px solid var(--thl-dark);
	transform: rotate(45deg);
	margin-top: -6px;
	transition: transform 0.2s;
}

.thl-info.is-open .thl-info__chevron {
	transform: rotate(-135deg);
	margin-top: 6px;
}

.thl-info__body {
	padding: 0 16px 16px 80px;
	font-size: 0.95rem;
}

@media (max-width: 600px) {
	.thl-info__body {
		padding-left: 16px;
	}
}

/* Yhteenveto */

.thl-summary {
	padding: 16px;
	border: 1px solid var(--thl-line);
	border-radius: var(--thl-radius);
	margin: 1.5rem 0;
}

.thl-summary__title {
	text-transform: none;
	letter-spacing: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.05rem;
	margin: 0 0 12px;
}

.thl-badge {
	display: inline-grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--thl-accent);
	font-size: 0.9rem;
}

.thl-summary__thumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	padding: 12px;
	background: var(--thl-soft);
	border-radius: 6px;
	margin-bottom: 14px;
}

.thl-summary__thumbs img {
	height: 84px;
	width: auto;
}

.thl-summary__thumbs img.is-main {
	height: 90px;
}

.thl-summary__cols {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
	gap: 20px;
}

@media (max-width: 700px) {
	.thl-summary__cols {
		grid-template-columns: 1fr;
	}
}

.thl-summary__head {
	font-weight: 700;
	margin-bottom: 6px;
}

.thl-summary__list {
	margin: 0;
	font-size: 0.9rem;
}

.thl-summary__row {
	display: grid;
	grid-template-columns: 90px 1fr;
	gap: 8px;
	margin-bottom: 3px;
}

.thl-summary__row dt {
	font-weight: 600;
}

.thl-summary__row dd {
	margin: 0;
}

.thl-summary__row dd span {
	display: block;
}

.thl-summary__price {
	display: grid;
	grid-template-columns: minmax(150px, 0.8fr) 1.2fr;
	grid-template-rows: auto 1fr;
	gap: 0 12px;
}

.thl-summary__price .thl-summary__head {
	grid-column: 1 / -1;
}

@media (max-width: 500px) {
	.thl-summary__price {
		grid-template-columns: 1fr;
		gap: 10px;
	}
}

.thl-price {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 16px 12px;
	background: var(--thl-sel-bg);
	border-radius: 6px;
	text-align: center;
}

.thl-price__amount {
	font-size: 1.9rem;
	font-weight: 700;
	color: var(--thl-sel);
	white-space: nowrap;
}

.thl-price__vat {
	font-size: 0.75rem;
	color: var(--thl-muted);
}

.thl-notice {
	padding: 12px;
	background: var(--thl-sel-bg);
	border-radius: 6px;
	font-size: 0.8rem;
	line-height: 1.4;
}

/* Navigointi */

.thl-nav {
	display: flex;
	justify-content: center;
	gap: 16px;
	margin: 1.5rem 0;
}

.thl-btn {
	min-width: 130px;
	padding: 10px 24px;
	background: #fff;
	border: 2px solid var(--thl-dark);
	border-radius: 2px;
	font-family: var(--thl-heading);
	font-size: 1rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s;
}

.thl-btn:not(:disabled):hover,
.thl-btn:focus-visible {
	background: var(--thl-accent);
}

.thl-btn--secondary {
	border-color: #999;
}

.thl-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.thl-reset {
	margin: -0.75rem 0 1.5rem;
	text-align: center;
}

.thl-reset__btn {
	padding: 4px 8px;
	background: none;
	border: 0;
	color: var(--thl-muted);
	font-size: 0.9rem;
	text-decoration: underline;
	cursor: pointer;
}

.thl-reset__btn:hover,
.thl-reset__btn:focus-visible {
	color: var(--thl-dark);
}

.thl-empty {
	padding: 1rem;
	background: var(--thl-soft);
	border-radius: 6px;
}

/* Vaihe 6 */

.thl-final {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 20px 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.thl-final__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	margin: 0;
}

.thl-final__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 120px;
	margin-bottom: 8px;
}

.thl-final__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.thl-final__placeholder {
	display: grid;
	place-items: center;
	width: 70px;
	height: 70px;
	border-radius: 50%;
	background: var(--thl-soft);
	font-size: 2rem;
	color: var(--thl-muted);
}

.thl-final__label {
	font-weight: 700;
	line-height: 1.25;
}

.thl-final__price {
	font-size: 0.9rem;
}

.thl-final__remove {
	display: grid;
	place-items: center;
	padding: 0;
	position: absolute;
	top: 0;
	right: 8px;
	width: 28px;
	height: 28px;
	border: 1px solid #999;
	border-radius: 50%;
	background: #fff;
	line-height: 1;
	font-size: 1.1rem;
	cursor: pointer;
	color: var(--thl-muted);
}

.thl-final__remove:hover,
.thl-final__remove:focus-visible {
	border-color: var(--thl-dark);
	color: var(--thl-dark);
}

.thl-total {
	display: grid;
	grid-template-columns: minmax(200px, 0.8fr) 2fr;
	gap: 12px;
	margin: 1rem 0 2rem;
}

.thl-total .thl-notice {
	font-size: 0.9rem;
	font-style: italic;
	display: flex;
	align-items: center;
}

@media (max-width: 600px) {
	.thl-total {
		grid-template-columns: 1fr;
	}
}

.thl-next h3,
.thl-form-section h3 {
	font-size: 1.1rem;
	margin: 0 0 0.5rem;
}

.thl-next {
	font-size: 0.95rem;
}

.thl-form-section {
	margin-top: 2.5rem;
	padding-top: 2rem;
	border-top: 1px solid var(--thl-line);
}

.thl-privacy {
	margin-top: 1rem;
	font-size: 0.9rem;
}

@media (max-width: 600px) {
	.thl-grid--buildings,
	.thl-grid--sizes,
	.thl-grid--options,
	.thl-final {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.thl-card {
		padding: 8px;
	}

	.thl-card.is-selected {
		padding: 7px;
	}

	.thl-card__media,
	.thl-final__media {
		height: 80px;
	}

	.thl-card__media img,
	.thl-final__media img {
		max-height: 80px;
	}

	.thl-card__desc {
		font-size: 0.8rem;
	}

	.thl-interactive > .thl-card {
		grid-column: 1 / -1;
	}
}

/* Teeman lomakepainikkeen pitkä teksti mahtumaan kapealle näytölle. */
.thl-form .wpcf7 .submit-container {
	max-width: calc(66% - 2rem);
}

.thl-form .wpcf7 .submit-container input[type="submit"] {
	white-space: normal;
	max-width: 100%;
	text-align: center;
}

@media screen and (max-width: 781px) {
	.thl-form .wpcf7 .submit-container {
		display: block;
		max-width: none;
		margin-left: 0;
	}

	.thl-form .wpcf7 .submit-container input[type="submit"] {
		width: 100%;
	}
}
