/* =========================================================================
   LIFINEX — global styles
   Tailwind utilities (tailwind-compiled.css) do the layout. This file adds:
   base styles, brand components (glass, gold sheen, buttons) and all motion.
   ========================================================================= */

@layer theme, base, components, utilities;

/* ---------- Base ---------- */
@layer base {
  html {
    scroll-behavior: smooth;
    background: #050505;
  }
  body {
    background: #050505;
    color: #f8f5ec;
    font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  ::selection {
    background: #d4a72c;
    color: #050505;
  }
  :focus-visible {
    outline: 2px solid #f5c94a;
    outline-offset: 3px;
    border-radius: 6px;
  }
}

@layer components {
  /* Gold text — used on selected words only */
  .text-gold-sheen {
    background: linear-gradient(100deg, #8c5a12 0%, #d4a72c 28%, #ffe6a0 52%, #f5c94a 70%, #8c5a12 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* Dark frosted glass with a hairline gold edge */
  .glass {
    background: rgb(11 10 8 / 0.62);
    border: 1px solid rgb(212 167 44 / 0.18);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
  }

  /* Header bar: near-opaque so nav stays readable over the hero image */
  .header-bar {
    background: rgb(11 10 8 / 0.92);
    border-color: rgb(212 167 44 / 0.28);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
  }

  /* Film grain over the hero */
  .grain::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  }

  /* ---------- Buttons (React: btn.gold / btn.ghost / btn.text) ---------- */
  .btn-gold,
  .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: 9999px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    line-height: 1.4285714;
    cursor: pointer;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
  }
  .btn-gold {
    background: #f5c94a;
    color: #050505;
    font-weight: 600;
    transition-property: background-color, transform;
  }
  .btn-gold:hover { background: #ffe6a0; }
  .btn-ghost {
    border: 1px solid rgb(248 245 236 / 0.2);
    background: rgb(248 245 236 / 0.03);
    color: #f8f5ec;
    font-weight: 500;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition-property: border-color, background-color, transform;
  }
  .btn-ghost:hover {
    border-color: rgb(212 167 44 / 0.6);
    background: rgb(212 167 44 / 0.1);
  }
  .btn-gold:active,
  .btn-ghost:active { transform: scale(0.97); }

  .btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 13px;
  }

  .btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    font-size: 0.875rem;
    line-height: 1.4285714;
    font-weight: 500;
    color: #f5c94a;
    cursor: pointer;
    transition: color 150ms cubic-bezier(0.23, 1, 0.32, 1), gap 150ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .btn-text:hover {
    gap: 0.625rem;
    color: #ffe6a0;
  }

  /* ---------- Scroll reveal + hero entrance (React: <Reveal /> / motion initial) ---------- */
  .js [data-reveal],
  .js [data-enter] {
    opacity: 0;
    transform: translateY(var(--enter-y, 24px));
    transition:
      opacity 300ms cubic-bezier(0.23, 1, 0.32, 1),
      transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
    transition-delay: var(--delay, 0s);
  }
  .js [data-reveal].is-in,
  .js [data-enter].is-in {
    opacity: 1;
    transform: none;
  }

  /* ---------- Coin ---------- */
  .coin-float { animation: coin-float 9s ease-in-out infinite; }
  .coin-orbit { animation: spin-cw 60s linear infinite; }
  .coin-orbit--reverse { animation: spin-ccw 90s linear infinite; }
  /* 3D coin canvas: transparent, covers only the coin's own bounding square, draws nothing else */
  .coin3d-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    background: transparent;
  }
  [data-coin-fallback] { transition: opacity 400ms ease; }
  .coin3d-ready [data-coin-fallback] { opacity: 0; }
  /* Circular radial glow — gradient, not a blurred box */
  .coin-glow {
    background: radial-gradient(circle closest-side at 50% 50%,
      rgba(212, 167, 44, 0.30) 0%, rgba(212, 167, 44, 0.14) 52%, rgba(212, 167, 44, 0) 78%);
    transform: scale(1.05);
  }
  /* Soft elliptical shadow under the coin, breathing with its float */
  .coin-shadow {
    left: 20%; right: 20%; bottom: -5%; height: 7%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
    transform: scale(calc(1 - var(--coin-float, 0) * 0.07));
    opacity: calc(0.85 - var(--coin-float, 0) * 0.15);
  }

  .float-y { animation: float-y 6s ease-in-out infinite; }
  .dash-flow { animation: dash-flow 1.4s linear infinite; }
  .flow-dot { animation: flow-dot 1.2s linear infinite; }

  .swap-y  { animation: swap-y 180ms cubic-bezier(0.23, 1, 0.32, 1) both; }
  .swap-y2 { animation: swap-y2 200ms cubic-bezier(0.23, 1, 0.32, 1) both; }
  .swap-x  { animation: swap-x 180ms cubic-bezier(0.23, 1, 0.32, 1) both; }

  /* ---------- Slot ring ---------- */
  .slot-seg { opacity: 0; }
  .slot-ring.is-in .slot-seg {
    opacity: 1;
    animation: slot-in 200ms ease both;
    animation-delay: var(--d, 0s);
  }

  /* ---------- FAQ accordion ---------- */
  .faq-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
      grid-template-rows 220ms cubic-bezier(0.23, 1, 0.32, 1),
      opacity 220ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .faq-panel.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
  }
  .faq-panel > div { min-height: 0; overflow: hidden; }

  /* ---------- Mobile drawer ---------- */
  .drawer {
    visibility: hidden;
    transition: visibility 0s linear 280ms;
  }
  .drawer.is-open {
    visibility: visible;
    transition-delay: 0s;
  }
  .drawer-overlay {
    opacity: 0;
    transition: opacity 200ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .drawer-panel {
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .drawer.is-open .drawer-overlay { opacity: 1; }
  .drawer.is-open .drawer-panel { transform: none; }

  /* ---------- Back to top ---------- */
  .to-top {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition:
      opacity 180ms cubic-bezier(0.23, 1, 0.32, 1),
      transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .to-top.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

/* ---------- Keyframes ---------- */
@keyframes coin-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes spin-cw  { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes dash-flow { to { stroke-dashoffset: -16; } }
@keyframes flow-dot {
  from { transform: translateX(-32px); }
  to   { transform: translateX(96px); }
}
@keyframes slot-in { from { opacity: 0; } }
@keyframes swap-y  { from { opacity: 0; transform: translateY(8px); } }
@keyframes swap-y2 { from { opacity: 0; transform: translateY(10px); } }
@keyframes swap-x  { from { opacity: 0; transform: translateX(12px); } }

/* ---------- Reduced motion: everything still works, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .coin-float, .coin-orbit, .coin-orbit--reverse, .float-y, .dash-flow { animation: none !important; }
  .flow-dot { display: none; }
  .js [data-reveal], .js [data-enter], .slot-seg { opacity: 1; transform: none; }
}
