/**
 * ReBorn – Aukštų planai, front-end.
 *
 * Visos spalvos ir dydžiai – CSS kintamieji, kad juos būtų galima perrašyti
 * temos CSS. Būsenų spalvas įrašo įskiepio nustatymai (žr. AP_Settings::css_vars).
 *
 * Šriftai NĖRA kraunami – naudojami tie, kurie jau užregistruoti svetainėje.
 *
 * Kodėl visi selektoriai pradedami nuo `.ap`
 * ------------------------------------------
 * Šis CSS sąmoningai keliamas į <head> (kad planas nemirktelėtų nesustyluotas),
 * todėl temos stiliai eina PO jo. Temos reset'e yra taisyklių tokio pat
 * specifiškumo kaip vieno klasės selektoriaus – pvz. `[type="button"]` ir
 * `img` – ir vienodo specifiškumo atveju nugali tas, kuris eina vėliau.
 * `.ap` priešdėlis pakelia specifiškumą iki dviejų klasių, tad eiliškumas
 * nebesvarbu. Elementai už `.ap` ribų (`.ap-notice`) priešdėlio neturi.
 */

.ap {
	/* Šriftai */
	--ap-font-number: "HalisaExtended", "Halisa Extended", serif;
	--ap-font-text: "CynthoNext", "CyntoNext", "Cynto Next", sans-serif;

	/* Geometrija */
	--ap-ar: 4000 / 1417;
	--ap-arn: 2.8229;
	--ap-z: 1;
	--ap-x: 0px;
	--ap-y: 0px;

	/* Butų plotai – atsarginės reikšmės, jei nustatymų CSS neįsikrautų. */
	--ap-free: transparent;
	--ap-free-on: rgba(211, 255, 178, .55);
	--ap-reserved: rgba(255, 204, 108, .4);
	--ap-reserved-on: rgba(255, 204, 108, .6);
	--ap-sold: rgba(255, 169, 171, .4);
	--ap-sold-on: rgba(255, 169, 171, .6);

	/*
	 * Kortelė. Visi dydžiai išvesti iš --ap-card-scale, tad visą kortelę
	 * galima padidinti ar sumažinti viena reikšme. 1 = originalus dizaino
	 * dydis; 0.8 – 20 % mažiau, kad kortelė patogiau tilptų į žemą plano juostą.
	 */
	--ap-card-scale: .8;

	/* Buto numeris derinamas atskirai – telefone jis proporcingai per didelis. */
	--ap-card-number-scale: 1;

	--ap-card-bg: #713600;
	--ap-card-text: #ffffff;
	--ap-card-number-color: #e5b57a;
	--ap-card-rule: #f9f6f2;

	--ap-card-radius: calc(62px * var(--ap-card-scale));
	--ap-card-w: calc(188px * var(--ap-card-scale));
	--ap-card-number-size: calc(52px * var(--ap-card-scale) * var(--ap-card-number-scale));
	--ap-card-body-size: calc(13px * var(--ap-card-scale));
	--ap-card-track: calc(1px * var(--ap-card-scale));
	/* Tarpas tarp buto numerio ir tipo. */
	--ap-card-gap-number: calc(8px * var(--ap-card-scale));
	/* Tarpai virš ir po skiriamąja linija. */
	--ap-card-gap-rule: calc(22px * var(--ap-card-scale));
	--ap-card-gap-after-rule: calc(17px * var(--ap-card-scale));
	/* Kiek platesnė kortelė, kai kaina ilga („… € + PVM“ komercinėse patalpose). */
	--ap-card-w-extra: calc(46px * var(--ap-card-scale));
	/* Tarpas tarp būsenos, kainos ir „k. | m²“ eilučių. */
	--ap-card-gap-line: calc(5px * var(--ap-card-scale));
	--ap-card-pad:
		calc(26px * var(--ap-card-scale))
		calc(26px * var(--ap-card-scale))
		calc(24px * var(--ap-card-scale))
		calc(46px * var(--ap-card-scale));

	/*
	 * Mygtukas „Peržiūrėti“ – tik liečiamame ekrane (žr. .ap-card__btn).
	 *
	 * Raidės turi apatinę ribą: kortelė telefone maža (--ap-card-scale: .672),
	 * ir vien masteliu išvestas dydis būtų neįskaitomas.
	 */
	--ap-card-btn-size: max(10px, calc(13px * var(--ap-card-scale)));
	--ap-card-btn-color: #e5b57a;

	/* Ženkliukas */
	--ap-badge-size: calc(50px * var(--ap-card-scale));
	--ap-badge-bg: #e5b57a;
	--ap-badge-fg: #000000;

	/* Mastelio mygtukai */
	--ap-zoom-size: 34px;
	--ap-zoom-gap: 14px;
	--ap-zoom-top: 16px;
	--ap-zoom-color: #713600;

	/* Saugiklis: sekcija niekada neaukštesnė nei ekranas. */
	--ap-h-max: 100vh;
	/* Mažiausias sekcijos aukštis telefone – įrašo nustatymai. 0 = pagal planą. */
	--ap-h-mobile: 0px;

	position: relative;
	isolation: isolate;
	-webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ scena */

.ap .ap-viewport {
	position: relative;
	width: 100%;
	max-height: var(--ap-h-max);
	overflow: hidden;
	/* Kol mastelis 1, vienas pirštas slenka puslapį, du pirštai priartina. */
	touch-action: pan-y;
}

/*
 * Sekcijos aukštį diktuoja nematomas matmenų elementas (žr. AP_Render).
 *
 * Nei `aspect-ratio`, nei `100cqw` čia netinka: Elementor konteineriai yra flex,
 * o juose iš savo pločio išvestas aukštis protėviams lieka nulinis – tada kita
 * puslapio sekcija užlipa ant plano. Tikrą proporciją turintį elementą flex
 * išmatuoja teisingai.
 *
 * Aukštis nepriklauso nuo mastelio: priartinus ir atitolinus sekcija lieka to
 * paties dydžio, o keičiasi tik planas jos viduje.
 */
.ap .ap-sizer {
	display: block;
	width: 100%;
	height: auto;
	max-width: none;
}

/* Priartinus vienas pirštas jau tempia planą – kitaip naršyklė pasisavintų gestą. */
.ap.is-zoomed .ap-viewport {
	touch-action: none;
}

.ap .ap-stage {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 100%;
	aspect-ratio: var(--ap-ar);
	transform-origin: 50% 50%;
	transform: translate(-50%, -50%) translate(var(--ap-x), var(--ap-y)) scale(var(--ap-z));
}

/* will-change tik judesio metu – kitaip naršyklė laiko sluoksnį rastrizuotą
   senu masteliu ir priartintas planas atrodo išblukęs. */
.ap .ap-stage.is-animating,
.ap.is-panning .ap-stage {
	will-change: transform;
}

.ap .ap-stage.is-animating {
	transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}

.ap .ap-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	display: block;
	z-index: 0;
}

/*
 * Švelnus atsiradimas. Klasę `ap--fade` uždeda JS ir tik tada, kai nuotrauka dar
 * neatsisiųsta – jei ji jau nupiešta (arba JS neveikia), planas nemirkteli.
 */
/* `ap--fade` yra ant to paties šakninio elemento, tad be tarpo. */
.ap.ap--fade .ap-img,
.ap.ap--fade .ap-overlay {
	opacity: 0;
	transition: opacity .45s ease;
}

.ap.ap--fade.is-loaded .ap-img,
.ap.ap--fade.is-loaded .ap-overlay {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.ap--fade .ap-img,
	.ap--fade .ap-overlay {
		transition: none;
	}
}

.ap .ap-overlay {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}

/*
 * Kortelių sluoksnis gyvena virš plano, bet NE jo viduje – jo neliečia nei
 * mastelis, nei tempimas, todėl tekstas visada aštrus.
 *
 * Jis yra ir už .ap-viewport ribų: ten galioja overflow:hidden, o plano juosta
 * žema (telefone ~130 px), tad kortelė būtų nukirsta. Sluoksnis uždedamas
 * tiksliai ant sekcijos, todėl JS skaičiavimai procentais nesikeičia.
 */
.ap .ap-markers {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	/* Dydis nesvarbus – kortelės dedamos px tikslumu nuo sekcijos kampo,
	   o sluoksnio kampas sutampa su .ap-viewport kampu. */
	height: 0;
	/* Virš mastelio mygtukų: telefone kortelė nusileidžia žemiau plano ir
	   mygtukai kirstųsi su jos tekstu. */
	z-index: 6;
	pointer-events: none;
}

/* -------------------------------------------------------------- butų plotai */

.ap .ap-unit {
	cursor: pointer;
	outline: none;
	/* Be šito mobilios naršyklės bakstelėjus mirkteli mėlyną nuorodos foną,
	   o ilgiau palaikius parodo sisteminį nuorodos meniu. */
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
}

.ap .ap-unit__shape {
	fill: transparent;
	transition: fill .22s ease;
}

.ap .ap-unit[data-state="free"] .ap-unit__shape {
	fill: var(--ap-free);
}

.ap .ap-unit[data-state="reserved"] .ap-unit__shape {
	fill: var(--ap-reserved);
}

.ap .ap-unit[data-state="sold"] .ap-unit__shape {
	fill: var(--ap-sold);
}

.ap .ap-unit[data-state="free"]:hover .ap-unit__shape,
.ap .ap-unit[data-state="free"].is-on .ap-unit__shape,
.ap .ap-unit[data-state="free"]:focus-visible .ap-unit__shape {
	fill: var(--ap-free-on);
}

.ap .ap-unit[data-state="reserved"]:hover .ap-unit__shape,
.ap .ap-unit[data-state="reserved"].is-on .ap-unit__shape,
.ap .ap-unit[data-state="reserved"]:focus-visible .ap-unit__shape {
	fill: var(--ap-reserved-on);
}

.ap .ap-unit[data-state="sold"]:hover .ap-unit__shape,
.ap .ap-unit[data-state="sold"].is-on .ap-unit__shape,
.ap .ap-unit[data-state="sold"]:focus-visible .ap-unit__shape {
	fill: var(--ap-sold-on);
}

.ap .ap-unit:focus-visible .ap-unit__shape {
	stroke: #713600;
	stroke-width: 3;
	stroke-dasharray: 6 5;
	vector-effect: non-scaling-stroke;
}

/* ------------------------------------------------------------------ kortelė */

.ap .ap-marker {
	position: absolute;
	left: var(--x, 0px);
	top: var(--y, 0px);
	width: var(--ap-card-w);
	transform: translate(var(--ap-tx, -50%), var(--ap-ty, -50%));
	opacity: 0;
	visibility: hidden;
	transition: opacity .15s ease;
	pointer-events: none;
}

/*
 * Platesnė kortelė ilgai kainai. Komercinėse patalpose kaina rašoma su „+ PVM“
 * ir į įprastą plotį netelpa – lūžtų į dvi eilutes. Žymę uždeda PHP pagal
 * kainos teksto ilgį (žr. AP_Render::unit_card), tad veikia bet kokiam ilgam
 * užrašui, ne tik konkrečiam tipui.
 */
.ap .ap-marker--wide {
	width: calc(var(--ap-card-w) + var(--ap-card-w-extra));
}

.ap .ap-marker.is-active {
	opacity: 1;
	visibility: visible;
}

.ap .ap-card {
	position: relative;
	display: block;
	background: var(--ap-card-bg);
	border-radius: var(--ap-card-radius);
	padding: var(--ap-card-pad);
	box-shadow: 0 18px 40px rgba(20, 12, 6, .28);
}

.ap .ap-card__number {
	display: block;
	font-family: var(--ap-font-number);
	font-weight: 400;
	font-size: var(--ap-card-number-size);
	line-height: 1;
	letter-spacing: -.02em;
	color: var(--ap-card-number-color);
}

.ap .ap-card__label,
.ap .ap-card__status,
.ap .ap-card__price,
.ap .ap-card__meta {
	display: block;
	font-family: var(--ap-font-text);
	font-weight: 300;
	font-size: var(--ap-card-body-size);
	line-height: 1.4;
	letter-spacing: var(--ap-card-track);
	color: var(--ap-card-text);
}

/* Tipas rašomas didžiosiomis – taip yra dizaine, o taksonomijos terminai
   svetainėje surašyti įprastai („Komercinės patalpos“). */
.ap .ap-card__label {
	text-transform: uppercase;
	margin-top: var(--ap-card-gap-number);
}

.ap .ap-card__price,
.ap .ap-card__meta {
	margin-top: var(--ap-card-gap-line);
}

.ap .ap-card__rule {
	display: block;
	height: 1px;
	background: var(--ap-card-rule);
	margin: var(--ap-card-gap-rule) 0 var(--ap-card-gap-after-rule);
}

/* ------------------------------------------------------ „Peržiūrėti“ mygtukas */

/*
 * Telefone kortelė yra tik tarpinis žingsnis: į buto puslapį nuveda antras
 * bakstelėjimas į tą patį plotą, bet iš kortelės to nematyti. Mygtukas tą kelią
 * parodo, o dviejų bakstelėjimų logika lieka kaip buvusi – abu keliai veda į tą
 * patį adresą.
 *
 * Kompiuteryje mygtuko nėra: ten kortelė seka pelę ir dingsta vos ją patraukus,
 * o buto puslapis atsidaro vienu paspaudimu.
 *
 * Klaviatūrai jis nepasiekiamas (`tabindex="-1"`, kortelė `aria-hidden`) –
 * nuoroda yra pats buto plotas plane, ir dubliuoti jos į Tab eilę nereikia.
 */
.ap .ap-card__btn {
	display: none;
}

.ap.is-touch .ap-card__btn {
	display: flex;
	align-items: start;
	justify-content: start;
	margin-top: 12px !important;
	font-family: var(--ap-font-text);
	font-weight: 400;
	font-size: var(--ap-card-btn-size);
	line-height: 1.2;
	letter-spacing: var(--ap-card-track);
	text-align: left;
	text-transform: uppercase;
	cursor: pointer;
	/* Kortelių sluoksnis įvykių negaudo (žr. .ap-markers) – mygtukui grąžinam.
	   Neaktyvi kortelė yra `visibility: hidden`, tad paspausti jos nepavyks. */
	pointer-events: auto;
	-webkit-tap-highlight-color: transparent;
	/*
	 * `!important` – dėl tos pačios priežasties kaip mastelio mygtukams: temos
	 * reset'as nuorodoms (`a`, `.entry-content a`) eina PO mūsų CSS, tad esant
	 * vienodam specifiškumui laimėtų jis ir mygtukas gautų temos pabraukimą ar
	 * spalvą.
	 */
	color: var(--ap-card-btn-color) !important;
	border: 0 !important;
	border-radius: 0px !important;
	text-decoration: none !important;
	box-shadow: none !important;
	transition: background-color .2s ease;
}

/* --------------------------------------------------------------------- ženkliukas */

/* Ženkliukas VISADA kairėje kortelės kraštinėje – nei būsena, nei kortelės
   pusė jo nekilnoja (brandbook reikalavimas). */
.ap .ap-card__badge {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translate(-50%, -50%);
	width: var(--ap-badge-size);
	height: var(--ap-badge-size);
	pointer-events: none;
}

.ap .ap-card__badge svg {
	display: block;
	width: 100%;
	height: 100%;
}

.ap .ap-card__badge .ap-badge-bg {
	fill: var(--ap-badge-bg);
}

.ap .ap-card__badge .ap-badge-fg {
	stroke: var(--ap-badge-fg);
}

/* Rezervuoto spynos korpusas užpildytas ta pačia ženkliuko spalva. */
.ap .ap-card__badge .ap-badge-fill {
	fill: var(--ap-badge-bg);
}

.ap .ap-marker[data-state="reserved"] {
	--ap-badge-bg: #ffcc6c;
	--ap-badge-fg: #ffffff;
}

.ap .ap-marker[data-state="sold"] {
	--ap-badge-bg: #aaaaaa;
	--ap-badge-fg: #ffffff;
}

/* --------------------------------------------------------- mastelio mygtukai */

.ap .ap-zoom {
	display: none;
	justify-content: center;
	gap: var(--ap-zoom-gap);
	margin-top: var(--ap-zoom-top);
	/* Virš plano, bet po kortele. */
	position: relative;
	z-index: 5;
}

.ap.is-touch .ap-zoom {
	display: flex;
}

/*
 * `!important` čia nėra tingumas: temos reset'as mygtukams (`[type="button"]`,
 * `button`) rašo savo paraštes, rėmelį ir apvalinimą su `!important`, o jo CSS
 * krenta po mūsų (mūsų stilius sąmoningai keliamas į <head>, kad planas
 * nemirktelėtų nesustyluotas). Be `!important` mastelio mygtukai gautų temos
 * stačiakampį stilių.
 */
.ap .ap-zoom__btn {
	width: var(--ap-zoom-size) !important;
	height: var(--ap-zoom-size) !important;
	min-width: 0 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	border: 1px solid var(--ap-zoom-color) !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--ap-zoom-color) !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
	-webkit-tap-highlight-color: transparent;
}

.ap .ap-zoom__btn:hover,
.ap .ap-zoom__btn:focus-visible,
.ap .ap-zoom__btn:active {
	background: var(--ap-zoom-color) !important;
	color: #ffffff !important;
}

.ap .ap-zoom__btn svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
}

.ap .ap-zoom__btn:disabled {
	opacity: .35;
	cursor: default;
}

.ap.is-panning .ap-stage {
	cursor: grabbing;
}

/* --------------------------------------------------------------- responsyvumas */

@media (max-width: 767px) {
	.ap {
		/* Telefone kortelė dar ~16 % mažesnė – tokios proporcijos yra dizaine. */
		--ap-card-scale: .672;
		/* Numeris čia dar 20 % mažesnis – kitaip jis užima pusę kortelės. */
		--ap-card-number-scale: .8;
	}

	/*
	 * Papildomas aukštis telefone. Planas – labai plati juosta (~130 px), tad
	 * priartinus matytųsi tik siauras plyšys. Aukštis pastovus: priartinimas jo
	 * nekeičia, o planas lieka vertikaliai centruotas.
	 */
	.ap .ap-viewport {
		min-height: var(--ap-h-mobile);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ap-stage.is-animating {
		transition: none;
	}

	.ap-unit__shape {
		transition: none;
	}
}

/* ------------------------------------------------------------ admin pranešimas */

.ap-notice {
	margin: 16px 0;
	padding: 14px 18px;
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	background: #fbfbfb;
	color: #50575e;
	font-size: 14px;
	line-height: 1.5;
}

.ap-notice__hint {
	color: #787c82;
	font-size: 13px;
}
