<?php
// includes/seo.php — uso: $seo = ['title'=>..., 'description'=>..., 'path'=>'/productos.php', 'noindex'=>false];
$seo = $seo ?? [];
$title = $seo['title'] ?? 'Enersys Perú | Computadoras, laptops y componentes';
$desc  = $seo['description'] ?? '';
$path  = $seo['path'] ?? '/';
$canonical = rtrim(SITE_URL, '/') . $path;
$ogImage   = rtrim(SITE_URL, '/') . '/assets/img/og/enersys-og.jpg'; // crear: 1200x630
$robots    = !empty($seo['noindex']) ? 'noindex, follow' : 'index, follow, max-image-preview:large';
?>
<title><?= htmlspecialchars($title) ?></title>
<meta name="description" content="<?= htmlspecialchars($desc) ?>">
<meta name="robots" content="<?= $robots ?>">
<link rel="canonical" href="<?= htmlspecialchars($canonical) ?>">

<meta property="og:type" content="website">
<meta property="og:locale" content="es_PE">
<meta property="og:site_name" content="Enersys Perú">
<meta property="og:title" content="<?= htmlspecialchars($title) ?>">
<meta property="og:description" content="<?= htmlspecialchars($desc) ?>">
<meta property="og:url" content="<?= htmlspecialchars($canonical) ?>">
<meta property="og:image" content="<?= htmlspecialchars($ogImage) ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="theme-color" content="#2F363F">

<script type="application/ld+json">
<?= json_encode([
  '@context' => 'https://schema.org',
  '@type'    => 'Organization',
  'name'     => 'Enersys Perú SAC',
  'url'      => rtrim(SITE_URL, '/') . '/',
  'logo'     => rtrim(SITE_URL, '/') . '/assets/img/logo/enersys-logo-vertical.png',
  'email'    => 'ventas@enersysperu.com',
  'contactPoint' => [[
    '@type' => 'ContactPoint',
    'telephone' => '+51-996-474-484',
    'contactType' => 'sales',
    'areaServed' => 'PE',
    'availableLanguage' => 'es'
  ]]
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
</script>