/* ==========================================================================
   RigeSys — custom styles layered on top of Tailwind CSS (CDN, JIT)
   Handles: fonts, gradients, glassmorphism, animations, micro-interactions
   ========================================================================== */

:root {
  --color-primary: #2563eb;
  --color-secondary: #3b82f6;
  --color-accent: #06b6d4;
  --color-text: #111827;
}

* {
  scroll-behavior: smooth;
}

html {
  scroll-padding-top: 88px;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: #ffffff;
  color: var(--color-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------------------------------------------------------------------- */
/* Loading screen                                                         */
/* ---------------------------------------------------------------------- */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  animation: pulse-scale 1.1s ease-in-out infinite;
}

@keyframes pulse-scale {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------- */
/* Gradient text / backgrounds                                            */
/* ---------------------------------------------------------------------- */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 55%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gradient-brand {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
}

.gradient-border {
  position: relative;
  border-radius: 1rem;
}

.gradient-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.6), rgba(59, 130, 246, 0.6), rgba(6, 182, 212, 0.6));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------------------------------------------------------------------- */
/* Glassmorphism                                                          */
/* ---------------------------------------------------------------------- */
.glass {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

#site-header {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#site-header.scrolled {
  box-shadow: 0 8px 30px -12px rgba(15, 23, 42, 0.15);
}

/* ---------------------------------------------------------------------- */
/* Floating abstract shapes (hero background)                             */
/* ---------------------------------------------------------------------- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
  pointer-events: none;
}

.blob-float-1 { animation: float-1 14s ease-in-out infinite; }
.blob-float-2 { animation: float-2 18s ease-in-out infinite; }
.blob-float-3 { animation: float-3 16s ease-in-out infinite; }

@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, 40px) scale(0.95); }
}

@keyframes float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 30px) scale(1.05); }
}

.grid-fade {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 0%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------------------------------------------------------------------- */
/* Scroll-reveal animations (IntersectionObserver toggles .in-view)       */
/* ---------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal="up"] { transform: translateY(28px); }
[data-reveal="down"] { transform: translateY(-28px); }
[data-reveal="left"] { transform: translateX(28px); }
[data-reveal="right"] { transform: translateX(-28px); }
[data-reveal="zoom"] { transform: scale(0.92); }

[data-reveal].in-view {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Stagger helper delays used via inline style="--delay:n" */
[data-reveal] { transition-delay: calc(var(--delay, 0) * 90ms); }

/* ---------------------------------------------------------------------- */
/* Card hover lift + glow                                                 */
/* ---------------------------------------------------------------------- */
.card-lift {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -20px rgba(37, 99, 235, 0.28);
}

/* ---------------------------------------------------------------------- */
/* Ripple effect for buttons                                              */
/* ---------------------------------------------------------------------- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.ripple-span {
  position: absolute;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: ripple-anim 0.65s ease-out;
  pointer-events: none;
}

@keyframes ripple-anim {
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------------- */
/* Marquee (testimonials / logos)                                         */
/* ---------------------------------------------------------------------- */
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 28s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------------------------------------------------------------------- */
/* FAQ accordion chevron rotation                                         */
/* ---------------------------------------------------------------------- */
.faq-chevron {
  transition: transform 0.3s ease;
}

.faq-item[data-open="true"] .faq-chevron {
  transform: rotate(180deg);
}

.faq-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item[data-open="true"] .faq-panel {
  grid-template-rows: 1fr;
}

.faq-panel > div {
  overflow: hidden;
}

/* ---------------------------------------------------------------------- */
/* Back to top button                                                     */
/* ---------------------------------------------------------------------- */
#back-to-top {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ---------------------------------------------------------------------- */
/* Scrollbar                                                              */
/* ---------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--color-primary), var(--color-secondary));
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ---------------------------------------------------------------------- */
/* Focus visibility for accessibility                                     */
/* ---------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 0.5rem 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------------------------------------------------------------------- */
/* Mobile menu slide                                                      */
/* ---------------------------------------------------------------------- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu.open {
  max-height: 32rem;
}

/* ---------------------------------------------------------------------- */
/* Utility: noise texture for premium depth on dark hero                  */
/* ---------------------------------------------------------------------- */
.noise-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Animated counters just rely on JS-updated textContent, no CSS needed */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
