<?php
$settings = json_decode(file_get_contents('data/settings.json'), true);
$content = json_decode(file_get_contents('data/content.json'), true);
$projects = json_decode(file_get_contents('data/projects.json'), true);
// Get top 3 featured projects
$featured_projects = array_slice($projects, 0, 3);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo htmlspecialchars($settings['site_title']); ?> - Ultra Premium Real Estate</title>
    <meta name="description" content="<?php echo htmlspecialchars($settings['site_title']); ?> crafts exquisite residential and commercial spaces blending architectural brilliance with modern design. Discover luxury living.">
    <meta name="keywords" content="Real Estate, Luxury Homes, Commercial Spaces, Property Development, Premium Real Estate">
    
    <!-- Open Graph / Social Media -->
    <meta property="og:type" content="website">
    <meta property="og:title" content="<?php echo htmlspecialchars($settings['site_title']); ?> - Premium Real Estate Development">
    <meta property="og:image" content="<?php echo $settings['logo_url']; ?>">

    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <!-- Custom CSS -->
    <link rel="stylesheet" href="css/style.css">
    
    <style>
        /* Specific styles for Home Page */
        .hero {
            height: 100vh;
            min-height: 800px;
            background: linear-gradient(rgba(17, 17, 17, 0.4), rgba(17, 17, 17, 0.7)), url('images/hero.png') center/cover no-repeat;
            display: flex;
            align-items: center;
            color: var(--text-white);
            position: relative;
        }
        
        .hero-content {
            max-width: 1000px;
            z-index: 2;
        }
        
        .hero-title {
            font-size: 5.5rem;
            color: var(--text-white);
            margin-bottom: 25px;
            animation: fadeUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
            line-height: 1.05;
            text-transform: uppercase;
        }
        
        .hero-subtitle {
            font-size: 1.4rem;
            margin-bottom: 50px;
            color: rgba(255,255,255,0.9);
            animation: fadeUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s forwards;
            opacity: 0;
            font-weight: 300;
            max-width: 700px;
        }
        
        .hero-btn {
            animation: fadeUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s forwards;
            opacity: 0;
        }
        
        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(40px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        /* Values Section */
        .values-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
        .value-card {
            padding: 20px;
        }
        .value-icon { font-size: 3rem; color: var(--accent); margin-bottom: 25px; display: block; }
        
        /* Featured Projects Styles */
        .featured-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 50px; }
        .featured-card { background: var(--bg-light); border: 1px solid var(--border); transition: var(--transition); }
        .featured-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.08); border-color: var(--accent); }
        .featured-img { height: 250px; width: 100%; object-fit: cover; }
        .featured-info { padding: 30px; }
        
        @media (max-width: 768px) {
            .hero-title { font-size: 3.5rem; }
            .values-grid { grid-template-columns: 1fr; }
            .overlap-box { margin-top: -50px; padding: 30px; }
        }
    </style>
</head>
<body>

<?php include 'header.php'; ?>

    <!-- Hero Section -->
    <section class="hero">
        <div class="container">
            <div class="hero-content">
                <h1 class="hero-title"><?php echo htmlspecialchars($content['home_hero_title']); ?></h1>
                <p class="hero-subtitle"><?php echo htmlspecialchars($content['home_hero_subtitle']); ?></p>
                <div class="hero-btn">
                    <a href="projects.php" class="btn btn-primary">Discover Projects</a>
                </div>
            </div>
        </div>
    </section>

    <!-- Values Section (Overlapping) -->
    <section class="section section-bg" style="padding-top: 0; background: transparent; padding-bottom: 80px;">
        <div class="container">
            <div class="overlap-box fade-up">
                <div class="text-center">
                    <h4 style="color: var(--accent); margin-bottom: 15px; font-family: var(--font-heading); letter-spacing: 3px; font-size: 1rem; text-transform: uppercase;">Excellence in</h4>
                    <h2 class="section-title center">Our Core Principles</h2>
                </div>
                
                <div class="values-grid">
                    <div class="value-card">
                        <i class="fas fa-building value-icon"></i>
                        <h3 style="font-size: 1.8rem; margin-bottom: 15px;">Quality Construction</h3>
                        <p style="color: var(--text-light);">We deliver exceptional construction using first-rate materials and innovative techniques. Every project is built with precision and care, ensuring unmatched durability, stunning aesthetics, and spaces that exceed expectations and endure over time.</p>
                    </div>
                    
                    <div class="value-card">
                        <i class="fas fa-clock value-icon"></i>
                        <h3 style="font-size: 1.8rem; margin-bottom: 15px;">Timely Completion</h3>
                        <p style="color: var(--text-light);">We guarantee on-schedule completion, respecting your timelines without compromise. Projects are executed with careful planning and efficiency, giving you a smooth, hassle-free experience as you prepare to step into your perfectly completed space.</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- About Overview -->
    <section class="section" style="padding-top: 50px;">
        <div class="container">
            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center;">
                <div class="fade-up">
                    <h4 style="color: var(--accent); margin-bottom: 15px; font-family: var(--font-heading); letter-spacing: 3px; font-size: 1rem; text-transform: uppercase;">Who We Are</h4>
                    <h2 class="section-title"><?php echo htmlspecialchars($content['about_title']); ?></h2>
                    <p style="font-size: 1.1rem; color: var(--text-light); margin-bottom: 30px; line-height: 1.8;">
                        <?php echo htmlspecialchars(substr($content['about_p1'], 0, 200)) . '...'; ?>
                    </p>
                    <a href="about.php" class="btn btn-outline">Read Our Full Story</a>
                </div>
                <div class="fade-up" style="position: relative;">
                    <div style="position: absolute; top: 20px; left: -20px; width: 100%; height: 100%; border: 2px solid var(--accent); z-index: -1;"></div>
                    <img src="images/hero.png" alt="About Land Vista" style="width: 100%; height: 400px; object-fit: cover; box-shadow: 0 20px 50px rgba(0,0,0,0.1);">
                </div>
            </div>
        </div>
    </section>

    <!-- Featured Projects -->
    <section class="section section-bg">
        <div class="container">
            <div style="display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px;" class="fade-up">
                <div>
                    <h4 style="color: var(--accent); margin-bottom: 15px; font-family: var(--font-heading); letter-spacing: 3px; font-size: 1rem; text-transform: uppercase;">Our Portfolio</h4>
                    <h2 class="section-title" style="margin-bottom: 0;">Featured Projects</h2>
                </div>
                <a href="projects.php" class="btn btn-outline" style="display: none; /* Hide on mobile initially */">View All Projects</a>
            </div>
            
            <div class="featured-grid">
                <?php foreach($featured_projects as $index => $project): 
                    $delay = $index * 0.15;
                ?>
                <div class="featured-card fade-up" style="transition-delay: <?php echo $delay; ?>s;">
                    <img src="<?php echo htmlspecialchars($project['image']); ?>" alt="<?php echo htmlspecialchars($project['title']); ?>" class="featured-img">
                    <div class="featured-info">
                        <span style="color: var(--accent); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; display: block; margin-bottom: 10px;"><?php echo htmlspecialchars($project['status']); ?></span>
                        <h3 style="font-size: 1.5rem; margin-bottom: 10px; text-transform: none;"><?php echo htmlspecialchars($project['title']); ?></h3>
                        <p style="color: var(--text-light); font-size: 0.9rem; margin-bottom: 20px;"><i class="fas fa-map-marker-alt" style="color: var(--accent); margin-right: 8px;"></i><?php echo htmlspecialchars($project['location']); ?></p>
                        <a href="project-details.php?id=<?php echo $project['id']; ?>" style="color: var(--primary); font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; display: inline-flex; align-items: center; text-decoration: none;">Explore <i class="fas fa-arrow-right" style="margin-left: 8px; color: var(--accent);"></i></a>
                    </div>
                </div>
                <?php endforeach; ?>
            </div>
            
            <div style="text-align: center; margin-top: 50px;" class="fade-up">
                <a href="projects.php" class="btn btn-primary">Discover All Projects</a>
            </div>
        </div>
    </section>
    
    <!-- CTA Section -->
    <section class="cta-section">
        <div class="container fade-up">
            <h2 class="cta-title">Ready to Find Your Dream Property?</h2>
            <p class="cta-desc">Get in touch with our expert real estate consultants today and let us guide you toward your perfect residential or commercial space.</p>
            <a href="contact.php" class="btn btn-primary">Contact Us Now</a>
        </div>
    </section>

<?php include 'footer.php'; ?>
