<?php

include_once('include/head.php');
include_once('include/purepower-data.php');

$category = $purepower['categories']['home'];

?>

<body>

<div class="main-page-wrapper">

<?php include_once('include/header.php'); ?>

<link rel="stylesheet" href="<?php path(); ?>/assets/css/purepower.css">

<main>

<div class="page-title-area text-center pt-100 pb-100 pt-lg-130 pb-lg-130"
    data-background="assets/img/background/residential-banner.webp">

    <div class="container">

        <span class="purepower-label">
            <?= htmlspecialchars($category['label']); ?>
        </span>

        <h2 class="page-title mb-15">
            <?= htmlspecialchars($category['title']); ?>
        </h2>

        <p class="purepower-page-subtitle">
            <?= htmlspecialchars($category['subtitle']); ?>
        </p>

    </div>

</div>

<section class="service-details-section pt-120 pt-lg-80 pb-100">

<div class="container">

    <div class="row align-items-center mb-100">

        <div class="col-lg-6">

            <div class="purepower-content">

                <span class="section-subtitle">
                    PuREPower Residential
                </span>

                <h1>
                    <?= htmlspecialchars($category['subtitle']); ?>
                </h1>

                <p>
                    <?= htmlspecialchars($category['description']); ?>
                </p>

                <a href="<?php path(); ?>/contact-us.php" class="btn btn-brand">
                    Enquire Now
                    <i class="bi bi-arrow-right"></i>
                </a>

            </div>

        </div>

        <div class="col-lg-6">

            <div class="purepower-main-image">

                <img src="<?php path(); ?>/<?= htmlspecialchars($category['image']); ?>"
                     alt="<?= htmlspecialchars($category['title']); ?>">

            </div>

        </div>

    </div>

    <div class="section-title text-center mb-60">

        <span class="section-subtitle">
            Residential Product Range
        </span>

        <h2>
            PuREPower Home Solutions
        </h2>

        <p>
            Explore advanced PuREPower Home energy storage systems designed
            for different residential power and backup requirements.
        </p>

    </div>

    <div class="row">

        <?php foreach ($category['products'] as $slug): ?>

            <?php

            if (!isset($purepower['products'][$slug])) {
                continue;
            }

            $product = $purepower['products'][$slug];

            ?>

            <div class="col-lg-4 col-md-6 mb-40">

                <div class="purepower-product-card">

                    <div class="product-image">

                        <img src="<?php path(); ?>/<?= htmlspecialchars($product['image']); ?>"
                             alt="<?= htmlspecialchars($product['name']); ?>">

                    </div>

                    <div class="product-content">

                        <span class="product-category">
                            PuREPower Home
                        </span>

                        <h3>
                            <?= htmlspecialchars($product['name']); ?>
                        </h3>

                        <div class="product-specs">

                            <?php if (!empty($product['rated_power'])): ?>

                                <div class="product-spec">

                                    <span>Rated Power</span>

                                    <strong>
                                        <?= htmlspecialchars($product['rated_power']); ?>
                                    </strong>

                                </div>

                            <?php endif; ?>

                            <?php if (!empty($product['capacity'])): ?>

                                <div class="product-spec">

                                    <span>Battery Capacity</span>

                                    <strong>
                                        <?= htmlspecialchars($product['capacity']); ?>
                                    </strong>

                                </div>

                            <?php endif; ?>

                            <?php if (!empty($product['key_specifications']['Backup time'])): ?>

                                <div class="product-spec">

                                    <span>Backup Time</span>

                                    <strong>
                                        <?= htmlspecialchars($product['key_specifications']['Backup time']); ?>
                                    </strong>

                                </div>

                            <?php endif; ?>

                        </div>

                        <p>
                            <?= htmlspecialchars($product['short_description']); ?>
                        </p>

                        <?php if (!empty($product['features'])): ?>

                            <div class="product-features">

                                <?php foreach (array_slice($product['features'], 0, 3) as $feature): ?>

                                    <span>
                                        <i class="bi bi-check2"></i>
                                        <?= htmlspecialchars($feature); ?>
                                    </span>

                                <?php endforeach; ?>

                            </div>

                        <?php endif; ?>

                        <a class="product-button"
                           href="<?php path(); ?>/purepower-product/<?= htmlspecialchars($slug); ?>">

                            Explore Product

                            <i class="bi bi-arrow-right"></i>

                        </a>

                    </div>

                </div>

            </div>

        <?php endforeach; ?>

    </div>

</div>

</section>

</main>

<?php include_once('include/footer.php'); ?>

</div>

</body>
</html>