/* ==========================================================================
   Vitarythm — Shared CSS: Design Tokens, Base Styles, Animations
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties — Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-cream: #FDF9F6;
  --color-blush: #FEF4F0;
  --color-sage: #7A9E7E;
  --color-sage-dark: #5B7A5E;
  --color-peach: #F4A261;
  --color-coral: #E8846B;
  --color-charcoal: #2D2A26;
  --color-charcoal-muted: #7A756F;
  --color-lavender: #C7B8D4;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Animation Timing */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 0.2s;
  --duration-base: 0.3s;
  --duration-slow: 0.5s;
  --duration-reveal: 0.6s;
}

/* --------------------------------------------------------------------------
   2. Base Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   3. Scroll Reveal Animations
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
}

.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    transition: all var(--duration-reveal) var(--ease-smooth);
  }

  .reveal.active {
    opacity: 1;
    transform: translateY(0);
  }

  .reveal-left {
    transition: all var(--duration-reveal) var(--ease-smooth);
  }

  .reveal-left.active {
    opacity: 1;
    transform: translateX(0);
  }

  .reveal-right {
    transition: all var(--duration-reveal) var(--ease-smooth);
  }

  .reveal-right.active {
    opacity: 1;
    transform: translateX(0);
  }

  .stagger-children > * {
    transition: all 0.5s var(--ease-smooth);
  }

  .stagger-children.active > *:nth-child(1) { transition-delay: 0.1s; }
  .stagger-children.active > *:nth-child(2) { transition-delay: 0.18s; }
  .stagger-children.active > *:nth-child(3) { transition-delay: 0.26s; }
  .stagger-children.active > *:nth-child(4) { transition-delay: 0.34s; }
  .stagger-children.active > *:nth-child(5) { transition-delay: 0.42s; }
  .stagger-children.active > *:nth-child(6) { transition-delay: 0.5s; }
  .stagger-children.active > *:nth-child(7) { transition-delay: 0.58s; }
  .stagger-children.active > *:nth-child(8) { transition-delay: 0.66s; }
  .stagger-children.active > *:nth-child(9) { transition-delay: 0.74s; }
  .stagger-children.active > *:nth-child(10) { transition-delay: 0.82s; }
  .stagger-children.active > *:nth-child(11) { transition-delay: 0.9s; }
  .stagger-children.active > *:nth-child(12) { transition-delay: 0.98s; }

  .stagger-children.active > * {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stagger-children > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   4. Floating Animation
   -------------------------------------------------------------------------- */
@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-12px) rotate(2deg);
  }
  66% {
    transform: translateY(-6px) rotate(-1deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .float {
    animation: float 6s var(--ease-smooth) infinite;
  }

  .float-delay-1 {
    animation-delay: 1s;
  }

  .float-delay-2 {
    animation-delay: 2s;
  }

  .float-delay-3 {
    animation-delay: 3s;
  }

  .float-delay-4 {
    animation-delay: 4s;
  }
}

/* --------------------------------------------------------------------------
   5. Nav Scroll Effect
   -------------------------------------------------------------------------- */
.nav-scrolled {
  background: rgba(253, 249, 246, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------------------------------
   6. Button Styles
   -------------------------------------------------------------------------- */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-smooth);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transition: left var(--duration-slow) var(--ease-smooth);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 24px -8px rgba(122, 158, 126, 0.4);
}

/* --------------------------------------------------------------------------
   7. Card Hover Styles
   -------------------------------------------------------------------------- */
.product-card,
.article-card {
  transition: all var(--duration-base) var(--ease-smooth);
}

.product-card:hover,
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   8. Grain Texture
   -------------------------------------------------------------------------- */
.grain::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.015;
  pointer-events: none;
  z-index: 1000;
}

/* --------------------------------------------------------------------------
   9. Section Spacing
   -------------------------------------------------------------------------- */
.section-pad {
  padding-top: 7rem;    /* 112px */
  padding-bottom: 7rem; /* 112px */
}

/* --------------------------------------------------------------------------
   10. Line Clamp
   -------------------------------------------------------------------------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   11. Body / Typography Defaults
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  background-color: var(--color-cream);
  color: var(--color-charcoal);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-charcoal);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

a {
  color: var(--color-sage-dark);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
}

a:hover {
  color: var(--color-sage);
}
