/*
 * Godrix Shimmer Layer
 * Specular / light-sweep effects layered on top of design-system.css.
 * Loaded LAST so it can upgrade existing components without editing them.
 *
 * Contents
 *   0. Tokens & registered properties
 *   1. Shimmer text (animated gradient headings)
 *   2. Shimmer buttons (idle pulse + hover sweep)
 *   3. Shimmer borders (rotating conic edge light)
 *   4. Card sheen (diagonal highlight on hover)
 *   5. Accents — badges, tags, stats, dividers, logo
 *   6. Utilities
 *   7. Light theme
 *   8. Reduced motion & small screens
 */

/* ============================================
   0. TOKENS & REGISTERED PROPERTIES
   ============================================ */
:root {
  /* The bright band that travels across a surface */
  --shimmer-hi: rgba(255, 255, 255, 0.92);
  /* Soft wash on either side of the band */
  --shimmer-sheen: rgba(255, 255, 255, 0.12);
  /* Edge light colour for conic borders */
  --shimmer-edge: var(--primary, #5affa0);

  /* Gradient used for shimmering text — mint, white highlight, mint */
  --shimmer-text-gradient: linear-gradient(
    100deg,
    var(--primary-dark, #3cdc8c) 0%,
    var(--primary, #5affa0) 28%,
    #ffffff 46%,
    var(--primary-light, #78ffb4) 58%,
    var(--primary, #5affa0) 76%,
    var(--primary-dark, #3cdc8c) 100%
  );

  --shimmer-duration: 4.5s;
  --shimmer-sweep-duration: 1.1s;
  --shimmer-rotate-duration: 5s;
}

/* Registered so the conic angle can be animated. Browsers without
   @property fall back to a static (non-rotating) edge gradient. */
@property --shimmer-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

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

@keyframes shimmer-sweep {
  0%   { transform: translateX(-120%) skewX(-18deg); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateX(220%) skewX(-18deg); opacity: 0; }
}

@keyframes shimmer-rotate {
  to { --shimmer-angle: 360deg; }
}

@keyframes shimmer-breathe {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ============================================
   1. SHIMMER TEXT
   Upgrades the existing .text-gradient so every highlighted word
   in a heading catches a moving light band.
   ============================================ */
.text-gradient,
.shimmer-text {
  background: var(--shimmer-text-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shimmer-slide var(--shimmer-duration) linear infinite;
}

/* Slower, more restrained sweep for very large display type */
.hero-title .text-gradient,
.hero-title .hero-highlight {
  --shimmer-duration: 6s;
}

/* One-shot variant: shimmers only while hovered */
.shimmer-text-hover {
  background: var(--shimmer-text-gradient);
  background-size: 200% auto;
  background-position: 200% center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-position 0.9s ease;
}

.shimmer-text-hover:hover {
  background-position: -200% center;
}

/* ============================================
   2. SHIMMER BUTTONS
   .btn already ships a ::before sweep; it animates back out on
   mouse-leave, which reads as a glitch. Replace it with a keyframed
   sweep on ::after that plays once per hover.
   ============================================ */
.btn::before {
  display: none;
}

.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--shimmer-sheen) 35%,
    var(--shimmer-hi) 50%,
    var(--shimmer-sheen) 65%,
    transparent 100%
  );
  transform: translateX(-120%) skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.btn:hover::after,
.btn:focus-visible::after {
  animation: shimmer-sweep var(--shimmer-sweep-duration) ease-out;
}

/* Primary CTAs shimmer on their own so the eye is drawn to them,
   with a long pause between passes. */
.btn-primary::after,
.shimmer-btn::after {
  animation: shimmer-sweep 2.4s ease-out infinite;
  animation-delay: 1.2s;
}

.btn-primary:hover::after,
.shimmer-btn:hover::after {
  animation: shimmer-sweep var(--shimmer-sweep-duration) ease-out;
}

/* ============================================
   3. SHIMMER BORDERS
   A light travels around the edge. Uses mask-composite so only the
   1px rim is painted, leaving the card background untouched.
   ============================================ */
.shimmer-border {
  position: relative;
  isolation: isolate;
}

.shimmer-border::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--shimmer-angle),
    transparent 0deg,
    transparent 40deg,
    var(--shimmer-edge) 70deg,
    #ffffff 84deg,
    var(--shimmer-edge) 98deg,
    transparent 130deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: shimmer-rotate var(--shimmer-rotate-duration) linear infinite;
  pointer-events: none;
}

/* Thicker rim for hero-level elements */
.shimmer-border-lg::before {
  padding: 2px;
}

/* Edge light only once the card is hovered */
.shimmer-border-hover::before {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.shimmer-border-hover:hover::before {
  opacity: 1;
}

/* ============================================
   4. CARD SHEEN
   Diagonal highlight that crosses the card on hover. Applied only to
   classes whose ::after is otherwise unused — spotlight-card,
   comet-card and glass-card already own theirs and are left alone.
   ============================================ */
.card,
.service-card,
.industry-card,
.case-study-card,
.tech-card,
.team-card,
.feature-card,
.stat-card,
.shimmer-card {
  position: relative;
  overflow: hidden;
}

.card::after,
.service-card::after,
.industry-card::after,
.case-study-card::after,
.tech-card::after,
.team-card::after,
.feature-card::after,
.stat-card::after,
.shimmer-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--shimmer-sheen) 40%,
    rgba(255, 255, 255, 0.22) 50%,
    var(--shimmer-sheen) 60%,
    transparent 100%
  );
  transform: translateX(-120%) skewX(-18deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.card:hover::after,
.service-card:hover::after,
.industry-card:hover::after,
.case-study-card:hover::after,
.tech-card:hover::after,
.team-card:hover::after,
.feature-card:hover::after,
.stat-card:hover::after,
.shimmer-card:hover::after {
  animation: shimmer-sweep 1.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* The sheen deliberately passes *over* the card contents — that is the
   effect. Children are left untouched so absolutely-positioned icons
   and accents keep their own positioning. */

/* ============================================
   5. ACCENTS
   ============================================ */

/* Hero badge — slow travelling highlight across the pill.
   The badge itself owns a fade-in animation, so the shimmer lives on
   ::after rather than overriding the `animation` property. */
.hero-badge {
  position: relative;
  overflow: hidden;
}

.hero-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 38%,
    var(--shimmer-sheen) 48%,
    var(--shimmer-hi) 50%,
    var(--shimmer-sheen) 52%,
    transparent 62%,
    transparent 100%
  );
  background-size: 250% 100%;
  animation: shimmer-slide 5s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

/* Section tags get a soft breathing glow rather than a sweep */
.section-tag {
  position: relative;
}

.section-tag::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 18px -4px var(--primary, #5affa0);
  animation: shimmer-breathe 3.5s ease-in-out infinite;
  pointer-events: none;
}

/* Stat numbers shimmer like the headings */
.hero-stat-value,
.stat-value,
.counter-value {
  background: var(--shimmer-text-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shimmer-slide 5.5s linear infinite;
}

/* Thin shimmering rule — drop between sections */
.shimmer-divider {
  height: 1px;
  border: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--primary, #5affa0) 30%,
    #ffffff 50%,
    var(--primary, #5affa0) 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-slide 4s linear infinite;
  opacity: 0.6;
}

/* Navbar hairline picks up the same light once the page is scrolled */
.navbar.scrolled::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--primary, #5affa0) 35%,
    #ffffff 50%,
    var(--primary, #5affa0) 65%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-slide 6s linear infinite;
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================
   6. UTILITIES
   ============================================ */

/* Loading placeholder — pairs with the existing .shimmer skeleton */
.shimmer-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--black-light, #1e293b);
  border-radius: var(--radius-md, 12px);
}

.shimmer-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--shimmer-sheen) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer-slide 1.6s linear infinite;
}

/* Opt out on any single element */
.shimmer-none,
.shimmer-none::after,
.shimmer-none::before {
  animation: none !important;
}

/* ============================================
   7. LIGHT THEME
   White surfaces swallow a white highlight, so the band becomes a
   tinted one and the text gradient darkens enough to stay readable.
   ============================================ */
[data-theme="light"] {
  --shimmer-hi: rgba(48, 33, 138, 0.28);
  --shimmer-sheen: rgba(48, 33, 138, 0.07);
  --shimmer-edge: #30218a;

  /* Palette blue ramp. Lightest stop is #4a90e2 (3.29:1 on white) which is
     AA for the large display type this is used on; everything else clears
     4.5 so it stays safe on smaller headings too. */
  --shimmer-text-gradient: linear-gradient(
    100deg,
    #022b3a 0%,
    #17509f 26%,
    #4a90e2 46%,
    #1d6fd0 58%,
    #17509f 78%,
    #022b3a 100%
  );
}

[data-theme="light"] .card::after,
[data-theme="light"] .service-card::after,
[data-theme="light"] .industry-card::after,
[data-theme="light"] .case-study-card::after,
[data-theme="light"] .tech-card::after,
[data-theme="light"] .team-card::after,
[data-theme="light"] .feature-card::after,
[data-theme="light"] .stat-card::after,
[data-theme="light"] .shimmer-card::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(48, 33, 138, 0.04) 40%,
    rgba(48, 33, 138, 0.1) 50%,
    rgba(48, 33, 138, 0.04) 60%,
    transparent 100%
  );
}

[data-theme="light"] .shimmer-border::before {
  background: conic-gradient(
    from var(--shimmer-angle),
    transparent 0deg,
    transparent 40deg,
    var(--shimmer-edge) 70deg,
    #0891b2 84deg,
    var(--shimmer-edge) 98deg,
    transparent 130deg,
    transparent 360deg
  );
}

[data-theme="light"] .shimmer-divider,
[data-theme="light"] .navbar.scrolled::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    #30218a 35%,
    #0891b2 50%,
    #30218a 65%,
    transparent 100%
  );
  background-size: 200% 100%;
}

[data-theme="light"] .shimmer-skeleton {
  background: #eef1f6;
}

/* design-system.css and some page-level <style> blocks define
   [data-theme="light"] .hero-stat-value / .text-gradient directly.
   Match that specificity so the shimmering gradient still applies. */
[data-theme="light"] .text-gradient,
[data-theme="light"] .shimmer-text,
[data-theme="light"] .hero-stat-value,
[data-theme="light"] .stat-value,
[data-theme="light"] .counter-value {
  background: var(--shimmer-text-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================
   8. REDUCED MOTION & SMALL SCREENS
   ============================================ */

/* Honour the OS setting: keep the colour, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .text-gradient,
  .shimmer-text,
  .hero-badge::after,
  .hero-stat-value,
  .stat-value,
  .counter-value,
  .shimmer-divider,
  .navbar.scrolled::after,
  .shimmer-border::before,
  .section-tag::after,
  .shimmer-skeleton::after,
  .btn::after,
  .btn-primary::after,
  .shimmer-btn::after {
    animation: none !important;
  }

  .text-gradient,
  .shimmer-text,
  .hero-stat-value,
  .stat-value,
  .counter-value {
    background-position: 50% center;
  }

  .btn::after,
  .btn-primary::after,
  .shimmer-btn::after {
    opacity: 0;
  }
}

/* Idle loops cost battery on phones; keep hover/tap effects only. */
@media (hover: none), (max-width: 768px) {
  .btn-primary::after,
  .shimmer-btn::after,
  .section-tag::after,
  .navbar.scrolled::after {
    animation: none !important;
  }

  .hero-badge::after {
    animation-duration: 8s;
  }

  .shimmer-border::before {
    animation-duration: 8s;
  }
}

/* Shimmer on text is decorative; never let it hide the words if the
   gradient fails to paint (e.g. background-clip unsupported). */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .text-gradient,
  .shimmer-text,
  .hero-stat-value,
  .stat-value,
  .counter-value {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--primary, #5affa0);
    animation: none;
  }
}
