/* ============================================================
   HAYYAT PRODUCTION — Motion Layer v1
   Apple-style transitions, frosted-glass UI, scroll reveals,
   SaaS background elements, easter eggs.
   Loaded site-wide. Defensive: never breaks layout if JS fails.
   ============================================================ */

/* ---------- 1. PAGE TRANSITIONS (Apple-style blur) ---------- */
#hayyat-page-veil {
  position: fixed; inset: 0; z-index: 99990;
  background: rgba(8, 8, 10, 0.55);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}
#hayyat-page-veil.hayyat-veil-on { opacity: 1; pointer-events: all; }
#hayyat-page-veil.hayyat-veil-off { opacity: 0; }

/* ---------- 2. SCROLL REVEALS (fold / rise) ---------- */
.hayyat-reveal {
  opacity: 0;
  transform: translateY(36px) perspective(900px) rotateX(6deg);
  transform-origin: center top;
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.hayyat-reveal.hayyat-in {
  opacity: 1;
  transform: translateY(0) perspective(900px) rotateX(0deg);
}
@media (prefers-reduced-motion: reduce) {
  .hayyat-reveal { opacity: 1; transform: none; transition: none; }
  #hayyat-page-veil { display: none; }
}

/* ---------- 3. FROSTED GLASS (iPhone duo blur UI) ---------- */
.hayyat-glass {
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ---------- 4. SAAS BACKGROUND ELEMENTS ---------- */
.hayyat-saas-bg {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; z-index: 0;
}
.hayyat-saas-card {
  position: absolute;
  width: 220px; padding: 14px 16px;
  font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.75);
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  animation: hayyat-float 9s ease-in-out infinite;
}
.hayyat-saas-card .hayyat-bar {
  height: 6px; border-radius: 3px; margin: 6px 0;
  background: linear-gradient(90deg, #E8B44A var(--w, 60%), rgba(255,255,255,0.12) var(--w, 60%));
}
.hayyat-saas-card:nth-child(2) { animation-delay: -3s; }
.hayyat-saas-card:nth-child(3) { animation-delay: -6s; }
@keyframes hayyat-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-16px) rotate(1deg); }
}
.hayyat-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 30%, transparent 75%);
  pointer-events: none;
}

/* ---------- 5. MAGNETIC BUTTONS ---------- */
.hayyat-magnetic { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); will-change: transform; }

/* ---------- 6. CHROMATIC ACCENT (logo color-wheel motif) ---------- */
a:hover .hayyat-chroma, .hayyat-chroma:hover {
  text-shadow:
    -1px 0 0 rgba(255, 60, 60, 0.55),
     1px 0 0 rgba(60, 220, 255, 0.55);
}

/* ---------- 7. EASTER EGGS ---------- */
/* Konami rainbow mode */
body.hayyat-rainbow-mode {
  animation: hayyat-rainbow-border 6s linear infinite;
}
@keyframes hayyat-rainbow-border {
  0% { box-shadow: inset 0 0 0 3px #ff3b3b; }
  20% { box-shadow: inset 0 0 0 3px #ffb13b; }
  40% { box-shadow: inset 0 0 0 3px #3bff7a; }
  60% { box-shadow: inset 0 0 0 3px #3bd8ff; }
  80% { box-shadow: inset 0 0 0 3px #b43bff; }
  100% { box-shadow: inset 0 0 0 3px #ff3b3b; }
}
#hayyat-egg-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 99999; padding: 12px 22px; border-radius: 999px;
  background: rgba(20, 20, 22, 0.85); color: #E8B44A;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 180, 74, 0.35);
  font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#hayyat-egg-toast.hayyat-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Secret timeline scrubber hint (footer) */
.hayyat-timeline-hint { cursor: pointer; }

/* ---------- 8. SMOOTH SCROLL FEEL ---------- */
html { scroll-behavior: smooth; }
::selection { background: #E8B44A; color: #0a0a0a; }

/* ---------- 9. HERO CINEMATIC VIGNETTE ---------- */
.hayyat-vignette::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 55%, rgba(0,0,0,0.55) 100%);
}
