/* ==========================================================================
   NutraScience — Luxury Animated Logo Intro
   Brand Theme: Deep Emerald Green, Metallic Gold, Pure Warm White
   ========================================================================== */

:root {
  --c-bg: #ffffff;
  --c-bg-warm: #faf8f5;
  --c-emerald: #144937;
  --c-emerald-deep: #0b2d22;
  --c-gold: #c59b27;
  --c-gold-bright: #fcd874;
  --c-gold-light: #fff3c4;
  --c-gold-dark: #8c670d;
  --c-text-dark: #1e293b;
  --c-text-muted: #64748b;
  
  --font-serif: 'Cinzel', 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --logo-ratio: calc(855 / 292);
  --text-reveal: 24.33%;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--c-bg);
  font-family: var(--font-sans);
  color: var(--c-text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Ambient Backdrop & Golden Dust Canvas
   -------------------------------------------------------------------------- */
.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse 85% 75% at 50% 50%,
    rgba(255, 255, 255, 1) 0%,
    rgba(252, 250, 245, 0.95) 55%,
    rgba(244, 239, 228, 0.65) 100%
  );
}

.particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Stage & Responsive Logo Container
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Ambient Radial Glow behind the leaf emblem */
.leaf-ambient-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  /* Offset toward the leaf location (left side of logo center) */
  transform: translate(-170%, -50%);
  width: min(380px, 45vw);
  height: min(380px, 45vw);
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: radial-gradient(
    circle at center,
    rgba(252, 216, 116, 0.28) 0%,
    rgba(42, 114, 88, 0.14) 40%,
    rgba(255, 255, 255, 0) 70%
  );
  filter: blur(28px);
  will-change: opacity, transform;
}

/* Logo Wrapper - Responsive & Centered */
.logo-wrapper {
  position: relative;
  width: min(855px, 86vw);
  aspect-ratio: 855 / 292;
  margin: 0 auto;
  user-select: none;
  transform: translateZ(0);
  will-change: transform;
  contain: layout style paint;
}

/* Resting floating idle animation */
.logo-wrapper.is-floating {
  animation: logoGentleFloat 5.2s ease-in-out infinite alternate;
}

@keyframes logoGentleFloat {
  0% {
    transform: translate3d(0, 0px, 0);
  }
  50% {
    transform: translate3d(0, -3.5px, 0);
  }
  100% {
    transform: translate3d(0, 1.5px, 0);
  }
}

/* Generic Layer Positioning */
.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.logo-source-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform: translateZ(0);
}

/* --------------------------------------------------------------------------
   LAYER 1: Leaf Emblem
   -------------------------------------------------------------------------- */
.leaf-layer {
  z-index: 12;
  /* Clip strictly to the leaf emblem: 0% to 24.33% */
  clip-path: polygon(0% 0%, 24.33% 0%, 24.33% 100%, 0% 100%);
  opacity: 0;
  transform: scale(0.92) translateZ(0);
  transform-origin: 12% 50%;
  filter: drop-shadow(0 0 0px rgba(20, 73, 55, 0));
  will-change: opacity, transform, filter;
}

/* --------------------------------------------------------------------------
   LAYER 2: SVG Shimmer & Liquid Gold Outline
   -------------------------------------------------------------------------- */
.leaf-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
  overflow: visible;
  transform: translateZ(0);
}

.liquid-gold-path {
  fill: none;
  stroke: url(#liquidGoldGrad);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(250, 208, 104, 0.9));
  opacity: 0;
  will-change: stroke-dashoffset, opacity;
  transform: translateZ(0);
}

/* Dewdrop Ripples */
.dewdrop-ripples-group {
  opacity: 1;
}

.dewdrop-ripple {
  fill: none;
  stroke: #c59b27;
  stroke-width: 1.8;
  opacity: 0;
  transform-origin: 93.3px 255.2px;
  filter: url(#rippleFilter);
}

/* Dewdrop Sparkle Star Flare */
.dewdrop-sparkle-group {
  opacity: 0;
  transform-origin: 93.3px 255.2px;
  will-change: transform, opacity;
}

.star-flare {
  fill: url(#liquidGoldGrad);
  transform-origin: 0 0;
}

.primary-flare {
  fill: #fff9e6;
}

.secondary-flare {
  fill: #fcd874;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   LAYER 3: Text Layer ("NutraScience" Wipe)
   -------------------------------------------------------------------------- */
.text-layer {
  z-index: 13;
  /* Text bounds are 24.33% to 100% */
  clip-path: polygon(24.33% 0%, 100% 0%, 100% 100%, 24.33% 100%);
}

.text-wipe-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Dynamic reveal via CSS variable */
  clip-path: polygon(24.33% 0%, var(--text-reveal, 24.33%) 0%, var(--text-reveal, 24.33%) 100%, 24.33% 100%);
  will-change: clip-path;
}

/* Leading Light Beam along the wipe boundary */
.wipe-light-beam {
  position: absolute;
  top: 24%;
  bottom: 30%;
  left: var(--text-reveal, 24.33%);
  width: 4px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 18;
  opacity: 0;
  will-change: left, opacity;
}

.wipe-light-core {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 250, 220, 0.95) 25%,
    #ffffff 50%,
    rgba(252, 216, 116, 0.95) 75%,
    rgba(197, 155, 39, 0) 100%
  );
  border-radius: 2px;
  box-shadow: 0 0 10px 2px rgba(252, 216, 116, 0.9), 0 0 18px 4px rgba(197, 155, 39, 0.6);
}

.wipe-light-corona {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 70px;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(252, 216, 116, 0.6) 40%,
    rgba(197, 155, 39, 0) 75%
  );
  filter: blur(4px);
}

/* --------------------------------------------------------------------------
   LAYER 4: Metallic Gold Light Sweep
   -------------------------------------------------------------------------- */
.metallic-sweep-overlay {
  position: absolute;
  inset: -15% -15%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(252, 216, 116, 0.05) 35%,
    rgba(255, 246, 210, 0.45) 45%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(252, 216, 116, 0.5) 55%,
    rgba(197, 155, 39, 0.1) 65%,
    rgba(255, 255, 255, 0) 80%
  );
  transform: translateX(-120%);
  will-change: transform, opacity;
}

/* Mask light sweep to the logo silhouette if supported */
@supports ((-webkit-mask-image: url('logo_mask.png')) or (mask-image: url('logo_mask.png'))) {
  .metallic-sweep-overlay {
    -webkit-mask-image: url('logo_mask.png');
    -webkit-mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('logo_mask.png');
    mask-size: 100% 100%;
    mask-repeat: no-repeat;
    mask-position: center;
    inset: 0;
  }
}

/* --------------------------------------------------------------------------
   Brand Subtitle / Tagline
   -------------------------------------------------------------------------- */
.brand-tagline {
  position: relative;
  z-index: 10;
  margin-top: 1.6rem;
  opacity: 0;
  transform: translateY(8px);
  will-change: opacity, transform;
}

.brand-tagline span {
  font-family: var(--font-serif);
  font-size: clamp(0.72rem, 1.4vw, 0.95rem);
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--c-gold-dark);
  font-weight: 600;
  display: inline-block;
  position: relative;
  padding: 0 1.2rem;
}

.brand-tagline span::before,
.brand-tagline span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 24px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--c-gold));
}

.brand-tagline span::before {
  left: -20px;
}

.brand-tagline span::after {
  right: -20px;
  background: linear-gradient(to left, transparent, var(--c-gold));
}

/* --------------------------------------------------------------------------
   Mobile & Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .stage {
    padding: 1rem;
  }
  
  .logo-wrapper {
    width: 92vw;
  }
  
  .brand-tagline span {
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    padding: 0 0.6rem;
  }
  
  .brand-tagline span::before,
  .brand-tagline span::after {
    width: 14px;
  }
}
