/* Paint shop — cream/warm theme variant (overrides shared tokens, keeps gold dominant) */

/* DO NOT INHERIT THE EDITORIAL-WHITE TOKENS — these are the original
   2008 brand swatches preserved for the Painters identity. The site-
   wide palette has cycled twice (Muscat Dusk navy, then Editorial
   White vibrant brand purple), but the Painters page was always
   built on this hot-pink + deep-purple + lemon-gold duo and is
   carved out from every site-wide sweep. Update the values here
   ONLY if the user asks specifically for a Painters refresh. */
body.theme-paper {
  --violet-950: #1a0830;
  --violet-900: #251046;
  --violet-850: #2d1558;
  --violet-800: #3b1f6b;
  --violet-700: #4c2a8a;
  --violet-600: #5e38a6;
  --magenta-700: #8a2370;
  --magenta-600: #b63289;
  --magenta-500: #d1488f;
  --magenta-400: #e668a8;
  --gold-600: #e0b400;
  --gold-500: #f6c90e;
  --gold-400: #ffd447;
  --gold-300: #ffe27a;
  --cream-100: #f6efe0;
  --cream-50: #faf7f0;

  background: var(--cream-50);
  color: var(--ink-900);
}

/* ===== WebGL fluid canvas — paint-in-motion background =====
   `position: fixed; inset: 0` already pins all four edges, so width/
   height are derived from positioning. Using 100vw caused horizontal
   overflow on browsers that include the scrollbar in the viewport
   width unit; 100% is bounded by the containing block instead. */
#fluid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

/* Stack everything above the WebGL fluid canvas (#fluid, z-index:0)
   — except elements that need their own positioning context. We
   exclude:
     - #fluid: stays at z-index:0 as the WebGL background
     - .shop-sticky / .wa-fab: fixed CTAs (must keep position:fixed)
     - .site-header: keeps its own z-index (var(--z-header)=50) so
       the open hamburger menu, which lives inside the header, can
       reliably stack above <main>/<footer> (which receive z-index:1
       below). Without this exception, the header would also drop to
       z-index:1, the menu's stacking context would be capped there,
       and DOM-later <main> would paint over the cream menu backdrop. */
body.theme-paper > *:not(#fluid):not(.shop-sticky):not(.wa-fab):not(.site-header) {
  position: relative;
  z-index: 1;
}

body.theme-paper > .shop-sticky,
body.theme-paper > .wa-fab {
  z-index: 2;
}

.paper-noise {
  position: absolute;
  inset: 0;
  background-image: url("../images/motifs/grain.svg");
  background-size: 200px;
  opacity: 0.16;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

.paint-hero {
  position: relative;
  padding-top: 160px;
  padding-bottom: 100px;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 28%, rgba(246, 201, 14, 0.25) 0%, transparent 60%),
    radial-gradient(circle at 12% 92%, rgba(182, 50, 137, 0.12) 0%, transparent 55%);
  isolation: isolate;
}

.paint-hero__decor {
  position: absolute;
  z-index: 0;
  opacity: 0.85;
  pointer-events: none;
}

.paint-hero__decor--drip {
  top: -20px; left: 5%;
  width: 260px;
}

.paint-hero__decor--splat {
  right: 5%; bottom: 10%;
  width: 320px;
  opacity: 0.6;
  transform: rotate(20deg);
}

.paint-hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  align-items: center;
}

.paint-hero .breadcrumb {
  color: var(--violet-700);
}

.paint-hero .breadcrumb a { color: var(--magenta-600); }
.paint-hero .breadcrumb::before { background: var(--magenta-600); }

.paint-hero h1 {
  font-size: clamp(2.5rem, 8vw, 7rem);
  line-height: 0.9;
  color: var(--violet-950);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.paint-hero h1 .ar {
  display: block;
  font-family: var(--font-arabic);
  font-weight: 900;
  color: var(--magenta-600);
  font-size: 0.88em;
  line-height: 1;
  margin-top: 0.3em;
  text-shadow: 4px 4px 0 var(--gold-400);
  overflow-wrap: anywhere;
}

.paint-hero__lead {
  font-size: var(--fs-20);
  max-width: 52ch;
  color: var(--ink-700);
  margin-bottom: 2rem;
}

.paint-hero__phones {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.paint-hero__phones a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.2rem;
  background: var(--violet-950);
  color: var(--gold-400);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: var(--fs-15);
  letter-spacing: 0.02em;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.paint-hero__phones a:hover {
  transform: translateY(-2px);
  background: var(--violet-900);
}

.paint-hero__stack {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.15;
  max-width: 440px;
  min-height: 420px;
  margin-inline: auto;
}

.can {
  position: absolute;
  left: 0;
  right: 0;
  height: 86px;
  border-radius: 20px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: var(--fs-18);
  letter-spacing: var(--ls-caps);
  color: var(--violet-950);
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur-med) var(--ease-out);
  border: 2px solid rgba(255, 255, 255, 0.55);
}

.can::before {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--can-dot, rgba(255, 255, 255, 0.55));
  flex: none;
  box-shadow:
    inset 0 -6px 10px rgba(0, 0, 0, 0.12),
    inset 0 3px 6px rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* Each can carries its product's actual paint tint in the dot —
   signals "this is what a fresh lid of this product looks like." */
.can--1 { top: 0;    --can-dot: #FFF8D6; background: linear-gradient(135deg, var(--gold-500), var(--gold-400)); transform: rotate(-4deg) translateX(-6%); }
.can--2 { top: 78px; --can-dot: #F8CBA0; background: linear-gradient(135deg, #E37B39, #F2D5B7); transform: rotate(3deg) translateX(5%); }
.can--3 { top: 156px; --can-dot: #C2D4BE; background: linear-gradient(135deg, #486150, #7A8A77); color: var(--paper); transform: rotate(-2deg) translateX(-4%); }
.can--4 { top: 234px; --can-dot: #BCD2E8; background: linear-gradient(135deg, #6E93BF, #384172); color: var(--paper); transform: rotate(4deg) translateX(7%); }
.can--5 { top: 312px; --can-dot: #F2B8DA; background: linear-gradient(135deg, #B63289, #4C2A8A); color: var(--paper); transform: rotate(-3deg) translateX(-5%); }

.paint-hero__stack:hover .can { transform: rotate(0) translateY(-2px); }

/* ============ PRODUCT SECTION ============ */
.products-section {
  padding-block: clamp(4rem, 9vw, 8rem);
  background: var(--paper);
  position: relative;
  overflow: hidden;
}

.products-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg,
    #E37B39 0%, #E37B39 14.2%,
    #486150 14.2%, #486150 28.4%,
    #6E93BF 28.4%, #6E93BF 42.6%,
    #384172 42.6%, #384172 56.8%,
    #8F8286 56.8%, #8F8286 71%,
    #F6C90E 71%, #F6C90E 85.2%,
    #B63289 85.2%, #B63289 100%);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}

.product-card {
  position: relative;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--cream-50);
  border: 1px solid rgba(59, 31, 107, 0.08);
  transition: transform var(--dur-med) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out);
  overflow: hidden;
}

/* .product-card:hover lives in the @media (hover: hover) block at
   the end of the file — keeps the lift off touch devices that would
   otherwise sticky-hover. */

.product-card__num {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--violet-900);
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: var(--fs-12);
  border-radius: 4px;
  letter-spacing: var(--ls-caps);
  margin-bottom: 1rem;
}

.product-card__visual {
  aspect-ratio: 1;
  border-radius: 14px;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
}

.product-card__visual::before {
  content: "";
  position: absolute;
  inset: 20% 20% 20% 20%;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.1);
}

.product-card__visual::after {
  content: "";
  position: absolute;
  inset: 30% 30% 30% 30%;
  background: var(--violet-950);
  border-radius: 50%;
  opacity: 0.08;
}

.product-card--matte .product-card__visual { background: linear-gradient(135deg, #F6C90E, #FFD447); }
.product-card--acrylic .product-card__visual { background: linear-gradient(135deg, #E37B39, #F2D5B7); }
.product-card--primer .product-card__visual { background: linear-gradient(135deg, #8F8286, #C7BBB9); }
.product-card--waterproof .product-card__visual { background: linear-gradient(135deg, #6E93BF, #B8C5E0); }
.product-card--alkyd .product-card__visual { background: linear-gradient(135deg, #3B3C3D, #6D6D71); }

.product-card h3 {
  font-size: var(--fs-18);
  line-height: 1.15;
  color: var(--violet-900);
  margin-bottom: 0.5rem;
  text-transform: none;
  letter-spacing: -0.01em;
}

.product-card p {
  font-size: var(--fs-14);
  color: var(--ink-700);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.spec-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: var(--fs-12);
}

.spec-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(59, 31, 107, 0.12);
}

.spec-list li strong {
  color: var(--magenta-600);
  font-family: var(--font-display);
  font-size: var(--fs-12);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spec-list li span { color: var(--ink-900); font-weight: 600; }

@media (max-width: 1100px) { .products-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .products-grid { grid-template-columns: 1fr; } }

/* ============ SWATCH SECTION ============ */
.swatch-section {
  padding-block: clamp(4rem, 9vw, 8rem);
  background: var(--cream-50);
  position: relative;
}

.swatch-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block: 2rem 3rem;
  padding: 0.6rem;
  background: var(--paper);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(59, 31, 107, 0.1);
  box-shadow: var(--shadow-sm);
}

.chip {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-12);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--violet-900);
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.chip__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--chip-color, var(--violet-900));
  border: 1.5px solid rgba(0, 0, 0, 0.12);
}

/* .chip:hover lives in the @media (hover: hover) block lower down */

.chip.is-active {
  background: var(--violet-950);
  color: var(--gold-400);
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.9rem;
  perspective: 1200px;
}

.swatch {
  --tilt: 0deg;
  --float-dur: 7s;
  --float-delay: 0s;
  --reveal-lag: 0ms;
  position: relative;
  aspect-ratio: 1;
  border-radius: 18px 22px 16px 24px / 22px 16px 24px 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 -8px 18px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 10px 22px -8px rgba(0, 0, 0, 0.18);
  /* Longer, expo-out easing so each swatch visibly "settles" into place
     instead of flashing from small to full size. Timing matches the spec
     in feedback_rtl_bidi + swatch-reveal memories (~780ms per swatch). */
  transition:
    opacity 780ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 780ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 360ms ease,
    border-radius 520ms cubic-bezier(.2, .7, .2, 1);
  transition-delay: var(--reveal-lag);
  transform-origin: center;
  overflow: hidden;
  cursor: pointer;
  display: block;
  opacity: 0;
  /* Gentler start: small Y-lift + subtle scale. Scale delta kept at 0.92
     (not 0.82) so the "small→big" step is not the dominant impression. */
  transform: translateY(14px) scale(0.92);
  animation: swatchFloat var(--float-dur) ease-in-out var(--float-delay) infinite;
  animation-play-state: paused;
  border: none;
}

/* Promote to GPU layer only while the reveal wave is active — removed
   after animationend via the JS, so 157 permanent composite layers are
   not eating memory for nothing. */
.swatch.is-animating {
  will-change: transform, opacity;
}

/* Gloss sheen that sweeps across the swatch face */
.swatch::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 40%,
    rgba(255, 255, 255, 0) 80%
  );
  transform: translateX(-120%);
  transition: transform 620ms cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Paint-drip that runs down on hover */
.swatch::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 22%;
  height: 40%;
  background: inherit;
  border-radius: 50% 50% 40% 40% / 40% 40% 60% 60%;
  transform: translate(-50%, -100%) scale(0.6);
  opacity: 0;
  transition: transform 520ms cubic-bezier(.4, 1.4, .55, 1), opacity 320ms ease;
  pointer-events: none;
  filter: brightness(0.88);
}

.swatch.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(var(--tilt));
  animation-play-state: running;
}

/* :focus-visible only — keyboard navigation feedback. Pointer hover
   feedback lives in the @media (hover: hover) block lower down so it
   doesn't sticky-fire on touch devices. */
.swatch:focus-visible {
  transform: scale(1.12) rotate(calc(var(--tilt) * -1.5)) translateY(-6px);
  border-radius: 24px 14px 26px 16px / 16px 26px 14px 24px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.6),
    inset 0 -10px 22px rgba(0, 0, 0, 0.2),
    0 20px 40px -10px rgba(0, 0, 0, 0.45),
    0 6px 16px -4px rgba(0, 0, 0, 0.25);
  z-index: 3;
  animation-play-state: paused;
}

.swatch:focus-visible::before { transform: translateX(120%); }

.swatch:focus-visible::after {
  opacity: 0.9;
  transform: translate(-50%, 14px) scale(1);
}

/* Click burst — paint splash on click */
.swatch__burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.6;
  animation: swatchBurst 700ms cubic-bezier(.2, .7, .2, 1) forwards;
  mix-blend-mode: screen;
}

@keyframes swatchBurst {
  0%   { transform: translate(-50%, -50%) scale(0);   opacity: 0.7; }
  60%  { transform: translate(-50%, -50%) scale(6);   opacity: 0.3; }
  100% { transform: translate(-50%, -50%) scale(9);   opacity: 0; }
}

@keyframes swatchFloat {
  0%, 100% { transform: translateY(0) rotate(var(--tilt)); }
  50%      { transform: translateY(-5px) rotate(calc(var(--tilt) + 1deg)); }
}

@media (prefers-reduced-motion: reduce) {
  .swatch {
    animation: none;
    transition: opacity 220ms ease;
    transform: none;
    transition-delay: 0ms;
  }
  .swatch.is-revealed { transform: none; }
  .swatch::before, .swatch::after { display: none; }
}

.swatch__hex {
  position: absolute;
  inset: auto 6px 6px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-900);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  backdrop-filter: blur(4px);
}

.swatch:focus-visible .swatch__hex { opacity: 1; }

.swatch[data-dark="true"] .swatch__hex {
  background: rgba(0, 0, 0, 0.7);
  color: var(--paper);
}

.swatch.is-hidden {
  display: none;
}

/* Sticky shop CTA — lifted above the .wa-fab (56×56 desktop, 52×52
   mobile) so the two FABs stack on the same trailing edge instead of
   colliding. RTL flips both elements to the left edge automatically
   (see rtl.css and components.css), so no RTL-specific bottom override
   is needed here. */
.shop-sticky {
  position: fixed;
  right: 1.5rem;
  bottom: calc(1.5rem + 56px + 12px);
  z-index: var(--z-header);
  background: var(--violet-950);
  color: var(--gold-400);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: var(--fs-14);
  box-shadow: var(--shadow-lg);
  transform: translateY(180%);
  transition: transform var(--dur-med) var(--ease-out);
}

.shop-sticky.is-visible { transform: translateY(0); }

.shop-sticky::before {
  content: "";
  width: 10px; height: 10px;
  background: var(--gold-500);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--gold-500);
}

@media (max-width: 640px) {
  .shop-sticky {
    right: 1rem;
    bottom: calc(1rem + 52px + 10px);
    font-size: var(--fs-12);
    padding: 0.7rem 0.9rem;
  }
}

/* Paint hero responsive */
@media (max-width: 1024px) {
  .paint-hero__inner { grid-template-columns: 1fr; }
  .paint-hero__stack { max-width: 360px; margin-top: 2rem; }
}

@media (max-width: 520px) {
  .paint-hero h1 { font-size: clamp(2rem, 13vw, 3rem); }
  .paint-hero h1 .ar { font-size: 0.82em; text-shadow: 2px 2px 0 var(--gold-400); }
  .paint-hero__stack { min-height: 360px; }
  .can { height: 72px; font-size: var(--fs-16); }
  .can--2 { top: 66px; }
  .can--3 { top: 132px; }
  .can--4 { top: 198px; }
  .can--5 { top: 264px; }
  .paint-hero .breadcrumb { flex-wrap: wrap; }
}

/* Override footer + header for paper theme */
body.theme-paper .site-footer { background: var(--violet-950); color: rgba(255, 255, 255, 0.75); }

/* ============================================================
   MOBILE SUPPORT — paint shop
   Phase 3 of the mobile audit. The 157-swatch reveal animation
   stays exactly as the swatch-reveal spec demands (780ms / row+col
   stagger): we only adjust column count, padding, and visibility
   of touch-only affordances. No timing changes.
   ============================================================ */

/* 3.1 — Swatch grid: shrink minmax floor on small phones so we get
   3-5 columns instead of 2 on iPhone SE. */
@media (max-width: 480px) {
  .swatch-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 0.6rem;
  }
}

@media (max-width: 360px) {
  .swatch-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 0.5rem;
  }
}

/* 3.2 — Hex labels: show by default on touch (where :hover never
   fires). 11px keeps it legible on high-DPI displays. */
@media (hover: none) {
  .swatch__hex {
    opacity: 1;
    font-size: 11px;
  }
}

/* 3.3 — Hero padding: cut top spacing in half on small phones so
   the headline + CTAs are visible above the fold. */
@media (max-width: 520px) {
  .paint-hero {
    padding-top: 110px;
    padding-bottom: 60px;
  }
}

/* 3.4 — Hover-only swatch effects (paint drip + gloss sheen) are
   now hover-gated. Touch users get an :active scale-down for tap
   feedback. :focus-visible kept outside the media query so keyboard
   users still see the lift. */
@media (hover: hover) {
  .swatch:hover {
    transform: scale(1.12) rotate(calc(var(--tilt) * -1.5)) translateY(-6px);
    border-radius: 24px 14px 26px 16px / 16px 26px 14px 24px;
    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.6),
      inset 0 -10px 22px rgba(0, 0, 0, 0.2),
      0 20px 40px -10px rgba(0, 0, 0, 0.45),
      0 6px 16px -4px rgba(0, 0, 0, 0.25);
    z-index: 3;
    animation-play-state: paused;
  }
  .swatch:hover::before { transform: translateX(120%); }
  .swatch:hover::after { opacity: 0.9; transform: translate(-50%, 14px) scale(1); }
  .swatch:hover .swatch__hex { opacity: 1; }
}

@media (hover: none) {
  .swatch:active {
    transform: scale(0.96);
    transition: transform 120ms ease;
  }
}

/* Touch feedback for product cards + filter chips (mirror of the
   desktop hover state). */
@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
  }
  .chip:hover { background: rgba(59, 31, 107, 0.06); }
}

@media (hover: none) {
  .product-card:active { transform: translateY(-2px); transition: transform 120ms ease; }
  .chip:active { background: rgba(59, 31, 107, 0.12); }
}

/* 3.5 — Hero cans tightening at 360px so the absolutely-positioned
   stack does not overflow on the smallest Android phones. */
@media (max-width: 360px) {
  .paint-hero__stack {
    min-height: 320px;
    max-width: 280px;
  }
  .can {
    height: 64px;
    font-size: var(--fs-14);
    padding: 0 1rem;
  }
  .can--2 { top: 58px; }
  .can--3 { top: 116px; }
  .can--4 { top: 174px; }
  .can--5 { top: 232px; }
}
