/**
 * Site-wide visual polish inspired by freefrontend patterns
 * (gradient borders, grain, marquee, ripples, progress, tooltips, tilt).
 */

/* ── Scroll progress ─────────────────────────────────────────────── */
.hub-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  width: 100%;
  z-index: 2147483640;
  transform-origin: left center;
  transform: scaleX(var(--hub-scroll, 0));
  background: linear-gradient(90deg, #8364C7, #77ddff, #f1641e);
  pointer-events: none;
  box-shadow: 0 0 18px rgba(177, 163, 248, 0.75);
}

/* ── Film grain DISABLED — continuous mix-blend animation caused mobile flashing ── */
.hub-grain {
  display: none !important;
}

/* ── Custom cursor DISABLED (kept off — main GPU culprit with spotlight) ── */
.hub-cursor,
.hub-cursor-ring {
  display: none !important;
}

html.hub-cursor-on,
html.hub-cursor-on a,
html.hub-cursor-on button,
html.hub-cursor-on input,
html.hub-cursor-on select,
html.hub-cursor-on .hub-select-trigger,
html.hub-cursor-on .hub-select-option {
  cursor: auto !important;
}

/* ── Animated gradient border masks stay OFF (heavy) ── */
.hub-border-glow {
  display: none !important;
}

/* Hover shine restored (one-shot on hover, not continuous) */
.hub-shine {
  position: relative;
  overflow: hidden;
}

.hub-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 45%,
    transparent 100%
  );
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 3;
}

.hub-shine:hover::after {
  animation: hub-shine-sweep 0.9s ease;
}

@keyframes hub-shine-sweep {
  to { left: 160%; }
}

/* ── Button ripples ──────────────────────────────────────────────── */
.hub-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: hub-ripple-anim 0.65s ease-out forwards;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 4;
}

@keyframes hub-ripple-anim {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

.button {
  position: relative;
  overflow: hidden;
}

/* ── Marquee ticker (JS-driven scroll — CSS animation alone fails when
   Windows/Opera has “reduce animations” / prefers-reduced-motion) ── */
.hub-marquee {
  position: relative;
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.55);
}

.hub-marquee-track {
  display: flex;
  width: max-content;
  gap: 0;
  /* JS drives transform; no will-change to avoid permanent GPU layer */
  animation: hub-marquee-scroll 42s linear infinite;
}

.hub-marquee.is-js-marquee .hub-marquee-track {
  animation: none;
}

.hub-marquee.is-paused .hub-marquee-track {
  animation-play-state: paused;
}

.hub-marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hub-marquee-item::after {
  content: "✦";
  color: var(--brand-accent);
  opacity: 0.7;
  margin-left: 8px;
}

@keyframes hub-marquee-scroll {
  to { transform: translateX(-50%); }
}

/* ── Stats strip ─────────────────────────────────────────────────── */
.hub-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.hub-stat {
  position: relative;
  overflow: hidden;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-soft);
  text-align: center;
}

.hub-stat-value {
  display: block;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(90deg, #fff, var(--brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hub-stat-label {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── 3D tilt cards ───────────────────────────────────────────────── */
.hub-tilt {
  transform-style: preserve-3d;
  will-change: transform;
}

.hub-tilt > * {
  transform: translateZ(0);
}

/* ── Social tooltips ─────────────────────────────────────────────── */
.socials-bar .social-link {
  position: relative;
}

.socials-bar .social-link[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  translate: -50% 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(12, 12, 20, 0.95);
  border: 1px solid rgba(177, 163, 248, 0.35);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.2s;
  z-index: 5;
}

.socials-bar .social-link[data-tooltip]:hover::before,
.socials-bar .social-link[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  translate: -50% 0;
}

/* ── Tagline scramble caret ──────────────────────────────────────── */
.hub-scramble {
  display: inline-block;
  white-space: nowrap;
  min-width: 1ch;
}

.hub-scramble.is-running {
  text-shadow: 0 0 12px rgba(119, 221, 255, 0.35);
}

/* ── Copy toast ──────────────────────────────────────────────────── */
.hub-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  translate: -50% 20px;
  z-index: 2147483642;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(177, 163, 248, 0.4);
  background: rgba(12, 12, 20, 0.92);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.hub-toast.is-on {
  opacity: 1;
  translate: -50% 0;
}

.nav-link .nav-soon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(241, 100, 30, 0.2);
  border: 1px solid rgba(241, 100, 30, 0.45);
  color: #ffb38a;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

@media (max-width: 900px) {
  .hub-border-glow {
    display: none !important;
  }

  .hub-shine::after {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .hub-stats {
    grid-template-columns: 1fr;
  }
}

/* Desktop: richer ticker + stats (site is used mostly on desktop) */
@media (min-width: 901px) {
  .hub-marquee {
    margin: 0 0 22px;
    border-radius: 999px;
    border-color: rgba(177, 163, 248, 0.2);
    background: linear-gradient(
      90deg,
      rgba(10, 14, 32, 0.55),
      rgba(131, 100, 199, 0.12),
      rgba(10, 14, 32, 0.55)
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .hub-marquee-item {
    padding: 14px 22px;
    font-size: 0.84rem;
    letter-spacing: 0.06em;
  }

  .hub-stats {
    gap: 14px;
    margin: 0 0 22px;
  }

  .hub-stat {
    padding: 22px 18px 20px;
    border-radius: 22px;
    background:
      linear-gradient(165deg, rgba(177, 163, 248, 0.1), transparent 55%),
      rgba(10, 14, 36, 0.55);
    border-color: rgba(177, 163, 248, 0.18);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 18px 36px rgba(0, 0, 0, 0.22);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease;
  }

  .hub-stat:hover {
    transform: translateY(-3px);
    border-color: rgba(119, 221, 255, 0.28);
  }

  .hub-stat-value {
    font-size: clamp(1.9rem, 2.6vw, 2.45rem);
  }

  .hub-stat-label {
    margin-top: 6px;
    font-size: 0.8rem;
    letter-spacing: 0.07em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-border-glow,
  .hub-shine::after {
    animation: none !important;
  }

  /* Keep ticker moving via JS — do not freeze transform here */
  .hub-marquee-track {
    animation: none !important;
  }

  .hub-progress {
    transition: none;
  }
}
