/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes drift {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-22px) translateX(14px); }
}

@keyframes portfolio-title-shimmer {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: -200% center;
  }
}

@keyframes arrow-nudge {
  0%, 85% {
    transform: translateX(0);
  }
  90% {
    transform: translateX(2px);
  }
  95% {
    transform: translateX(1px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes scan {
  0% { top: 10%; opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { top: 95%; opacity: 0; }
}

@keyframes scrollline {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  50.001% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.reveal-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--stagger, 0) * 70ms);
}
.reveal-up.in-view,
.carousel-track .reveal-up {
  opacity: 1;
  transform: translateY(0);
}

.reveal-up[data-delay="1"] { --stagger: 1; }
.reveal-up[data-delay="2"] { --stagger: 2; }
.reveal-up[data-delay="3"] { --stagger: 3; }
.reveal-up[data-delay="4"] { --stagger: 4; }
.reveal-up[data-delay="5"] { --stagger: 5; }
.reveal-up[data-delay="6"] { --stagger: 6; }
.reveal-up[data-delay="7"] { --stagger: 7; }

/* Keep page-link buttons' hitboxes fixed while their reveal animation runs. */
.portfolio-see-all.reveal-up,
.portfolio-see-all.portfolio-animate-heading {
  opacity: 0;
  transform: translate3d(0, 0, 0);
  filter: blur(3px);
  transition:
    opacity 0.55s var(--ease),
    filter 0.55s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease),
    color 0.3s var(--ease),
    transform 0.3s var(--ease);
  transition-delay: calc(var(--stagger, 0) * 70ms);
  will-change: opacity, filter;
}

.portfolio-see-all.reveal-up.in-view,
.portfolio-see-all.portfolio-animate-heading.in-view {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}

.portfolio-see-all.reveal-up.in-view:hover,
.portfolio-see-all.portfolio-animate-heading.in-view:hover {
  transform: translate3d(0, -2px, 0) scale(1.015);
}

.portfolio-see-all.reveal-up.in-view:active,
.portfolio-see-all.portfolio-animate-heading.in-view:active {
  transform: translate3d(0, 0, 0) scale(0.99);
}

/* ==========================================================================
   Magnetic buttons
   ========================================================================== */
.magnetic {
  will-change: transform;
  transition: transform 0.25s var(--ease);
}

/* ==========================================================================
   HIGH-END INTERACTIVE VISUALS & ANIMATIONS
   Custom Cursor, Glowing Glass Buttons, Micro-Fire Sparks, 3D Tilts & Radio Waves
   ========================================================================== */

/* 1. Global Fine Pointer & Cursor */
@media (hover: hover) and (pointer: fine) {
  body, a, button, [role="button"], input, textarea, select, .cursor-pointer {
    cursor: none !important;
  }
}

/* 2. Custom Cursor */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  opacity: 0;
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.8);
  backdrop-filter: blur(12px) saturate(1.8);
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.08), 0 0 30px rgba(255, 13, 37, 0.15);
  transition: width 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              border-radius 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              opacity 0.2s ease;
  will-change: transform, width, height, left, top;
}

/* Hovering over buttons/player UI: morphs into a clean, small high-visibility dot */
.custom-cursor.is-dot {
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  background: #FF0D25 !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 10px rgba(255, 13, 37, 0.95), 0 0 20px rgba(255, 13, 37, 0.5) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.custom-cursor.is-dot .cursor-face {
  opacity: 0 !important;
  visibility: hidden;
}

.cursor-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.2s ease, transform 0.15s ease-out;
  transform-origin: center center;
}

.cursor-eye {
  transition: cx 0.15s ease-out, cy 0.15s ease-out;
}

.cursor-mouth {
  transition: transform 0.15s ease-out;
}

/* Untinted clean emojis & Apple-styled animated emojis */
.emoji-clean {
  display: inline-block;
  font-style: normal;
  filter: none !important;
  text-shadow: none !important;
  color: initial !important;
  -webkit-text-fill-color: initial !important;
  vertical-align: middle;
}

.animated-emoji {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.16em;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: none !important;
}

/* Clean text highlight without color distortion */
.cursor-highlight {
  position: relative;
  display: inline-block;
  z-index: 1;
}

.text-glow {
  text-shadow: none !important;
}

/* 4. Glassmorphism Utilities */
.glass {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 0.5px rgba(255, 255, 255, 0.12), inset 0 -0.5px rgba(255, 255, 255, 0.05), 0 4px 24px -4px rgba(0, 0, 0, 0.4) !important;
  -webkit-backdrop-filter: blur(25px) saturate(1.8) brightness(1.1) !important;
  backdrop-filter: blur(25px) saturate(1.8) brightness(1.1) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.glass-heavy {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), inset 0 -1px rgba(255, 255, 255, 0.05), 0 16px 48px -12px rgba(0, 0, 0, 0.6) !important;
  -webkit-backdrop-filter: blur(40px) saturate(2) brightness(1.15) !important;
  backdrop-filter: blur(40px) saturate(2) brightness(1.15) !important;
  background: rgba(14, 14, 20, 0.65) !important;
}

/* 5. High-Impact Glowing Buttons */
.btn-glow,
.btn--primary,
.nav-cta {
  position: relative;
  overflow: visible !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  text-decoration: none !important;
  border-radius: 9999px !important;
  font-family: var(--font-display) !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  cursor: pointer;
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
  will-change: transform, box-shadow;
}

.btn-glow,
.btn--primary {
  background: #FF0D25 !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  box-shadow: 0 0 30px rgba(255, 13, 37, 0.55), 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

.btn-glow::before,
.btn--primary::before {
  content: "";
  border-radius: inherit;
  opacity: 0.55;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2), transparent) 0 0/200% 100%;
  animation: 3s ease-in-out infinite glow-wave;
  position: absolute;
  top: -2px;
  right: -2px;
  bottom: -2px;
  left: -2px;
  z-index: 0;
}

.btn-glow::after,
.btn--primary::after {
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  height: 1px;
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  z-index: 1;
}

.btn-glow:hover,
.btn--primary:hover {
  background: #FF2B40 !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  box-shadow: 0 0 45px rgba(255, 13, 37, 0.85), 0 0 90px rgba(255, 13, 37, 0.4), 0 12px 30px rgba(0, 0, 0, 0.6) !important;
  transform: translateY(-2px) scale(1.03) !important;
}

.btn-glow:hover::before,
.btn--primary:hover::before {
  opacity: 0.95;
  animation-duration: 1.2s;
}

.btn-glow:active,
.btn--primary:active {
  transform: scale(0.94) !important;
}

@keyframes glow-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Radio waves on button hover */
.btn-glow:hover,
.btn--primary:hover,
.nav-cta:hover {
  animation: 2s ease-out infinite radio-waves-btn;
}

@keyframes radio-waves-btn {
  0% { outline-offset: 0px; outline: 2px solid rgba(255, 13, 37, 0.5); }
  100% { outline-offset: 18px; outline: 2px solid rgba(255, 13, 37, 0); }
}

/* Nav CTA button styling */
.nav-cta {
  padding: 10px 22px !important;
  font-size: 0.88rem !important;
  background: rgba(255, 13, 37, 0.18) !important;
  border: 1px solid rgba(255, 13, 37, 0.4) !important;
  color: #ffffff !important;
  box-shadow: inset 0 0.5px rgba(255, 255, 255, 0.25), 0 0 18px rgba(255, 13, 37, 0.2) !important;
}

.nav-cta:hover {
  background: rgba(255, 13, 37, 0.36) !important;
  border-color: rgba(255, 13, 37, 0.75) !important;
  box-shadow: 0 0 28px rgba(255, 13, 37, 0.45), inset 0 0.5px rgba(255, 255, 255, 0.35) !important;
  transform: scale(1.04);
}

/* 6. Fire Embers & Micro-Flame Animation */
.btn-sparks {
  position: relative;
  width: 20px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  pointer-events: none;
}

.btn-ember {
  position: absolute;
  bottom: 2px;
  left: 50%;
  border-radius: 50%;
  pointer-events: none;
  animation: ember-float ease-out infinite;
}

/* Legacy button flame animation disabled to ensure custom brand identity */
.btn-sparks,
.btn-flame-core,
.btn-flame-inner,
.btn-flame-glow,
.btn-ember {
  display: none !important;
}

@keyframes ember-float {
  0% {
    transform: translate(0, 0) scale(0.8);
    opacity: 0.95;
  }
  100% {
    transform: translate(var(--drift-x, 4px), var(--drift-y, -26px)) scale(0.05);
    opacity: 0;
  }
}

/* 7. Card 3D Perspective Tilt & Radio Waves */
.client-card,
.shortform-card,
.thumbnail-item,
.thumbnail-full-item,
.review-item,
.portfolio-card,
.achievement-card {
  transform-style: preserve-3d;
  perspective: 800px;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: center center;
}

/* Longform cards: Pure 2D rendering to eliminate carousel clipping and bugs */
.longform-card {
  transform: none !important;
  transform-style: flat !important;
  perspective: none !important;
}

/* Radio waves on card hover */
.longform-card:hover .play-icon,
.thumbnail-item:hover,
.showreel-wrapper:hover .showreel-play-btn {
  animation: 2s ease-out infinite radio-waves;
}

@keyframes radio-waves {
  0% {
    box-shadow: 0 0 rgba(255, 13, 37, 0.35), 0 0 rgba(255, 13, 37, 0.18), 0 0 rgba(255, 13, 37, 0.08);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(255, 13, 37, 0), 0 0 0 22px rgba(255, 13, 37, 0), 0 0 0 38px rgba(255, 13, 37, 0);
  }
}

/* Card hover glow elevation */
.client-card:hover,
.longform-card:hover,
.shortform-card:hover,
.thumbnail-item:hover,
.thumbnail-full-item:hover,
.review-item:hover {
  border-color: rgba(255, 13, 37, 0.45) !important;
  box-shadow: 0 0 32px rgba(255, 13, 37, 0.25), 0 16px 40px rgba(0, 0, 0, 0.5) !important;
}

/* 8. Dot Matrix Background — Matching Brand Color Scheme */
.dot-matrix {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(255, 13, 37, 0.16) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 85%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 85%);
}

/* Animated Glowing Background for Hero Section */
.hero-glow-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(45px);
  opacity: 0.5;
  pointer-events: none;
  contain: paint;
  backface-visibility: hidden;
}

.hero-glow-orb--1 {
  width: clamp(320px, 42vw, 600px);
  height: clamp(320px, 42vw, 600px);
  top: 10%;
  left: 20%;
  background: radial-gradient(circle at 50% 50%,
      rgba(255, 13, 37, 0.28) 0%,
      rgba(255, 13, 37, 0.12) 40%,
      rgba(212, 10, 30, 0.04) 65%,
      transparent 80%);
}

.hero-glow-orb--2 {
  width: clamp(280px, 36vw, 500px);
  height: clamp(280px, 36vw, 500px);
  bottom: 15%;
  right: 15%;
  background: radial-gradient(circle at 50% 50%,
      rgba(255, 43, 64, 0.22) 0%,
      rgba(255, 13, 37, 0.08) 42%,
      rgba(255, 13, 37, 0.02) 65%,
      transparent 78%);
}

/* Static Non-Animated Glowing Orbs (Premium Studio Burnt-Orange Lighting, 0% CPU Cost) */
.static-bg-glows {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.static-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  contain: paint;
  filter: blur(80px);
}

/* 1. Top glowing orb: centered in middle of hero, attached to hero background so it scrolls away when leaving hero */
.static-orb--top {
  position: absolute;
  width: clamp(520px, 64vw, 920px);
  height: clamp(380px, 48vw, 680px);
  top: clamp(-40px, -4vw, 0px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255, 13, 37, 0.32) 0%,
    rgba(200, 10, 30, 0.15) 42%,
    rgba(130, 5, 20, 0.03) 68%,
    transparent 80%);
}

/* 2. Left glow orb: detached from background (fixed/floating), moved up to create an asymmetrical ("odd") look with the right glow */
.static-orb--left {
  width: clamp(380px, 46vw, 680px);
  height: clamp(380px, 46vw, 680px);
  top: 18vh;
  left: -12vw;
  background: radial-gradient(circle at 50% 50%,
    rgba(225, 15, 35, 0.20) 0%,
    rgba(170, 10, 25, 0.07) 48%,
    transparent 72%);
}

/* 3. Right glow orb: detached from background (fixed/floating), positioned lower down for staggered depth */
.static-orb--right {
  width: clamp(400px, 48vw, 720px);
  height: clamp(400px, 48vw, 720px);
  top: 58vh;
  right: -12vw;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 35, 55, 0.18) 0%,
    rgba(210, 10, 30, 0.06) 50%,
    transparent 72%);
}

/* 9. Fullscreen Shockwave Ripple */
.shockwave-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.shockwave-ring {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(255, 43, 64, 0.75);
  background: radial-gradient(circle, rgba(255, 13, 37, 0.18) 0%, transparent 70%);
  animation: shockwave-expand 0.85s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes shockwave-expand {
  0% {
    width: 0;
    height: 0;
    opacity: 0.95;
  }
  100% {
    width: 850px;
    height: 850px;
    opacity: 0;
  }
}

/* 10. 3D Word Reveal Animations (Anti-Clipping Clearances) */
.hero-word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: middle;
  perspective: 800px;
  padding-top: 4px;
  padding-bottom: 8px;
  margin-bottom: -8px;
  margin-right: 0;
}

.hero-heading-word,
.hero-word {
  display: inline-block;
  will-change: transform, opacity;
  transform: translateY(115%) rotateX(45deg);
  opacity: 0;
  padding-bottom: 4px;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-heading-word.in-view,
.hero-word.in-view {
  transform: translateY(0) rotateX(0deg);
  opacity: 1;
}

/* 11. Scroll Indicator */
.hero-scroll-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
  opacity: 0.75;
  transition: opacity 0.3s ease;
}

.scroll-text {
  font-family: var(--font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: rgba(240, 240, 245, 0.4);
  font-weight: 600;
}

.scroll-mouse {
  width: 20px;
  height: 32px;
  border-radius: 999px;
  border: 1.5px solid rgba(240, 240, 245, 0.25);
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.scroll-dot {
  width: 4px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: scroll-bounce 1.6s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(10px); opacity: 0.2; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Page-Enter Animations — Portfolio & Thumbnail Secondary Pages
   Smooth cinematic reveal: nav slides in → header fades → content cascades
   ========================================================================== */

/* Navbar entrance on secondary pages (portfolio, thumbnail) */
.site-navbar.nav-pre-animate {
  transform: translateX(-50%) translateY(calc(-100% - 30px)) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Page content layer: entire main + footer fade up from slightly below */
@keyframes pageEnterFadeUp {
  0% {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(6px);
  }
  60% {
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0px);
  }
}

/* Portfolio/thumbnail page header (nav) — slides in from top */
.portfolio-header.site-navbar {
  transition: transform 1.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.1s ease, background 0.5s ease, border-color 0.5s ease, backdrop-filter 0.5s ease, box-shadow 0.5s ease !important;
  will-change: transform, opacity !important;
}

/* Intro section — fades up after nav settles */
.portfolio-intro {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(8px);
  animation: pageEnterFadeUp 900ms cubic-bezier(0.16, 1, 0.3, 1) 350ms forwards;
  will-change: transform, opacity, filter;
}

/* Filter buttons — appear after intro */
.portfolio-filters {
  opacity: 0;
  transform: translateY(22px);
  animation: pageEnterFadeUp 800ms cubic-bezier(0.16, 1, 0.3, 1) 600ms forwards;
  will-change: transform, opacity;
}

/* Main content grid — appears last with a gentle blur-up */
.portfolio-grid,
.thumbnail-grid-full {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(4px);
  animation: pageEnterFadeUp 900ms cubic-bezier(0.16, 1, 0.3, 1) 850ms forwards;
  will-change: transform, opacity, filter;
}

/* Stagger the individual reveal-up items inside portfolio-intro:
   CSS animations handle these instead of the scroll IntersectionObserver.
   Using !important here ensures JS-added .in-view class can't override the timing. */
.portfolio-intro .reveal-up,
.portfolio-intro .reveal-up.in-view {
  opacity: 0;
  transform: translateY(0);
  transition: none !important;
}

.portfolio-intro .reveal-up[data-delay="1"],
.portfolio-intro .reveal-up[data-delay="1"].in-view {
  animation: pageEnterFadeUp 800ms cubic-bezier(0.16, 1, 0.3, 1) 380ms forwards !important;
  transition: none !important;
}

.portfolio-intro .reveal-up[data-delay="2"],
.portfolio-intro .reveal-up[data-delay="2"].in-view {
  animation: pageEnterFadeUp 800ms cubic-bezier(0.16, 1, 0.3, 1) 500ms forwards !important;
  transition: none !important;
}

.portfolio-intro .reveal-up[data-delay="3"],
.portfolio-intro .reveal-up[data-delay="3"].in-view {
  animation: pageEnterFadeUp 800ms cubic-bezier(0.16, 1, 0.3, 1) 620ms forwards !important;
  transition: none !important;
}

