/* ==========================================================================
   REVCENDIA — UTILITIES
   Animation primitives (driven by main.js via IntersectionObserver) and
   small structural helpers. Subtle only, per brand direction — no scale
   transforms beyond hover elevation, no bounce, no spin.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SCROLL REVEAL (fade + slide)
   Elements start in a hidden state and are revealed by main.js adding
   .is-visible when they enter the viewport. Pure-CSS fallback: if JS
   fails to load, .no-js on <html> keeps everything visible.
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
  will-change: opacity, transform;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal="fade"] {
  transform: none;
}

[data-reveal="slide-left"] {
  transform: translateX(-32px);
}

[data-reveal="slide-left"].is-visible {
  transform: translateX(0);
}

[data-reveal="slide-right"] {
  transform: translateX(32px);
}

[data-reveal="slide-right"].is-visible {
  transform: translateX(0);
}

/* Staggered children reveal — apply [data-reveal-group] to a parent and
   [data-reveal] to its direct children; main.js assigns incremental
   transition-delay via inline style based on DOM order. */
[data-reveal-group] > [data-reveal] {
  transition-delay: var(--reveal-delay, 0ms);
}

html.no-js [data-reveal] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   2. PARALLAX (very low intensity)
   Applied via main.js to elements with [data-parallax]; JS sets
   transform: translateY() on scroll using requestAnimationFrame,
   clamped to a small pixel range so the effect stays understated.
   -------------------------------------------------------------------------- */
[data-parallax] {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  [data-parallax] {
    transform: none !important;
  }
}

/* --------------------------------------------------------------------------
   3. HOVER ELEVATION
   -------------------------------------------------------------------------- */
.elevate {
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.elevate:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   4. ANIMATED COUNTERS
   main.js swaps the text content of [data-counter] from 0 to its
   target value when scrolled into view. No layout shift: element
   reserves its final width via tabular-nums.
   -------------------------------------------------------------------------- */
[data-counter] {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   5. TEXT HELPERS
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-muted { color: var(--color-body); }
.text-white { color: #FFFFFF; }
.text-balance { text-wrap: balance; }

.eyebrow-plain {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-body);
}

/* --------------------------------------------------------------------------
   6. SPACING HELPERS
   -------------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }
.mt-9 { margin-top: var(--space-9); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

/* --------------------------------------------------------------------------
   7. DIVIDER
   -------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background-color: var(--color-border);
  border: none;
  margin-block: var(--space-9);
}

.divider--dark {
  background-color: var(--color-white-12);
}

/* --------------------------------------------------------------------------
   8. ASPECT-RATIO IMAGE FRAME
   Used for editorial imagery (architecture, abstract, portraits) so
   layout never shifts while images load.
   -------------------------------------------------------------------------- */
.frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--color-section);
}

.frame--portrait { aspect-ratio: 4 / 5; }
.frame--landscape { aspect-ratio: 16 / 10; }
.frame--square { aspect-ratio: 1 / 1; }
.frame--wide { aspect-ratio: 21 / 9; }

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   9. BACK-TO-TOP
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard),
              visibility var(--duration-base);
  z-index: var(--z-header);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 640px) {
  .back-to-top {
    right: var(--space-4);
    bottom: var(--space-4);
  }
}
