<?php
$home_content = $home_content ?? [];

$home_hero = $home_content['hero'] ?? [
    'eyebrow' => 'WHO-GMP Certified',
    'title' => 'Sterile Injectable Manufacturing',
    'highlight' => 'Built on Quality, Precision, and Trust',
    'description' => 'Sanjar Pharma LLP is a WHO-GMP certified pharmaceutical manufacturer in India specializing in Dry Powder Injections, Liquid Vial Injections, Ampoule Injections, PFS Injections, Suspension Injections, and Eye/Ear Drops for domestic and international markets.',
    'primary_button_text' => 'Our Products',
    'primary_button_url' => $base_url . '/products',
    'secondary_button_text' => 'Download Brochure',
    'secondary_button_url' => $base_url . '/assets/pdf/sanjar-pharma-company-profile.pdf',
    'background' => [
        'desktop_light' => $base_url . '/assets/images/main/hom/ge/home-l.webp',
        'desktop_dark'  => $base_url . '/assets/images/main/hom/ge/home-d.webp',
        'mobile_light'  => $base_url . '/assets/images/main/hom/ge/home-m-l.webp',
        'mobile_dark'   => $base_url . '/assets/images/main/hom/ge/home-m-d.webp'
    ]
];

$about_home = $home_content['about'] ?? [
    'eyebrow' => 'About Sanjar Pharma LLP',
    'title' => 'Your Global Partner in',
    'highlight' => 'Sterile Injectable',
    'title_after' => 'Manufacturing',
    'description_1' => 'Operating with WHO, GLP, GMP and ISO certifications, Sanjar Pharma LLP has established itself as a quality-focused Small Volume Parenteral injectable manufacturer. 
    Our facility in Himatnagar, Gujarat is engineered to meet national and international pharmaceutical demands with strict quality and compliance.',
    'description_2' => 'Sanjar Pharma manufacture pharmaceutical formulations across multiple therapeutic segments while maintaining a strong focus on patient safety, product consistency, and regulatory compliance. Our operations are supported by advanced production systems, controlled environments, qualified professionals, and strict compliance with global manufacturing standards.',
    'button_text' => 'Know More About Us',
    'button_url' => $base_url . '/about',
    'image' => [
        'desktop_light' => $base_url . '/assets/images/main/hom/home-light.webp',
        'desktop_dark'  => $base_url . '/assets/images/main/hom/home-dark.webp',
        'mobile_light'  => $base_url . '/assets/images/main/hom/home-light.webp',
        'mobile_dark'   => $base_url . '/assets/images/main/hom/home-dark.webp'
    ]
];

$stats = $home_content['stats'] ?? [
    ['value' => 15, 'suffix' => '+', 'label' => 'Years of Excellence', 'sub' => 'Since 2016'],
    ['value' => 150, 'suffix' => '+', 'label' => 'Skilled Professionals', 'sub' => 'Dedicated Experts'],
    ['value' => 50, 'suffix' => '+', 'label' => 'Annual Capacity', 'sub' => 'High-Quality Output'],
    ['value' => 98, 'suffix' => '+', 'label' => 'Export Markets', 'sub' => 'Trusted Worldwide']
];

$features = $home_content['features'] ?? [
    ['title' => 'WHO-GMP Certified', 'desc' => 'Compliant with international pharmaceutical quality standards.'],
    ['title' => 'Advanced R&D', 'desc' => 'Continuous product development for better healthcare outcomes.'],
    ['title' => 'Modern Facility', 'desc' => 'Technology-backed infrastructure for sterile injectable manufacturing.'],
    ['title' => 'Quality Control', 'desc' => 'Robust quality checks across every stage of production.'],
    ['title' => 'Global Presence', 'desc' => 'Reliable export support across international healthcare markets.'],
    ['title' => 'Long-Term Commitment', 'desc' => 'Focused on dependable supply, service and customer confidence.']
];



$ticker_items = !empty($home_therapeutics)
    ? array_merge($home_therapeutics, $home_therapeutics)
    : [];
?>

<link rel="preload" as="image" href="<?= htmlspecialchars($home_hero['background']['desktop_light'], ENT_QUOTES, 'UTF-8') ?>" media="(min-width: 992px)" fetchpriority="high">
<link rel="preload" as="image" href="<?= htmlspecialchars($home_hero['background']['mobile_light'], ENT_QUOTES, 'UTF-8') ?>" media="(max-width: 991px)" fetchpriority="high">

<section class="home-hero lazy-theme-bg"
    aria-labelledby="homeHeroTitle"
    data-theme-asset="background"
    data-desktop-light="<?= htmlspecialchars($home_hero['background']['desktop_light'], ENT_QUOTES, 'UTF-8') ?>"
    data-desktop-dark="<?= htmlspecialchars($home_hero['background']['desktop_dark'], ENT_QUOTES, 'UTF-8') ?>"
    data-mobile-light="<?= htmlspecialchars($home_hero['background']['mobile_light'], ENT_QUOTES, 'UTF-8') ?>"
    data-mobile-dark="<?= htmlspecialchars($home_hero['background']['mobile_dark'], ENT_QUOTES, 'UTF-8') ?>"
>
    <div class="site-container home-hero-inner">
        <div class="home-hero-content">
            <span class="pill badge-brand">
                <?= htmlspecialchars($home_hero['eyebrow'], ENT_QUOTES, 'UTF-8') ?>
            </span>

            <h1 id="homeHeroTitle">
                <?= htmlspecialchars($home_hero['title'], ENT_QUOTES, 'UTF-8') ?><br>
                <span><?= htmlspecialchars($home_hero['highlight'], ENT_QUOTES, 'UTF-8') ?></span>
            </h1>

            <p>
                <?= htmlspecialchars($home_hero['description'], ENT_QUOTES, 'UTF-8') ?>
            </p>

            <div class="hero-actions">
                <a href="<?= htmlspecialchars($home_hero['primary_button_url'], ENT_QUOTES, 'UTF-8') ?>" class="primary-button">
                    <?= htmlspecialchars($home_hero['primary_button_text'], ENT_QUOTES, 'UTF-8') ?>
                    <svg class="btn-icon" viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M13.2 5.3 20 12l-6.8 6.7-1.4-1.4 4.4-4.3H4v-2h12.2l-4.4-4.3 1.4-1.4Z"/>
                    </svg>
                </a>

                <a href="<?= htmlspecialchars($home_hero['secondary_button_url'], ENT_QUOTES, 'UTF-8') ?>" class="secondary-button">
                    <?= htmlspecialchars($home_hero['secondary_button_text'], ENT_QUOTES, 'UTF-8') ?>
                    <svg class="btn-icon" viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M11 4h2v8.2l3.3-3.3 1.4 1.4L12 16l-5.7-5.7 1.4-1.4 3.3 3.3V4ZM5 18h14v2H5v-2Z"/>
                    </svg>
                </a>
            </div>

            <div class="hero-cert-row" aria-label="Sanjar Pharma certifications">
                <?php foreach ($certifications as $cert): ?>
                    <div class="hero-cert">
                        <img
                            src="<?= htmlspecialchars($cert['image'], ENT_QUOTES, 'UTF-8') ?>"
                            width="48"
                            height="48"
                            alt="<?= htmlspecialchars($cert['name'], ENT_QUOTES, 'UTF-8') ?>"
                            loading="eager"
                            decoding="async"
                        >
                        <span><?= htmlspecialchars($cert['label'], ENT_QUOTES, 'UTF-8') ?></span>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
</section>

<section class="stats-section section-sm" aria-label="Sanjar Pharma company statistics">
    <div class="site-container">
        <div class="stats-grid card">
            <?php foreach ($stats as $stat): ?>
                <article class="stat-card">
                    <strong>
                        <span class="counter-number" data-counter="<?= (int) $stat['value'] ?>">0</span><?= htmlspecialchars($stat['suffix'], ENT_QUOTES, 'UTF-8') ?>
                    </strong>
                    <h2><?= htmlspecialchars($stat['label'], ENT_QUOTES, 'UTF-8') ?></h2>
                    <p><?= htmlspecialchars($stat['sub'], ENT_QUOTES, 'UTF-8') ?></p>
                </article>
            <?php endforeach; ?>
        </div>
    </div>
</section>

<section class="about-home-section section" aria-labelledby="aboutHomeTitle">
    <div class="site-container about-home-grid">
        <div class="section-copy">
            <span class="section-eyebrow"><?= htmlspecialchars($about_home['eyebrow'], ENT_QUOTES, 'UTF-8') ?></span>

            <h2 id="aboutHomeTitle">
                <?= htmlspecialchars($about_home['title'], ENT_QUOTES, 'UTF-8') ?>
                <span><?= htmlspecialchars($about_home['highlight'], ENT_QUOTES, 'UTF-8') ?></span>
                <?= htmlspecialchars($about_home['title_after'], ENT_QUOTES, 'UTF-8') ?>
            </h2>

            <p><?= htmlspecialchars($about_home['description_1'], ENT_QUOTES, 'UTF-8') ?></p>
            <p><?= htmlspecialchars($about_home['description_2'], ENT_QUOTES, 'UTF-8') ?></p>

            <ul class="check-list about-list">
                <li>Advanced infrastructure and technology</li>
                <li>Dedicated R&D and quality control</li>
                <li>Global regulatory compliance</li>
                <li>End-to-end manufacturing excellence</li>
            </ul>

            <a href="<?= htmlspecialchars($about_home['button_url'], ENT_QUOTES, 'UTF-8') ?>" class="primary-button">
                <?= htmlspecialchars($about_home['button_text'], ENT_QUOTES, 'UTF-8') ?>
                <svg class="btn-icon" viewBox="0 0 24 24" aria-hidden="true">
                    <path d="M13.2 5.3 20 12l-6.8 6.7-1.4-1.4 4.4-4.3H4v-2h12.2l-4.4-4.3 1.4-1.4Z"/>
                </svg>
            </a>
        </div>

        <div class="about-visual">
            <img
                class="lazy-theme-img"
                data-theme-asset="image"
                src="<?= htmlspecialchars($about_home['image']['desktop_light'], ENT_QUOTES, 'UTF-8') ?>"
                data-desktop-light="<?= htmlspecialchars($about_home['image']['desktop_light'], ENT_QUOTES, 'UTF-8') ?>"
                data-desktop-dark="<?= htmlspecialchars($about_home['image']['desktop_dark'], ENT_QUOTES, 'UTF-8') ?>"
                data-mobile-light="<?= htmlspecialchars($about_home['image']['mobile_light'], ENT_QUOTES, 'UTF-8') ?>"
                data-mobile-dark="<?= htmlspecialchars($about_home['image']['mobile_dark'], ENT_QUOTES, 'UTF-8') ?>"
                width="800"
                height="800"
                alt="Sanjar Pharma sterile injectable manufacturing facility"
                loading="lazy"
                decoding="async"
            >

            <div class="year-badge">
                <strong>2016</strong>
                <span>Year of Establishment</span>
            </div>
        </div>
    </div>
</section>

<section class="category-section section-sm" aria-labelledby="categoryTitle">
    <div class="site-container">
        <div class="section-head">
            <div>
                <span class="section-eyebrow">Category</span>
                <h2 id="categoryTitle" class="section-title">Our Specialized Categories</h2>
            </div>

            <a href="<?= $base_url ?>/products" class="section-link">View All Products</a>
        </div>

        <div class="category-carousel" aria-label="Product categories carousel">
            <?php if (!empty($home_categories)): ?>
                <?php foreach ($home_categories as $slug => $cat): ?>
                    <article class="category-card card-hover">
                        <a href="<?= $base_url ?>/product-category/<?= htmlspecialchars($slug, ENT_QUOTES, 'UTF-8') ?>/">
                            <img
                                src="<?= htmlspecialchars($cat['image'], ENT_QUOTES, 'UTF-8') ?>"
                                width="420"
                                height="300"
                                alt="<?= htmlspecialchars($cat['name'], ENT_QUOTES, 'UTF-8') ?>"
                                loading="lazy"
                                decoding="async"
                            >
                            <h3><?= htmlspecialchars($cat['name'], ENT_QUOTES, 'UTF-8') ?></h3>
                        </a>
                    </article>
                <?php endforeach; ?>
            <?php endif; ?>
        </div>
    </div>
</section>

<section class="why-section section section-surface" aria-labelledby="whyTitle">
    <div class="site-container why-grid">
        <div class="section-copy">
            <span class="section-eyebrow">Why Choose Us</span>

            <h2 id="whyTitle">
                Why Pharmaceutical Companies Choose Sanjar Pharma
            </h2>

            <p>Selecting a pharmaceutical manufacturing partner requires more than production capacity. It requires confidence in quality systems, regulatory compliance, and manufacturing consistency.</p>
            <p>Sanjar Pharma combines modern infrastructure, experienced technical teams, and comprehensive quality management systems to support reliable pharmaceutical manufacturing.
            </p>

            <a href="<?= $base_url ?>/manufacturing" class="primary-button">
                Our Manufacturing
                <svg class="btn-icon" viewBox="0 0 24 24" aria-hidden="true">
                    <path d="M13.2 5.3 20 12l-6.8 6.7-1.4-1.4 4.4-4.3H4v-2h12.2l-4.4-4.3 1.4-1.4Z"/>
                </svg>
            </a>
        </div>

        <div class="feature-grid">
            <?php foreach ($features as $feature): ?>
                <article class="feature-card card card-pad card-hover">
                    <span class="feature-icon" aria-hidden="true"></span>
                    <h3><?= htmlspecialchars($feature['title'], ENT_QUOTES, 'UTF-8') ?></h3>
                    <p><?= htmlspecialchars($feature['desc'], ENT_QUOTES, 'UTF-8') ?></p>
                </article>
            <?php endforeach; ?>
        </div>
    </div>
</section>

<section class="therapy-section section-sm" aria-labelledby="therapyTitle">
    <div class="site-container">
        <div class="section-head">
            <div>
                <span class="section-eyebrow">Therapeutic Areas</span>
                <h2 id="therapyTitle" class="section-title">Serving Multiple Healthcare Segments</h2>
            </div>
        </div>
    </div>

    <?php if (!empty($ticker_items)): ?>
        <div class="marquee therapy-marquee">
            <div class="marquee-track duration-slow">
                <?php foreach ($ticker_items as $class): ?>
                    <?php
                    $class_name = is_array($class) ? ($class['name'] ?? '') : $class;
                    if (empty($class_name)) continue;
                    $class_slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $class_name), '-'));
                    ?>
                    <a href="<?= $base_url ?>/therapeutic/<?= htmlspecialchars($class_slug, ENT_QUOTES, 'UTF-8') ?>" class="marquee-item">
                        <?= htmlspecialchars($class_name, ENT_QUOTES, 'UTF-8') ?>
                    </a>
                <?php endforeach; ?>
            </div>
        </div>

        <div class="marquee therapy-marquee therapy-marquee-second">
            <div class="marquee-track direction-reverse duration-slow">
                <?php foreach ($ticker_items as $class): ?>
                    <?php
                    $class_name = is_array($class) ? ($class['name'] ?? '') : $class;
                    if (empty($class_name)) continue;
                    $class_slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $class_name), '-'));
                    ?>
                    <a href="<?= $base_url ?>/therapeutic/<?= htmlspecialchars($class_slug, ENT_QUOTES, 'UTF-8') ?>" class="marquee-item">
                        <?= htmlspecialchars($class_name, ENT_QUOTES, 'UTF-8') ?>
                    </a>
                <?php endforeach; ?>
            </div>
        </div>
    <?php endif; ?>
</section>


<?php
function gp_icon($type) {
    $icons = [
        'arrow' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M13.2 5.3 20 12l-6.8 6.7-1.4-1.4 4.4-4.3H4v-2h12.2l-4.4-4.3 1.4-1.4Z"/></svg>',
        'check' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9.2 16.2-4.2-4.2-1.4 1.4 5.6 5.6L21 7.2l-1.4-1.4L9.2 16.2Z"/></svg>',
        'shield' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2 4 5.4v5.8c0 5 3.4 9.7 8 10.8 4.6-1.1 8-5.8 8-10.8V5.4L12 2Z"/></svg>',
        'vial' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 2h6v2h-1v5.2l4.4 7.6A3.5 3.5 0 0 1 15.4 22H8.6a3.5 3.5 0 0 1-3-5.2L10 9.2V4H9V2Z"/></svg>',
        'search' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10.8 4a6.8 6.8 0 1 0 0 13.6 6.8 6.8 0 0 0 0-13.6Zm5.6 10 4.1 4.1-1.4 1.4-4.1-4.1 1.4-1.4Z"/></svg>',
        'globe' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm6.9 9h-3.1a15.5 15.5 0 0 0-1.2-5A8 8 0 0 1 18.9 11ZM12 4.1c.8 1.1 1.5 2.8 1.8 4.9h-3.6c.3-2.1 1-3.8 1.8-4.9ZM4.1 13h3.1c.2 1.8.6 3.5 1.2 5A8 8 0 0 1 4.1 13Zm3.1-2H4.1A8 8 0 0 1 8.4 6a15.5 15.5 0 0 0-1.2 5ZM12 19.9c-.8-1.1-1.5-2.8-1.8-4.9h3.6c-.3 2.1-1 3.8-1.8 4.9Z"/></svg>'
    ];

    return $icons[$type] ?? $icons['arrow'];
}

?>
<section class="global-map-section section-sm section-surface" aria-labelledby="mapTitle">
    <div class="site-container">
        <div class="section-head centered-head">
            <div>
                <span class="section-eyebrow">International Markets</span>
                <h2 id="mapTitle" class="section-title">A Trusted Name in <span>30+ Countries</span></h2>
                <p>Reliable supply chains across global markets.</p>
            </div>
        </div>

        <div class="map-card card">
            <div id="map" aria-label="Sanjar Pharma global presence map"></div>
        </div>
    </div>
</section>


<section class="blog-section section-sm" aria-labelledby="blogTitle">
    <div class="site-container">
        <div class="section-head">
            <div>
                <span class="section-eyebrow">Insights</span>
                <h2 id="blogTitle" class="section-title">Stay Updated With Sanjar Pharma</h2>
                <p>Insights on sterile manufacturing, quality compliance and pharmaceutical trends.</p>
            </div>

            <a href="<?= $base_url ?>/insights" class="section-link">View All</a>
        </div>

        <?php if (!empty($latest_blogs)): ?>
            <?php $hero_blog = array_shift($latest_blogs); ?>

            <div class="blog-grid">
                <article class="blog-featured-card card card-hover">
                    <a href="<?= $base_url ?>/<?= htmlspecialchars($hero_blog['slug'], ENT_QUOTES, 'UTF-8') ?>">
                        <img
                            src="<?= $base_url . htmlspecialchars($hero_blog['image'], ENT_QUOTES, 'UTF-8') ?>"
                            width="680"
                            height="360"
                            alt="<?= htmlspecialchars($hero_blog['title'], ENT_QUOTES, 'UTF-8') ?>"
                            loading="lazy"
                            decoding="async"
                        >
                        <h3><?= htmlspecialchars($hero_blog['title'], ENT_QUOTES, 'UTF-8') ?></h3>
                    </a>
                </article>

                <div class="blog-side-list">
                    <?php foreach ($latest_blogs as $blog): ?>
                        <article class="blog-small-card card card-hover">
                            <a href="<?= $base_url ?>/<?= htmlspecialchars($blog['slug'], ENT_QUOTES, 'UTF-8') ?>">
                                <img
                                    src="<?= $base_url . htmlspecialchars($blog['image'], ENT_QUOTES, 'UTF-8') ?>"
                                    width="150"
                                    height="100"
                                    alt="<?= htmlspecialchars($blog['title'], ENT_QUOTES, 'UTF-8') ?>"
                                    loading="lazy"
                                    decoding="async"
                                >
                                <h3><?= htmlspecialchars($blog['title'], ENT_QUOTES, 'UTF-8') ?></h3>
                            </a>
                        </article>
                    <?php endforeach; ?>
                </div>
            </div>
        <?php endif; ?>
    </div>
</section>

<style>
.home-hero {
  position: relative;
  min-height: clamp(620px, 82vh, 880px);
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background-position: center;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, var(--body-bg) 0%, var(--overlay-soft) 34%, transparent 78%);
}

.home-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.52fr) minmax(0, 0.48fr);
  align-items: center;
  min-height: inherit;
  padding-block: clamp(4rem, 8vw, 7rem);
}

.home-hero-content {
  max-width: 720px;
}

.home-hero h1 {
  margin-bottom: 1rem;
}

.home-hero h1 span,
.global-card h2 span {
  color: var(--primary);
}

.home-hero p {
  max-width: 62ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.hero-cert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: clamp(1.75rem, 3vw, 3rem);
}

.hero-cert {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 58px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
}

.hero-cert img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.hero-cert span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--heading);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.stat-card {
  padding: clamp(1rem, 2vw, 1.8rem);
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat-card:last-child {
  border-right: 0;
}

.stat-card strong {
  display: block;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 1;
  color: var(--primary);
}

.stat-card h2 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(0.95rem, 0.35vw + 0.9rem, 1.2rem);
}

.stat-card p {
  margin: 0;
  color: var(--muted);
}

.about-home-grid,
.why-grid {
  display: grid;
  gap: clamp(1rem, 2vw, 2rem);
  align-items: center;
}
.why-grid {
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.2fr);
}
.about-home-grid{
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.about-list {
  margin: 1.5rem 0 2rem;
}

.about-visual {
  position: relative;
}

.about-visual img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.year-badge {
  position: absolute;
  left: 1.25rem;
  bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.year-badge strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--primary);
}

.year-badge span {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--heading);
}

.category-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 300px);
  gap: 1rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scroll-padding-inline: 1rem;
  padding: 0.25rem 0.25rem 1rem;
}

.category-carousel::-webkit-scrollbar {
  height: 8px;
}

.category-carousel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border);
}

.category-card {
  scroll-snap-align: start;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.category-card a {
  text-decoration: none;
}

.category-card img {
  width: 100%;
  aspect-ratio: 1 / 0.85;
  object-fit: contain;
  background: var(--surface-2);
}

.category-card h3 {
  min-height: 64px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 1rem;
  font-size: 1rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-icon {
  display: block;
  width: 36px;
  height: 36px;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: var(--primary);
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.feature-card p {
  margin: 0;
}

.therapy-marquee {
  margin-top: 1rem;
}

.therapy-marquee-second {
  margin-top: 0.85rem;
}

.global-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 2rem;
  align-items: center;
  padding: clamp(1.5rem, 4vw, 4rem);
}

.map-lite {
  display: grid;
  place-items: center;
  gap: 1rem;
}

.map-globe {
  width: min(100%, 520px);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 52% 50%, var(--primary) 0 2%, transparent 3%),
    linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.map-lite ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-lite li {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--heading);
  font-weight: 700;
}

.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.85fr);
  gap: 1.25rem;
  align-items: stretch;
}

.blog-featured-card,
.blog-small-card {
  overflow: hidden;
}

.blog-featured-card a,
.blog-small-card a {
  display: block;
  text-decoration: none;
}

.blog-featured-card img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  background: var(--surface-2);
}

.blog-featured-card h3 {
  margin: 0;
  padding: 1.1rem;
  font-size: clamp(1.05rem, 0.8vw + 0.95rem, 1.45rem);
}

.blog-side-list {
  display: grid;
  gap: 1rem;
}

.blog-small-card a {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
}

.blog-small-card img {
  width: 120px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.blog-small-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

@media (max-width: 991px) {
  .home-hero {
    min-height: 760px;
    align-items: start;
  }

  .home-hero::after {
    background: linear-gradient(180deg, var(--body-bg) 0%, var(--overlay-soft) 48%, transparent 100%);
  }

  .home-hero-inner,
  .about-home-grid,
  .why-grid,
  .global-card,
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .home-hero-inner {
    align-items: start;
    padding-block: 4rem 2rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card:nth-child(2) {
    border-right: 0;
  }

  .stat-card:nth-child(1),
  .stat-card:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-featured-card img {
    height: 260px;
  }
}

@media (max-width: 575px) {
  .home-hero {
    min-height: 720px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-cert-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 330px);
  }

  .stats-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .stat-card:last-child {
    border-bottom: 0;
  }

  .category-carousel {
    grid-auto-columns: minmax(220px, 78vw);
  }

  .blog-featured-card img {
    height: 220px;
  }

  .blog-small-card a {
    grid-template-columns: 96px 1fr;
  }

  .blog-small-card img {
    width: 96px;
    height: 72px;
  }
}
</style>
<script>
document.addEventListener("DOMContentLoaded", () => {
    const counters = document.querySelectorAll("[data-counter]");
    if (!counters.length) return;

    const runCounter = counter => {
        if (counter.dataset.counted === "true") return;

        counter.dataset.counted = "true";

        const target = Number(counter.dataset.counter || 0);
        const duration = 1200;
        const startTime = performance.now();

        const update = currentTime => {
            const progress = Math.min((currentTime - startTime) / duration, 1);
            const easedProgress = 1 - Math.pow(1 - progress, 3);
            const value = Math.floor(easedProgress * target);

            counter.textContent = value.toLocaleString("en-IN");

            if (progress < 1) {
                requestAnimationFrame(update);
            } else {
                counter.textContent = target.toLocaleString("en-IN");
            }
        };

        requestAnimationFrame(update);
    };

    if (!("IntersectionObserver" in window)) {
        counters.forEach(runCounter);
        return;
    }

    const observer = new IntersectionObserver(entries => {
        entries.forEach(entry => {
            if (!entry.isIntersecting) return;

            runCounter(entry.target);
            observer.unobserve(entry.target);
        });
    }, {
        threshold: 0.35
    });

    counters.forEach(counter => observer.observe(counter));
});
</script>