/* Project tile (woocommerce/content-product.php) + floor plan viewer (includes/js/kafelek.js)
   Sizes follow the design file: --u = 1px of the 788px wide design tile, so every section
   and font keeps its proportion at any tile width. */

.woocommerce ul.products:has(> .arch-tile-li) {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin: 0 0 30px;
}
.woocommerce ul.products:has(> .arch-tile-li)::before,
.woocommerce ul.products:has(> .arch-tile-li)::after { display: none; }
@media (max-width: 991px) { .woocommerce ul.products:has(> .arch-tile-li) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .woocommerce ul.products:has(> .arch-tile-li) { grid-template-columns: minmax(0, 1fr); } }

.woocommerce ul.products li.product.arch-tile-li {
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
	border: 0;
	container-type: inline-size;
}

.arch-tile {
	--u: calc(100cqw / 788);
	--ink: #1a2033;
	--muted: #6b7590;
	--line: #e4e7ee;
	--orange: #ec631f;
	position: relative;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: calc(22 * var(--u));
	box-shadow: 0 calc(4 * var(--u)) calc(22 * var(--u)) rgba(26, 32, 51, .1);
	color: var(--ink);
	font-weight: 400; /* body is 300 */
	line-height: 1.2;
}
.arch-tile img { max-width: none; }
/* theme animates "all" on links: sizes follow the tile width, so a width change while loading looked like a text zoom */
.arch-tile a { transition-property: color, background-color, border-color, opacity; }
.arch-tile button { width: auto; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* --- visualisation slider --- */
.arch-tile__media { position: relative; border-radius: calc(22 * var(--u)) calc(22 * var(--u)) 0 0; overflow: hidden; }
.arch-tile__slides {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	aspect-ratio: 3 / 2;
}
.arch-tile__slides::-webkit-scrollbar { display: none; }
.arch-tile__slide { flex: 0 0 100%; scroll-snap-align: start; }
/* older, taller visualisations are cropped equally top and bottom */
.woocommerce ul.products li.product .arch-tile__slide img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

.arch-tile .arch-tile__nav {
	position: absolute;
	top: 50%;
	width: calc(56 * var(--u));
	height: calc(56 * var(--u));
	min-width: 26px;
	min-height: 26px;
	margin-top: calc(-28 * var(--u));
	border-radius: 50%;
	background: rgba(255, 255, 255, .9) !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	opacity: 0;
	transition: opacity .2s;
}
.arch-tile__nav::before {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 30%;
	height: 30%;
	border: solid var(--ink);
	border-width: 2px 2px 0 0;
	transform: translateX(-15%) rotate(45deg);
}
.arch-tile__nav--prev { left: calc(16 * var(--u)); }
.arch-tile__nav--prev::before { transform: translateX(15%) rotate(-135deg); }
.arch-tile__nav--next { right: calc(16 * var(--u)); }
.arch-tile__media:hover .arch-tile__nav, .arch-tile__nav:focus-visible { opacity: 1; }
@media (hover: none) { .arch-tile__nav { display: none; } }

.arch-tile__dots { position: absolute; left: 0; right: 0; bottom: calc(14 * var(--u)); display: flex; justify-content: center; gap: calc(10 * var(--u)); pointer-events: none; }
.arch-tile__dots span { width: calc(12 * var(--u)); height: calc(12 * var(--u)); min-width: 5px; min-height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .6); box-shadow: 0 0 3px rgba(0, 0, 0, .3); }
.arch-tile__dots span.is-active { background: #fff; }

.arch-tile__badge {
	position: absolute;
	top: calc(22 * var(--u));
	left: calc(22 * var(--u));
	padding: calc(8 * var(--u)) calc(16 * var(--u));
	border-radius: calc(8 * var(--u));
	background: var(--orange);
	color: #fff;
	font-size: calc(36 * var(--u));
	line-height: 1.1;
	pointer-events: none;
}

/* heart + compare: plugin buttons restyled as round icons, orange when active */
.arch-tile__actions {
	position: absolute;
	top: calc(26 * var(--u));
	right: calc(16 * var(--u));
	display: flex;
	flex-direction: column;
	gap: calc(18 * var(--u));
}
.arch-tile__actions .tinv-wraper { margin: 0 !important; }
.arch-tile__actions .tinv-wishlist-clear, .arch-tile__actions .tinvwl-tooltip { display: none !important; }
.arch-tile__actions .tinvwl_add_to_wishlist_button,
.arch-tile__actions a.compare {
	position: relative;
	display: block !important;
	width: calc(66 * var(--u));
	height: calc(66 * var(--u));
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #fff !important;
	box-shadow: 0 2px 10px rgba(26, 32, 51, .15);
	font-size: 0 !important;
	overflow: hidden;
}
.arch-tile__actions .tinvwl_add_to_wishlist_button::before,
.arch-tile__actions a.compare::before {
	content: "" !important;
	position: absolute;
	inset: 0;
	margin: auto !important;
	width: 46%;
	height: 46%;
	background: var(--ink);
	-webkit-mask: url(../img/kafelek/ulubione.png) center / contain no-repeat;
	mask: url(../img/kafelek/ulubione.png) center / contain no-repeat;
	transition: background-color .2s;
}
.arch-tile__actions a.compare::before {
	-webkit-mask-image: url(../img/kafelek/porownaj.png);
	mask-image: url(../img/kafelek/porownaj.png);
}
/* heart: the plugin's own webfont glyph (as on the old list), outline -> filled when in wishlist */
.arch-tile__actions .tinvwl_add_to_wishlist_button::before {
	content: "\e909" !important;
	inset: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	background: none;
	-webkit-mask: none;
	mask: none;
	color: var(--ink);
	font: normal calc(34 * var(--u)) / 1 tinvwl-webfont !important;
	vertical-align: baseline;
}
.arch-tile__actions .tinvwl_add_to_wishlist_button.tinvwl-product-in-list::before { content: "\e908" !important; color: var(--orange); }
.arch-tile__actions .tinvwl_add_to_wishlist_button > *, .arch-tile__actions a.compare > * { display: none; }
.arch-tile__actions a.compare:hover::before,
.arch-tile__actions a.compare.added::before { background: var(--orange); }

/* --- body --- */
.arch-tile__body { flex: 1; display: flex; flex-direction: column; padding: 0 calc(19 * var(--u)) 0 calc(20 * var(--u)); }
.arch-tile__body > div + div { border-top: 1px solid var(--line); }
.woocommerce ul.products li.product .arch-tile__body img { display: block; flex: none; width: var(--w, auto) !important; height: auto !important; margin-top: 0; margin-bottom: 0; }

.arch-tile__head {
	display: grid;
	grid-template-columns: calc(290 * var(--u)) calc(155 * var(--u)) calc(154 * var(--u)) 1fr;
	align-items: end;
	padding: calc(26 * var(--u)) 0 calc(20 * var(--u)) calc(6 * var(--u));
}
.arch-tile__name { display: contents; }
.woocommerce ul.products li.product .arch-tile__title { grid-column: 1 / -1; margin: 0; text-transform: none; letter-spacing: 0; padding: 0; font-size: calc(57 * var(--u)); font-weight: 600; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arch-tile__title a { color: var(--ink); text-decoration: none; }
.arch-tile__title a:hover { color: var(--orange); }
.arch-tile__area { display: block; margin-top: calc(8 * var(--u)); font-size: calc(58 * var(--u)); line-height: 1; white-space: nowrap; }
.arch-tile__area sup { font-size: .5em; top: -.85em; }
.arch-tile__count {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: calc(16 * var(--u));
	height: calc(58 * var(--u));
	margin-bottom: calc(2 * var(--u));
	border-left: 1px solid var(--line);
	font-size: calc(32 * var(--u));
}
.arch-tile__count img { --w: calc(48 * var(--u)); }

.arch-tile__specs {
	display: grid;
	grid-template-columns: 41fr 27fr 32fr;
	align-items: center;
	min-height: calc(109 * var(--u));
}
.arch-tile .arch-tile__spec {
	display: flex;
	align-items: center;
	gap: calc(16 * var(--u));
	min-width: 0;
	padding: calc(14 * var(--u)) calc(6 * var(--u)) calc(14 * var(--u)) calc(16 * var(--u));
	text-align: left;
	font-size: calc(26 * var(--u));
	line-height: 1.25;
}
.arch-tile__spec + .arch-tile__spec { border-left: 1px solid var(--line); }
.arch-tile__spec--plot { padding-left: calc(8 * var(--u)); }
.arch-tile__spec small { display: block; margin-bottom: calc(4 * var(--u)); color: var(--muted); font-size: calc(19 * var(--u)); line-height: 1.2; }
.arch-tile__spec--plot img { --w: calc(52 * var(--u)); }
.arch-tile__spec--roof img { --w: calc(56 * var(--u)); }
.arch-tile__spec--storey img { --w: calc(42 * var(--u)); }
.arch-tile__spec--storey span { font-size: calc(23 * var(--u)); }
button.arch-tile__spec:hover small, button.arch-tile__spec:hover { color: var(--orange); }

.arch-tile__cost {
	position: relative;
	display: flex;
	align-items: center;
	min-height: calc(86 * var(--u));
	padding-left: calc(8 * var(--u));
}
.arch-tile__cost > img { --w: calc(40 * var(--u)); margin-right: calc(33 * var(--u)); }
.arch-tile__cost-label { white-space: nowrap; color: var(--muted); font-size: calc(19 * var(--u)); }
.arch-tile .arch-tile__info { margin-left: calc(12 * var(--u)); padding: calc(4 * var(--u)) !important; }
.arch-tile__info img { --w: calc(26 * var(--u)); }
.arch-tile__info:hover, .arch-tile__info[aria-expanded="true"] { filter: invert(48%) sepia(83%) saturate(2500%) hue-rotate(352deg) brightness(97%); }
.arch-tile__cost strong { margin-left: auto; padding-right: calc(5 * var(--u)); font-size: calc(34 * var(--u)); font-weight: 400; white-space: nowrap; }
.arch-tile__tip {
	position: absolute;
	z-index: 5;
	left: 0;
	right: 0;
	bottom: calc(100% - 4px);
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--ink);
	color: #fff;
	font-size: 12px;
	line-height: 1.4;
	box-shadow: 0 6px 20px rgba(26, 32, 51, .25);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: .15s;
}
.arch-tile__info[aria-expanded="true"] + .arch-tile__tip { opacity: 1; visibility: visible; transform: none; }

.arch-tile__foot {
	display: flex;
	align-items: center;
	margin-top: auto;
	padding: calc(23 * var(--u)) calc(7 * var(--u)) calc(37 * var(--u)) calc(4 * var(--u));
}
.arch-tile .arch-tile__plan {
	display: flex !important;
	align-items: center;
	gap: calc(16 * var(--u));
	min-width: calc(232 * var(--u));
	height: calc(65 * var(--u));
	padding: 0 calc(18 * var(--u)) 0 calc(22 * var(--u)) !important;
	border: max(1px, calc(1.5 * var(--u))) solid #5d6b8e !important;
	border-radius: calc(14 * var(--u));
	font-size: calc(22 * var(--u));
	font-weight: 500;
	white-space: nowrap;
}
.arch-tile__plan img { --w: calc(40 * var(--u)); }
.arch-tile__plan::after { content: ""; flex: none; margin-right: calc(4 * var(--u)); width: calc(9 * var(--u)); height: calc(9 * var(--u)); margin-left: auto; border: solid currentColor; border-width: max(1px, calc(2 * var(--u))) max(1px, calc(2 * var(--u))) 0 0; transform: rotate(45deg); }
.arch-tile__plan:hover, .arch-tile__plan.is-open { border-color: var(--orange) !important; color: var(--orange); }
.arch-tile__price-label:has(+ .arch-tile__price del) { display: none; } /* sale: label dropped as in the design, no room for both prices beside it */
.arch-tile__price-label { margin-left: auto; padding-left: calc(12 * var(--u)); color: var(--muted); font-size: calc(20 * var(--u)); white-space: nowrap; }
.arch-tile__price { display: flex; align-items: baseline; gap: calc(18 * var(--u)); margin-left: calc(30 * var(--u)); white-space: nowrap; }
.arch-tile__price:has(del) { margin-left: auto; padding-left: calc(30 * var(--u)); }
.arch-tile__price del { color: var(--muted); font-size: calc(26 * var(--u)); }
.arch-tile__price ins { font-size: calc(38 * var(--u)); font-weight: 600; text-decoration: none; letter-spacing: -.02em; }
.arch-tile__price .amount { color: inherit; }
.woocommerce ul.products li.product .arch-tile__cart { display: block; flex: none; margin-left: calc(20 * var(--u)); padding: 0; background: none; border: 0; }
.arch-tile__cart img { --w: calc(36 * var(--u)); }
.arch-tile__cart:hover img { filter: invert(48%) sepia(83%) saturate(2500%) hue-rotate(352deg) brightness(97%); }

/* --- floor plan / site plan viewer --- */
.arch-viewer-backdrop { position: fixed; inset: 0; z-index: 99998; background: rgba(26, 32, 51, .45); }
.arch-viewer {
	--ink: #1a2033;
	position: fixed;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(900px, calc(100vw - 24px));
	height: min(760px, calc(100vh - 24px));
	height: min(760px, calc(100dvh - 24px));
	padding: 20px 24px 18px;
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 10px 40px rgba(26, 32, 51, .25);
	color: var(--ink);
}
.arch-viewer.is-side { position: absolute; transform: none; }
.arch-viewer[hidden], .arch-viewer-backdrop[hidden] { display: none; }
.arch-viewer button { font: inherit; color: inherit; cursor: pointer; }
.arch-viewer__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.arch-viewer .arch-viewer__title { margin: 0; text-transform: none; letter-spacing: 0; font-size: 22px; font-weight: 700; }
.arch-viewer__close { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f0f2f5; font-size: 0 !important; position: relative; }
.arch-viewer__close::before, .arch-viewer__close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; margin: -1px 0 0 -8px; background: var(--ink); transform: rotate(45deg); }
.arch-viewer__close::after { transform: rotate(-45deg); }
.arch-viewer__close:hover { background: #e4e7ee; }
.arch-viewer__stage { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; cursor: grab; }
.arch-viewer__stage.is-drag { cursor: grabbing; }
.arch-viewer .arch-viewer__img { display: block; flex: none; max-width: none !important; max-height: none !important; margin: auto; user-select: none; -webkit-user-drag: none; }
.arch-viewer__arrow { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 12px rgba(26, 32, 51, .2); font-size: 0 !important; }
.arch-viewer__arrow::before { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px; border: solid var(--ink); border-width: 2px 2px 0 0; transform: translateX(-2px) rotate(45deg); }
.arch-viewer__arrow--prev { left: 8px; }
.arch-viewer__arrow--prev::before { transform: translateX(2px) rotate(-135deg); }
.arch-viewer__arrow--next { right: 8px; }
.arch-viewer__zoom { display: flex; align-self: flex-end; margin-top: 10px; border: 1px solid #e4e7ee; border-radius: 12px; overflow: hidden; }
.arch-viewer__zoom button { width: 44px; height: 40px; border: 0; background: #fff; font-size: 22px; line-height: 1; }
.arch-viewer__zoom button:hover { background: #f0f2f5; }
.arch-viewer__zoom output { min-width: 64px; padding: 0 6px; border: solid #e4e7ee; border-width: 0 1px; font-size: 14px; line-height: 40px; text-align: center; }
@media (max-width: 599px) { .arch-viewer { height: min(100vw + 120px, 100dvh - 24px); padding: 14px 14px 12px; border-radius: 16px; } .arch-viewer__title { font-size: 18px; } }
