/*
Theme Name: ABIFORM
Theme URI: https://abiform.kz/
Author: ABIFORM
Description: Объектілерге арналған жиһаз бен жабдық интернет-дүкені. Web және mobile макеттері бір design.html ішінде: ені 1024px-тен бастап — desktop нұсқа, одан төмен — mobile нұсқа.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: abiform
Tags: one-page, e-commerce, responsive
*/

/* catalog menu: touch (iPad) */
@media (hover: hover) and (pointer: fine) { [data-catbackdrop] { display: none !important; } }
[data-catmenu] [style*="overflow-y"] { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
@media (hover: none) { [data-catmenu] [style*="overflow-y"] { padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important; } }
@media (hover: none) { html:has([data-catbackdrop][style*="block"]), html:has([data-catbackdrop][style*="block"]) body { overflow: hidden !important; overscroll-behavior: none; } }

/* product photos: white background instead of placeholder stripes */
[style*="repeating-linear-gradient"]:has(> img) { background: #ffffff !important; }

/* iPad/iPhone: tap flash off */
html, body, * { -webkit-tap-highlight-color: transparent !important; }
button, a, label, [role="button"], [style*="cursor: pointer"], [style*="cursor:pointer"] { touch-action: manipulation; -webkit-touch-callout: none; }


/* ------------------------------------------------------------------
   Бұл файл тек тема тақырыбы (WordPress оны талап етеді) және
   сыртқы стильдерден қорғайтын бірнеше ереже үшін қажет.
   Дизайнның нақты стилі design.html ішінде — оны бұл жерден өзгертпе.
   ------------------------------------------------------------------ */

html,
body {
	margin: 0;
	padding: 0;
	background: #f5f5f5;
}

/* Плагиндер қосатын жолақтар макетті жылжытпасын */
html {
	margin-top: 0 !important;
}

* html body {
	margin-top: 0 !important;
}

#wpadminbar {
	display: none;
}

/* dc-runtime іске қосылғанша шикі шаблон көрінбесін */
x-dc {
	display: none !important;
}

#abiform-root {
	display: contents;
}

/* Тақырып жүктелгенше жыпылықтамас үшін */
body.abiform-booting {
	visibility: visible;
}

/* WordPress автоматты түрде қосатын сурет стильдері дизайнға әсер етпесін */
#abiform-root img {
	max-width: none;
	height: auto;
}

/* Қолжетімділік: тек скринридерге арналған мәтін */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}


/* Checkout: Город + Улица в одну строку на десктопе, друг под другом на мобильном */
.abf-addr-row{display:flex;gap:12px;align-items:flex-start}
.abf-addr-row > div{flex:1 1 0;min-width:0}
@media (max-width:1023px){
  .abf-addr-row{display:block}
}


/* Hero-блок с картинкой: на мобильном — в одну колонку */
@media (max-width:1023px){
  .abf-hero-2col{grid-template-columns:1fr !important}
  .abf-hero-2col .abf-hero-media{min-height:200px !important;border-radius:16px;overflow:hidden}
}


/* Карточка товара на мобильном: цена всегда в одну строку */
@media (max-width:1023px){
  .abf-price-row{gap:6px !important}
  .abf-price-row > span:first-child{font-size:18px !important}
  .abf-price-row > span:last-child:not(:first-child){font-size:11px !important}
}

/* Карточка товара на мобильном: цена закреплена под названием, кнопка — у нижнего края.
   Так цена не сдвигается при добавлении в корзину. */
@media (max-width:1023px){
  .abf-price-row{margin-top:0 !important}
  .abf-card-ctrl{margin-top:auto !important}
}

/* Поиск: 16px на мобильном, иначе iOS зумит страницу при фокусе */
@media (max-width:1023px){
  .abf-search-input{font-size:16px !important}
}

@media (max-width:1023px){ .abf-search-drop{left:16px !important;right:16px !important;margin-top:-6px !important} }

/* Hero-карточки страниц: белый текст на синем градиенте */
.abf-hero-2col h1,
.abf-hero-2col p { color: #FFFFFF !important; }

/* iOS Safari: өріске басқанда экран жақындап кетпеуі үшін — шрифт 16px-тен кем болмауы керек */
@media (max-width:1023px){
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  textarea,
  select { font-size: 16px !important; }
}
/* =====================================================================
 * ABIFORM · «О компании» жаңа дизайны
 * Мазмұны: WordPress → Страницы → «О компании» (ID 12257, черновик болса да жұмыс істейді).
 * /about ашылғанда ескі блоктың орнына сол беттің мазмұнын шығарады.
 * Өшіру керек болса — осы блокты functions.php-дан алып тастаңыз.
 * ===================================================================== */
add_action( 'wp_footer', function () {
	if ( is_admin() ) {
		return;
	}
	$abx_page = get_post( 12257 );
	if ( ! $abx_page || 'trash' === $abx_page->post_status ) {
		return;
	}
	$abx_html = preg_replace( '~<!--\s*/?wp:html\s*-->~', '', $abx_page->post_content );
	echo '<template id="abx-about-src">' . $abx_html . '</template>'; // phpcs:ignore WordPress.Security.EscapeOutput -- админ жазған HTML.
	?>
<style>
.abx-host>:not(#abx):not(style):not(link){display:none!important}
.abx-host>#abx{position:relative;width:100vw;max-width:100vw;left:50%;margin-left:-50vw}
html{overflow-x:clip}
</style>
<script id="abx-about-mount">
(function(){
	var src=document.getElementById('abx-about-src'); if(!src) return;
	function mount(){
		if(!/^\/about\/?$/.test(location.pathname)||document.getElementById('abx')) return;
		var h=Array.prototype.find.call(document.querySelectorAll('h1'),function(e){return e.textContent.indexOf('казахстанская компания')>-1;});
		if(!h) return;
		var box=h.parentElement; while(box&&box.children.length<10) box=box.parentElement;
		if(!box) return;
		var frag=src.content.cloneNode(true), codes=[];
		Array.prototype.forEach.call(frag.querySelectorAll('script'),function(s){codes.push(s.textContent);s.parentNode.removeChild(s);});
		box.classList.add('abx-host'); box.appendChild(frag);
		codes.forEach(function(c){var s=document.createElement('script');s.textContent=c;box.appendChild(s);});
	}
	var t; new MutationObserver(function(){clearTimeout(t);t=setTimeout(mount,60);}).observe(document.body,{childList:true,subtree:true});
	window.addEventListener('popstate',mount);
	mount();
})();
</script>
	<?php
}, 99 );