/* =========================================================================
   CB Center Baghdad — premium polish layer (animations + image fit).
   Purely visual, additive. Does not touch layout, logic, or data.
   ========================================================================= */

/* crisper rendering everywhere */
* { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html { scroll-behavior: smooth; }
img { image-rendering: auto; }

/* ---- scroll reveal (elements tagged by cb-anim.js) ---- */
.cb-reveal { opacity: 0; transform: translateY(24px); }
.cb-reveal.cb-in {
  opacity: 1; transform: none;
  transition: opacity .65s cubic-bezier(.22,1,.36,1), transform .65s cubic-bezier(.22,1,.36,1);
}
@media (prefers-reduced-motion: reduce) {
  .cb-reveal, .cb-reveal.cb-in { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---- product cards: refined hover lift + image zoom ---- */
[data-cb-id] {
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease, border-color .3s ease !important;
  will-change: transform;
}
[data-cb-id]:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 20px 44px rgba(0,0,0,.13) !important;
  border-color: #ffd9bd !important;
}
/* clip the zoom to the image frame (first child = the image/hero area) */
[data-cb-id] > div:first-child { overflow: hidden; }
[data-cb-id] img { transition: transform .55s cubic-bezier(.22,1,.36,1); will-change: transform; }
[data-cb-id]:hover img { transform: scale(1.07); }
/* the cover-fill product image must sit behind the discount badge + fav heart */
[data-cb-id] > div:first-child > span:first-child,
[data-cb-id] > div:first-child > button { z-index: 3; }

/* ---- category & brand cards: inner image zoom (lift handled by the
       template's existing hover) ---- */
.cb-tilt { overflow: hidden; }
.cb-tilt img { transition: transform .55s cubic-bezier(.22,1,.36,1); }
.cb-tilt:hover img { transform: scale(1.06); }

/* ---- buttons: subtle, premium feedback ---- */
button { transition: transform .12s ease, background-color .22s ease, color .22s ease, box-shadow .22s ease, border-color .22s ease; }
button:active { transform: scale(.97); }

/* ---- image loading shimmer (the "refresh" feel) ---- */
@keyframes cbShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.cb-imgwrap { position: relative; }
.cb-imgwrap::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(100deg, #f1f1f4 30%, #fafafa 50%, #f1f1f4 70%);
  background-size: 200% 100%; animation: cbShimmer 1.5s ease-in-out infinite; opacity: 1;
  transition: opacity .4s ease; pointer-events: none; z-index: 0;
}
.cb-imgwrap.cb-loaded::before { opacity: 0; }
.cb-imgwrap > * { position: relative; z-index: 1; }

/* ---- gentle entrance for the modal sheets / overlays ---- */
.cb-pd, .cb-modal { animation: cbPop .34s cubic-bezier(.22,1,.36,1); }
@keyframes cbPop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* =========================================================================
   Modernization layer (2026) — softer neutrals, gentle depth, refined
   typography. Additive & non-structural; reliable selectors only.
   ========================================================================= */

/* refined page canvas + text rendering (cards now read as floating on a soft
   off-white, instead of white-on-white) */
body {
  background: #fbfbfc;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* confident, tighter headings (Cairo carries -ve tracking well) */
h1, h2, h3, h4 { letter-spacing: -0.012em; }
h1 { letter-spacing: -0.022em; }

/* warm accent selection + accessible focus rings */
::selection { background: rgba(255,106,0,.16); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(255,106,0,.5);
  outline-offset: 2px;
  border-radius: 9px;
}

/* slim, modern scrollbar */
* { scrollbar-width: thin; scrollbar-color: #d7d7df transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb {
  background: #d7d7df; border-radius: 99px;
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #bfbfca; }

/* product cards — soft resting depth + refined border (the core "premium" cue) */
[data-cb-id] {
  box-shadow: 0 1px 2px rgba(16,16,22,.045), 0 10px 26px rgba(16,16,22,.05);
  border-color: #ececf1 !important;
}

/* category / brand tiles — match the cards' gentle resting depth */
.cb-tilt {
  box-shadow: 0 1px 2px rgba(16,16,22,.04), 0 8px 22px rgba(16,16,22,.045);
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease, border-color .3s ease;
}
.cb-tilt:hover { box-shadow: 0 14px 32px rgba(16,16,22,.1); }

/* form fields — calm focus ring + smooth transitions */
input, select, textarea { transition: border-color .18s ease, box-shadow .18s ease; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(255,106,0,.12); }

/* =========================================================================
   Section structure — consistent rhythm + a delicate divider opening each
   content section (border-top is grid/flex-safe; a ::before would become a
   grid item and break layout).
   ========================================================================= */
.cb-sec {
  margin-top: 14px !important;
  padding-top: 52px !important;
  border-top: 1px solid #eeeef3 !important;
}
/* hero / first section — keep its original tight spacing, no divider */
.cb-sec.cb-sec-first { margin-top: 24px !important; padding-top: 0 !important; border-top: 0 !important; }
/* refined, confident section titles */
.cb-sec h2 { letter-spacing: -0.022em; }

/* =========================================================================
   HERO — animated accessory showcase: floating tiles, a spinning cooling fan,
   pulsing glow on the accent pieces, a drifting cluster + ambient light.
   ========================================================================= */
.cb-hero-cluster { perspective: 1100px; transition: transform .45s cubic-bezier(.22,1,.36,1); }
.cb-hero-grid { position: relative; z-index: 1; animation: cbHeroDrift 11s ease-in-out infinite; }
@keyframes cbHeroDrift {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(-2.4deg) translateY(-8px); }
}

/* soft drifting ambient glows behind the cluster (clipped by the hero's overflow) */
.cb-hero-cluster::before, .cb-hero-cluster::after {
  content: ""; position: absolute; border-radius: 50%; z-index: 0; pointer-events: none; filter: blur(22px);
}
.cb-hero-cluster::before {
  width: 160px; height: 160px; top: 12%; left: 6%;
  background: radial-gradient(circle, rgba(255,106,0,.36), transparent 68%);
  animation: cbAmbient 7.5s ease-in-out infinite;
}
.cb-hero-cluster::after {
  width: 120px; height: 120px; bottom: 10%; right: 10%;
  background: radial-gradient(circle, rgba(255,160,70,.26), transparent 68%);
  animation: cbAmbient 9.5s ease-in-out infinite reverse;
}
@keyframes cbAmbient {
  0%, 100% { transform: translate(0,0) scale(1); opacity: .75; }
  50%      { transform: translate(18px,-20px) scale(1.15); opacity: 1; }
}

/* each accessory tile floats with its own organic timing */
.cb-hero-tile { will-change: transform; animation: cbFloat 6s ease-in-out infinite; }
.cb-ht-1 { animation-duration: 6.7s; animation-delay: 0s; }
.cb-ht-2 { animation-duration: 5.2s; animation-delay: .7s; }
.cb-ht-3 { animation-duration: 7.3s; animation-delay: .35s; }
.cb-ht-4 { animation-duration: 5.9s; animation-delay: 1s; }
@keyframes cbFloat {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-14px) rotate(.7deg); }
}

/* the accent pieces (graphics card + fan) breathe a warm glow */
.cb-ht-glow { animation-name: cbFloat, cbTileGlow; }
@keyframes cbTileGlow {
  0%, 100% { box-shadow: 0 0 36px rgba(255,106,0,.12) inset, 0 8px 22px rgba(0,0,0,.22); border-color: rgba(255,138,60,.25); }
  50%      { box-shadow: 0 0 56px rgba(255,106,0,.26) inset, 0 16px 42px rgba(255,90,0,.3); border-color: rgba(255,160,80,.6); }
}

/* the cooling fan actually spins */
.cb-hero-fan { transform-origin: 50% 50%; animation: cbSpin 5.5s linear infinite; }
@keyframes cbSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .cb-hero-cluster::before, .cb-hero-cluster::after,
  .cb-hero-grid, .cb-hero-tile, .cb-hero-fan { animation: none !important; }
}
