/* ============================================================
   CUSTOM CURSOR
   ============================================================ */

@media (pointer: fine) {
  .cursor-dot,
  .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    border-radius: 50%;
    will-change: transform;
  }

  .cursor-dot {
    width: 6px;
    height: 6px;
    background: var(--accent, #c4956a);
    transition: opacity 0.25s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  }

  .cursor-ring {
    width: 36px;
    height: 36px;
    border: 1px solid var(--accent, #c4956a);
    opacity: 0.5;
    transition:
      width 0.3s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
      height 0.3s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
      opacity 0.3s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
      border-color 0.3s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
    will-change: transform, width, height;
  }

  .cursor-ring.is-hovering {
    width: 56px;
    height: 56px;
    opacity: 0.9;
    border-color: var(--accent2, #9c6868);
  }

  .cursor-dot.is-hovering {
    opacity: 0;
  }

  .cursor-ring.is-down {
    width: 28px;
    height: 28px;
  }

  body.cursor-active,
  body.cursor-active a,
  body.cursor-active button,
  body.cursor-active .w-opt,
  body.cursor-active .g-item,
  body.cursor-active input,
  body.cursor-active select,
  body.cursor-active textarea,
  body.cursor-active label {
    cursor: none;
  }
}

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-dot,
  .cursor-ring {
    display: none;
  }
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 9998;
  pointer-events: none;
  background: transparent;
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent, #c4956a), var(--accent2, #9c6868));
  will-change: width;
}

/* ============================================================
   MARQUEE
   ============================================================ */

.marquee {
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: inline-flex;
  will-change: transform;
  animation: marquee-scroll var(--marquee-duration, 30s) linear infinite;
}

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

.marquee__item {
  display: inline-flex;
  align-items: center;
  padding-right: var(--marquee-gap, 3rem);
  flex-shrink: 0;
}

/* ============================================================
   FILM GRAIN OVERLAY
   ============================================================ */

.grain {
  position: relative;
}

.grain::after {
  content: "";
  position: fixed;
  inset: -100%;
  z-index: 9990;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-jump 0.65s steps(4) infinite;
  will-change: transform;
}

/* ============================================================
   MAGNETIC BUTTON
   ============================================================ */

.magnetic {
  will-change: transform;
  transition: transform 0.35s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

/* ============================================================
   TILT CARD
   ============================================================ */

.tilt {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.5s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

/* ============================================================
   REVEAL SYSTEM v2
   ============================================================ */

.js .rv,
.js .rv-left,
.js .rv-right,
.js .rv-scale,
.js .rv-rotate {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.8s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.8s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: var(--rv-delay, 0ms);
  will-change: opacity, transform;
}

.js .rv-left { transform: translateX(-48px); }

.js .rv-right { transform: translateX(48px); }

.js .rv-scale { transform: scale(0.92); }

.js .rv-rotate { transform: translateY(32px) rotate(2deg); }

.rv-delay-1 { --rv-delay: 100ms; }
.rv-delay-2 { --rv-delay: 200ms; }
.rv-delay-3 { --rv-delay: 300ms; }
.rv-delay-4 { --rv-delay: 400ms; }

.rv-in {
  opacity: 1;
  transform: none;
}

.js .rv.rv-in,
.js .rv-left.rv-in,
.js .rv-right.rv-in,
.js .rv-scale.rv-in,
.js .rv-rotate.rv-in {
  opacity: 1;
  transform: none;
}

.rv-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.7s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: calc(var(--rv-stagger-index, 0) * 90ms);
  will-change: opacity, transform;
}

.rv-stagger.rv-in > * {
  opacity: 1;
  transform: none;
}

/* ============================================================
   TYPEWRITER CURSOR
   ============================================================ */

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent, #c4956a);
  animation: pulse-soft 1s ease-in-out infinite;
}

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

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

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes grain-jump {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(196, 149, 106, 0.15); }
  50% { box-shadow: 0 0 40px rgba(196, 149, 106, 0.35); }
}

.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-soft { animation: pulse-soft 2.5s ease-in-out infinite; }
.animate-shimmer {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}
.animate-spin-slow { animation: spin-slow 14s linear infinite; }
.animate-glow-pulse { animation: glow-pulse 3s ease-in-out infinite; }

/* ============================================================
   SELECTION & FOCUS
   ============================================================ */

::selection {
  background: var(--accent, #c4956a);
  color: #070708;
}

:focus-visible {
  outline: 2px solid var(--accent, #c4956a);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .marquee-track,
  .grain::after,
  .animate-float,
  .animate-pulse-soft,
  .animate-shimmer,
  .animate-spin-slow,
  .animate-glow-pulse,
  .typewriter-cursor {
    animation: none !important;
  }

  .js .rv,
  .js .rv-left,
  .js .rv-right,
  .js .rv-scale,
  .js .rv-rotate,
  .rv-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .magnetic,
  .tilt {
    transition: none;
  }

  html {
    scroll-behavior: auto !important;
  }
}
