/* =========================================================
   CreatinePro — motion system
   One set of curves and durations for the whole site. Only transform / opacity / colour are animated
   (no layout properties), so nothing shifts and phones stay smooth. All of it is neutralised by the
   prefers-reduced-motion rule at the end of styles.css (and the JS helpers skip themselves).
   ========================================================= */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --t-fast: .16s;
  --t: .26s;
  --t-slow: .42s;
}

/* ---------- Header ---------- */
.site-header { transition: background-color var(--t) ease, box-shadow var(--t) ease, border-color var(--t) ease; }
.site-header.is-scrolled { background: rgba(7, 8, 10, .95); box-shadow: 0 12px 30px -20px rgba(0, 0, 0, .9); }
.nav-link::after { transition: transform var(--t) var(--ease-out), background-color var(--t-fast) ease; }
.mega { animation: megaIn var(--t) var(--ease-out); }
.mega-in > * { animation: cpEnter var(--t-slow) var(--ease-out) both; }
.mega-in > *:nth-child(2) { animation-delay: 40ms; } .mega-in > *:nth-child(3) { animation-delay: 80ms; } .mega-in > *:nth-child(4) { animation-delay: 120ms; }

/* ---------- Buttons & controls: quick hover, tactile press ---------- */
.btn, .add-btn, .icon-btn, .filter, .pill, .chip, .swatch, .goal-tile, .pdp-sw, .pick, .tool-btn, .m-expand, .text-btn, .link-btn {
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t) ease, opacity var(--t-fast) ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled), .add-btn:active:not(:disabled), .tool-btn:active, .pick:active:not(:disabled) { transform: scale(.97); }
.icon-btn:active, .swatch:active, .filter:active, .pill:active, .chip:active, .m-expand:active { transform: scale(.92); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 22px -16px rgba(0, 0, 0, .9); }
:focus-visible { transition: outline-offset var(--t-fast) var(--ease-out); }

/* ---------- Product cards ---------- */
.card { transition: transform var(--t) var(--ease-out), border-color var(--t) ease, box-shadow var(--t) ease; }
.card-media img { transition: transform .5s var(--ease-out), opacity var(--t) ease; }
.card:active { transform: translateY(-1px) scale(.995); }

/* ---------- Feedback ---------- */
@keyframes cpPulse { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
.pulse { animation: cpPulse .42s var(--ease-out); }
@keyframes cpPop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.add-btn.done .ic { animation: cpPop .32s var(--ease-out); }
.count { transition: transform .3s var(--ease-out); }

/* ---------- Entry animations ---------- */
@keyframes cpEnter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.enter { animation: cpEnter var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
.motion-ready .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.motion-ready .reveal.in { opacity: 1; transform: none; }

/* ---------- Cart drawer ---------- */
@keyframes cpLineIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.line.just-added { animation: cpLineIn .42s var(--ease-out) both; }
.line.just-added .th { box-shadow: 0 0 0 1.5px rgba(20, 169, 242, .6); transition: box-shadow 1.2s ease; }
.cart { transition: transform .4s var(--ease-out); }
.scrim { transition: opacity .32s ease; }

/* ---------- Filter / tabs content swaps ---------- */
.fgroup-body { animation: cpEnter var(--t) var(--ease-out); }
.chip { animation: cpEnter var(--t) var(--ease-out); }
.filter-panel { transition: transform .38s var(--ease-out), visibility .38s; }

/* ---------- Shop by goal ---------- */
.goal-stage { transition: opacity .14s ease, transform .14s ease; }
.goal-stage.swap-out { opacity: 0; transform: translateY(6px); }
.goal-stage.swap-in > * { animation: cpEnter .4s var(--ease-out) both; }
.goal-stage.swap-in > *:nth-child(2) { animation-delay: 60ms; }
.goal-stage.swap-in .goal-prod { animation: cpEnter .42s var(--ease-out) both; }
.goal-stage.swap-in .goal-prod:nth-child(2) { animation-delay: 60ms; }
.goal-stage.swap-in .goal-prod:nth-child(3) { animation-delay: 120ms; }

/* ---------- Mobile menu (full screen): fade + slight drop, rows cascade in; closing is quicker than opening ---------- */
.mobile-nav { transition: opacity .2s ease, transform .24s var(--ease-in), visibility 0s linear .24s; }
.mobile-nav.is-open { transition: opacity .3s ease, transform .42s var(--ease-out), visibility 0s; }
@keyframes cpLinkIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mobile-nav.is-open .mobile-links > li, .mobile-nav.is-open .mnav-promo { animation: cpLinkIn .46s var(--ease-out) both; animation-delay: calc(70ms + var(--i, 0) * 38ms); }
.mobile-nav.is-open .mobile-nav-foot { animation: cpEnter .4s var(--ease-out) both; animation-delay: 360ms; }
.burger i { transition: transform .32s var(--ease-out), top .32s var(--ease-out), opacity .2s ease; }

/* ---------- Carousel dots ---------- */
.dots button { transition: width var(--t) var(--ease-out), background-color var(--t) ease; }

@media (prefers-reduced-motion: reduce) {
  .motion-ready .reveal { opacity: 1; transform: none; }
  .enter, .line.just-added, .mobile-nav.is-open .mobile-links > li, .mobile-nav.is-open .mnav-promo, .mobile-nav.is-open .mobile-nav-foot { animation: none !important; }
  .mobile-nav, .mobile-nav.is-open, .m-shop-panel { transition: none !important; transform: none; }
}

/* =========================================================
   Buttons — one consistent micro-interaction set (150–300ms, transform/opacity/colour only)
   hover: lift 1px + icons nudge · press: quick scale-down (instant on touch) · focus: clear accent ring
   ========================================================= */
.btn, .add-btn, .pd-add, .mp-cta, .goal-tile, .pd-rel-nav, .pd-zoom, .mnav-close, .icon-btn { will-change: auto; }
.btn .ic, .add-btn .ic, .pd-rel-all .ic, .text-btn .ic, .link-btn .ic { transition: transform .22s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled), .add-btn:hover:not(:disabled) { transform: translateY(-1px); }
  .btn:hover:not(:disabled) .arrow, .btn:hover:not(:disabled) .ic:last-child:not(:first-child) { transform: translateX(3px); }
  .btn:hover:not(:disabled) .ic:first-child:not(:last-child) { transform: scale(1.08); }
  .add-btn:hover:not(:disabled) .ic { transform: rotate(90deg); }
  .btn-outline:hover:not(:disabled), .add-btn:hover:not(:disabled) { box-shadow: 0 10px 22px -16px rgba(0, 0, 0, .9); }
}
/* press: shrink immediately, release eases back */
.btn:active:not(:disabled), .add-btn:active:not(:disabled), .pd-add:active:not(:disabled), .mp-cta:active { transform: scale(.97); transition-duration: 60ms; }
.icon-btn:active, .pd-zoom:active, .pd-rel-nav:active:not(:disabled), .mnav-close:active, .gt-arrow:active { transform: scale(.92); transition-duration: 60ms; }
/* keyboard focus: visible, consistent, not a glow */
.btn:focus-visible, .add-btn:focus-visible, .icon-btn:focus-visible, .goal-tile:focus-visible, .mnav-row:focus-visible, .pd-sw:focus-visible, .pd-thumbs button:focus-visible,
.pd-arrow:focus-visible, .pd-zoom:focus-visible, .pd-rel-nav:focus-visible, .filter:focus-visible, .swatch:focus-visible, .pd-acc button:focus-visible, .mnav-close:focus-visible, .m-cat:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; }
/* add-to-cart success on cards: label swaps to ✓ with a short pop, button tints accent */
.add-btn.done { border-color: var(--accent); color: var(--accent); background: rgba(20, 169, 242, .08); }
.add-btn.done span { animation: cpEnter .26s var(--ease-out) both; }
/* cart icon count bump when something is added */
@keyframes cpBump { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.cart-btn.pulse .count { animation: cpBump .4s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .btn, .add-btn, .pd-add, .btn .ic, .add-btn .ic { transition: none !important; }
  .btn:hover, .add-btn:hover, .btn:active, .add-btn:active { transform: none !important; }
  .add-btn.done span, .cart-btn.pulse .count { animation: none !important; }
}

/* =========================================================
   Page transitions (same-origin navigations: menu, header nav, links)
   Cross-document View Transitions where supported: outgoing page fades + lifts slightly, incoming fades up.
   The header keeps its own name so it stays still instead of flashing. Fallback classes for other browsers.
   ========================================================= */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
@keyframes ptOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes ptIn { from { opacity: 0; transform: translateY(12px); } }
::view-transition-old(root) { animation: ptOut .2s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: ptIn .36s cubic-bezier(.22, 1, .36, 1) both; }
::view-transition-group(site-header) { animation-duration: 0s; }
html.pt-leaving main, html.pt-leaving .site-footer { opacity: 0; transform: translateY(-8px); transition: opacity .2s ease, transform .2s var(--ease-in); }
html.pt-in main { animation: ptIn .36s var(--ease-out) both; }

/* Button refinement: primary gets a soft accent lift on hover, everything presses in slightly */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { box-shadow: 0 12px 26px -16px rgba(20, 169, 242, .6), 0 2px 6px -2px rgba(0, 0, 0, .5); }
  .btn-outline:hover:not(:disabled) { box-shadow: 0 12px 24px -18px rgba(255, 255, 255, .35); }
  .goal-tile:hover .gt-arrow { background: rgba(255, 255, 255, .06); }
}
.btn:active:not(:disabled), .add-btn:active:not(:disabled), .pd-add:active:not(:disabled) { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25); }
.goal-tile:active .gt-arrow { transform: scale(.9); }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  html.pt-leaving main, html.pt-leaving .site-footer { opacity: 1; transform: none; transition: none; }
  html.pt-in main { animation: none; }
}
