/* ===== BASE.CSS ===== */
/* Reset, typography, and global styles */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background 0.4s ease,
    color 0.4s ease;
  position: relative;
}

/* Premium Noise Texture Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.035;
  z-index: 9999; /* Subtle overlay on everything */
  pointer-events: none;
}

/* Soft ambient glow */
body::after {
  content: "";
  position: fixed;
  top: -10%;
  right: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(226, 183, 20, 0.04) 0%,
    transparent 70%
  );
  z-index: -2;
  pointer-events: none;
  animation: bgGlowFloat 20s ease-in-out infinite alternate;
}

@keyframes bgGlowFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, -20px) scale(1.05);
  }
}

/* Custom Text Selection */
::selection {
  background: var(--violet-soft);
  color: var(--violet);
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
}
h1 {
  font-size: var(--fs-h1);
}
h2 {
  font-size: var(--fs-h2);
}
h3 {
  font-size: var(--fs-h3);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
}
h4 {
  font-size: var(--fs-body);
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}

p {
  max-width: 65ch;
}

a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}
ul,
ol {
  list-style: none;
}

/* Layout */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}
section {
  padding: 64px 0 80px;
}

/* Common text components */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--text);
}

.section-title {
  font-size: var(--fs-h1);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 14px;
}
.section-sub {
  color: var(--text-dim);
  max-width: 65ch;
  margin-bottom: 56px;
  font-size: var(--fs-body);
  line-height: var(--lh-base);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    transform: none !important;
    box-shadow: none !important;
  }
}

#particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

/* ---- Scroll Progress Bar ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform-origin: 0% 50%;
  transform: scaleX(0);
  z-index: 10001; /* Above custom cursor if needed */
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* ---- Custom Cursor ---- */
@media (pointer: fine) {
  body {
    cursor: none;
  }
  a,
  button,
  .card,
  input,
  textarea,
  select,
  [role="button"] {
    cursor: none;
  }

  .custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    transition: width 0.2s, height 0.2s;
  }

  .custom-cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition:
      width 0.3s,
      height 0.3s,
      background 0.3s,
      border-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: black;
    text-transform: uppercase;
    letter-spacing: 1px;
    mix-blend-mode: difference;
    opacity: 0.8;
  }

  .custom-cursor-follower.hover-active {
    width: 70px;
    height: 70px;
    background: white;
    border-color: white;
    opacity: 1;
    mix-blend-mode: difference;
  }

  .custom-cursor-follower.hover-active::after {
    content: attr(data-cursor-text);
  }
}

/* ===== TYPOGRAPHY ANIMATIONS ===== */
@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blurIn {
  0% {
    opacity: 0;
    filter: blur(10px);
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes maskReveal {
  0% {
    clip-path: inset(100% 0 0 0);
    transform: translateY(20px);
  }
  100% {
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
  }
}

.animate-fade-up {
  opacity: 0;
  transform: translateY(20px);
}
.animate-fade-up.is-visible {
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-blur-in {
  opacity: 0;
  filter: blur(10px);
  transform: scale(0.98);
}
.animate-blur-in.is-visible {
  animation: blurIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-mask-reveal {
  clip-path: inset(100% 0 0 0);
  transform: translateY(20px);
}
.animate-mask-reveal.is-visible {
  animation: maskReveal 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ===== GLOBAL LOADER ===== */
#global-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.8s ease-out,
    visibility 0.8s;
}
#global-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 16px;
  animation: pulseLogo 1.5s ease-in-out infinite alternate;
}
.loader-progress {
  width: 0;
  height: 2px;
  background: var(--cyan);
  animation: loadProgress 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes pulseLogo {
  0% {
    opacity: 0.3;
    filter: blur(2px);
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}
@keyframes loadProgress {
  0% {
    width: 0;
  }
  100% {
    width: 120px;
  }
}
