/**
 * Craftory Box — Product calculator
 */

.catalog-page--product {
	--front-font: "Helvetica Neue", HelveticaNeue-Light, HelveticaNeue-Regular, Helvetica, Arial, sans-serif;
	--front-font-nav: "Helvetica Neue", HelveticaNeueCyr-Roman, Helvetica, Arial, sans-serif;
	background: #fff;
}

.product-calc {
	background: #fff;
}

.product-calc__inner {
	padding-block: clamp(40px, 5vw, 56px) clamp(64px, 8vw, 96px);
}

.product-calc__head {
	margin-bottom: clamp(32px, 4vw, 48px);
	padding-bottom: clamp(24px, 3vw, 32px);
	border-bottom: 1px solid var(--front-gold);
	text-align: center;
}

.product-calc h1.product-calc__title {
	margin: 0 0 clamp(16px, 2vw, 24px);
	font-family: var(--front-font);
	font-size: clamp(28px, 3.2vw, 45px);
	font-weight: 400;
	line-height: 1.14;
	color: var(--front-black);
}

.product-page p.product-calc__lead,
.catalog-page p.product-calc__lead {
	margin: 0 auto;
	max-width: none;
	font-family: var(--front-font);
	font-size: clamp(16px, 1.6vw, 20px);
	font-weight: 400;
	line-height: 1.3;
	color: var(--front-black);
	white-space: nowrap;
}

.product-calc__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(24px, 5vw, 48px);
	align-items: start;
	margin-bottom: clamp(32px, 5vw, 48px);
}

.product-calc__preview {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: clamp(280px, 30vw, 420px);
}

.product-calc__image {
	display: block;
	width: auto;
	max-width: min(100%, 560px);
	height: auto;
	object-fit: contain;
}

.product-calc h2.product-calc__product-title {
	margin: 0 0 clamp(20px, 3vw, 28px);
	font-family: var(--front-font);
	font-size: clamp(22px, 2.4vw, 32px);
	font-weight: 400;
	line-height: 1.14;
	text-align: left;
	color: var(--front-black);
}

.product-calc__gallery {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 16px;
	margin-bottom: clamp(24px, 3vw, 32px);
}

.product-calc__gallery-track {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	scrollbar-width: none;
}

.product-calc__gallery-track::-webkit-scrollbar {
	display: none;
}

.product-calc__gallery-nav {
	flex: 0 0 auto;
	width: 20px;
	height: 35px;
	padding: 0;
	border: 0;
	background: transparent center / contain no-repeat;
	cursor: pointer;
}

.product-calc__gallery-nav--prev {
	background-image: url("../images/catalog/gallery-arrow-next.svg");
}

.product-calc__gallery-nav--next {
	background-image: url("../images/catalog/gallery-arrow-prev.svg");
}

.product-calc__thumb {
	flex: 0 0 auto;
	display: block;
	width: 88px;
	height: 88px;
	padding: 8px;
	border: 1px solid transparent;
	background: #fff;
	cursor: pointer;
	text-decoration: none;
}

.product-calc__thumb.is-active {
	border-color: var(--front-gold);
	cursor: default;
}

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

.product-calc p.product-calc__label {
	margin: 0 0 5px;
	font-family: var(--front-font);
	font-size: clamp(18px, 2vw, 24px);
	font-weight: 400;
	line-height: 1.14;
	color: var(--front-black);
}

.product-calc__sizes-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.product-calc__size {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	height: min-content;
	min-height: min-content;
	padding: 12px 18px;
	border: 1px solid var(--front-gold);
	border-radius: 999px;
	background: #fff;
	color: var(--front-black);
	font-family: var(--front-font);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	cursor: pointer;
	appearance: none;
	transition: background-color 0.2s ease;
}

.product-calc__size:hover {
	background: rgba(198, 161, 91, 0.08);
}

.product-calc__size.is-active {
	border: 1px solid var(--front-gold);
	background: rgba(198, 161, 91, 0.22);
	color: var(--front-black);
}

.product-calc__size.is-custom-match {
	border: 1px solid var(--front-gold);
	background: rgba(198, 161, 91, 0.22);
	box-shadow: inset 0 0 0 1px var(--front-gold);
}

.product-calc__size.is-match-highlight {
	position: relative;
	z-index: 1;
	animation: product-calc-size-match 0.75s ease-in-out 4;
}

@keyframes product-calc-size-match {
	0%,
	100% {
		transform: scale(1);
		border-color: var(--front-gold);
		background: rgba(198, 161, 91, 0.22);
		box-shadow: 0 0 0 0 rgba(198, 161, 91, 0.45);
	}

	50% {
		transform: scale(1.04);
		border-color: var(--front-gold);
		background: rgba(198, 161, 91, 0.48);
		box-shadow: 0 0 0 10px rgba(198, 161, 91, 0);
	}
}

.product-calc__custom-size {
	margin-top: clamp(24px, 3vw, 32px);
}

.product-calc__custom-fields {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
	gap: 12px;
	align-items: end;
}

.product-calc__custom-fields.has-error .product-calc__custom-input {
	border-color: #c0392b;
	color: #c0392b;
}

.product-calc__custom-error {
	margin: 12px 0 0;
	font-family: var(--front-font);
	font-size: 14px;
	line-height: 1.3;
	color: #c0392b;
}

.product-calc__field--action {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 8px;
}

.product-calc__field-spacer {
	display: block;
	font-size: clamp(16px, 1.4vw, 18px);
	line-height: 1.14;
	visibility: hidden;
}

.product-calc__add-size {
	box-sizing: border-box;
	width: 100%;
	min-width: 120px;
	height: 56px;
	min-height: 56px;
	padding: 10px 12px;
	border: 1px solid var(--front-gold);
	border-radius: 0;
	background: #fff;
	color: var(--front-black);
	font-family: var(--front-font-nav);
	font-size: 14px;
	font-weight: 400;
	text-transform: uppercase;
	cursor: pointer;
	appearance: none;
}

.product-calc__add-size:hover,
.product-calc__add-size:focus-visible {
	background: rgba(198, 161, 91, 0.08);
}

.product-calc__custom-size .product-calc__field span {
	font-size: clamp(16px, 1.4vw, 18px);
	color: var(--front-black);
}

.product-calc__custom-size .product-calc__field input,
.product-calc__custom-input {
	min-height: 56px;
	font-size: 18px;
	color: var(--front-black);
}

.product-calc__custom-input::placeholder {
	color: var(--front-gray);
	opacity: 1;
}

.product-calc__custom-input:focus::placeholder {
	opacity: 0;
}

.product-calc__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.product-calc__field span {
	font-family: var(--front-font);
	font-size: 14px;
	color: var(--front-gray);
}

.product-calc__field input {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1px solid var(--front-gold);
	border-radius: 0;
	background: #fff;
	font-family: var(--front-font);
	font-size: 16px;
	color: var(--front-black);
}

.product-calc__field input.has-error {
	border-color: #c0392b;
}

.product-calc__pricing {
	border-top: 1px solid var(--front-gold);
	padding-top: clamp(28px, 3.5vw, 40px);
}

.product-calc__slider-wrap {
	margin-bottom: clamp(28px, 3.5vw, 40px);
}

.product-calc__slider-rail {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 40px;
}

.product-calc__slider-cap {
	position: absolute;
	top: 50%;
	left: 0;
	z-index: 1;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--front-gold);
	transform: translateY(-50%);
	pointer-events: none;
}

.product-calc__slider-cap--end {
	right: 0;
	left: auto;
}

.product-calc__slider {
	position: relative;
	z-index: 2;
	width: 100%;
	height: 40px;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	appearance: none;
	cursor: pointer;
}

.product-calc__slider-rail::before {
	content: "";
	position: absolute;
	top: 50%;
	right: 7px;
	left: 7px;
	z-index: 0;
	height: 2px;
	background: var(--front-gold);
	transform: translateY(-50%);
}

.product-calc__slider::-webkit-slider-runnable-track {
	height: 40px;
	border-radius: 0;
	background: transparent;
}

.product-calc__slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 0;
	height: 0;
	margin-top: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.product-calc__slider::-moz-range-track {
	height: 40px;
	border-radius: 0;
	background: transparent;
}

.product-calc__slider::-moz-range-thumb {
	width: 0;
	height: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.product-calc__slider-value {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	padding: 7px 16px;
	border-radius: 999px;
	background: var(--front-gold);
	font-family: var(--front-font);
	font-size: 15px;
	font-weight: 400;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
	pointer-events: none;
	transform: translate(-50%, -50%);
}

.product-calc__qty-fields {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: clamp(16px, 2vw, 24px);
	margin-bottom: clamp(28px, 3.5vw, 40px);
}

.product-calc__pricing .product-calc__field--qty,
.product-calc__pricing .product-calc__field--price {
	width: min(100%, 200px);
}

.product-calc__pricing .product-calc__field-label {
	font-family: var(--front-font);
	font-size: 14px;
	line-height: 1.2;
	color: var(--front-gray);
}

.product-calc__pricing .product-calc__field input {
	min-height: 56px;
	padding: 10px 14px;
	border: 1px solid rgba(198, 161, 91, 0.55);
	font-size: clamp(20px, 2vw, 24px);
	color: var(--front-black);
}

.product-calc__pricing .product-calc__price-input {
	cursor: default;
}

.product-calc__table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	margin-bottom: 0;
}

.product-calc__table {
	width: 100%;
	min-width: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.product-calc__table th,
.product-calc__table td {
	padding: 10px 6px;
	border: 1px solid rgba(198, 161, 91, 0.55);
	font-family: var(--front-font);
	font-size: clamp(12px, 1vw, 14px);
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	vertical-align: middle;
}

.product-calc__table thead th:first-child,
.product-calc__table tbody th {
	width: 72px;
	background: var(--front-gold);
	color: #fff;
}

.product-calc__table thead th:not(:first-child),
.product-calc__table tbody td {
	background: #fff;
	color: var(--front-black);
}

.product-calc__tier-qty,
.product-calc__tier-price {
	appearance: none;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.product-calc__tier-qty:hover,
.product-calc__tier-price:hover {
	opacity: 0.75;
}

.product-calc__summary {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	margin: 0;
	margin-left: auto;
	max-width: 100%;
}

.product-calc p.product-calc__total {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: flex-end;
	gap: 0.35em;
	margin: 15px 0;
	font-family: var(--front-font);
	font-size: clamp(20px, 2vw, 24px);
	line-height: 1.2;
	color: var(--front-black);
}

.product-calc__total-value {
	font-size: clamp(18px, 2.25vw, 28px);
	font-weight: 400;
	line-height: 1;
	color: var(--front-gold);
}

.product-calc__submit {
	box-sizing: border-box;
	width: auto;
	min-height: 44px;
	padding: 10px 48px;
	border: 0;
	border-radius: 0;
	background: var(--front-gold);
	color: #fff;
	font-family: var(--front-font-nav);
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.product-calc__submit:hover,
.product-calc__submit:focus-visible {
	filter: brightness(1.05);
}

.product-calc__checkout-error {
	margin: 0;
	max-width: 320px;
	font-family: var(--front-font);
	font-size: 14px;
	line-height: 1.35;
	text-align: right;
	color: #b42318;
}

/* ==========================================================================
   Product checkout modal
   ========================================================================== */
body.product-checkout-modal-open {
	overflow: hidden;
}

.product-checkout-modal {
	position: fixed;
	inset: 0;
	z-index: 3000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(48px, 10vh, 96px) clamp(16px, 4vw, 32px);
}

.product-checkout-modal[hidden] {
	display: none;
}

.product-checkout-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(17, 18, 20, 0.82);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.product-checkout-modal.is-open .product-checkout-modal__overlay {
	opacity: 1;
}

.product-checkout-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(100%, 640px);
	max-height: min(calc(100vh - clamp(96px, 20vh, 192px)), 720px);
	overflow-y: auto;
	padding: clamp(24px, 3.5vw, 32px);
	background: #fff;
	box-shadow: 0 18px 48px rgba(17, 18, 20, 0.24);
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.product-checkout-modal.is-open .product-checkout-modal__dialog {
	opacity: 1;
	transform: translateY(0);
}

.product-checkout-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	color: var(--front-black);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.product-checkout-modal__close:hover,
.product-checkout-modal__close:focus-visible {
	color: var(--front-gold);
}

.product-checkout-modal__title {
	margin: 0 0 12px;
	font-family: var(--front-font-serif);
	font-size: clamp(24px, 2.8vw, 32px);
	font-weight: 400;
	line-height: 1.14;
	text-transform: uppercase;
	color: var(--front-black);
}

.product-checkout-modal__lead {
	margin: 0 0 20px;
	font-family: var(--front-font);
	font-size: 15px;
	line-height: 1.4;
	color: var(--front-gray);
}

.product-checkout-modal__section {
	margin-bottom: 20px;
}

.product-checkout-modal__section-title {
	margin: 0 0 12px;
	font-family: var(--front-font);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--front-black);
}

.product-checkout-modal__summary {
	margin-bottom: 24px;
	padding: 16px;
	border: 1px solid rgba(198, 161, 91, 0.45);
	background: rgba(198, 161, 91, 0.06);
}

.product-checkout-modal__summary-list {
	display: grid;
	gap: 10px;
	margin: 0;
}

.product-checkout-modal__summary-row {
	display: grid;
	grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
	gap: 12px;
	align-items: baseline;
}

.product-checkout-modal__summary-row dt {
	margin: 0;
	font-family: var(--front-font);
	font-size: 14px;
	font-weight: 400;
	color: var(--front-gray);
}

.product-checkout-modal__summary-row dd {
	margin: 0;
	font-family: var(--front-font);
	font-size: 15px;
	font-weight: 400;
	color: var(--front-black);
	text-align: right;
}

.product-checkout-modal__summary-row--total dd {
	font-size: 18px;
	font-weight: 700;
	color: var(--front-gold);
}

.product-checkout-modal__fields {
	display: grid;
	gap: 12px;
}

.product-checkout-modal__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.product-checkout-modal__label {
	font-family: var(--front-font);
	font-size: 13px;
	font-weight: 400;
	color: var(--front-black);
}

.product-checkout-modal__control {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border: 1px solid #d9d9d9;
	background: #fff;
	color: var(--front-black);
	font-family: var(--front-font);
	font-size: 15px;
	line-height: 1.3;
	transition: border-color 0.2s ease;
}

.product-checkout-modal__control:focus {
	outline: none;
	border-color: var(--front-gold);
}

.product-checkout-modal__control--textarea {
	min-height: 88px;
	resize: vertical;
}

.product-checkout-modal__options {
	display: grid;
	gap: 10px;
	margin-bottom: 12px;
}

.product-checkout-modal__option {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid #d9d9d9;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.product-checkout-modal__option:has(input:checked) {
	border-color: var(--front-gold);
	background: rgba(198, 161, 91, 0.08);
}

.product-checkout-modal__option input[type="radio"] {
	appearance: none;
	-webkit-appearance: none;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	padding: 0;
	border: 2px solid rgba(198, 161, 91, 0.55);
	border-radius: 50%;
	background: #fff;
	outline: none;
	box-shadow: none;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.product-checkout-modal__option input[type="radio"]:checked {
	border-color: var(--front-gold);
	background-color: #fff;
	background-image: radial-gradient(circle, var(--front-gold) 0 5px, #fff 5px);
}

.product-checkout-modal__option input[type="radio"]:focus-visible {
	outline: 2px solid var(--front-gold);
	outline-offset: 2px;
}

.product-checkout-modal__option-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.product-checkout-modal__option-label {
	font-family: var(--front-font);
	font-size: 15px;
	font-weight: 600;
	color: var(--front-black);
}

.product-checkout-modal__option-desc {
	font-family: var(--front-font);
	font-size: 13px;
	line-height: 1.35;
	color: var(--front-gray);
}

.product-checkout-modal__delivery-panel[hidden] {
	display: none;
}

.product-checkout-modal__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 52px;
	margin-top: 4px;
	padding: 14px 16px;
	border: 0;
	background: var(--front-gold);
	color: #fff;
	font-family: var(--front-font-nav);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.14;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: filter 0.2s ease, opacity 0.2s ease;
}

.product-checkout-modal__submit:hover,
.product-checkout-modal__submit:focus-visible {
	filter: brightness(1.05);
}

.product-checkout-modal__submit:disabled {
	opacity: 0.7;
	cursor: wait;
}

.product-checkout-modal__success {
	margin: 0;
	padding-top: 8px;
	font-family: var(--front-font);
	font-size: 16px;
	line-height: 1.4;
	color: var(--front-black);
}

.product-checkout-modal__error {
	margin: 0 0 12px;
	font-family: var(--front-font);
	font-size: 14px;
	line-height: 1.4;
	color: #b42318;
}

@media (prefers-reduced-motion: reduce) {
	.product-checkout-modal__overlay,
	.product-checkout-modal__dialog {
		transition: none;
	}
}

/* Product description below calculator */
.product-calc-description {
	background: #fff;
}

.product-calc-description__inner {
	padding-block: 0 clamp(48px, 6vw, 80px);
}

.product-calc-description__text {
	max-width: 920px;
	margin: 0 auto;
	font-family: var(--front-font);
	font-size: clamp(15px, 1.3vw, 18px);
	font-weight: 400;
	line-height: 1.4;
	color: var(--front-black);
	text-align: left;
}

.product-calc-description__text p {
	margin: 0 0 1em;
}

.product-calc-description__text p:last-child {
	margin-bottom: 0;
}
