/* ==========================================================================
   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 */

/* ---------------------------------------------------------------------- */
/* Kicker / eyebrow label — Linear/Vercel-style small caps with a tick     */
/* ---------------------------------------------------------------------- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.kicker::before {
  content: "";
  width: 14px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px;
}

/* ---------------------------------------------------------------------- */
/* Mouse-follow spotlight — subtle radial glow tracking the pointer        */
/* ---------------------------------------------------------------------- */
.spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(560px circle at var(--spot-x, 50%) var(--spot-y, 0%), rgba(37, 99, 235, 0.14), transparent 60%);
}

.spotlight-active .spotlight {
  opacity: 1;
}

/* ---------------------------------------------------------------------- */
/* Animated grid — slow drift so the background feels alive               */
/* ---------------------------------------------------------------------- */
.grid-fade {
  animation: grid-drift 34s linear infinite;
}

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 88px 44px, 88px 44px; }
}

/* ---------------------------------------------------------------------- */
/* Parallax floats — nudged via JS on mousemove, data-parallax="0.02"     */
/* ---------------------------------------------------------------------- */
[data-parallax] {
  will-change: transform;
  transition: transform 0.2s ease-out;
}

/* ---------------------------------------------------------------------- */
/* Premium button sheen — a light sweep on hover, not a generic ripple    */
/* ---------------------------------------------------------------------- */
.btn-sheen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-sheen::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-18deg);
  transition: left 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.btn-sheen:hover::after {
  left: 130%;
}

/* Magnetic hover — JS sets --mx/--my within a small radius */
.btn-magnetic {
  transform: translate(var(--mx, 0), var(--my, 0));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------------------- */
/* Premium card — hairline border, restrained radius, glow-on-hover       */
/* ---------------------------------------------------------------------- */
.card-premium {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-premium:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 30px 60px -30px rgba(37, 99, 235, 0.35);
  transform: translateY(-4px);
}

.card-premium .card-index {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: rgba(37, 99, 235, 0.45);
}

/* ---------------------------------------------------------------------- */
/* Process timeline — connecting line that draws in on scroll             */
/* ---------------------------------------------------------------------- */
.timeline-line {
  position: absolute;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.15));
  overflow: hidden;
}

.timeline-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-line.in-view::after {
  transform: scaleX(1);
}

.timeline-dot {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.timeline-dot.in-view {
  transform: scale(1);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
}

/* ---------------------------------------------------------------------- */
/* Case study media — layered gradient "screen" instead of a stock photo  */
/* ---------------------------------------------------------------------- */
.case-media {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 15% 0%, rgba(37, 99, 235, 0.22), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(6, 182, 212, 0.18), transparent 55%),
    linear-gradient(160deg, #0f172a, #111c33 55%, #0f172a);
}

.case-media .noise-overlay {
  opacity: 0.05;
}

/* ---------------------------------------------------------------------- */
/* Industry chip — minimal pill instead of a heavy icon card              */
/* ---------------------------------------------------------------------- */
.industry-chip {
  transition: border-color 0.25s ease, color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.industry-chip:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--color-primary);
  background-color: rgba(37, 99, 235, 0.05);
  transform: translateY(-2px);
}

/* ---------------------------------------------------------------------- */
/* Section seam — a hairline gradient instead of a hard color-block edge  */
/* ---------------------------------------------------------------------- */
.section-seam {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.18), rgba(6, 182, 212, 0.18), transparent);
}

/* 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;
  }
}
