/*
 * Cloud Station homepage motion layer
 * Load after both language-specific style.css files.
 * Keeps the existing monochrome system, Somar Sans / NT Voice typography,
 * and all layout dimensions intact.
 */

/* Scroll reveals: quiet, short travel; inline --rd staggers remain supported
   but cannot leave long queues on dense grids such as the client wall. */
.reveal {
  transform: translateY(16px);
  transition:
    opacity 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: min(var(--rd, 0s), 340ms);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* The hero keeps its own line/stat choreography; only soften the distance
   and duration so it reads as one purposeful entrance, not a second reveal. */
.hero-title .line {
  transform: translateY(0.22em);
  transition:
    opacity 560ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-title.in .line:nth-child(2) {
  transition-delay: 120ms;
}

.hero-stats .stat {
  transform: translateY(10px);
  transition:
    opacity 460ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-stats.in .stat:nth-child(1) { transition-delay: 40ms; }
.hero-stats.in .stat:nth-child(2) { transition-delay: 120ms; }
.hero-stats.in .stat:nth-child(3) { transition-delay: 200ms; }

/* Stable numeral columns without changing font family, size, or weight. */
[data-count] {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Actual CMS request feedback. Shimmer overlays are decorative only:
   no content is hidden, no regions are resized, and interaction stays clear. */
html[data-site-content-state="loading"] [data-count] {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    100deg,
    rgba(241, 241, 241, 0.08) 0%,
    rgba(241, 241, 241, 0.22) 46%,
    rgba(241, 241, 241, 0.08) 88%
  );
  background-size: 220% 100%;
  background-position: 100% 0;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  border-radius: 4px;
  animation: cs-number-shimmer 1.45s ease-in-out infinite;
}

html[data-site-content-state="loading"] .clients-marquee,
html[data-site-content-state="loading"] .pt-bento {
  position: relative;
}

html[data-site-content-state="loading"] .clients-marquee::after,
html[data-site-content-state="loading"] .pt-bento::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 18%,
    rgba(25, 25, 25, 0.07) 44%,
    rgba(25, 25, 25, 0.13) 50%,
    rgba(25, 25, 25, 0.07) 56%,
    transparent 82%
  );
  background-size: 220% 100%;
  background-position: 100% 0;
  animation: cs-region-shimmer 1.55s ease-in-out infinite;
}

@keyframes cs-number-shimmer {
  to { background-position: -120% 0; }
}

@keyframes cs-region-shimmer {
  to { background-position: -120% 0; }
}

/* A brief opacity-only acknowledgement for live CMS text/logo replacements. */
.site-content-updated {
  animation: cs-content-updated 300ms ease-out both;
}

@keyframes cs-content-updated {
  from { opacity: 0.62; }
  to { opacity: 1; }
}

/* Non-blocking data status notice; logical positioning supports Arabic RTL. */
.site-data-status {
  position: fixed;
  inset-inline-start: 16px;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(25, 25, 25, 0.12);
  border-radius: 12px;
  background: rgba(241, 241, 241, 0.96);
  color: #191919;
  box-shadow: 0 8px 28px -16px rgba(25, 25, 25, 0.34);
  font-family: var(--font-main, "NT Voice", "Somar Sans", sans-serif);
  font-size: 13px;
  line-height: 1.45;
  text-align: start;
  direction: inherit;
  pointer-events: none;
}

html[dir="ltr"] .site-data-status {
  inset-inline-start: max(16px, env(safe-area-inset-left, 0px));
}

html[dir="rtl"] .site-data-status {
  inset-inline-start: max(16px, env(safe-area-inset-right, 0px));
}

.site-data-status__text {
  min-width: 0;
}

.site-data-status__retry {
  flex: none;
  padding: 4px 8px;
  border: 1px solid rgba(25, 25, 25, 0.22);
  border-radius: 999px;
  color: inherit;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}

.site-data-status__retry:hover {
  background: rgba(25, 25, 25, 0.07);
}

.site-data-status[data-state="error"] {
  border-color: rgba(25, 25, 25, 0.28);
  background: #f7f4f0;
}

@media (max-width: 560px) {
  .reveal {
    transform: translateY(10px);
    transition-duration: 420ms;
    transition-delay: min(var(--rd, 0s), 180ms);
  }

  .hero-title .line {
    transform: translateY(0.14em);
    transition-duration: 460ms;
  }

  .hero-stats .stat {
    transform: translateY(6px);
    transition-duration: 380ms;
  }

  .hero-stats.in .stat:nth-child(1) { transition-delay: 30ms; }
  .hero-stats.in .stat:nth-child(2) { transition-delay: 90ms; }
  .hero-stats.in .stat:nth-child(3) { transition-delay: 150ms; }

  .site-data-status {
    inset-inline: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.in,
  .hero-title .line,
  .hero-title.in .line,
  .hero-stats .stat,
  .hero-stats.in .stat,
  .site-content-updated {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
    transition-delay: 0s;
  }

  html[data-site-content-state="loading"] [data-count] {
    color: inherit;
    -webkit-text-fill-color: currentColor;
    background: none;
    animation: none;
  }

  html[data-site-content-state="loading"] .clients-marquee::after,
  html[data-site-content-state="loading"] .pt-bento::after {
    display: none;
    animation: none;
  }
}

/* Counters carry their real value in the HTML so crawlers that don't run JavaScript read
   "17", not "0". Hide it until homepage-motion.js has reset it to 0 (data-count-ready), so
   visitors never see the final value flash before the count-up. Without JavaScript the
   value simply stays visible. */
@media (scripting: enabled) {
  [data-count]:not([data-count-ready]) {
    visibility: hidden;
  }
}
