/* GloryPixel — global animations */

/* === ENTRY ANIMATIONS === */
@keyframes gp-fade-up {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes gp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes gp-slide-right {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes gp-slide-left {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes gp-scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes gp-clip-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes gp-blur-in {
  from { opacity: 0; filter: blur(12px); transform: translateY(20px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* === CONTINUOUS === */
@keyframes gp-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes gp-glow-pulse {
  0%, 100% { box-shadow: 0 0 16px var(--accent-glow), 0 0 0 rgba(0,224,138,0.4); }
  50% { box-shadow: 0 0 32px var(--accent-glow), 0 0 0 8px rgba(0,224,138,0); }
}
@keyframes gp-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes gp-rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes gp-marquee-x {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes gp-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.3; }
}
@keyframes gp-scan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}
@keyframes gp-pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* === REVEAL CLASSES (driven by IntersectionObserver) === */
[data-reveal] {
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), filter 0.9s ease;
  will-change: transform, opacity;
}
[data-reveal="up"] { transform: translateY(50px); }
[data-reveal="left"] { transform: translateX(-50px); }
[data-reveal="right"] { transform: translateX(50px); }
[data-reveal="scale"] { transform: scale(0.92); }
[data-reveal="blur"] { filter: blur(14px); transform: translateY(20px); }
[data-reveal].in {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
  filter: blur(0);
}

/* stagger via inline --d (set by JS) */
[data-reveal] { transition-delay: var(--d, 0ms); }

/* === HEADER ANIMATIONS === */
.nav { animation: gp-fade-in 0.8s ease both; }
.nav-inner > * { animation: gp-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }
.nav-inner > *:nth-child(1) { animation-delay: 0.05s; }
.nav-inner > *:nth-child(2) { animation-delay: 0.15s; }
.nav-inner > *:nth-child(3) { animation-delay: 0.25s; }

/* === HERO ANIMATIONS === */
.ct-hero h1, .art-hero h1, .page-hero h1 {
  animation: gp-blur-in 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}
.ct-hero h1 .accent, .art-hero h1 em, .page-hero h1 .accent {
  display: inline-block;
  animation: gp-fade-up 1s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.5s;
}
.ct-hero-side, .page-hero-side, .art-meta {
  animation: gp-fade-up 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.4s;
}
.breadcrumbs { animation: gp-fade-in 0.6s ease both; animation-delay: 0.1s; }

/* hero glow drift */
.ct-hero::before, .art-hero::before, .page-hero::before {
  animation: gp-float 8s ease-in-out infinite;
}

/* === ACCENT DOT PULSE EVERYWHERE === */
.dot, .pulse, .live, .map-pin {
  position: relative;
}
.ct-status .v::before,
.contact-row::before,
.faq-item .toggle {
  /* leave existing styles intact */
}

/* live dots: add a ring */
[data-pulse] {
  position: relative;
}
[data-pulse]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: gp-pulse-ring 2s ease-out infinite;
}

/* === TABLE / LIST ROW HOVER === */
.compare-row:hover .cell.good { background: rgba(0,224,138,0.04); }
.compare-row { transition: background 0.3s ease; }

/* === GLOWING DOTS === */
.block-h .dot,
.section-head .index .dot,
.art-cat .dot,
.page-tag .dot {
  animation: gp-glow-pulse 2.4s ease-in-out infinite;
}

/* === BUTTON HOVER ENHANCE === */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  background-size: 200% 100%;
  background-position: -200% 0;
  transition: background-position 0.6s ease;
  pointer-events: none;
}
.btn:hover::before {
  background-position: 200% 0;
}
.btn-primary { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-glow), 0 0 24px var(--accent-glow);
}
.btn .arrow { display: inline-block; transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.btn:hover .arrow { transform: translate(6px, -6px) rotate(8deg); }

/* === LINK UNDERLINE WIPE === */
.nav-links a {
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-links a:hover::after { width: 100%; }

/* === CARD HOVER LIFT === */
.post, .related-item, .channel, .case-card, .office-card,
.featured-cover, .post-cover, .art-cover, .contact-row, .social {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.4s ease;
}
.post:hover, .related-item:hover {
  transform: translateY(-4px);
}
.channel:hover { transform: translateY(-2px); }

/* === COVER GRADIENT DRIFT === */
.featured-cover::before,
.art-cover::before,
.post-cover::before {
  animation: gp-float 12s ease-in-out infinite;
}
.featured-cover:hover .planet,
.art-cover .planet {
  animation: gp-fade-up 1.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.3s;
}
.post-cover:hover {
  transform: scale(1.02);
  filter: brightness(1.08);
}

/* === SCAN LINE ON ARTICLE COVER === */
.art-cover::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  opacity: 0.6;
  animation: gp-scan 6s linear infinite;
  pointer-events: none;
  z-index: 2;
}

/* === TEXT SHIMMER FOR ACCENTS === */
.featured h2 a,
.art-content h2,
.address-card .city,
.cta h2 .accent {
  background: linear-gradient(90deg, currentColor 0%, currentColor 40%, var(--accent) 50%, currentColor 60%, currentColor 100%);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gp-shimmer 8s linear infinite;
}

/* fallback if browser doesn't like text-fill */
@supports not (-webkit-background-clip: text) {
  .featured h2 a, .art-content h2, .address-card .city, .cta h2 .accent {
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

/* === CHIP / FILTER ACTIVE GLOW === */
.f.active, .chip.active, .blog-filters .f.active {
  animation: gp-glow-pulse 2.4s ease-in-out infinite;
}

/* === FAQ accordion smoothness === */
.faq-item .toggle { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, color 0.3s ease, border-color 0.3s ease; }
.faq-item.open .toggle { transform: rotate(45deg) scale(1.1); }
.faq-q:hover .toggle { transform: scale(1.1); }
.faq-item.open .faq-q:hover .toggle { transform: rotate(45deg) scale(1.15); }

/* === CONTACT ROW SLIDE-IN ON HOVER === */
.contact-row .arrow { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease, opacity 0.3s ease; }
.contact-row:hover .arrow { transform: translate(8px, -8px); }

/* === TICKER / METRIC HOVER === */
.metric-card, .ticker-item, .stat {
  transition: transform 0.3s ease, color 0.3s ease;
}
.metric-card:hover, .stat:hover { transform: translateY(-2px); }

/* === MAP PIN BOOST === */
.map-pin { animation: gp-glow-pulse 2.4s ease-in-out infinite; }

/* === HOVER UNDERLINE FOR EMAIL/CITY === */
.contact-row .email, .phone-row a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
}
.contact-row:hover .email, .phone-row a:hover {
  background-size: 100% 1px;
}

/* === RESPECT REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
}

/* === TOUCH DEVICES: fix double-tap on links === */
/* На тач-пристроях перший тап триггерить :hover (translateY/scale) — */
/* і лише другий йде як клік. Вимикаємо hover-transforms на тач, */
/* + touch-action: manipulation прибирає 300ms delay. */
@media (hover: none) {
  .post:hover, .related-item:hover, .channel:hover,
  .post-cover:hover, .featured-cover:hover, .case-card:hover,
  .office-card:hover, .contact-row:hover, .social:hover {
    transform: none;
    filter: none;
  }
  .post:hover h3, .post:hover .more, .post:hover::before,
  .related-item:hover h4 {
    color: inherit;
  }
  .post:hover .more .arrow, .btn:hover .arrow, .svc:hover .arrow-cell {
    transform: none;
  }
  a, button, [role="button"], .btn, .post, .related-item,
  .channel, .case-card, .svc, .nav-overlay-cta, .footer-mobile-cta {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}
