/* ============================================
   NORTHTEK.io — $10K Premium Design System
   Preloader · Gradient Mesh · 3D Tilt · Grain
   Film Grain · Cursor Trail · Clip Reveals
   ============================================ */

/* ---- Lenis ---- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* ---- Base ---- */
html { scroll-padding-top: 80px; }
::selection { background: rgba(0,212,255,0.2); color: #F0F6FC; }
:focus-visible { outline: 2px solid #00D4FF; outline-offset: 3px; border-radius: 4px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0B1120; }
::-webkit-scrollbar-thumb { background: #21262D; border-radius: 3px; }
html:not(.dark) ::-webkit-scrollbar-track { background: #F1F5F9; }
html:not(.dark) ::-webkit-scrollbar-thumb { background: #CBD5E1; }

/* ============ PRELOADER ============ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0B1120;
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}
#preloader.done { transform: translateY(-100%); }

.preloader-icon { width: 48px; height: 48px; }

.preloader-path {
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: draw-n 2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
@keyframes draw-n {
  0%  { stroke-dashoffset: 160; fill: transparent; }
  65% { stroke-dashoffset: 0; fill: transparent; }
  100%{ stroke-dashoffset: 0; fill: #00D4FF; }
}

.preloader-star {
  opacity: 0;
  animation: star-pop 0.4s ease forwards 1.3s;
}
@keyframes star-pop { to { opacity: 1; } }

.preloader-label {
  font-family: 'Satoshi', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: #484F58;
  margin-top: 18px;
  opacity: 0;
  animation: pre-fade 0.5s ease forwards 0.9s;
}
@keyframes pre-fade { to { opacity: 1; } }

.preloader-bar {
  width: 100px;
  height: 1px;
  background: #21262D;
  margin-top: 24px;
  border-radius: 1px;
  overflow: hidden;
  opacity: 0;
  animation: pre-fade 0.3s ease forwards 1s;
}
.preloader-bar-fill {
  width: 0%;
  height: 100%;
  background: #00D4FF;
  animation: bar-fill 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.8s;
}
@keyframes bar-fill { to { width: 100%; } }

/* ============ SCROLL PROGRESS ============ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #00D4FF;
  z-index: 150;
  transform-origin: left;
  transform: scaleX(0);
  will-change: transform;
}

/* ============ CUSTOM CURSOR ============ */
#custom-cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
}
.cursor-ring {
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,212,255,0.3);
  transition: width 0.3s cubic-bezier(0.16,1,0.3,1),
              height 0.3s cubic-bezier(0.16,1,0.3,1),
              margin 0.3s cubic-bezier(0.16,1,0.3,1),
              border-color 0.3s, background 0.3s;
}
#custom-cursor.cursor-hover .cursor-ring {
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  border-color: rgba(0,212,255,0.12);
  background: rgba(0,212,255,0.03);
}
@media (pointer: coarse) { #custom-cursor { display: none !important; } }

/* ============ CURSOR TRAIL ============ */
.cursor-dot {
  position: fixed;
  border-radius: 50%;
  background: rgba(0,212,255,0.35);
  pointer-events: none;
  z-index: 9998;
  will-change: transform, opacity;
}
@media (pointer: coarse) { .cursor-dot { display: none !important; } }

/* ============ TEXT REVEAL ============ */
.line-mask { overflow: hidden; padding-bottom: 0.08em; }

/* ============ GRADIENT MESH ============ */
.gradient-mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  will-change: transform;
}
.blob-1 {
  width: min(500px, 70vw); height: min(500px, 70vw);
  background: rgba(0,212,255,0.07);
  top: -10%; left: -8%;
  animation: drift-1 22s ease-in-out infinite;
}
.blob-2 {
  width: min(400px, 55vw); height: min(400px, 55vw);
  background: rgba(16,185,129,0.04);
  top: 55%; right: -12%;
  animation: drift-2 28s ease-in-out infinite;
}
.blob-3 {
  width: min(350px, 50vw); height: min(350px, 50vw);
  background: rgba(0,212,255,0.05);
  bottom: -20%; left: 28%;
  animation: drift-3 25s ease-in-out infinite;
}
.blob-4 {
  width: min(250px, 35vw); height: min(250px, 35vw);
  background: rgba(99,102,241,0.03);
  top: 18%; right: 22%;
  animation: drift-4 20s ease-in-out infinite;
}
@keyframes drift-1 {
  0%,100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(80px,50px) scale(1.12); }
  50% { transform: translate(30px,90px) scale(0.95); }
  75% { transform: translate(-30px,30px) scale(1.06); }
}
@keyframes drift-2 {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(-60px,-40px) scale(1.08); }
  66% { transform: translate(40px,-20px) scale(0.92); }
}
@keyframes drift-3 {
  0%,100% { transform: translate(0,0) scale(1); }
  30% { transform: translate(50px,-60px) scale(1.1); }
  70% { transform: translate(-40px,30px) scale(0.94); }
}
@keyframes drift-4 {
  0%,100% { transform: translate(0,0) scale(1); }
  40% { transform: translate(-30px,50px) scale(1.15); }
  80% { transform: translate(20px,-30px) scale(0.9); }
}

html:not(.dark) .mesh-blob { filter: blur(120px); }
html:not(.dark) .blob-1 { background: rgba(0,212,255,0.06); }
html:not(.dark) .blob-2 { background: rgba(16,185,129,0.04); }
html:not(.dark) .blob-3 { background: rgba(0,212,255,0.05); }
html:not(.dark) .blob-4 { background: rgba(99,102,241,0.03); }

/* ============ MARQUEE ============ */
@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee-scroll 45s linear infinite;
  will-change: transform;
}
.marquee-track:hover { animation-play-state: paused; }

/* ============ NAVBAR ============ */
.nav-solid {
  background: rgba(11,17,32,0.9) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(240,246,252,0.04);
}
html:not(.dark) .nav-solid {
  background: rgba(255,255,255,0.9) !important;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.nav-link { position: relative; }
.nav-link.active::after {
  content: '';
  position: absolute; bottom: -3px; left: 0; right: 0;
  height: 1.5px; background: #00D4FF;
}

/* ============ SERVICE LIST ============ */
.service-row { transition: background-color 0.4s ease; }
.service-row:hover { background-color: rgba(0,212,255,0.02); }
html:not(.dark) .service-row:hover { background-color: rgba(0,212,255,0.04); }

/* ============ PORTFOLIO ============ */
.geo-grid { position: relative; overflow: hidden; }
.geo-grid::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(240,246,252,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,246,252,0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
html:not(.dark) .geo-grid::after {
  background-image:
    linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px);
}

.portfolio-grad-1 { background: linear-gradient(155deg, #161B22, #1C2128, rgba(0,212,255,0.06)); }
.portfolio-grad-2 { background: linear-gradient(155deg, #1C2128, #21262D, rgba(16,185,129,0.05)); }
.portfolio-grad-3 { background: linear-gradient(155deg, #161B22, #0D1117, rgba(0,212,255,0.04)); }
html:not(.dark) .portfolio-grad-1 { background: linear-gradient(155deg, #F1F5F9, #E2E8F0, rgba(0,212,255,0.06)); }
html:not(.dark) .portfolio-grad-2 { background: linear-gradient(155deg, #E2E8F0, #F1F5F9, rgba(16,185,129,0.06)); }
html:not(.dark) .portfolio-grad-3 { background: linear-gradient(155deg, #F1F5F9, #F8FAFC, rgba(0,212,255,0.04)); }

/* ============ 3D TILT ============ */
.tilt-card {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
}

/* ============ CLIP PATH REVEAL ============ */
.clip-reveal-img {
  will-change: clip-path;
}

/* ============ SEO CARDS ============ */
.seo-card { position: relative; overflow: hidden; }
.seo-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 0;
  background: #00D4FF;
  transition: height 0.5s cubic-bezier(0.16,1,0.3,1);
}
.seo-card:hover::before { height: 100%; }

/* ============ STATS ============ */
.stat-number { font-variant-numeric: tabular-nums; }

/* ============ DIFFERENTIATORS ============ */
.diff-item { transition: background-color 0.3s ease; }
.diff-item:hover { background-color: rgba(0,212,255,0.02); }
html:not(.dark) .diff-item:hover { background-color: rgba(0,212,255,0.04); }

/* ============ FAQ ============ */
.faq-content { overflow: hidden; }
.faq-icon { transition: transform 0.3s ease; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(45deg); }

/* ============ MOBILE MENU ============ */
.mobile-overlay {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.mobile-overlay.open { transform: translateX(0); }

/* ============ FORM ============ */
.form-input { transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus {
  border-color: #00D4FF;
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
  outline: none;
}

/* ============ MAGNETIC ============ */
.magnetic { will-change: transform; }

/* ============ SPOTLIGHT CARD HOVER ============ */
/* Radial glow follows cursor on cards — 21st.dev style */
.spotlight-card {
  position: relative;
  overflow: hidden;
}
.spotlight-card::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,255,0.08) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  top: var(--mouse-y, -200px);
  left: var(--mouse-x, -200px);
  pointer-events: none;
  transition: opacity 0.4s ease;
  opacity: 0;
  z-index: 1;
}
.spotlight-card:hover::before {
  opacity: 1;
}
html:not(.dark) .spotlight-card::before {
  background: radial-gradient(circle, rgba(0,212,255,0.06) 0%, transparent 70%);
}

/* ============ ANIMATED GRADIENT BORDER ============ */
/* Shimmer border on service rows — sweeps left to right on hover */
.gradient-border-row {
  position: relative;
}
.gradient-border-row::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0,212,255,0) 30%,
    rgba(0,212,255,0.4) 50%,
    rgba(0,212,255,0) 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-position: -100% 0;
  transition: none;
  opacity: 0;
}
.gradient-border-row:hover::after {
  opacity: 1;
  animation: border-shimmer 1.5s ease forwards;
}
@keyframes border-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* ============ HERO TEXT SHIMMER ============ */
/* Light sweep across hero headline after reveal */
.hero-shimmer {
  position: relative;
  overflow: hidden;
}
.hero-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(0,212,255,0.07) 45%,
    rgba(0,212,255,0.12) 50%,
    rgba(0,212,255,0.07) 55%,
    transparent 80%
  );
  animation: text-shimmer 3s ease-in-out 2.5s forwards;
  pointer-events: none;
}
@keyframes text-shimmer {
  0%   { left: -120%; }
  100% { left: 120%; }
}

/* ============ CARD SHINE / GLARE ============ */
/* Diagonal light sweep on portfolio card hover */
.card-shine {
  position: relative;
  overflow: hidden;
}
.card-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.04) 45%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 55%,
    transparent 60%
  );
  transform: rotate(0deg);
  transition: left 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 2;
}
.card-shine:hover::after {
  left: 120%;
}

/* ============ ANIMATED GRADIENT BADGE/TAG ============ */
/* The portfolio tags get an animated border */
.tag-glow {
  position: relative;
}
.tag-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #00D4FF, #10B981, #00D4FF);
  background-size: 300% 300%;
  animation: tag-border-flow 4s ease infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.tilt-card:hover .tag-glow::before {
  opacity: 1;
}
@keyframes tag-border-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============ SMOOTH NUMBER FLIP ============ */
/* Tabular nums with a subtle pulse on complete */
@keyframes stat-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.stat-done {
  animation: stat-pulse 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============ SECTION DIVIDER GLOW ============ */
/* Subtle horizontal glow line between sections */
.glow-divider {
  position: relative;
  overflow: visible;
}
.glow-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: radial-gradient(ellipse, rgba(0,212,255,0.25) 0%, transparent 70%);
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .marquee-track { animation: none !important; }
  #custom-cursor, .cursor-dot, #film-grain { display: none !important; }
  .line-mask .line-inner { transform: none !important; }
  .mesh-blob { animation: none !important; }
  #preloader { display: none !important; }
  .spotlight-card::before, .card-shine::after,
  .hero-shimmer::after, .gradient-border-row::after { display: none !important; }
}

/* ============ MOBILE RESPONSIVE ============ */

/* --- Small screens (< 640px) --- */
@media (max-width: 639px) {
  /* Hide 3D canvas on mobile for performance */
  #hero-3d { display: none !important; }

  /* Tighter section spacing */
  section { padding-top: 4rem !important; padding-bottom: 4rem !important; }
  section.min-h-screen { padding-top: 0 !important; padding-bottom: 0 !important; }

  /* Hero adjustments */
  .hero-title {
    font-size: clamp(2rem, 10vw, 3.2rem) !important;
    margin-bottom: 1.25rem !important;
  }
  .hero-subtitle {
    font-size: 1rem !important;
    margin-bottom: 1.75rem !important;
  }

  /* Marquee smaller on mobile */
  .marquee-track span {
    font-size: 1.75rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Stats grid: 2 columns on mobile instead of 4 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }
  .stat-number {
    font-size: 2rem !important;
  }

  /* Differentiator grid: single column */
  .diff-item {
    padding: 1.25rem !important;
  }

  /* FAQ touch targets */
  .faq-trigger {
    min-height: 52px !important;
    padding: 1rem 1.25rem !important;
  }
  .faq-content p {
    padding: 0 1.25rem 1.25rem !important;
  }

  /* Contact form full width */
  .form-input, textarea.form-input {
    font-size: 16px !important; /* Prevents iOS zoom */
  }

  /* Footer stacking */
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
}

/* --- Medium screens (640-1023px) --- */
@media (min-width: 640px) and (max-width: 1023px) {
  #hero-3d { opacity: 0.4; }

  section { padding-top: 5rem !important; padding-bottom: 5rem !important; }
  section.min-h-screen { padding-top: 0 !important; padding-bottom: 0 !important; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* --- Portfolio horizontal scroll mobile fix --- */
.hide-scrollbars {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.hide-scrollbars::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

@media (max-width: 767px) {
  .portfolio-card {
    width: 85vw !important;
    flex-shrink: 0;
    scroll-snap-align: center;
  }
  .portfolio-track {
    gap: 1rem !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
  .glow-divider {
    margin-top: 2rem;
    margin-bottom: 2rem;
  }
}

/* --- Ensure hero video doesn't drain battery on mobile --- */
@media (max-width: 767px) {
  #home video {
    display: none;
  }
}

/* --- Fix horizontal overflow everywhere --- */
html, body {
  overflow-x: hidden;
}

/* --- Consistent section padding on mobile --- */
@media (max-width: 639px) {
  .px-5 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
}

