/* ==========================================================================
   ASUÑA PARFUMERIE — Pays et devise (Sénégal FCFA / Italie EUR)
   Sélecteur du header, boutons du hero, drapeaux, message discret, éléments propres à un marché.
   Dépend de tokens.css, header.css, hero.css. Comportement : assets/js/market.js
   ========================================================================== */

/* --------------------------------------------------------------------------
   Éléments propres à un marché (rendus par le serveur, basculés par <html data-market>)
   -------------------------------------------------------------------------- */
html[data-market="IT"] .only-sn,
html:not([data-market="IT"]) .only-it {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Drapeaux (SVG ronds, aucun émoji)
   -------------------------------------------------------------------------- */
.flag {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(59, 23, 12, 0.16);
  vertical-align: middle;
}

.flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Sélecteur du header
   Ordinateur : drapeau + devise + chevron, avant Favoris / Compte / Panier.
   Mobile (< 1024px) : drapeau + chevron, à la place de l'icône Favoris.
   -------------------------------------------------------------------------- */
.site-actions__item--market {
  display: flex;
}

.market-switch {
  position: relative;
}

.market-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--icon-hit, 40px);
  padding: 0 8px;
  border: 0;
  border-radius: var(--asuna-radius-pill);
  background: transparent;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.market-switch__toggle:hover,
.market-switch__toggle[aria-expanded="true"] {
  background: rgba(59, 23, 12, 0.06);
}

.market-switch__toggle:focus-visible {
  outline: 2px solid var(--asuna-champagne);
  outline-offset: 2px;
}

.market-switch__code {
  font-variant-numeric: tabular-nums;
}

.market-switch__chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.2s var(--asuna-ease);
}

.market-switch__toggle[aria-expanded="true"] .market-switch__chevron {
  transform: rotate(180deg);
}

.market-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 212px;
  padding: 6px;
  border: 1px solid var(--asuna-border);
  border-radius: 16px;
  background: var(--asuna-ivory-light);
  box-shadow: 0 18px 40px -18px rgba(28, 13, 5, 0.35);
}

.market-switch__menu[hidden] {
  display: none;
}

.market-switch__option {
  display: grid;
  grid-template-columns: auto 1fr auto 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--asuna-brown);
  font-family: var(--asuna-font-ui);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.market-switch__option:hover,
.market-switch__option:focus-visible {
  background: rgba(59, 23, 12, 0.06);
  outline: none;
}

.market-switch__currency {
  color: var(--asuna-text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.market-switch__check {
  width: 16px;
  height: 16px;
  color: var(--asuna-caramel);
  visibility: hidden;
}

.market-switch__option[aria-checked="true"] .market-switch__check {
  visibility: visible;
}

@media (max-width: 1023.98px) {
  .site-actions__item--favorites {
    display: none;
  }

  .market-switch__toggle {
    gap: 4px;
    padding: 0 4px;
  }

  .market-switch__code {
    display: none;
  }

  .market-switch__toggle .flag {
    width: 20px;
    height: 20px;
  }

  .market-switch__menu {
    right: -56px;
  }
}

/* --------------------------------------------------------------------------
   Hero : deux boutons sous le texte de la première diapositive
   -------------------------------------------------------------------------- */
.hero__markets {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 22px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.hero__slide.is-active .hero__markets {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 750ms var(--hero-ease), transform 900ms var(--hero-ease);
  transition-delay: 530ms;
}

.hero__slide.is-active .hero__markets + .hero__cta {
  transition-delay: 640ms;
}

.hero__markets + .hero__cta {
  margin-top: 16px;
}

.hero__market {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 248px;
  height: 38px;
  padding: 0 18px 0 10px;
  border: 1px solid rgba(251, 247, 241, 0.42);
  border-radius: var(--asuna-radius-pill);
  background: rgba(28, 13, 5, 0.18);
  color: var(--asuna-on-dark);
  font-family: var(--asuna-font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.hero__market .flag {
  box-shadow: 0 0 0 1px rgba(251, 247, 241, 0.5);
}

.hero__market:hover {
  border-color: rgba(251, 247, 241, 0.8);
  background: rgba(28, 13, 5, 0.32);
}

.hero__market[aria-pressed="true"] {
  border-color: var(--asuna-on-dark);
  background: var(--asuna-on-dark);
  color: var(--asuna-brown);
}

.hero__market[aria-pressed="true"] .flag {
  box-shadow: 0 0 0 1px rgba(59, 23, 12, 0.18);
}

.hero__market:focus-visible {
  outline: 2px solid var(--asuna-champagne);
  outline-offset: 2px;
}

@media (max-width: 767.98px) {
  .hero__markets {
    gap: 6px;
    margin-top: 12px;
  }

  .hero__markets + .hero__cta {
    margin-top: 12px;
  }

  .hero__market {
    min-width: 0;
    height: 28px;
    gap: 6px;
    padding: 0 10px 0 5px;
    font-size: 8.5px;
    letter-spacing: 0.08em;
  }

  .hero__market .flag {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 359.98px) {
  .hero__market {
    font-size: 7.5px;
    letter-spacing: 0.04em;
  }
}

/* --------------------------------------------------------------------------
   Message discret : « Votre panier a été actualisé pour le pays sélectionné. »
   -------------------------------------------------------------------------- */
.market-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--asuna-brown);
  color: var(--asuna-on-dark);
  font-family: var(--asuna-font-ui);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 14px 34px -14px rgba(28, 13, 5, 0.55);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s var(--asuna-ease);
}

.market-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1023.98px) {
  .market-toast {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__markets,
  .market-toast,
  .market-switch__chevron {
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   Article non vendu dans le pays choisi (popup Panier, page Commande)
   -------------------------------------------------------------------------- */
.cart-item.is-unavailable .cart-item__media,
.cart-item.is-unavailable .cart-item__name {
  opacity: 0.6;
}

.cart-item__unit--unavailable,
.co-item__price--unavailable {
  color: #a3341f;
  font-weight: 500;
}

.cart-modal__blocked {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7e6df;
  color: #8a2c1a;
  font-family: var(--asuna-font-ui);
  font-size: 12.5px;
  line-height: 1.45;
}

.cart-modal__blocked[hidden] {
  display: none;
}

/* Hero : boutons pays sur chaque diapositive — espacements resserrés (titres sur deux lignes) */
@media (min-width: 768px) {
  .hero__content:has(.hero__markets) .hero__eyebrow { margin-bottom: 12px; }
  .hero__content:has(.hero__markets) .hero__text { margin-top: 14px; }
  .hero__markets { gap: 6px; margin-top: 16px; }
  .hero__market { height: 34px; }
  .hero__markets + .hero__cta { margin-top: 14px; height: 38px; }
}
@media (min-width: 768px) and (max-width: 1279.98px) {
  .hero__content:has(.hero__markets) .hero__title { font-size: clamp(32px, 3.6vw, 46px); }
  .hero__content:has(.hero__markets) .hero__text { font-size: 13px; }
  .hero__market { height: 30px; min-width: 220px; font-size: 10px; }
}
@media (min-width: 1280px) and (max-width: 1439.98px) {
  .hero__content:has(.hero__markets) .hero__title { font-size: clamp(38px, 3.4vw, 48px); }
}
