<?php
    /**
     * Page: Zespół BRPP
     */

    get_header();

    $title = get_field('title');
    $list_specialists = get_field('list_specialists');
?>
	<main id="primary" class="site-main">
        <div class="box-0">
            <?php get_template_part('inc/breadcrumb');?>
        </div>

        <div class="box-1">
            <div class="container">
                <div class="row">
                    <div class="col col-1">
                        <div class="box-head">
                            <h2><?php echo esc_html($title); ?></h2>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-2">
            <div class="container">
                <div class="row">
                    <div class="tiles">
                        <?php foreach ($list_specialists as $item) : ?>
                            <div class="tile">
                                <div class="tile--wrapper">
                                    <div class="tile--img">
                                        <img src="<?php echo esc_url($item['image']); ?>" alt="">

                                        <button class="tile--btn">
                                            <img src="/wp-content/uploads/2025/08/plus-icon.svg" alt="">
                                        </button>
                                    </div>
                                    <div class="tile--data">
                                        <h3><?php echo esc_html($item['name']); ?></h3>
                                        <p><?php echo esc_html($item['position']); ?></p>
                                    </div>
                                </div>

                                <div class="tile-sidebar">
                                    <div class="tile-sidebar-bg"></div>
                                    <div class="tile-sidebar--wrapper">
                                        <button class="tile--btn">
                                            <img src="/wp-content/uploads/2025/08/plus-icon.svg" alt="">
                                        </button>

                                        <div class="tile--img">
                                            <img src="<?php echo esc_url($item['more_info']['image']); ?>" alt="">
                                        </div>
                                        <div class="tile--data">
                                            <div class="tile--data-head">
                                                <h3><?php echo esc_html($item['name']); ?></h3>
                                                <p><?php echo esc_html($item['position']); ?></p>
                                            </div>
                                            <ul class="tile--data-contact">
                                                <?php foreach ($item['more_info']['emails'] as $key => $e_item) : ?>
                                                    <li>
                                                        <?php if ($key === 0): ?>
                                                            <label>E-mail:</label>
                                                        <?php endif; ?>
                                                        <a href="mailto:<?php echo esc_html($e_item['email']); ?>"><?php echo esc_html($e_item['email']); ?></a>
                                                    </li>
                                                <?php endforeach; ?>
                                                <?php foreach ($item['more_info']['phones'] as $key => $p_item) : ?>
                                                    <li>
                                                        <?php if ($key === 0): ?>
                                                            <label>Telefon:</label>
                                                        <?php endif; ?>
                                                        <a href="tel:<?php echo esc_html($p_item['phone']); ?>"><?php echo esc_html($p_item['phone']); ?></a>
                                                    </li>
                                                <?php endforeach; ?>
                                            </ul>
                                            <div class="tile--data-text">
                                                <div class="text-1">
                                                    <?php echo wp_kses_post($item['more_info']['description_1']); ?>
                                                </div>
                                                <div class="text-2">
                                                    <?php echo wp_kses_post($item['more_info']['description_2']); ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
            </div>
        </div>
    </main>
<?php
get_footer();
