/* ========================================
   FX Layer — premium micro-interactions
   Mobile-first: base = phone, then scale up
   ======================================== */

/* ---------- Animated logo mark ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text, #f0f2f5);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}
.logo-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  overflow: visible;
}
.logo-text {
  display: inline-flex;
  align-items: baseline;
}
.logo-text em {
  font-style: italic;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent, #6c63ff), var(--accent2, #22d3ee));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Ring: decorative dotted circle, rotates slowly */
.logo-ring {
  transform-origin: 32px 32px;
  animation: logo-spin 22s linear infinite;
}
@keyframes logo-spin {
  to { transform: rotate(360deg); }
}

/* G path: draws in on load, then idles */
.logo-g {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: logo-draw 1.4s cubic-bezier(0.77, 0, 0.18, 1) 0.3s forwards,
             logo-breathe 4s ease-in-out 2s infinite;
}
@keyframes logo-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes logo-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.75; }
}

/* Orbiting dot */
.logo-orbit {
  transform-origin: 32px 32px;
  animation: logo-orbit 4.5s linear infinite;
}
@keyframes logo-orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.logo:hover .logo-ring { animation-duration: 6s; }
.logo:hover .logo-orbit { animation-duration: 1.5s; }

/* Ensure footer instance stays flex */
.footer-brand .logo {
  display: inline-flex !important;
  margin-bottom: 16px;
}

/* Logo in loader — bigger + dramatic */
.page-loader .logo-mark {
  width: 84px;
  height: 84px;
}
.page-loader .logo {
  flex-direction: column;
  gap: 18px;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary, #a0aec0);
}
.page-loader .logo-text em {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--text-secondary, #a0aec0);
  font-style: normal;
}



/* Hide native cursor on desktop */
@media (hover: hover) and (pointer: fine) {
  html, body, a, button, .btn, [role="button"] { cursor: none; }
}

/* Custom cursor */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.15s var(--ease-spring, ease-out), width 0.2s, height 0.2s;
}
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease-spring, ease-out),
              height 0.25s var(--ease-spring, ease-out),
              border-color 0.25s,
              background 0.25s;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor-ring.hover {
  width: 70px;
  height: 70px;
  border-color: transparent;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(2px);
}
.cursor-ring.active {
  width: 30px;
  height: 30px;
}
@media (hover: none) or (pointer: coarse) {
  .cursor, .cursor-ring { display: none !important; }
}
/* Hide global cursor while menu overlay is open (menu has its own HUD cursor) */
body.menu-open .cursor,
body.menu-open .cursor-ring { opacity: 0 !important; }

/* WebGL-ish mesh gradient canvas */
.hero { position: relative; isolation: isolate; }
.hero-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.85;
  filter: blur(40px) saturate(1.1);
  pointer-events: none;
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Split text — word reveal */
.split-line {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.1;
  padding-bottom: 0.08em;
}
.split-word {
  display: inline-block;
  transform: translateY(110%);
  will-change: transform;
}
.split-word.revealed {
  transform: translateY(0);
  transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Reveal targets (GSAP ScrollTrigger) */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.9s cubic-bezier(0.19, 1, 0.22, 1),
              transform 0.9s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Magnetic buttons */
.btn {
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1),
              background 0.3s,
              color 0.3s,
              box-shadow 0.3s;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    140px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.25),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.btn:hover::before { opacity: 1; }

/* 3D tilt bento cards */
.bento-item {
  transform-style: preserve-3d;
  perspective: 1000px;
  will-change: transform;
}
.bento-item .bento-inner {
  transform: translateZ(0);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.bento-item.tilt-active {
  transition: transform 0.2s cubic-bezier(0.19, 1, 0.22, 1);
}
.bento-item .bento-icon,
.bento-item h3 {
  transform: translateZ(40px);
  transition: transform 0.4s;
}
.bento-item:hover .bento-icon { transform: translateZ(60px) scale(1.08); }

/* Gradient-border glow on featured bento */
.bento-lg {
  position: relative;
}
.bento-lg::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--angle, 0deg),
    transparent 0deg,
    var(--accent, #6c63ff) 60deg,
    var(--accent2, #22d3ee) 140deg,
    transparent 200deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
  animation: rotate-angle 6s linear infinite;
  pointer-events: none;
}
.bento-lg:hover::after { opacity: 1; }

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@keyframes rotate-angle {
  to { --angle: 360deg; }
}

/* Marquee strip */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  padding: 28px 0;
  background: linear-gradient(90deg,
    rgba(108, 99, 255, 0.04),
    rgba(34, 211, 238, 0.04));
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.marquee-track {
  display: flex;
  gap: 64px;
  width: max-content;
  animation: marquee 40s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track {
  animation-play-state: paused;
}
.marquee-item {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(36px, 6vw, 84px);
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,255,255,0.4);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 64px;
}
.marquee-item .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #6c63ff);
  box-shadow: 0 0 20px var(--accent-glow, rgba(108,99,255,0.4));
  -webkit-text-stroke: 0;
  flex-shrink: 0;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Trust counter pulse */
.trust-number {
  transition: color 0.4s;
}
.trust-item.counted .trust-number {
  background: linear-gradient(135deg, var(--accent, #6c63ff), var(--accent2, #22d3ee));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Hero cards float */
.hero-card {
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Page-load dim */
body.loading { overflow: hidden; }
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg, #07090f);
  z-index: 10000;
  display: grid;
  place-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.page-loader.done {
  opacity: 0;
  visibility: hidden;
}
.page-loader .pl-mark {
  font-family: var(--font-display, Georgia, serif);
  font-style: italic;
  font-weight: 800;
  font-size: 42px;
  background: linear-gradient(135deg, var(--accent, #6c63ff), var(--accent2, #22d3ee));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pl-pulse 1.2s ease-in-out infinite;
}
@keyframes pl-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.98); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* ---------- Mobile-first polish ---------- */
/* Base = phone; larger screens get enhancements */

html { -webkit-text-size-adjust: 100%; }

/* Prevent horizontal bleed from effects */
body { overflow-x: hidden; }

/* Bigger tap targets on touch */
@media (hover: none), (pointer: coarse) {
  .btn, .nav-links a, .footer-col a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .footer-col a { display: inline-flex; }
  /* Disable expensive effects on mobile */
  .hero-bg-canvas { filter: blur(30px) saturate(1.05); opacity: 0.7; }
  .grain { opacity: 0.025; }
  .marquee-track { animation-duration: 28s; }
}

/* Tighter hero on small phones */
@media (max-width: 420px) {
  .hero h1 { font-size: clamp(2rem, 10vw, 2.6rem) !important; line-height: 1.08; }
  .hero-sub { font-size: 1rem !important; }
  .hero-badge { font-size: 0.7rem !important; padding: 6px 12px !important; }
  .hero-card { padding: 16px !important; }
  .section-header h2 { font-size: clamp(1.8rem, 8vw, 2.4rem) !important; }
  .marquee { padding: 18px 0; }
}

/* Logo in nav on mobile — slightly smaller */
@media (max-width: 540px) {
  .logo-mark { width: 30px; height: 30px; }
  .logo { font-size: 1rem; gap: 8px; }
  .page-loader .logo-mark { width: 68px; height: 68px; }
}

/* Tablet: re-enable some desktop affordances for hybrid devices */
@media (min-width: 720px) and (hover: hover) {
  .hero-card:hover { transform: translateY(-6px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .marquee-track { animation: none; }
  .split-word { transform: none; }
  .reveal { opacity: 1; transform: none; }
}
