/* Homepage trust and travel-card refinements, built on the original green/gold style */
:root{--deep:#082c26;--green:#0e4a3d;--gold:#f2b33d;--ink:#112d29;--border:#deebe7}
html{scroll-behavior:smooth}body{overflow-x:clip}a,button{touch-action:manipulation}a:focus-visible,button:focus-visible,input:focus-visible{outline:3px solid #e6a523;outline-offset:3px}
.navwrap .nav{max-width:1280px}.nav .logo{min-width:0;flex-shrink:0;display:flex;align-items:center;gap:12px;max-width:215px;line-height:1.05}.nav .brand-symbol{width:57px;height:57px;flex:none;object-fit:contain}.nav .brand-words{display:flex;flex-direction:column;gap:3px;letter-spacing:1.2px;font-family:Poppins,sans-serif}.brand-top{font-weight:600;font-size:11px;letter-spacing:1.35px;color:#f7d47e}.brand-bottom{font-size:15px;line-height:1.1;font-weight:800;color:#fff;letter-spacing:.35px}.nav .logo-img{max-width:125px;width:auto;height:64px;object-fit:contain}.footer-brand .brand-symbol{width:75px;height:75px;object-fit:contain}.footer-brand .brand-words{display:grid;gap:5px}.footer-brand .brand-top{font-size:12px}.footer-brand .brand-bottom{font-size:18px}.footer-brand .logo-img{height:95px;max-width:150px}.logo:hover{opacity:.94}.hero .navwrap{background:rgba(6,40,33,.22)}.nav-toggle{flex:none}.header-cta{border-radius:999px}.section-heading h2{line-height:1.16;letter-spacing:-.5px}
/* Animated, back-and-forth yellow point mirrors the supplied route-card example */
.route-card{border:1px solid #e2ede9;box-shadow:0 14px 30px rgba(11,59,50,.065);min-width:0;display:flex;flex-direction:column;isolation:isolate}
.route-card .route-inner{padding:23px 22px 21px;display:flex;flex-direction:column;align-items:flex-start;gap:10px;width:100%;flex:1;min-width:0}
.route-card .route-eyebrow{font-size:10px;color:#75948c!important;letter-spacing:1.8px;font-weight:700;margin:0 0 2px!important}
.route-card .rt{width:100%;min-width:0;display:flex;flex-wrap:nowrap;align-items:center;gap:10px;font-size:clamp(15px,1.35vw,19px);font-weight:700;line-height:1.45;color:#123c34;margin:1px 0 0}
.route-card .rt span{white-space:normal;overflow-wrap:normal;word-break:normal;min-width:0;max-width:46%;flex:0 1 auto}
.route-card .rt span:last-child{text-align:right}
.route-card .line{flex:1 1 32px;min-width:18px;height:0;border-top:2px dashed #b0c7cb;margin:0;position:relative;align-self:center}
.route-card .line b{width:15px;height:15px;top:-9px;left:0;background:#f2b81e;box-shadow:0 0 0 3px #fff,0 3px 9px #e6a52350;animation:route-shuttle 3s ease-in-out infinite alternate}
@keyframes route-shuttle{from{left:0}to{left:calc(100% - 15px)}}
.route-card .route-meta{margin:0!important;color:#6a827a;font-size:13px;line-height:1.7}.route-card .route-meta strong{color:#3f6256}
.route-card .route-actions{margin-top:auto;display:flex;gap:10px 16px;flex-wrap:wrap;align-items:center;width:100%;padding-top:5px}
.route-card .route-actions .btn{background:#174d3e;padding:11px 16px;border-radius:10px;white-space:nowrap}
.route-card .route-actions .btn:hover{background:#0a372d}
.route-card .route-detail{color:#2b6250;font-size:12px;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}
.route-card .route-detail:hover{color:#10402f}
/* Referenced traveller-review section, with platform verified source and no guest-submitted reviews */
.reviews-section{background:#f9fcfb;color:var(--ink)}.reviews-section .sec{padding-top:64px;padding-bottom:66px}.reviews-intro{display:flex;align-items:end;justify-content:space-between;gap:24px;margin-bottom:31px}.reviews-intro h2{font-size:clamp(28px,3.4vw,39px);margin:6px 0 11px;letter-spacing:-1.1px}.reviews-intro .sub{margin:0;max-width:620px;line-height:1.8}.reviews-top-link{font-weight:700;color:#17533e;white-space:nowrap;font-size:13px;padding:12px 0}.reviews-top-link:hover{text-decoration:underline}.review-summary{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);gap:20px;margin-bottom:35px}.rating-snapshot,.google-review-cta{padding:28px 30px;border:1px solid #dceae6;border-radius:20px;background:#fff;box-shadow:0 9px 30px rgba(5,52,42,.04)}.rating-source{color:#496b5e;font-weight:700;letter-spacing:.2px;font-size:14px!important;margin:0 0 12px}.ta-icon{background:#36aa86;color:white;border-radius:999px;padding:2px 6px;margin-right:5px;font-size:11px;letter-spacing:-2px}.rating-main{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.rating-number{font-size:clamp(42px,5vw,56px);font-weight:700;line-height:1;color:#102d27;letter-spacing:-2px}.rating-stars{color:#f4ad08;letter-spacing:2px;font-size:21px}.rating-of{font-size:16px;color:#879c94}.rating-track{height:9px;background:#e5f0ed;border-radius:999px;max-width:330px;overflow:hidden;margin:16px 0 12px}.rating-track span{display:block;height:100%;background:linear-gradient(90deg,#ffc63f,#f3a900);border-radius:999px}.rating-note{font-size:12px!important;color:#667b74;line-height:1.8;margin:0}.rating-note a{color:#11543c;font-weight:700;text-decoration:underline;text-underline-offset:3px}.google-review-cta{display:flex;gap:22px;align-items:start}.google-letter{display:flex;align-items:center;justify-content:center;border-radius:16px;background:#f3f8fb;width:54px;height:54px;flex:0 0 54px;font-size:36px;font-weight:800;color:#4285f4;font-family:Arial,sans-serif}.google-review-cta h3{margin:3px 0 5px;font-size:21px}.google-review-cta p{color:#60776e;font-size:13px;line-height:1.9;margin:0 0 18px}.google-action{background:#07417d;display:inline-flex;gap:10px;align-items:center;border-radius:11px}.google-action:hover{background:#0e5a9c}
.reviews-carousel-head{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:14px}.reviews-carousel-head p{font-size:14px;margin:0;font-weight:700}.reviews-carousel-head p span{font-weight:400;color:#6f8179;font-size:12px}.reviews-carousel-controls{display:flex;gap:9px}.slider-btn{width:39px;height:39px;border-radius:50%;border:1px solid #d5e7e1;display:grid;place-items:center;background:#fff;color:#134f3e;font-size:22px;cursor:pointer;box-shadow:0 2px 7px #103f3011}.slider-btn:hover{background:#e7f4ed}.slider-btn:disabled{opacity:.38;cursor:not-allowed}.reviews-track{display:grid;grid-auto-columns:minmax(265px,calc((100% - 36px)/3));grid-auto-flow:column;gap:18px;overflow-x:auto;scrollbar-width:thin;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;padding:2px 2px 18px}.review-card{min-height:270px;display:flex;flex-direction:column;gap:15px;border:1px solid #dfebe7;background:#fff;border-radius:19px;padding:24px 23px;scroll-snap-align:start;box-shadow:0 4px 8px rgba(11,59,50,.045)}.review-card-head{display:flex;align-items:center;gap:11px}.review-avatar{width:47px;height:47px;border-radius:50%;display:grid;place-items:center;background:#217b7e;color:#fff;flex:none;font-weight:700;font-size:20px}.review-card:nth-child(2n) .review-avatar{background:#b74c5b}.review-card:nth-child(3n) .review-avatar{background:#486cb3}.review-card-head h3{margin:0 0 3px;font-size:15px;line-height:1.4}.review-card-head p{font-size:11px;color:#7a8c85;margin:0}.source-tag{margin-left:auto;font-size:10px;padding:4px 7px;border-radius:999px;background:#eaf6f0;color:#276b51;white-space:nowrap}.review-card-copy{font-size:13px;color:#49645a;line-height:1.9;flex:1;margin:1px 0 0}.review-card>a{color:#14563d;font-size:12px;font-weight:700}.review-card>a:hover{text-decoration:underline}
.tripadvisor-band{background:#f3f7f6;border-top:1px solid #deebe7;text-align:center;padding:60px 0 65px;position:relative;overflow:hidden}.tripadvisor-band:after{content:"";position:absolute;inset:auto 0 0;height:8px;background:linear-gradient(90deg,#104a40,#269885,#f3bd4b,#104a40)}.ta-band-inner{display:flex;flex-direction:column;align-items:center}.tripadvisor-band h2{font-family:Georgia,'Times New Roman',serif;font-size:clamp(26px,3.1vw,39px);font-weight:400;color:#142e28;margin:4px 0 12px}.tripadvisor-band p:not(.kicker){color:#60756d;font-size:13px;margin:0 0 24px}.ta-band-action{display:flex;align-items:center;flex-direction:column;gap:20px}.ta-wordmark{font-weight:800;font-family:Arial,sans-serif;font-size:clamp(25px,3.4vw,37px);letter-spacing:-1px;color:#171717;display:inline-flex;align-items:center;gap:0;white-space:nowrap}.ta-wordmark>span:nth-child(2){color:#34a987}.ta-wordmark .ta-eye{font-weight:700;color:#009780;font-size:19px;letter-spacing:-8px;margin-right:15px;transform:rotate(-4deg)}.ta-external{font-size:13px;color:#28654c;margin-left:10px}.ta-band-action .btn{background:#174d3e;border-radius:999px;padding:12px 22px}.ta-band-action .btn:hover{background:#0a3c30}
@media(min-width:1100px){.nav .logo{max-width:220px}.navwrap .nav nav{gap:clamp(13px,1.7vw,25px)}}
@media(max-width:1040px){.nav .logo{max-width:50%}.reviews-track{grid-auto-columns:minmax(270px,calc((100% - 18px)/2))}}
@media(max-width:720px){.nav .brand-symbol{width:45px;height:45px}.nav .brand-top{font-size:9px}.nav .brand-bottom{font-size:12px}.nav .logo-img{max-height:53px;max-width:100px}.nav .logo{max-width:calc(100% - 75px)}.reviews-section .sec{padding-top:42px;padding-bottom:43px}.reviews-intro{flex-direction:column;align-items:flex-start;gap:5px;margin-bottom:20px}.review-summary{grid-template-columns:1fr;gap:13px;margin-bottom:28px}.rating-snapshot,.google-review-cta{padding:22px}.reviews-track{grid-auto-columns:minmax(265px,90%)}.review-card{min-height:260px}.reviews-carousel-head p span{display:block;margin-top:2px}.route-card .rt{font-size:17px}.route-card .route-inner{padding:21px}.tripadvisor-band{padding:46px 0 52px}}
@media(max-width:400px){.reviews-track{grid-auto-columns:92%}.review-card{padding:19px 17px}.reviews-carousel-head{align-items:flex-end}.source-tag{display:none}.google-review-cta{gap:14px}.google-letter{width:43px;height:43px;flex-basis:43px;font-size:29px}.route-card .route-actions{flex-direction:column;align-items:stretch}.route-card .route-actions .btn,.route-card .route-detail{text-align:center}.nav .brand-bottom{font-size:11px}}
@media(prefers-reduced-motion:reduce){.route-card .line b{animation:none!important}.reviews-track{scroll-behavior:auto}}

/* Subtle fallback premium hero when no owner-provided hero photo has been set. */
.hero:not([style*='background-image']){background-image:radial-gradient(circle at 94% 17%,rgba(242,179,61,.13),transparent 37%),radial-gradient(circle at 5% 102%,rgba(30,119,95,.34),transparent 37%),linear-gradient(130deg,#0a382e,#104e3f)}

/* Official logo supplied by the site owner, cropped responsively via CSS. */
.ta-wordmark.ta-logo-link{display:flex;align-items:center;justify-content:center;width:min(420px,88vw);height:100px;max-width:100%;overflow:hidden;text-decoration:none;line-height:1}
.ta-wordmark.ta-logo-link img{display:block;width:100%;height:auto;flex:none;mix-blend-mode:multiply}
.ta-wordmark.ta-logo-link:focus-visible{outline:3px solid #e6a523;outline-offset:4px}

.ta-wordmark.ta-logo-link {
    width: 35px;
    height: 10px;
}

@media (max-width: 600px) {
    .ta-wordmark.ta-logo-link {
        width: 200px;
        height: 67px;
    }
}

/* Sri Lanka Best Tour: lighter, narrow-screen-safe homepage override.
   Append at the END of assets/updates.css. No PHP or database edits. */
html, body { width: 100%; max-width: 100%; overflow-x: clip; }
.hero { position: relative; isolation: isolate; color:#183e35; }
/* Keep your existing background image; lighten it without replacing its URL. */
.hero::before { content:""; position:absolute; inset:0; background:rgba(255,255,255,.53); pointer-events:none; z-index:-1; }
.hero .herotxt { position:relative; max-width:1200px; }
.hero .herotxt > .eb2, .hero .hero-lead, .hero .hero-foot { color:#173e35 !important; text-shadow:0 1px 1px rgba(255,255,255,.8); }
.hero h1 { color:#133b33; text-shadow:0 1px 6px rgba(255,255,255,.78); }
.hero .herotxt > .script { color:#b47a08; -webkit-text-fill-color:#b47a08; background:none; text-shadow:0 1px 5px rgba(255,255,255,.8); }
.hero .nav nav a, .hero .nav .logo { color:#173e35; }
.hero .nav-toggle { color:#173e35; border-color:#71968d; }
.hero .nav nav.open { background:#123c32; }
.hero .nav nav.open a { color:#fff; }
.hero .search { width:100%; max-width:100%; box-shadow:0 12px 34px rgba(9,52,42,.16); }
.hero .search label, .hero .search input, .hero .search button { min-width:0; }
.hero .search input { font-size:16px; }
.hero .search .btn { white-space:normal; line-height:1.4; }
.hero .herotxt, .hero .search, .hero .nav, .hero .navwrap { min-width:0; }
.hero .herotxt > * { max-width:100%; }
.gallery-grid, .grid, .detail-grid, .footer-grid, .review-summary { min-width:0; }
.gallery-grid > *, .grid > *, .detail-grid > *, .footer-grid > *, .review-summary > * { min-width:0; }
.reviews-track { width:100%; max-width:100%; min-width:0; }
.ta-band-inner, .tripadvisor-band, .reviews-section { max-width:100%; }
@media(max-width:720px) {
  .hero { min-height:0; padding-bottom:25px; background-position:center top !important; }
  .hero::before { background:rgba(255,255,255,.78); }
  .hero .herotxt { padding-top:18px; padding-bottom:12px; }
  .hero .herotxt > .eb2 { letter-spacing:1.9px; font-size:10px; }
  .hero h1 { font-size:clamp(28px,7vw,40px); line-height:1.18; }
  .hero .script { font-size:clamp(45px,12vw,65px); }
  .hero .hero-lead { font-size:14px; line-height:1.65; }
  .hero .search { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:15px; margin-top:19px; border-radius:15px; }
  .hero .search label { width:100%; min-width:0; }
  .hero .search input { width:100%; max-width:100%; }
  .hero .search .btn { grid-column:1/-1; width:100%; }
  .hero .nav { width:100%; }
  .reviews-track { grid-auto-columns:minmax(0,90%); }
  .ta-wordmark.ta-logo-link { width:min(220px,70vw); height:auto; }
  .ta-wordmark.ta-logo-link img { width:100%; height:auto; }
}
@media(max-width:480px) {
  .w { padding-left:15px; padding-right:15px; }
  .hero .search { grid-template-columns:minmax(0,1fr); }
  .hero .search .btn { grid-column:1; }
  .hero .nav .logo { max-width:calc(100% - 65px); }
  .hero .header-cta { max-width:100%; }
  .hero .hero-foot { font-size:11px; }
  .reviews-track { grid-auto-columns:minmax(0,90%); }
}

/* Restore homepage banner */
.hero {
    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.12)
        ),
        url('/assets/home-banner.jpg') !important;

    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

/* Prevent horizontal overflow */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

/* Mobile layout */
@media (max-width: 768px) {
    .hero {
        background-position: center top !important;
    }
}
<?php
require_once __DIR__.'/config.php';
function seo_head(string $title, string $description, string $location='', string $image='', array $jsonLd=[], bool $noindex=false): void {
    $desc=excerpt($description,300);
    $full=canonical($location);
    $logo=setting('logo');
    $siteImage=$image ?: ($logo ? canonical('uploads/'.$logo) : canonical('assets/sri-lanka-best-tour-logo.webp'));
    if ($siteImage && str_starts_with($siteImage, '/')) $siteImage=canonical(ltrim(substr($siteImage, strlen(base_path())),'/'));
    ?>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title><?=e($title)?></title><meta name="description" content="<?=e($desc)?>"><link rel="canonical" href="<?=e($full)?>">
<meta property="og:type" content="<?= $location && str_starts_with($location,'travel-guides/') ? 'article' : 'website' ?>">
<meta property="og:title" content="<?=e($title)?>"><meta property="og:description" content="<?=e($desc)?>"><meta property="og:url" content="<?=e($full)?>">
<?php if($siteImage): ?><meta property="og:image" content="<?=e($siteImage)?>"><?php endif ?>
<meta name="twitter:card" content="<?= $siteImage?'summary_large_image':'summary' ?>">
<?php if($noindex): ?><meta name="robots" content="noindex,nofollow"><?php endif ?>
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Dancing+Script:wght@700&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="<?=e(path('assets/favicon.png'))?>">
<link rel="stylesheet" href="<?=e(path('assets/style.css'))?>"><link rel="stylesheet" href="<?=e(path('assets/updates.css'))?>">
<?php foreach($jsonLd as $schema): ?><script type="application/ld+json"><?=json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT)?></script><?php endforeach ?>
</head><body>
<?php
}
function business_schema(): array {
    $same=[];
    foreach(['tripadvisor_url','google_business_url'] as $key) if (setting($key)) $same[]=setting($key);
    $result=['@context'=>'https://schema.org','@type'=>'TravelAgency','name'=>setting('site_name'),'url'=>canonical(),
      'telephone'=>setting('phone'),'description'=>setting('home_seo_description'),'sameAs'=>$same];
    $result['logo']=setting('logo') ? canonical('uploads/'.setting('logo')) : canonical('assets/sri-lanka-best-tour-logo.webp');
    if(setting('address')) $result['address']=['@type'=>'PostalAddress','streetAddress'=>setting('address'),'addressCountry'=>'LK'];
    return $result;
}
function breadcrumbs_schema(array $links): array {
    $items=[];
    foreach($links as $idx=>[$name,$href]) $items[]=['@type'=>'ListItem','position'=>$idx+1,'name'=>$name,'item'=>canonical($href)];
    return ['@context'=>'https://schema.org','@type'=>'BreadcrumbList','itemListElement'=>$items];
}
function brand_html(bool $inFooter=false): void {
    $name=setting('site_name');
    $logo=setting('logo');
    if($logo){
        echo '<img class="logo-img" src="'.e(path('uploads/'.$logo)).'" alt="'.e($name).'" width="188" height="54">';
    }else{
        echo '<img class="brand-symbol" src="'.e(path('assets/sri-lanka-best-tour-logo.webp')).'" alt="" width="58" height="58">';
        echo '<span class="brand-words"><span class="brand-top">SRI LANKA</span><span class="brand-bottom">BEST TOUR</span></span>';
    }
}
function route_card_html(array $r): void {
    $from=trim((string)($r['from_place']??'')); $to=trim((string)($r['to_place']??''));
    $title=record_title('routes',$r); $url=item_url('routes',$r);
    $duration=trim((string)($r['duration']??'')); $price=trim((string)($r['price']??''));
    $msg='Hello! I would like to book a private transfer from '.$from.' to '.$to.'. Could you share availability and a price?';
    ?>
<article class="card route route-card" aria-label="Private transfer from <?=e($from)?> to <?=e($to)?>">
  <div class="route-inner">
    <p class="route-eyebrow">PRIVATE TRANSFER · SRI LANKA</p>
    <div class="rt"><span title="<?=e($from)?>"><?=e($from)?></span><i class="line" aria-hidden="true"><b></b></i><span title="<?=e($to)?>"><?=e($to)?></span></div>
    <p class="route-meta"><?=e($duration?:'Flexible departure')?> <span aria-hidden="true">·</span> <strong><?= $price?'From '.e($price):'Ask for price' ?></strong></p>
    <div class="route-actions"><a class="btn sm" href="<?=e(wa($msg))?>" target="_blank" rel="noopener noreferrer" aria-label="Enquire on WhatsApp about <?=e($title)?>">Book via WhatsApp <span aria-hidden="true">↗</span></a><a class="route-detail" href="<?=e($url)?>">Route details <span aria-hidden="true">→</span></a></div>
  </div>
</article>
<?php }
function nav_header(bool $hero=false): void {
    $logo=setting('logo'); $name=setting('site_name'); ?>
<div class="navwrap <?= $hero?'on-hero':'' ?>"><div class="w nav">
<a href="<?=e(path())?>" class="logo" aria-label="<?=e($name)?> homepage"><?php brand_html(); ?></a>
<button class="nav-toggle" type="button" aria-expanded="false" aria-controls="main-navigation" aria-label="Open navigation">☰</button>
<nav id="main-navigation" aria-label="Main navigation"><a href="<?=e(path('routes'))?>">Routes</a><a href="<?=e(path('destinations'))?>">Destinations</a><a href="<?=e(path('tours'))?>">Tours</a><a href="<?=e(path('travel-guides'))?>">Travel guides</a><a href="<?=e(path('gallery'))?>">Gallery</a><a href="<?=e(path('#reviews'))?>">Reviews</a></nav>
<a class="gold header-cta" href="<?=e(wa('Hello! I would like to plan a Sri Lanka trip.'))?>" target="_blank" rel="noopener noreferrer">Book Now <span aria-hidden="true">↗</span></a>
</div></div>
<?php }
function footer(): void { $name=setting('site_name'); $logo=setting('logo'); ?>
<section class="cta"><div class="w"><div><p class="kicker">YOUR SRI LANKA STORY</p><div class="script">Your Next Adventure Starts Here!</div><p>Tell us your travel dates, group size and destinations. We’ll help plan the journey.</p></div><a class="gold" href="<?=e(wa('Hello! I would like to plan a trip in Sri Lanka. Please help me with a quote.'))?>" target="_blank" rel="noopener noreferrer">Plan my trip on WhatsApp →</a></div></section>
<footer id="contact"><div class="w footer-grid"><div><a href="<?=e(path())?>" class="logo footer-brand" aria-label="<?=e($name)?> home"><?php brand_html(); ?></a><p>Private drivers, airport transfers, scenic journeys and tailor-made round tours across Sri Lanka.</p><p>© <?=date('Y')?> <?=e($name)?></p></div>
<div><b>Explore</b><p><a href="<?=e(path('tours'))?>">Tour packages</a></p><p><a href="<?=e(path('routes'))?>">Popular routes</a></p><p><a href="<?=e(path('destinations'))?>">Destinations</a></p><p><a href="<?=e(path('travel-guides'))?>">Travel guides</a></p><p><a href="<?=e(path('gallery'))?>">Photo gallery</a></p></div>
<div><b>Connect</b><p><a href="<?=e(wa('Hello! I have a Sri Lanka travel enquiry.'))?>" target="_blank" rel="noopener noreferrer">WhatsApp: <?=e(setting('phone'))?></a></p><?php if(setting('email')): ?><p><a href="mailto:<?=e(setting('email'))?>"><?=e(setting('email'))?></a></p><?php endif ?><p><?=e(setting('address'))?></p><p><a href="<?=e(setting('tripadvisor_url'))?>" target="_blank" rel="noopener noreferrer">Tripadvisor reviews ↗</a></p><p><a href="<?=e(setting('google_business_url'))?>" target="_blank" rel="noopener noreferrer">Google Business Profile ↗</a></p></div></div></footer>
<a class="fab" href="<?=e(wa('Hello! I would like to enquire about a Sri Lanka trip.'))?>" target="_blank" rel="noopener noreferrer" aria-label="Ask us about your trip on WhatsApp" title="Chat on WhatsApp"><svg width="29" height="29" viewBox="0 0 24 24" fill="white" aria-hidden="true"><path d="M12.04 2A9.93 9.93 0 0 0 3.5 17.13L2 22l5.03-1.46A10 10 0 1 0 12.04 2zm0 18.16a8.16 8.16 0 0 1-4.16-1.14l-.3-.18-2.98.86.89-2.9-.2-.3a8.16 8.16 0 1 1 6.75 3.66zm4.48-6.1c-.25-.12-1.47-.72-1.7-.8-.23-.08-.4-.12-.57.12-.17.25-.65.8-.8.96-.14.17-.29.19-.54.06-.25-.12-1.04-.38-1.98-1.22-.73-.65-1.22-1.46-1.36-1.7-.15-.25-.02-.38.11-.51.11-.11.25-.29.37-.43.12-.14.16-.24.24-.41.09-.17.04-.31-.02-.43-.06-.12-.57-1.37-.78-1.87-.2-.49-.41-.42-.57-.43h-.49c-.17 0-.43.06-.66.31-.23.25-.87.85-.87 2.06s.9 2.39 1.02 2.56c.13.17 1.77 2.69 4.28 3.77.6.26 1.07.41 1.44.52.61.19 1.16.16 1.59.1.49-.07 1.47-.6 1.68-1.19.21-.58.21-1.09.15-1.19-.06-.1-.23-.16-.48-.28z"/></svg></a>
<script src="<?=e(path('assets/site.js'))?>" defer></script></body></html>
<?php }
function card_html(string $t,array $r): void {
    $title=record_title($t,$r);
    $url=item_url($t,$r);
    $summary=record_summary($t,$r);
    $waText=match($t){ 'tours'=>'Hello! I would like details and a quote for the '.$title.' tour.', 'routes'=>'Hello! Can I get a quote for '.$title.'?', 'destinations'=>'Hello! I would like to visit '.$title.'. Can you help plan my trip?', default=>'Hello! I was reading '.$title.' and would like travel advice.'};
    ?>
<article class="card listing-card"><a class="card-media" href="<?=e($url)?>" aria-label="Learn about <?=e($title)?>"><?=picture($r,'200')?></a><div class="cb"><p class="card-kicker"><?=e($t==='blogs'?'TRAVEL GUIDE':($t==='tours'?'CURATED JOURNEY':($t==='routes'?'PRIVATE TRANSFER':'DESTINATION'))) ?></p><h3><a href="<?=e($url)?>"><?=e($title)?></a></h3><p><?=e(excerpt($summary,125))?></p><?php if($t==='tours' && !empty($r['duration_days'])): ?><p>✦ <?= (int)$r['duration_days'] ?> days <?php if(!empty($r['price'])): ?> · From <?=e($r['price'])?><?php endif ?></p><?php elseif($t==='routes' && !empty($r['duration'])): ?><p>✦ <?=e($r['duration'])?></p><?php endif ?><div class="card-actions"><a class="text-link" href="<?=e($url)?>">Explore details →</a><a class="btn sm" href="<?=e(wa($waText))?>" target="_blank" rel="noopener noreferrer">Enquire ↗</a></div></div></article>
<?php }
function markdown_content(string $text): string {
    // Escape all content; convert only safe absolute-HTTPS/HTTP or local Markdown links.
    $inline = static function (string $value): string {
        $pattern = '~\[([^\]\r\n]+)\]\(((?:https?://[^\s)]+)|(?:/(?!/)[^\s)]*))\)~iu';
        preg_match_all($pattern, $value, $matches, PREG_OFFSET_CAPTURE);
        $result = '';
        $offset = 0;
        foreach ($matches[0] as $i => $match) {
            $raw = $match[0];
            $at = $match[1];
            $result .= e(substr($value, $offset, $at - $offset));
            $label = $matches[1][$i][0];
            $url = $matches[2][$i][0];
            $external = preg_match('~^https?://~i', $url) === 1;
            // Respect subfolder installs; leave absolute external links unchanged.
            $href = $external ? $url : path(ltrim($url, '/'));
            $result .= '<a href="' . e($href) . '"' .
                ($external ? ' target="_blank" rel="noopener noreferrer"' : '') .
                '>' . e($label) . '</a>';
            $offset = $at + strlen($raw);
        }
        return $result . e(substr($value, $offset));
    };

    $lines = preg_split('/\r\n|\r|\n/', $text);
    $html = '';
    $inList = false;
    $para = [];
    $flush = static function () use (&$para, &$html, $inline): void {
        if ($para) {
            $html .= '<p>' . implode(' ', array_map($inline, $para)) . '</p>';
            $para = [];
        }
    };
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line === '') {
            $flush();
            if ($inList) { $html .= '</ul>'; $inList = false; }
            continue;
        }
        if (preg_match('/^(#{2,3})\s+(.+)$/u', $line, $m)) {
            $flush();
            if ($inList) { $html .= '</ul>'; $inList = false; }
            $tag = strlen($m[1]) === 2 ? 'h2' : 'h3';
            $html .= "<$tag>" . $inline($m[2]) . "</$tag>";
        } elseif (preg_match('/^[-*]\s+(.+)$/u', $line, $m)) {
            $flush();
            if (!$inList) { $html .= '<ul>'; $inList = true; }
            $html .= '<li>' . $inline($m[1]) . '</li>';
        } else {
            if ($inList) { $html .= '</ul>'; $inList = false; }
            $para[] = $line;
        }
    }
    $flush();
    if ($inList) $html .= '</ul>';
    return $html;
}

/* Blue clickable links in article content */
.article-body a[href] {
    color: #075ec7 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
    font-weight: 600 !important;
}

.article-body a[href]:hover {
    color: #003e96 !important;
}

.article-body a[href]:visited {
    color: #6943b9 !important;
}
