<?php
require_once __DIR__ . '/config.php';

$pageTitle       = "Karot ve Karotçu Hizmetleri | İstanbul - " . SITE_NAME;
$metaDescription = "Tüm karot ve karotçu hizmetleri: beton karot, beton delme, beton kesme, duvar karot, klima ve tesisat karotu, karot fiyatları. İstanbul. " . PHONE_FORMATTED;
$currentPage     = "hizmetler";
$canonicalUrl    = canonicalUrl('/hizmetler');
$ogImage         = defaultOgImage();
// Not: Bu sayfanin hero'su gradient+metin; gorsel YOK. Bu yuzden $heroImage set edilmez (gereksiz preload onlenir).

// Hizmet siralamasi
$serviceSlugs = ['beton-karot','beton-delme','beton-kesme','duvar-karot','klima-karot','tesisat-karot','karot-fiyatlari'];
$services = [];
foreach ($serviceSlugs as $s) {
    $f = __DIR__ . '/data/hizmetler/' . $s . '.json';
    if (file_exists($f)) {
        $data = json_decode((string)file_get_contents($f), true);
        if (is_array($data)) $services[] = $data;
    }
}

include __DIR__ . '/inc/header.php';
?>

<main>
    <div class="border-b" style="background: var(--color-concrete); border-color: var(--color-line);">
        <div class="container mx-auto px-4 py-3">
            <nav class="text-sm" aria-label="Breadcrumb">
                <a href="/" class="hover:underline" style="color: var(--color-cta);">Ana Sayfa</a>
                <span class="mx-2 text-gray-400">/</span>
                <span class="text-gray-700">Hizmetler</span>
            </nav>
        </div>
    </div>

    <section style="background: linear-gradient(180deg, #0f1f3a 0%, #1f2a44 100%); color:#fff;">
        <div class="container mx-auto px-4 py-14 md:py-16">
            <h1 class="text-3xl md:text-5xl font-extrabold mb-3">Karot Hizmetlerimiz</h1>
            <p class="text-gray-200 text-lg max-w-3xl">Beton karot delme, beton kesme, duvar karotu, klima ve tesisat geçişleri.
                Su soğutmalı makineler, iş güvenliği önlemleri ve net yazılı teklif ile İstanbul geneli.</p>
            <div class="mt-7 flex flex-col sm:flex-row gap-3">
                <a href="tel:<?php echo e(PHONE_TEL); ?>" class="font-bold py-3 px-6 rounded-md text-white" style="background-color: var(--color-cta);">
                    Ara: <?php echo e(PHONE_FORMATTED); ?>
                </a>
                <a href="/karot-fiyatlari" class="bg-white/10 hover:bg-white/15 border border-white/20 font-semibold py-3 px-6 rounded-md">
                    Karot Fiyatları
                </a>
            </div>
        </div>
    </section>

    <section class="py-14 bg-white">
        <div class="container mx-auto px-4">
            <?php
            // Slug -> görsel/alt eslemesi (gercek dosya boyutlari)
            $hubImageMap = [
                'beton-karot'      => ['/images/karot-makinesi-beton-delme.jpg', 'Karot makinesi ile beton delme uygulaması',     1600, 1200],
                'beton-delme'      => ['/images/karot-makinesi-uygulama.jpg',    'Karot makinesi ile beton delme uygulaması',     1200,  900],
                'beton-kesme'      => ['/images/beton-kesme-elmas-testere.jpg',  'Elmas testere ile beton kesme uygulaması',      1200,  803],
                'duvar-karot'      => ['/images/hilti-karot-makinesi.jpg',       'El tutmalı karot makinesi ile duvar delme',     1200, 1600],
                'klima-karot'      => ['/images/hilti-karot-makinesi.jpg',       'Klima geçişi için karot makinesi ile delme',    1200, 1600],
                'tesisat-karot'    => ['/images/karot-makinesi-uygulama.jpg',    'Tesisat geçişi için karot uygulaması',          1200,  900],
                'karot-fiyatlari'  => ['/images/elmas-karot-ucu.jpg',            'Elmas karot ucu yakın çekim',                    1200,  894],
            ];
            ?>
            <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
                <?php foreach ($services as $s):
                    $img = $hubImageMap[$s['slug']] ?? ['/images/karot-makinesi-beton-delme.jpg', 'Karot uygulaması', 1600, 1200];
                ?>
                <article class="border rounded-lg overflow-hidden hover:border-orange-500 hover:shadow transition flex flex-col" style="border-color: var(--color-line);">
                    <a href="/<?php echo e($s['slug']); ?>" class="block aspect-[16/10] overflow-hidden bg-gray-100">
                        <img src="<?php echo e($img[0]); ?>"
                             alt="<?php echo e($img[1]); ?>"
                             width="<?php echo e((int)$img[2]); ?>" height="<?php echo e((int)$img[3]); ?>"
                             loading="lazy" decoding="async"
                             style="width:100%;height:100%;object-fit:cover;display:block;">
                    </a>
                    <div class="p-6 flex-1 flex flex-col">
                        <h2 class="text-xl font-bold mb-2" style="color: var(--color-ink);">
                            <a href="/<?php echo e($s['slug']); ?>" class="hover:underline"><?php echo e($s['name']); ?></a>
                        </h2>
                        <p class="text-gray-600 mb-4 text-[15px]"><?php echo e($s['hero']['subtitle']); ?></p>
                        <a href="/<?php echo e($s['slug']); ?>" class="mt-auto inline-flex items-center gap-1 text-sm font-semibold" style="color: var(--color-cta);">
                            Detay &rarr;
                        </a>
                    </div>
                </article>
                <?php endforeach; ?>
            </div>
        </div>
    </section>

    <section class="py-14" style="background: var(--color-concrete);">
        <div class="container mx-auto px-4">
            <div class="max-w-3xl mb-8">
                <h2 class="text-2xl md:text-3xl font-extrabold mb-3" style="color: var(--color-ink);">Tüm Hizmetlerde Ortak Standartlarımız</h2>
                <p class="text-gray-600">Hangi hizmeti alıyor olursanız olun, sahada aynı disiplinli süreci uyguluyoruz.</p>
            </div>
            <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-5">
                <?php
                $std = [
                    ['Su Soğutmalı Uygulama','Tozsuz, titreşimsiz, betonu çatlatmadan kesim.'],
                    ['İş Güvenliği Önlemleri','KKD, saha güvenliği ve sorumluluk bilinci.'],
                    ['Yazılı Teklif','Keşif sonrası net fiyat; gizli maliyet yok.'],
                    ['Kentsel Dönüşüm Uygunluğu','Statik kontrolle uyumlu, planlı karot delme.'],
                ];
                foreach ($std as $s): ?>
                <div class="bg-white border rounded-lg p-5" style="border-color: var(--color-line);">
                    <h3 class="font-bold mb-1" style="color: var(--color-ink);"><?php echo e($s[0]); ?></h3>
                    <p class="text-sm text-gray-600"><?php echo e($s[1]); ?></p>
                </div>
                <?php endforeach; ?>
            </div>
        </div>
    </section>

    <section class="py-14" style="background: var(--color-cta); color:#fff;">
        <div class="container mx-auto px-4 text-center">
            <h2 class="text-2xl md:text-3xl font-extrabold mb-3">Projenizi Birlikte Planlayalım</h2>
            <p class="text-lg mb-6">Telefonda kısaca anlatın; İstanbul içi ücretsiz keşif yapalım.</p>
            <div class="flex flex-col sm:flex-row gap-3 justify-center">
                <a href="tel:<?php echo e(PHONE_TEL); ?>" class="bg-white font-bold py-3 px-6 rounded-md" style="color: var(--color-ink);">
                    Ara: <?php echo e(PHONE_FORMATTED); ?>
                </a>
                <a href="mailto:<?php echo e(EMAIL); ?>" class="bg-white/10 hover:bg-white/15 border border-white/30 font-semibold py-3 px-6 rounded-md">
                    E-posta: <?php echo e(EMAIL); ?>
                </a>
            </div>
        </div>
    </section>
</main>

<?php
$breadcrumb = [
    '@type' => 'BreadcrumbList',
    'itemListElement' => [
        [ '@type' => 'ListItem', 'position' => 1, 'name' => 'Ana Sayfa', 'item' => SITE_URL . '/' ],
        [ '@type' => 'ListItem', 'position' => 2, 'name' => 'Hizmetler', 'item' => $canonicalUrl ],
    ],
];

$itemList = [
    '@type' => 'ItemList',
    'itemListElement' => [],
];
$pos = 1;
foreach ($services as $s) {
    $itemList['itemListElement'][] = [
        '@type' => 'ListItem',
        'position' => $pos++,
        'url'  => SITE_URL . '/' . $s['slug'],
        'name' => $s['name'],
    ];
}

echo renderJsonLd([
    '@context' => 'https://schema.org',
    '@graph' => [
        $breadcrumb,
        [
            '@type' => 'WebPage',
            '@id'   => $canonicalUrl,
            'url'   => $canonicalUrl,
            'name'  => $pageTitle,
            'description' => $metaDescription,
            'inLanguage'  => 'tr-TR',
            'mainEntity'  => $itemList,
        ],
        [
            '@type' => 'Organization',
            '@id'   => organizationId(),
            'name'  => SITE_NAME,
            'url'   => SITE_URL,
            'logo'  => SITE_URL . '/images/favicon.svg',
            'telephone' => PHONE_TEL,
            'email'     => EMAIL,
        ],
    ],
]);

include __DIR__ . '/inc/footer.php';
