/* ============================================================
   Er Charity — 3D Landing Page
   Companion styles for Tailwind (CDN) + Three.js + GSAP
   Layered separation: 3D layer / animation layer / UI layer
   ============================================================ */

:root {
  --color-primary: #1BABB4;
  --color-secondary: #EB852B;
  --color-light-blue: #9FCDD3;
  --color-mint: #E1F2F0;
  --color-cream: #FAE1B8;
  --color-text: #3E3F41;
  --color-background: #FFFFFF;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Critical fallback (works even if Tailwind CDN is blocked) ---------- */
.container-fallback {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 20px;
}
.fallback-title { font-size: clamp(2rem, 5vw, 3.75rem); font-weight: 800; line-height: 1.2; }
.fallback-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border-radius: 999px;
  font-weight: 700; text-decoration: none;
  background: var(--color-primary); color: #fff;
}

/* ---------- 3D layer ---------- */
#scene-wrap { z-index: 0; }
#three-canvas { display: block; width: 100%; height: 100%; }

/* CSS-only fallback orb (shown when WebGL is unavailable) */
.css-orb {
  position: absolute;
  top: 50%; left: 50%;
  width: min(60vw, 460px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(250, 225, 184, .95) 0%, rgba(235, 133, 43, .45) 28%, transparent 60%),
    radial-gradient(circle at 65% 70%, rgba(27, 171, 180, .55) 0%, transparent 58%);
  box-shadow: 0 0 100px 20px rgba(27, 171, 180, .14);
  animation: orb-float 7s ease-in-out infinite;
  filter: blur(1px);
}
.css-orb::after {
  content: '';
  position: absolute; inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(27, 171, 180, .35);
  animation: orb-spin 18s linear infinite;
}
@keyframes orb-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-14px); }
}
@keyframes orb-spin { to { transform: rotate(360deg); } }

/* ---------- UI layer ---------- */
.glass {
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 12px 40px -14px rgba(27, 171, 180, .22), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.glass-dark {
  background: rgba(62, 63, 65, .55);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .12);
}

.text-gradient {
  background: linear-gradient(100deg, var(--color-text) 0%, var(--color-primary) 60%, var(--color-secondary) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: rgba(27, 171, 180, .08);
  color: #176D73;
  border: 1px solid rgba(27, 171, 180, .2);
}
.eyebrow-tag .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-secondary);
  box-shadow: 0 0 0 4px rgba(235, 133, 43, .14);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(5px);
  transition:
    opacity .85s var(--ease-out-expo),
    transform .85s var(--ease-out-expo),
    filter .85s var(--ease-out-expo);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; filter: none; }

/* Buttons with trailing icon pill (RTL: pill on the start side) */
.btn-pill { transition: transform .35s var(--ease-out-expo), box-shadow .35s, background .35s; }
.btn-pill:active { transform: scale(.97); }
.btn-pill .btn-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .2);
  transition: transform .35s var(--ease-out-expo), background .35s;
}
.btn-pill:hover .btn-icon { transform: translateX(-3px) scale(1.06); background: rgba(255, 255, 255, .3); }
html[dir="ltr"] .btn-pill:hover .btn-icon { transform: translateX(3px) scale(1.06); }

/* Card hover */
.feature-card { transition: transform .5s var(--ease-out-expo), box-shadow .5s var(--ease-out-expo), border-color .35s; }
.feature-card:hover {
  transform: translateY(-6px);
  border-color: rgba(27, 171, 180, .45);
  box-shadow: 0 22px 50px -22px rgba(27, 171, 180, .35);
}

/* Scroll indicator */
.scroll-cue { animation: cue-bob 2.2s ease-in-out infinite; }
@keyframes cue-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* Copy buttons */
.copy-btn { transition: background .25s, color .25s, border-color .25s; }
.copy-btn.copied { background: var(--color-primary) !important; color: #fff !important; border-color: var(--color-primary) !important; }

/* Fine grain overlay */
.grain::after {
  content: '';
  position: fixed; inset: 0; z-index: 80; pointer-events: none;
  opacity: .022;
  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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px;
}

/* Focus visibility */
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; filter: none; }
}
