{*
 * MÉRIDIAN — Chargement des feuilles de style
 * Le design system (tokens/base/components) est dans assets/css/theme.css,
 * chargé automatiquement par PrestaShop (présent dans $stylesheets.external).
 * Ici : preload des fontes + CSS spécifique à la page (après theme.css).
 *}
{assign var=_meridian value="`$urls.base_url`themes/meridian/assets"}

{* Préchargement des fontes variables (perf : swap, pas de FOIT) *}
<link rel="preload" href="{$_meridian}/fonts/archivo-variable.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{$_meridian}/fonts/bodoni-moda-variable.woff2" as="font" type="font/woff2" crossorigin>

{* Couche de compatibilité (grille/utilitaires/collapse/dropdown/modal) AVANT theme.css *}
<link rel="stylesheet" href="{$_meridian}/css/compat.css" type="text/css">

{* CSS cœur PrestaShop + thème (theme.css) + modules *}
{foreach $stylesheets.external as $stylesheet}
  <link rel="stylesheet" href="{$stylesheet.uri}" type="text/css" media="{$stylesheet.media}">
{/foreach}

{* Couleurs personnalisées du back-office (customizer) : surcharge les tokens, APRÈS theme.css *}
<link rel="stylesheet" href="{$_meridian}/css/var.css" type="text/css">{*  *}

{* CSS spécifique à la page, chargé APRÈS theme.css (cascade), uniquement si nécessaire *}
{if in_array($page.page_name, ['category','best-sales','new-products','prices-drop','search','manufacturer','supplier','bestsales'])}
  <link rel="stylesheet" href="{$_meridian}/css/catalog.css" type="text/css">
{elseif $page.page_name == 'product'}
  <link rel="stylesheet" href="{$_meridian}/css/product.css" type="text/css">
{elseif in_array($page.page_name, ['cart','checkout','order-confirmation','order-detail'])}
  <link rel="stylesheet" href="{$_meridian}/css/checkout.css" type="text/css">
{elseif in_array($page.page_name, ['authentication','registration','my-account','identity','address','addresses','history','order-slip','order-follow','order-return','discount','password','guest-tracking','module-psgdpr-gdpr','module-polarisprestatheme-wishlist','module-ps_emailalerts-account'])}
  <link rel="stylesheet" href="{$_meridian}/css/account.css" type="text/css">
{elseif $page.page_name == 'contact'}
  <link rel="stylesheet" href="{$_meridian}/css/contact.css" type="text/css">
{elseif $page.page_name == 'stores'}
  <link rel="stylesheet" href="{$_meridian}/css/stores.css" type="text/css">
{/if}

{foreach $stylesheets.inline as $stylesheet}
  <style>{$stylesheet.content}</style>
{/foreach}

{* CSS personnalisé du back-office (customizer) : chargé EN DERNIER → a le dernier mot sur la cascade *}
<link rel="stylesheet" href="{$_meridian}/css/custom.css" type="text/css">{*  *}
