/* =====================================================
   ZARC ARCHITECTS - MAGIC LAYER
   Enhanced UI/UX effects — layered on top, non-breaking
   ===================================================== */

/* ============================================
   1. CUSTOM CURSOR
   ============================================ */
body { cursor: none; }

#cursor-dot,
#cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 99999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition-property: opacity, transform, width, height, background, border-color;
  transition-timing-function: ease;
  will-change: transform;
}

#cursor-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  transition-duration: 0.05s;
}

#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.5);
  background: transparent;
  transition-duration: 0.18s;
}

/* cursor states */
body.cursor-hover #cursor-ring {
  width: 56px;
  height: 56px;
  border-color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.04);
}
body.cursor-hover #cursor-dot {
  transform: translate(-50%, -50%) scale(0);
}
body.cursor-click #cursor-ring {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.12);
}

/* hide cursor on touch / mobile */
@media (hover: none), (max-width: 768px) {
  #cursor-dot, #cursor-ring { display: none !important; }
  body { cursor: auto !important; }
}


/* ============================================
   2. PAGE TRANSITION OVERLAY
   ============================================ */
#page-transition {
  position: fixed;
  inset: 0;
  background: #2a2a2a;
  z-index: 9999;
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}
#page-transition.entering {
  animation: curtainIn 0.5s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
#page-transition.leaving {
  animation: curtainOut 0.45s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

@keyframes curtainIn {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); transform-origin: bottom; }
}
@keyframes curtainOut {
  from { transform: scaleY(1); transform-origin: top; }
  to   { transform: scaleY(0); transform-origin: top; }
}


/* ============================================
   3. MAGNETIC BUTTONS
   ============================================ */
.btn {
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1),
              background 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease;
}

/* Ripple effect on buttons */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}


/* ============================================
   4. TILT CARDS (service + project cards)
   ============================================ */
.service-card,
.project-card,
.gallery-item,
.pillar {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
              background 0.3s ease,
              box-shadow 0.4s ease;
}

.service-card:hover,
.project-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.07);
}

.gallery-item:hover {
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}


/* ============================================
   5. SPLIT-TEXT HERO ANIMATION (char by char)
   ============================================ */
.hero-title-zarc .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(60px) rotateX(-40deg);
  animation: charDrop 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes charDrop {
  to { opacity: 1; transform: translateY(0) rotateX(0deg); }
}


/* ============================================
   6. GLITCH EFFECT on ZARC hover
   ============================================ */
.hero-title-zarc {
  position: relative;
  display: inline-block;
}
.hero-title-zarc::before,
.hero-title-zarc::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: inherit;
}
.hero-title-zarc::before {
  color: rgba(255,100,100,0.7);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
}
.hero-title-zarc::after {
  color: rgba(100,200,255,0.7);
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
}
.hero-title-zarc.glitching::before {
  opacity: 1;
  animation: glitchTop 0.3s steps(2) forwards;
}
.hero-title-zarc.glitching::after {
  opacity: 1;
  animation: glitchBot 0.3s steps(2) forwards;
}

@keyframes glitchTop {
  0%   { transform: translate(-3px, -2px); }
  25%  { transform: translate(3px, 0); }
  50%  { transform: translate(-2px, 2px); }
  75%  { transform: translate(2px, -1px); }
  100% { transform: translate(0); opacity: 0; }
}
@keyframes glitchBot {
  0%   { transform: translate(3px, 2px); }
  25%  { transform: translate(-3px, 0); }
  50%  { transform: translate(2px, -2px); }
  75%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0); opacity: 0; }
}


/* ============================================
   7. COUNTER ANIMATION (stats)
   ============================================ */
.stat-num {
  display: inline-block;
  transition: transform 0.2s ease;
}
.stat-num.counting {
  animation: countPulse 0.1s ease;
}
@keyframes countPulse {
  0%   { transform: scale(1.15); }
  100% { transform: scale(1); }
}


/* ============================================
   8. SMOOTH SCROLL PARALLAX — hero content
   ============================================ */
.hero-content {
  will-change: transform;
  transition: none;
}


/* ============================================
   9. HORIZONTAL SCROLL CARDS — featured projects
   ============================================ */
.projects-scroll-hint {
  display: none;
  font-family: var(--ff-cond);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--col-muted);
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.projects-scroll-hint i { font-size: 0.7rem; animation: arrowPulse 1.5s ease-in-out infinite; }
@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}


/* ============================================
   10. NOISE TEXTURE OVERLAY on hero
   ============================================ */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}
.hero-content { z-index: 3; }
.hero-scroll-hint { z-index: 3; }


/* ============================================
   11. SECTION TITLE — underline draw animation
   ============================================ */
.section-title {
  position: relative;
  display: inline-block;
}
.section-title .title-underline {
  position: absolute;
  bottom: -6px;
  left: 0;
  height: 1px;
  width: 0;
  background: rgba(255,255,255,0.25);
  transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.section-title.underlined .title-underline {
  width: 100%;
}


/* ============================================
   12. STAGGER REVEAL — enhanced
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.75s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.75s cubic-bezier(0.23, 1, 0.32, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ============================================
   13. MARQUEE — pause on hover
   ============================================ */
.marquee-strip:hover .marquee-track {
  animation-play-state: paused;
}
.marquee-strip {
  cursor: default;
}


/* ============================================
   14. BLUEPRINT SVG — draw-on animation
   ============================================ */
.blueprint-svg rect,
.blueprint-svg polygon,
.blueprint-svg line,
.blueprint-svg path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.blueprint-box.drawn .blueprint-svg rect,
.blueprint-box.drawn .blueprint-svg polygon,
.blueprint-box.drawn .blueprint-svg line,
.blueprint-box.drawn .blueprint-svg path {
  stroke-dashoffset: 0;
}


/* ============================================
   15. FLOATING LABEL FORM INPUTS
   ============================================ */
.form-group {
  position: relative;
}
.form-group input:focus,
.form-group textarea:focus {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2), 0 4px 20px rgba(0,0,0,0.3);
}

/* Glow line at bottom of focused input */
.form-group input,
.form-group select,
.form-group textarea {
  border-bottom-width: 1px;
  transition: border-color 0.3s ease,
              background 0.3s ease,
              box-shadow 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(255,255,255,0.55);
}


/* ============================================
   16. PROJECT CARD — reveal overlay on hover
   ============================================ */
.project-card {
  position: relative;
}
.project-card-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}
.project-card:hover .project-card-overlay {
  opacity: 1;
}
.project-info {
  position: relative;
  z-index: 2;
}


/* ============================================
   17. NAV — progress bar
   ============================================ */
#scroll-progress {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: 2px;
  background: rgba(255,255,255,0.7);
  width: 0%;
  z-index: 1001;
  transition: width 0.1s linear;
  pointer-events: none;
}


/* ============================================
   18. GALLERY ITEM — category badge pop
   ============================================ */
.gallery-cat {
  transition: color 0.3s ease, letter-spacing 0.3s ease;
}
.gallery-item:hover .gallery-cat {
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.28em;
}


/* ============================================
   19. SOCIAL LINKS — spin on hover
   ============================================ */
.social-link i {
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  display: inline-block;
}
.social-link:hover i {
  transform: rotate(360deg) scale(1.15);
}


/* ============================================
   20. FOOTER — reveal line
   ============================================ */
#site-footer {
  position: relative;
  overflow: hidden;
}
#site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
  animation: footerLine 3s ease-in-out infinite;
}
@keyframes footerLine {
  0%   { left: -100%; }
  100% { left: 100%; }
}


/* ============================================
   21. NUMBERS — pulsing glow on stat
   ============================================ */
.stat:hover .stat-num {
  text-shadow: 0 0 30px rgba(255,255,255,0.4);
  transition: text-shadow 0.3s ease;
}


/* ============================================
   22. HERO SCROLL HINT — improved bounce
   ============================================ */
.hero-scroll-hint {
  animation: fadeIn 1s 1.5s both;
}
.scroll-line {
  animation: scrollBounce 2s 1.5s ease-in-out infinite;
}
@keyframes scrollBounce {
  0%   { transform: scaleY(1) translateY(0); opacity: 0.7; }
  50%  { transform: scaleY(0.5) translateY(8px); opacity: 0.2; }
  100% { transform: scaleY(1) translateY(0); opacity: 0.7; }
}


/* ============================================
   23. LIGHTBOX — enhanced entrance
   ============================================ */
.lightbox-panel {
  transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.45s ease;
}
.lightbox.open .lightbox-panel {
  transform: translateY(0) scale(1);
}


/* ============================================
   24. SECTION LABEL — animated line
   ============================================ */
.section-label::before {
  animation: none;
  transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  width: 0;
}
.section-label.line-drawn::before {
  width: 30px;
}


/* ============================================
   25. BACKGROUND PARTICLE DOTS (about section)
   ============================================ */
.section-about {
  position: relative;
  overflow: hidden;
}
#about-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}
.about-grid {
  position: relative;
  z-index: 1;
}


/* ============================================
   MOBILE OVERRIDES
   Disable/tune effects that hurt mobile UX
   ============================================ */
@media (max-width: 768px) {

  /* Disable 3D tilt — causes layout jank on touch */
  .service-card,
  .project-card,
  .gallery-item,
  .pillar,
  .team-card,
  .niche-card {
    transform: none !important;
    transform-style: flat;
    will-change: auto;
  }

  /* Disable hero parallax shift — causes overflow on mobile */
  .hero-content {
    transform: none !important;
    opacity: 1 !important;
  }
  #hero-canvas {
    transform: none !important;
  }

  /* Page transition overlay — keep but simpler */
  #page-transition {
    display: none;
  }

  /* Scroll progress bar — keep but thinner */
  #scroll-progress { height: 2px; }

  /* Magnetic buttons — no magnetic movement on touch */
  .btn {
    transform: none !important;
    will-change: auto;
  }

  /* Glitch effect — disable on mobile */
  .hero-title-zarc::before,
  .hero-title-zarc::after {
    display: none;
  }

  /* Blueprint draw — speed up on mobile */
  .blueprint-svg rect,
  .blueprint-svg polygon,
  .blueprint-svg line,
  .blueprint-svg path {
    transition-duration: 1s;
  }

  /* Section label line — always show on mobile */
  .section-label::before {
    width: 30px !important;
    transition: none;
  }

  /* Title underline — instant on mobile */
  .section-title .title-underline {
    width: 100% !important;
    transition: none;
  }

  /* Reveal — faster and less travel on mobile */
  .reveal {
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  /* Gallery overlay — show on tap (handled by always-opacity-0, tap reveals lightbox) */
  .gallery-overlay { display: none; }

  /* About particles — hide on mobile for perf */
  #about-canvas { display: none; }

  /* Social spin — disable */
  .social-link:hover i { transform: none; }

  /* Footer shimmer line — simplify */
  #site-footer::before { display: none; }
}

@media (max-width: 480px) {
  /* Split text — faster drop on small screens */
  .hero-title-zarc .char {
    animation-duration: 0.5s;
  }

  /* Ripple on buttons — keep it */
  .btn .ripple { animation-duration: 0.5s; }

  /* Noise texture on hero — hide for perf */
  #hero::after { display: none; }
}
