/* MERARY — home page art-direction polish. Loaded after the site CSS (last on index.html).
   Keeps the existing identity: blush gradient, olive-charcoal headings, Playfair Display + Montserrat,
   rose pill CTAs, soft pink-tinted shadows.
   Motion: one "premium" archetype (350–900 ms, ease-out, transform/opacity only), hover gated by
   (hover:hover)(pointer:fine), movement removed under prefers-reduced-motion.
   Product-card hover (lift, photo zoom) lives in card-hover.css (shared with the catalog). */

:root{
  --p-olive:#3D4536;
  --p-rose:#CF4F76;                 /* readable rose for large text on the pink hero (≥3:1) */
  --p-cta-a:#D13F72;                /* CTA gradient: same rose hue, deep enough for white text (≥4.5:1) */
  --p-cta-b:#B8315F;
  --p-cta:linear-gradient(135deg,var(--p-cta-a) 0%,var(--p-cta-b) 100%);
  --p-cta-ink:0 1px 1px rgba(95,15,45,.32);
  --p-glow:rgba(184,49,95,.45);
  --p-ease:cubic-bezier(.22,1,.36,1);
}

/* ───────── 1. Hero: readable rose, solid primary CTA ───────── */
body .hero-merary__title .hero-merary__title-pink{
  color:var(--p-rose);
  text-shadow:0 2px 28px rgba(255,255,255,.55);
}
body .hero-merary__buttons .hero-merary__btn{
  position:relative;overflow:hidden;isolation:isolate;
  height:58px;min-width:236px;padding:0 34px;
  border:0;border-radius:999px;
  background:var(--p-cta);
  color:#fff;font:700 14px/1 'Montserrat',system-ui,sans-serif;letter-spacing:.09em;text-shadow:var(--p-cta-ink);
  box-shadow:0 16px 30px -12px var(--p-glow),inset 0 1px 0 rgba(255,255,255,.38);
  transition:transform .35s var(--p-ease),box-shadow .35s var(--p-ease);
}
body .hero-merary__buttons .hero-merary__btn::after{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(105deg,transparent 32%,rgba(255,255,255,.5) 50%,transparent 68%);
  transform:translateX(-130%);
}
body .hero-merary__buttons .hero-merary__btn:active{transform:scale(.985)}
body .hero-merary__buttons .hero-merary__btn:focus-visible{outline:3px solid #fff;outline-offset:2px;box-shadow:0 0 0 5px var(--p-cta-b)}

/* Phones: a calmer hero CTA (same velvet-rose + satin language as the card button) so it does not shout over the bouquet */
@media (max-width:700px){
  body .hero-merary__buttons .hero-merary__btn{
    height:50px;min-width:0;padding:0 26px;gap:8px;
    background:
      linear-gradient(112deg,rgba(255,255,255,0) 30%,rgba(255,255,255,.12) 47%,rgba(255,255,255,.03) 58%,rgba(255,255,255,0) 70%),
      linear-gradient(180deg,#CE4172 0%,#B3305E 100%);
    font-size:13px;font-weight:600;letter-spacing:.06em;text-shadow:none;
    box-shadow:inset 0 0 0 1px rgba(255,205,222,.24),inset 0 1px 0 rgba(255,255,255,.26),0 10px 18px -12px rgba(150,35,80,.55);
  }
}

/* ───────── 2. «Хиты продаж»: brand typography instead of Times New Roman / Arial ───────── */
html body #bestsellers .cx-product-body h3,
html body #bestsellers .cx-product-body h3 a{
  font-family:'Playfair Display',Georgia,serif;font-weight:500;font-size:18px;line-height:1.25;
  letter-spacing:-.005em;color:var(--p-olive);
}
.p-sku{font:500 .6em/1 'Montserrat',system-ui,sans-serif;letter-spacing:.14em;color:#B79AA2;margin-left:.55em;white-space:nowrap;vertical-align:.18em}
.p-sku--m{display:none}
html body #bestsellers .cx-product-bottom strong{
  font-family:'Playfair Display',Georgia,serif;font-weight:600;font-size:23px;letter-spacing:-.01em;color:#2F3528;
}
html body #bestsellers .cx-product-image{overflow:hidden}
html body[data-page="home"] #bestsellers .merary-add-cart{transition:background-color .25s,border-color .25s,transform .3s var(--p-ease)}

/* ───────── 3. Card CTA «Купить сейчас»: velvet-rose pill with a satin sheen, pearl disc for the arrow ───────── */
html body[data-page="home"] #bestsellers .merary-buy-now{
  --cta-disc:27px;
  position:relative;isolation:isolate;overflow:hidden;
  height:46px !important;
  padding:0 4px 0 14px !important;
  gap:4px !important;
  justify-content:space-between !important;
  border-radius:999px !important;
  background:
    linear-gradient(112deg,rgba(255,255,255,0) 30%,rgba(255,255,255,.13) 47%,rgba(255,255,255,.04) 58%,rgba(255,255,255,0) 70%),
    linear-gradient(180deg,#CE4172 0%,#B3305E 100%) !important;
  box-shadow:inset 0 0 0 1px rgba(255,205,222,.26),inset 0 1px 0 rgba(255,255,255,.28),0 12px 20px -13px rgba(150,35,80,.65) !important;
  font-family:'Montserrat',system-ui,sans-serif !important;
  font-size:12px !important;font-weight:500 !important;letter-spacing:.01em !important;
  text-shadow:none;
  -webkit-tap-highlight-color:transparent;
  transition:transform .35s var(--p-ease),box-shadow .35s var(--p-ease),background-color .25s !important;
}
html body[data-page="home"] #bestsellers .merary-buy-now::after{
  content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background:linear-gradient(108deg,transparent 38%,rgba(255,255,255,.34) 50%,transparent 62%);
  transform:translateX(-120%);
}
html body[data-page="home"] #bestsellers .merary-buy-now > *{position:relative;z-index:1}
html body[data-page="home"] #bestsellers .merary-buy-now .qo-label,
html body[data-page="home"] #bestsellers .merary-buy-now > span:first-child{
  flex:1 1 auto;min-width:0;text-align:left;white-space:nowrap;line-height:1;padding-top:1px;
}
html body[data-page="home"] #bestsellers .merary-buy-now .merary-arrow{
  box-sizing:border-box;flex:0 0 var(--cta-disc);width:var(--cta-disc);height:var(--cta-disc);
  padding:8px;border-radius:50%;
  color:#B3305E;stroke:#B3305E;stroke-width:2;
  background:radial-gradient(circle at 34% 28%,#fff 0%,#FFE6ED 62%,#F7C9D6 100%);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.75),0 3px 7px -2px rgba(110,20,55,.5);
  transition:transform .35s var(--p-ease),background-color .25s,color .25s,box-shadow .25s;
}
html body[data-page="home"] #bestsellers .merary-buy-now:active:not(:disabled){
  transform:scale(.98) !important;
  background:linear-gradient(180deg,#B8335F 0%,#A32A55 100%) !important;
  box-shadow:0 4px 10px -8px rgba(150,35,80,.6) !important;
}
html body[data-page="home"] #bestsellers .merary-buy-now:active:not(:disabled) .merary-arrow{transform:scale(.9)}
html body[data-page="home"] #bestsellers .merary-buy-now:active:not(:disabled)::after{transform:translateX(120%);transition:transform .55s var(--p-ease)}
html body[data-page="home"] #bestsellers .merary-buy-now:focus-visible{outline:2px solid #B5315F;outline-offset:3px}
html body[data-page="home"] #bestsellers .merary-buy-now:disabled{background:#EADDE1 !important;color:#9A8890 !important;box-shadow:none !important}

@media (min-width:701px){
  html body[data-page="home"] #bestsellers .merary-buy-now{--cta-disc:34px;padding:0 5px 0 20px !important;gap:6px !important;letter-spacing:.015em !important;font-size:13px !important;height:48px !important}
  html body[data-page="home"] #bestsellers .merary-buy-now .merary-arrow{padding:10px}
}
@media (max-width:410px){
  html body[data-page="home"] #bestsellers .merary-buy-now{font-size:11.5px !important;padding-left:13px !important}
}
@media (max-width:379px){
  /* narrow phones: no room for a disc — centred label with a slim arrow keeps a full-size touch target */
  html body[data-page="home"] #bestsellers .merary-buy-now{padding:0 8px !important;gap:5px !important;justify-content:center !important;font-size:11.5px !important;font-weight:600 !important}
  html body[data-page="home"] #bestsellers .merary-buy-now .qo-label,
  html body[data-page="home"] #bestsellers .merary-buy-now > span:first-child{flex:0 1 auto;text-align:center}
  html body[data-page="home"] #bestsellers .merary-buy-now .merary-arrow{flex:0 0 13px;width:13px;height:13px;padding:0;background:none;box-shadow:none;stroke:#fff;color:#fff}
}
@media (max-width:340px){
  html body[data-page="home"] #bestsellers .merary-buy-now{font-size:11px !important;padding:0 6px !important}
}

/* ───────── 4. One CTA language: every rose button with white text meets 4.5:1 ───────── */
html body .home-search__submit,
html body .section__link--btn,
html body .merary-cinematic__cta,
html body .occasion-result__button,
html .promo-modal__cta,
html .callback-modal__submit,
html .promo-auth-modal__submit{
  background:var(--p-cta) !important;color:#fff !important;text-shadow:var(--p-cta-ink);
  box-shadow:0 10px 22px -12px var(--p-glow),inset 0 1px 0 rgba(255,255,255,.3);
}
html body .section__link--btn{box-shadow:0 10px 22px -12px var(--p-glow),inset 0 1px 0 rgba(255,255,255,.3) !important}
html body .home-search__submit{font-weight:700}
.home-search__bar{transition:box-shadow .35s var(--p-ease)}
.home-search__bar:focus-within{box-shadow:0 0 0 4px rgba(232,165,176,.3),0 16px 34px -16px rgba(212,80,122,.5)}
.home-search__submit,.section__link--btn{position:relative;overflow:hidden;isolation:isolate}
.home-search__submit::after,.section__link--btn::after{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(105deg,transparent 32%,rgba(255,255,255,.5) 50%,transparent 68%);transform:translateX(-130%);
}

/* ───────── 5. Category mosaic: text never fights the cut-outs ───────── */
.category-card__content{position:relative}
.category-card__content::before{
  content:"";position:absolute;z-index:-1;pointer-events:none;
  inset:-12px -26px -12px -12px;border-radius:26px;
  background:radial-gradient(120% 120% at 20% 25%,rgba(255,248,250,.62),rgba(255,248,250,.3) 60%,transparent 100%);
  -webkit-mask-image:radial-gradient(130% 120% at 18% 24%,#000 38%,transparent 78%);
  mask-image:radial-gradient(130% 120% at 18% 24%,#000 38%,transparent 78%);
}
.category-card__arrow{transition:transform .4s var(--p-ease),color .3s}

/* ───────── 6. Reviews: readable size, a quiet quotation mark ───────── */
body .review-card--home{position:relative;overflow:hidden;transition:transform .4s var(--p-ease),box-shadow .4s var(--p-ease),border-color .3s}
body .review-card--home::before{
  content:"\201C";position:absolute;top:6px;right:20px;
  font:400 88px/1 'Playfair Display',Georgia,serif;color:rgba(232,165,176,.38);pointer-events:none;
}
body .review-card--home .review-card__text{font-size:15px;line-height:1.7;color:#403f3d;position:relative}
body .review-card--home .review-card__stars{font-size:15px;letter-spacing:.12em}

/* ───────── 7. Calm product badges: no endless shimmer on every card; one pass on hover ───────── */
.product-badge::before,.product-badge::after{animation:none !important}
.product-badge--hit{background:rgba(255,248,250,.78);border-color:rgba(240,79,119,.34);height:28px;padding:0 12px 0 10px}
.product-badge--hit .product-badge__text{font-size:10.5px;letter-spacing:.06em}

/* ───────── 8. Hover layer: pointer devices only ───────── */
@media (hover:hover) and (pointer:fine){
  body .hero-merary__buttons .hero-merary__btn:hover{transform:translateY(-2px);box-shadow:0 22px 36px -12px var(--p-glow),inset 0 1px 0 rgba(255,255,255,.4)}
  body .hero-merary__buttons .hero-merary__btn:hover::after,
  .home-search__submit:hover::after,.section__link--btn:hover::after{transform:translateX(130%);transition:transform .9s var(--p-ease)}

  html body[data-page="home"] #bestsellers .merary-buy-now:hover:not(:disabled){
    transform:translateY(-1px) !important;
    background:linear-gradient(180deg,#CB3E6E 0%,#B5315F 100%) !important;
    box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 16px 24px -14px rgba(150,35,80,.7) !important;
  }
  html body[data-page="home"] #bestsellers .merary-buy-now:hover:not(:disabled)::after{transform:translateX(120%);transition:transform .9s var(--p-ease)}
  html body[data-page="home"] #bestsellers .merary-buy-now:hover:not(:disabled) .merary-arrow{
    background:radial-gradient(circle at 34% 28%,#fff 0%,#FFE6ED 62%,#F7C9D6 100%);color:#B3305E;stroke:#B3305E;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.85),0 5px 10px -3px rgba(110,20,55,.55);transform:translateX(3px) scale(1.04);
  }
  @media (max-width:379px){
    html body[data-page="home"] #bestsellers .merary-buy-now:hover:not(:disabled) .merary-arrow{background:none;box-shadow:none;stroke:#fff;color:#fff;transform:none}
  }

  .cx-product-card:hover .product-badge::before{animation:product-badge-shimmer-glow 1.2s ease-out 1 !important}
  .cx-product-card:hover .product-badge::after{animation:product-badge-shimmer 1.2s ease-out 1 !important}

  .category-card .category-card__media{transition:transform .8s var(--p-ease)}
  .category-card:hover .category-card__media{transform:translateY(-7px) scale(1.035)}
  .category-card:hover .category-card__arrow{transform:translateX(6px)}
  body .review-card--home:hover{transform:translateY(-4px);box-shadow:0 22px 40px -22px rgba(212,80,122,.35);border-color:rgba(232,165,176,.7)}
}

/* ───────── 9. Motion layer: skipped entirely under prefers-reduced-motion ───────── */
@media (prefers-reduced-motion:no-preference){
  /* one orchestrated moment: after the loader, the hero is "set" in a calm sequence (class added by home-polish.js) */
  html.p-hero-go .hero-merary__title > span{animation:pRise .7s var(--p-ease) both}
  html.p-hero-go .hero-merary__title > span:nth-child(1){animation-delay:0s}
  html.p-hero-go .hero-merary__title > span:nth-child(2){animation-delay:.07s}
  html.p-hero-go .hero-merary__title > span:nth-child(3){animation-delay:.14s}
  html.p-hero-go .hero-merary__title > span:nth-child(4){animation-delay:.21s}
  html.p-hero-go .hero-merary__subtitle{animation:pRise .7s var(--p-ease) .28s both}
  html.p-hero-go .hero-merary__buttons{animation:pRise .7s var(--p-ease) .36s both}
  html.p-hero-go .hero-merary__signature-asset{animation:pSign .9s cubic-bezier(.4,0,.2,1) .5s both}
  html.p-hero-go .hero-merary__photo{animation:pSettle 1.2s var(--p-ease) both}
  html.p-hero-go .hero-merary__features{animation:pRise .7s var(--p-ease) .45s both}

  @keyframes pRise{from{opacity:0;transform:translateY(22px)}to{opacity:1;transform:none}}
  @keyframes pSign{from{opacity:0;clip-path:inset(0 100% 0 0)}30%{opacity:.78}to{opacity:.78;clip-path:inset(0 0 0 0)}}
  @keyframes pSettle{from{transform:scale(1.04)}to{transform:scale(1)}}

  /* product grid: rows rise once as they enter (individual `translate` keeps hover transform free) */
  .p-rv{opacity:0;translate:0 20px}
  .p-rv.p-in{opacity:1;translate:0 0;transition:opacity .8s var(--p-ease) var(--p-d,0ms),translate .8s var(--p-ease) var(--p-d,0ms)}

  /* wishlist heart: brief confirmation on the control that was just pressed */
  .cx-wish.p-pop{animation:pHeart .5s var(--p-ease)}
  @keyframes pHeart{0%{transform:scale(1)}35%{transform:scale(1.32)}65%{transform:scale(.94)}100%{transform:scale(1)}}
}

/* ───────── 10. Phones: two-column cards — tidy, equal rows ───────── */
@media (max-width:700px){
  html body #bestsellers .cx-product-body h3{margin:0;min-height:calc(2 * 1.24em)}
  html body #bestsellers .cx-product-body h3 a{
    font-size:15.5px;line-height:1.24;letter-spacing:0;
    display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;overflow-wrap:anywhere;
  }
  .p-sku{display:none}
  html body #bestsellers .cx-product-body > .cx-stock{order:1}
  .p-sku--m{display:block;order:2;margin:7px 0 3px;font:500 10px/1 'Montserrat',system-ui,sans-serif;letter-spacing:.16em;color:#B3939C}
  html body #bestsellers .cx-product-body > h3{order:3}
  html body #bestsellers .cx-product-body > .cx-product-desc{order:4}
  html body #bestsellers .cx-product-body > .cx-product-bottom{order:5}
  html body #bestsellers .cx-product-body > .merary-product-actions{order:6}
  html body #bestsellers .cx-product-desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;min-height:2.7em;margin-top:6px}
  html body #bestsellers .cx-product-bottom strong{font-size:20px}
}
@media (max-width:370px){
  html body #bestsellers .cx-product-body{padding-left:12px;padding-right:12px}
  html body #bestsellers .product-badge{top:10px;left:10px;height:24px;padding:0 9px 0 8px;gap:5px}
  html body #bestsellers .product-badge .product-badge__icon{width:12px;height:12px;font-size:12px}
  html body #bestsellers .product-badge .product-badge__text{font-size:9.5px;letter-spacing:.04em}
  html body #bestsellers .cx-wish{top:8px;right:8px}
}

/* ───────── 11. Reduced motion: hover keeps colour/shadow feedback, loses all movement ───────── */
@media (prefers-reduced-motion:reduce){
  html body[data-page="home"] #bestsellers .merary-buy-now,
  html body[data-page="home"] #bestsellers .merary-buy-now .merary-arrow{transition:none !important}
  html body[data-page="home"] #bestsellers .merary-buy-now::after{display:none}
  .category-card .category-card__media,.category-card:hover .category-card__media,
  .category-card:hover .category-card__arrow,
  body .review-card--home,body .review-card--home:hover{transform:none !important;scale:none !important;transition:none !important}
}
