<?php
	$top_footer = get_field('top_footer_box', 'option');
	$footer = get_field('footer_box', 'option');

	$page_id   = get_the_ID();
	$page_type = get_post_type( $page_id );

	$top_footer_head = '';
	$top_footer_text = '';
	$top_footer_link = '';

	if(get_the_ID() == 25) {
		$top_footer_head = $top_footer['home_page']['title'];
		$top_footer_text = $top_footer['home_page']['text'];
		$top_footer_link = $top_footer['home_page']['btn'];
	} else if(get_the_ID() == 38) {
		$top_footer_head = $top_footer['about_office']['title'];
		$top_footer_text = $top_footer['about_office']['text'];
		$top_footer_link = $top_footer['about_office']['btn'];
	} else if(get_the_ID() == 47) {
		$top_footer_head = $top_footer['team']['title'];
		$top_footer_text = $top_footer['team']['text'];
		$top_footer_link = $top_footer['team']['btn'];
	} else if(get_the_ID() == 54) {
		$top_footer_head = $top_footer['services']['title'];
		$top_footer_text = $top_footer['services']['text'];
		$top_footer_link = $top_footer['services']['btn'];
	} else if(get_queried_object_id() == 473) {
		$top_footer_head = $top_footer['kariera']['title'];
		$top_footer_text = $top_footer['kariera']['text'];
		$top_footer_link = $top_footer['kariera']['btn'];
	} else if($page_type == 'post') {
		$top_footer_head = $top_footer['blog']['title'];
		$top_footer_text = $top_footer['blog']['text'];
		$top_footer_link = $top_footer['blog']['btn'];
	}
?>

	<footer id="site-footer" class="site-footer">
		<div class="container">
			<?php if ( !empty($top_footer_head) || !empty($top_footer_text) || !empty($top_footer_link) ): ?>
				<div class="footer-1">
					<div class="row">
						<div class="col col-1">
							<img src="/wp-content/uploads/2025/08/logo_small_white.svg" alt="">
							<h2><?php echo esc_html($top_footer_head); ?></h2>
							<p><?php echo esc_html($top_footer_text); ?></p>
							<a class="btn_2" href="<?php echo esc_url($top_footer_link['url']); ?>" target="<?php echo esc_attr($top_footer_link['target'] ?: '_self'); ?>">
								<?php echo esc_html($top_footer_link['title']); ?>
							</a>
						</div>
						<div class="col col-2">
							<img src="/wp-content/uploads/2025/08/footer-img.png" alt="">
						</div>
					</div>
				</div>
			<?php endif; ?>
			<div class="footer-2">
				<div class="row">
					<div class="col col-1">
						<p><?php echo esc_html($footer['col_1']['title']); ?></p>
						<a href="<?php echo esc_url($footer['col_1']['btn']['url']); ?>" target="<?php echo esc_attr($footer['col_1']['btn']['target'] ?: '_self'); ?>">
							<?php echo esc_html($footer['col_1']['btn']['title']); ?>
						</a>
						<a href="<?php echo esc_url($footer['col_1']['btn_2']['url']); ?>" target="<?php echo esc_attr($footer['col_1']['btn_2']['target'] ?: '_self'); ?>">
							<?php echo esc_html($footer['col_1']['btn_2']['title']); ?>
						</a>
					</div>
					<div class="col col-2">
						<ol>
							<li>
								<?php echo wp_kses_post($footer['col_2']['text']); ?>
							</li>
							<li>
								<?php echo wp_kses_post($footer['col_3']['text']); ?>
							</li>
							<li>
								<?php echo wp_kses_post($footer['col_4']['text']); ?>
							</li>
						</ol>
					</div>
					<div class="col col-3">
						<a href="<?php echo esc_url($footer['col_1']['btn']['url']); ?>" target="<?php echo esc_attr($footer['col_1']['btn']['target'] ?: '_self'); ?>">
							<?php echo esc_html($footer['col_1']['btn']['title']); ?>
						</a>
					</div>
				</div>
			</div>
		</div>
	</footer>
</div><!-- #page -->

<?php wp_footer(); ?>

</body>
</html>
