/* ============================================
   ENRICHMENTS CSS
   Visual polish layer — optional per site.
   Loaded between base.css and theme.css.
   Uses data-enrich attribute for composition.
   ============================================ */

/* --- A. Grain/Noise Texture Overlay --- */
/* CSS-only noise via SVG data URI — no image file needed */
[data-enrich~="grain"] {
  position: relative;
}
[data-enrich~="grain"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  mix-blend-mode: multiply;
}
/* Avoid stacking conflicts with data-bg and data-divider pseudo-elements */
[data-enrich~="grain"][data-bg]::after,
[data-enrich~="grain"][data-divider]::after {
  /* Let bg/divider keep their pseudo-elements; grain uses a wrapper approach */
}

/* Dark sections: lighten the blend so it still reads */
.section--dark[data-enrich~="grain"]::after,
.section--accent[data-enrich~="grain"]::after {
  mix-blend-mode: soft-light;
  opacity: 0.04;
}


/* --- B. Section Vignette/Glow --- */
/* Soft radial gradient spotlight behind focal content */
[data-enrich~="glow"] {
  position: relative;
}
[data-enrich~="glow"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse at center,
    var(--color-primary, #2563eb) 0%,
    transparent 70%
  );
  opacity: 0.06;
}
/* Boost glow visibility on dark sections */
.section--dark[data-enrich~="glow"]::before,
.section--accent[data-enrich~="glow"]::before {
  opacity: 0.08;
}


/* --- C. Fixed Diagonal Pattern --- */
/* Tailwind-style fixed background — content scrolls over the pattern */
[data-enrich~="diagonal"] {
  position: relative;
}
[data-enrich~="diagonal"]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(0, 0, 0, 0.015) 8px,
    rgba(0, 0, 0, 0.015) 9px
  );
  background-attachment: fixed;
  background-size: 100% 100%;
}
/* Dark sections: use white stripes */
.section--dark[data-enrich~="diagonal"]::before,
.section--accent[data-enrich~="diagonal"]::before {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(255, 255, 255, 0.02) 8px,
    rgba(255, 255, 255, 0.02) 9px
  );
}


/* --- D. Hairline Section Borders --- */
/* Ultra-subtle 1px dividers between sections — alternative to shape dividers */
[data-enrich~="hairline"] {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.section--dark[data-enrich~="hairline"] {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.section--accent[data-enrich~="hairline"] {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}


/* --- E. Section Spacing Enhancement --- */
/* Generous padding for a premium, airy feel */
[data-enrich~="spacious"] {
  --section-padding: 7rem;
}
@media (max-width: 768px) {
  [data-enrich~="spacious"] {
    --section-padding: 4.5rem;
  }
}


/* --- F. Balanced Text Wrap on Headings --- */
h1, h2, h3 {
  text-wrap: balance;
}


/* --- G. Brand-Tinted Shadow Variables --- */
/* Override shadow tokens with brand-tinted versions.
   Sites define --color-primary-rgb in theme.css (e.g. "37, 99, 235")
   to enable these. Falls back to neutral if not set. */
:root {
  --shadow-brand-color: rgba(var(--color-primary-rgb, 0, 0, 0), 0.08);
  --shadow-brand-sm:    0 1px 3px var(--shadow-brand-color);
  --shadow-brand-md:    0 4px 12px var(--shadow-brand-color);
  --shadow-brand-lg:    0 8px 24px var(--shadow-brand-color);
  --shadow-brand-hover: 0 8px 24px rgba(var(--color-primary-rgb, 0, 0, 0), 0.12);
}


/* --- H. Label Line Accent --- */
/* "— SECTION LABEL" pattern: thin line before .label text */
.label::before {
  content: '';
  display: inline-block;
  width: 30px;
  height: 2px;
  background: currentColor;
  vertical-align: middle;
  margin-right: 0.75rem;
}


/* --- I. Heading Underline Accent --- */
/* Opt-in via data-enrich="underline" on a section or parent */
[data-enrich~="underline"] h2::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--color-primary);
  margin-top: 1rem;
  border-radius: 2px;
}
[data-enrich~="underline"] .text-center h2::after,
[data-enrich~="underline"] h2.text-center::after {
  margin-left: auto;
  margin-right: auto;
}


/* --- J. Smooth Reveal Animations --- */
/* Directional scroll-reveal classes — triggered by IntersectionObserver adding .revealed */
.reveal-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-right {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
  opacity: 1;
  transform: none;
}

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


/* --- K. Stagger Delay System --- */
/* Add data-stagger to a grid/flex parent to cascade child entrance */
[data-stagger] > *:nth-child(1) { transition-delay: 0s; }
[data-stagger] > *:nth-child(2) { transition-delay: 0.05s; }
[data-stagger] > *:nth-child(3) { transition-delay: 0.1s; }
[data-stagger] > *:nth-child(4) { transition-delay: 0.15s; }
[data-stagger] > *:nth-child(5) { transition-delay: 0.2s; }
[data-stagger] > *:nth-child(6) { transition-delay: 0.25s; }
[data-stagger] > *:nth-child(7) { transition-delay: 0.3s; }
[data-stagger] > *:nth-child(8) { transition-delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  [data-stagger] > * {
    transition-delay: 0s !important;
  }
}


/* --- L. Image Reveal Effect --- */
/* Clip-path wipe from left when scrolled into view */
.img-reveal {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.img-reveal.revealed {
  clip-path: inset(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  .img-reveal {
    clip-path: none;
    transition: none;
  }
}


/* --- M. CTA Breathing Animation --- */
/* Subtle shadow pulse on primary buttons — gated behind motion preference */
@keyframes cta-breathe {
  0%, 100% { box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, 0, 0, 0), 0.15); }
  50% { box-shadow: 0 4px 20px rgba(var(--color-primary-rgb, 0, 0, 0), 0.3); }
}

@media (prefers-reduced-motion: no-preference) {
  .btn--primary {
    animation: cta-breathe 3s ease-in-out infinite;
  }
  /* Pause animation on hover so it doesn't fight with hover transforms */
  .btn--primary:hover {
    animation-play-state: paused;
  }
}


/* --- N. Separator Dot Utility --- */
/* Centered dot between inline items: <span class="sep-dot">text</span> */
.sep-dot::before {
  content: '\00B7';
  margin: 0 0.75rem;
  color: var(--color-text-muted, #94a3b8);
}


/* --- O. Stat Number Formatting --- */
/* Tighter tracking and tabular figures for large stat numbers */
.stat__number {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}


/* --- Print: hide decorative enrichments --- */
@media print {
  [data-enrich~="grain"]::after,
  [data-enrich~="glow"]::before,
  [data-enrich~="diagonal"]::before {
    display: none !important;
  }
  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
  .img-reveal {
    clip-path: none;
  }
  .btn--primary {
    animation: none;
  }
}
