/* 
 * Sara Cookies - Custom Premium Styling & Transitions
 * Extends Tailwind CSS with custom fonts, paper grain textures, and custom keyframes.
 */

:root {
  --color-chocolate: #2e211b;
  --color-cream: #eae0c7;
  --font-dynapuff: 'DynaPuff', cursive, sans-serif;
  --font-body: 'DynaPuff', cursive, sans-serif;
}

/* Base resets & typography */
body {
  font-family: var(--font-body);
  background-color: var(--color-cream);
  color: var(--color-chocolate);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Typography Classes */
.font-dynapuff {
  font-family: var(--font-dynapuff);
}

.font-body {
  font-family: var(--font-body);
}

/* Premium Artisan Paper Grain Overlay */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Organic Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--color-chocolate);
  border-radius: 5px;
  border: 2px solid var(--color-cream);
}

::-webkit-scrollbar-thumb:hover {
  background: #47332a;
}

/* Interactive Floating Cookie Animation */
@keyframes float {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(2deg);
  }
  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

/* Subtle Shadow Overlay for Three.js Canvas */
.cookie-shadow {
  background: radial-gradient(ellipse at center, rgba(46, 33, 27, 0.18) 0%, rgba(46, 33, 27, 0) 70%);
  transition: all 0.5s ease;
}

/* Organic blobs for background decoration */
.organic-blob {
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  animation: morphBlob 16s ease-in-out infinite alternate;
  filter: blur(40px);
  opacity: 0.15;
  mix-blend-mode: multiply;
  transition: background-color 1s ease-in-out;
}

@keyframes morphBlob {
  0% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  }
  50% {
    border-radius: 60% 40% 50% 50% / 50% 60% 40% 60%;
  }
  100% {
    border-radius: 45% 55% 60% 40% / 40% 45% 55% 60%;
  }
}

/* Custom interactive outline buttons */
.btn-premium-outline {
  border: 2px solid var(--color-chocolate);
  color: var(--color-chocolate);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-premium-outline:hover {
  background-color: var(--color-chocolate);
  color: var(--color-cream);
  transform: translateY(-2px) scale(1.02);
}

.btn-premium-fill {
  background-color: var(--color-chocolate);
  color: var(--color-cream);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-premium-fill:hover {
  background-color: #47332a;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 20px rgba(46, 33, 27, 0.15);
}

/* Three.js viewport styles */
#cookie-canvas {
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
}

#cookie-canvas:active {
  cursor: grabbing;
}

/* RTL Helpers for arabic direction */
[dir="rtl"] .rtl-flip {
  transform: scaleX(-1);
}

/* Smooth Product Card transitions (used by filter JS) */
.product-card {
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

/* Scroll reveal fade-in-up animation for sections */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}
