/* =========================================================================
   Nanuca — Visual Enhancement Layer (non-destructive)
   Layers texture, depth, glow and cinematic motion on top of the base site.
   Every effect is gated behind a body class so it can be toggled live.
   Brand-faithful: warm greens + vanilla cream only.
   ========================================================================= */

:root {
  --fx-intensity: 1;            /* global motion multiplier, set by panel */
  --fx-grain-opacity: 0.05;
  --fx-glow: 74, 155, 115;      /* --green-500 rgb */
  --fx-cream: 255, 248, 232;
}

@media (prefers-reduced-motion: reduce) {
  :root { --fx-intensity: 0; }
  /* --fx-intensity only zeroes the tilt; stop the float outright too. */
  .fx-hero .hero-brand-mark:not(.fx-tilting) { animation: none; }
}

/* -------------------------------------------------------------------------
   1. FILM GRAIN + AMBIENT TEXTURE  (body.fx-grain)
   A fixed fractal-noise veil over the whole page + a slow warm light wash.
   ------------------------------------------------------------------------- */
.fx-grain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: var(--fx-grain-opacity);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: fxGrainShift 6s steps(5) infinite;
}
@keyframes fxGrainShift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* A breathing ambient light wash behind everything — gives the page depth. */
.fx-grain::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 18% 12%, rgba(var(--fx-glow), 0.16), transparent 70%),
    radial-gradient(45% 40% at 85% 88%, rgba(214, 184, 122, 0.14), transparent 72%);
  filter: blur(8px);
  animation: fxAmbientDrift calc(26s / max(var(--fx-intensity), 0.25)) ease-in-out infinite alternate;
}
@keyframes fxAmbientDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.08); }
}

/* -------------------------------------------------------------------------
   2. HERO — SPOTLIGHT, DEPTH, LEVITATION  (body.fx-hero)
   ------------------------------------------------------------------------- */

/* Cursor-tracked spotlight behind the logo card. Falls back to centered. */
.fx-hero .hero-brand-stage {
  --mx: 50%;
  --my: 42%;
}
.fx-hero .hero-brand-stage::before {
  content: "";
  position: absolute;
  inset: -6% -10%;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    circle at var(--mx) var(--my),
    rgba(var(--fx-glow), 0.42),
    rgba(var(--fx-glow), 0.12) 32%,
    transparent 62%
  );
  filter: blur(14px);
  transition: background-position 0.18s ease-out;
  animation: fxHaloPulse calc(7s / max(var(--fx-intensity), 0.3)) ease-in-out infinite;
}
@keyframes fxHaloPulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.05); }
}

/* The logo mark parallax-tilts toward the cursor (vars set by JS). When idle it
   uses the SAME float as the products showcase — productFeatureFloat, defined in
   styles.css. The cursor tilt adds .fx-tilting, which pauses the float and lets
   the var-based transform take over; releasing resumes the float. */
.fx-hero .hero-brand-mark {
  transform:
    perspective(1100px)
    rotateX(calc(var(--tilt-x, 0deg) * var(--fx-intensity)))
    rotateY(calc(var(--tilt-y, 0deg) * var(--fx-intensity)));
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.fx-hero .hero-brand-mark:not(.fx-tilting) {
  animation: productFeatureFloat 7s ease-in-out infinite;
}

/* Caption pills float at a different depth for a layered parallax read. */
.fx-hero .hero-brand-caption {
  transform: translateZ(40px) translate(
    calc(var(--par-x, 0px) * 1.6),
    calc(var(--par-y, 0px) * 1.6)
  );
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Periodic gloss sweep across the logo card. */
.fx-hero .hero-brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.55) 48%,
    rgba(255, 255, 255, 0.0) 60%
  );
  background-size: 280% 100%;
  background-position: 180% 0;
  mix-blend-mode: soft-light;
  animation: fxSheen 7.5s ease-in-out infinite;
  animation-delay: 1.5s;
}
@keyframes fxSheen {
  0%, 62%, 100% { background-position: 180% 0; }
  78%           { background-position: -60% 0; }
}

/* Vignette + warm floor glow on the hero for cinematic depth. */
.fx-hero .hero {
  overflow: hidden;
}
.fx-hero .hero .hero-overlay {
  box-shadow:
    inset 0 -120px 120px -60px rgba(31, 74, 52, 0.18),
    inset 0 80px 90px -60px rgba(255, 248, 232, 0.5);
}

/* Floating particle canvas sits behind hero content, above background art. */
.fx-particles-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* -------------------------------------------------------------------------
   3. CINEMATIC IMAGERY — Ken Burns + sheen + depth  (body.fx-imagery)
   Applies to carousel, products visual reel and catalog showcase.
   ------------------------------------------------------------------------- */

/* Slow Ken Burns drift on whatever slide is currently active. */
.fx-imagery .carousel-slide.active img {
  animation: fxKenBurns calc(11s / max(var(--fx-intensity), 0.4)) ease-out forwards;
  transform-origin: var(--kb-origin, 60% 40%);
}
.fx-imagery .products-visual-slide.is-active img {
  animation: fxKenBurnsSoft calc(12s / max(var(--fx-intensity), 0.4)) ease-out forwards;
}
@keyframes fxKenBurns {
  0%   { transform: scale(1.02); }
  100% { transform: scale(1.14); }
}
@keyframes fxKenBurnsSoft {
  0%   { transform: scale(1.03) translateY(0); }
  100% { transform: scale(1.12) translateY(-2%); }
}

/* Readability + depth: darken the foot of every image frame, lift the frame. */
.fx-imagery .carousel-viewport::after,
.fx-imagery .products-visual-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(20, 46, 32, 0.42) 0%,
    rgba(20, 46, 32, 0.06) 26%,
    transparent 48%
  );
  border-radius: inherit;
}
.fx-imagery .carousel-frame,
.fx-imagery .products-visual-reel {
  box-shadow:
    0 36px 70px -32px rgba(31, 74, 52, 0.45),
    0 8px 24px -12px rgba(31, 74, 52, 0.3);
}

/* Glancing light sweep across the carousel frame, looped slowly. */
.fx-imagery .carousel-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 40%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 60%
  );
  background-size: 220% 100%;
  background-position: 160% 0;
  mix-blend-mode: overlay;
  animation: fxFrameSweep 9s ease-in-out infinite;
}
@keyframes fxFrameSweep {
  0%, 70%, 100% { background-position: 160% 0; }
  85%           { background-position: -40% 0; }
}

/* Catalog showcase image: gentle continuous breathing zoom. */
.fx-imagery .products-showcase-feature img {
  animation: fxKenBurnsSoft 14s ease-in-out infinite alternate;
}

/* -------------------------------------------------------------------------
   4. RICHER CARD + REVEAL MOTION  (body.fx-cards)
   ------------------------------------------------------------------------- */

/* Product cards: lift higher with a colored glow + animated gradient sheen. */
.fx-cards .product-card {
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease;
}
.fx-cards .product-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    transparent 38%,
    rgba(var(--fx-cream), 0.5) 50%,
    transparent 62%
  );
  background-size: 240% 100%;
  background-position: 170% 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fx-cards .product-card:hover {
  transform: translateY(-10px) scale(1.012);
  box-shadow:
    0 30px 55px -24px rgba(31, 74, 52, 0.4),
    0 0 0 1px rgba(var(--fx-glow), 0.25),
    0 0 34px -6px rgba(var(--fx-glow), 0.3);
}
.fx-cards .product-card:hover::after {
  opacity: 1;
  animation: fxCardSheen 0.9s ease-out;
}
@keyframes fxCardSheen {
  from { background-position: 170% 0; }
  to   { background-position: -70% 0; }
}

/* Client cards + business bridge links pick up the same lift language. */
.fx-cards .client-card {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}
.fx-cards .client-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 26px 48px -22px rgba(31, 74, 52, 0.38);
}
.fx-cards .business-bridge-link {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}
.fx-cards .business-bridge-link:hover {
  transform: translateY(-5px);
}

/* Reveal-on-scroll gets a touch more travel + a blur-in for richness. */
.fx-cards .reveal {
  filter: blur(6px);
  transition:
    opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.fx-cards .reveal.is-visible {
  filter: blur(0);
}

/* Marquee picks up a soft fade at both edges so it reads as continuous. */
.fx-grain .marquee-band {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

/* -------------------------------------------------------------------------
   5. CONTROL PANEL  (always available; brand-faithful)
   ------------------------------------------------------------------------- */
.fx-toggle {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 9500;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 232, 0.5);
  background: linear-gradient(150deg, var(--green-700, #2f6b4d), var(--green-900, #1f4a34));
  color: rgba(255, 248, 232, 0.95);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 30px -10px rgba(31, 74, 52, 0.55);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}
.fx-toggle:hover {
  transform: translateY(-3px) rotate(-8deg) scale(1.05);
  box-shadow: 0 20px 38px -10px rgba(31, 74, 52, 0.6);
}
.fx-toggle svg { width: 24px; height: 24px; }

.fx-panel {
  position: fixed;
  left: 22px;
  bottom: 86px;
  z-index: 9500;
  width: 290px;
  max-width: calc(100vw - 44px);
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.86);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(31, 74, 52, 0.14);
  box-shadow: 0 26px 60px -22px rgba(31, 74, 52, 0.5);
  color: var(--green-900, #1f4a34);
  font-family: "Montserrat", system-ui, sans-serif;
  transform-origin: bottom left;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.fx-panel[hidden] {
  display: block;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
}
.fx-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.fx-panel-sub {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-family: "Nunito", system-ui, sans-serif;
  color: rgba(31, 74, 52, 0.65);
}
.fx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(31, 74, 52, 0.08);
  font-size: 0.82rem;
  font-weight: 600;
}
.fx-switch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(31, 74, 52, 0.22);
  cursor: pointer;
  transition: background 0.25s ease;
}
.fx-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(31, 74, 52, 0.35);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.fx-switch[aria-checked="true"] {
  background: linear-gradient(120deg, var(--green-500, #4a9b73), var(--green-700, #2f6b4d));
}
.fx-switch[aria-checked="true"]::after { transform: translateX(18px); }

.fx-slider-row {
  padding: 12px 0 4px;
  border-top: 1px solid rgba(31, 74, 52, 0.08);
}
.fx-slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.fx-slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--green-500, #4a9b73);
}
.fx-reset {
  margin-top: 12px;
  width: 100%;
  padding: 9px;
  border-radius: 999px;
  border: 1px solid rgba(31, 74, 52, 0.2);
  background: transparent;
  color: var(--green-900, #1f4a34);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.fx-reset:hover { background: rgba(31, 74, 52, 0.07); transform: translateY(-1px); }

/* On stacked layouts the hero's qualities/CTA row can land in the bottom-left
   corner where this toggle floats. Shrink it and tuck it tighter into the
   corner so it reads as a quiet utility chip rather than covering hero copy. */
@media (max-width: 960px) {
  .fx-toggle { width: 44px; height: 44px; left: 14px; bottom: 14px; opacity: 0.88; }
  .fx-toggle svg { width: 20px; height: 20px; }
  .fx-panel { left: 14px; bottom: 66px; }
}
