/**
 * JJ Stone Craft House — Animation Support CSS
 * Companion to jjstone_animations.js + jjstone_polish.js
 * Drop into /assets/ alongside the JS files.
 */

/* ─────────────────────────────────────────────
   CUSTOM CURSOR
   Ring: amber circle with lag
   Dot: precise amber pinpoint
   Desktop only — hidden on touch devices
───────────────────────────────────────────── */
.jj-custom-cursor-active,
.jj-custom-cursor-active * {
  cursor: none !important;
}

.jj-cursor-ring {
  position:       fixed;
  top:            0;
  left:           0;
  width:          38px;
  height:         38px;
  border:         1px solid rgba(201, 168, 76, 0.5);
  border-radius:  50%;
  pointer-events: none;
  z-index:        9999;
  transform:      translate(-50%, -50%);
  opacity:        0;
  transition:
    width          0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    height         0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color   0.25s ease,
    background     0.25s ease,
    opacity        0.3s  ease;
}

.jj-cursor-ring--visible {
  opacity: 1;
}

.jj-cursor-ring--hover {
  width:        56px;
  height:       56px;
  border-color: rgba(201, 168, 76, 0.9);
  background:   rgba(201, 168, 76, 0.06);
}

.jj-cursor-dot {
  position:       fixed;
  top:            0;
  left:           0;
  width:          4px;
  height:         4px;
  background:     rgba(201, 168, 76, 0.95);
  border-radius:  50%;
  pointer-events: none;
  z-index:        9999;
  transform:      translate(-50%, -50%);
  opacity:        0;
  transition:     opacity 0.3s ease;
}

.jj-cursor-dot--visible {
  opacity: 1;
}

/* ─────────────────────────────────────────────
   MAGNETIC BUTTONS
   Elements that follow cursor within bounds.
   Add .jj-magnetic to any CTA or link button.
   Wrap inner text in .jj-magnetic-inner for
   layered depth effect.
───────────────────────────────────────────── */
.jj-magnetic {
  display:          inline-block;
  transform-origin: center;
  will-change:      transform;
}

/* ─────────────────────────────────────────────
   TEXT SCRUB
   Word spans created by setupTextScrub()
───────────────────────────────────────────── */
.jj-scrub-word {
  display:        inline-block;
  will-change:    opacity;
}

/* ─────────────────────────────────────────────
   PAGE TRANSITION OVERLAY
   Brand-green wipe between pages.
   Covers full viewport, sits above everything.
───────────────────────────────────────────── */
.jj-transition-overlay {
  position:       absolute;
  top: 0; left: 0; right: 0;
  /* Lives in the SCROLL layer (absolute, JS-anchored to scrollY when shown),
     not the fixed layer — iOS composites fixed elements separately and was
     leaving a strip of page visible at the bottom during transitions despite
     the element measuring 80px taller than the viewport. As scroll-layer
     content it paints exactly where page content paints, in every browser
     layer iOS samples. Height stays over-extended past any viewport.
     Session 5 architectural fix. */
  height: calc(100vh + 120px);   /* fallback for browsers without lvh */
  height: calc(100lvh + env(safe-area-inset-bottom, 0px) + 80px);
  background:     rgb(17, 31, 10);
  z-index:        9997;
  pointer-events: none;
  transform-origin: top center;
}

.jj-transition-logo {
  position:    absolute;
  top:         50%;
  left:        50%;
  transform:   translate(-50%, -50%);
  width:       260px;
  z-index:     1;
  pointer-events: none;
  user-select: none;
}

/* ─────────────────────────────────────────────
   MARQUEE
   Outer clips overflow. Track scrolls infinitely.
───────────────────────────────────────────── */
[data-marquee-wrap] {
  overflow:   hidden;
  width:      100%;
  cursor:     default;
}

[data-marquee] {
  display:     flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  gap:         0;
}

/* ─────────────────────────────────────────────
   CLIP-PATH REVEAL
   Elements using data-reveal="clip" or "clip-left"
   Overflow must be hidden for clip to work cleanly
───────────────────────────────────────────── */
[data-reveal="clip"],
[data-reveal="clip-left"] {
  overflow: hidden;
}

/* ─────────────────────────────────────────────
   REDUCED MOTION — POLISH LAYER ADDITIONS
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .jj-transition-overlay {
    display: none;
  }

  [data-reveal="clip"],
  [data-reveal="clip-left"] {
    clip-path: none !important;
  }

  .jj-scrub-word {
    opacity: 1 !important;
  }
}

/* ─────────────────────────────────────────────
   PRE-ANIMATION VISIBILITY GUARD
   Prevents unstyled flash before JS fires.
   Elements with data-reveal start hidden;
   .jj-anim-ready class is added by JS on init —
   if JS never loads, everything stays visible.
───────────────────────────────────────────── */
@media (pointer: fine) {
[data-reveal],
[data-stagger] > *,
[data-section-reveal] {
  will-change: transform, opacity;
}
}

/* ─────────────────────────────────────────────
   WORD / LINE REVEAL WRAPPERS
   Created dynamically by JS — styles here
───────────────────────────────────────────── */
.jj-word-wrap {
  display:        inline-block;
  overflow:       hidden;
  vertical-align: bottom;
  line-height:    1.15;
}

.jj-word-inner {
  display: inline-block;
}

.jj-line-inner {
  display: block;
}

/* ─────────────────────────────────────────────
   LOGO
───────────────────────────────────────────── */
.jj-logo {
  transition:       transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: left center;
}

header.jj-nav--scrolled .jj-logo {
  transform: scale(0.85);
}

/* ─────────────────────────────────────────────
   NAV SCROLL STATE
   .jj-nav--scrolled toggled by JS at 60px
   Applied to <header> — the sticky wrapper
───────────────────────────────────────────── */
header,
nav,
.nav,
[data-nav] {
  transition:
    background-color 0.45s ease,
    backdrop-filter  0.45s ease,
    box-shadow       0.45s ease;
}

.jj-nav--scrolled {
  background-color: rgba(17, 31, 10, 0.97);
  backdrop-filter:  blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(201, 168, 76, 0.25), 0 2px 20px rgba(0, 0, 0, 0.5);
}

/* ─────────────────────────────────────────────
   HOVER LIFT ELEMENTS
   Transition backing for GSAP hover states
───────────────────────────────────────────── */
[data-hover-lift],
.jj-card,
.jj-cta {
  transition: box-shadow 0.3s ease;
}

[data-hover-lift]:hover,
.jj-card:hover,
.jj-cta:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35),
              0 2px 8px rgba(201, 168, 76, 0.08);
}

/* ─────────────────────────────────────────────
   DRAW LINE
   Sets initial visible display so GSAP scaleX
   works cleanly
───────────────────────────────────────────── */
[data-draw-line] {
  display:          block;
  transform-origin: left center;
}

/* ─────────────────────────────────────────────
   PARALLAX ELEMENTS
   background-size: cover must be explicit
   for parallax position shift to work cleanly
───────────────────────────────────────────── */
[data-parallax] {
  background-attachment: scroll; /* intentional — GSAP handles the shift */
  background-size: cover;
}

/* ─────────────────────────────────────────────
   REDUCED MOTION OVERRIDES
   All animations collapse to instant opacity
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-stagger] > *,
  [data-section-reveal],
  [data-reveal-line],
  [data-hero-words],
  [data-draw-line] {
    opacity:   1 !important;
    transform: none !important;
    clip-path: none !important;
  }

  .jj-word-inner,
  .jj-line-inner {
    transform: none !important;
    opacity:   1 !important;
  }

  [data-parallax] {
    background-position: center center !important;
  }
}

/* ─────────────────────────────────────────────
   SMOOTH SCROLL (native)
───────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* ─────────────────────────────────────────────
   STEP 02 — CLIP-PATH IMAGE REVEAL
   [data-reveal-clip] — desktop (pointer:fine) only
   so mobile users aren't permanently hidden
───────────────────────────────────────────── */
@media (pointer: fine) {
  [data-reveal-clip] {
    clip-path: inset(100% 0 0 0);
  }
}

/* ─────────────────────────────────────────────
   STEP 05 — GRAIN TEXTURE OVERLAY
   Fixed noise layer over entire viewport.
   z-index 9998 keeps it below cursor (9999).
───────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
}

/* ─────────────────────────────────────────────
   STEP 06 — CURSOR LABEL
   Appended inside .jj-cursor-ring by JS
───────────────────────────────────────────── */
.jj-cursor-label {
  position: absolute;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #c9a84c;
  opacity: 0;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(-50%);
  left: 50%;
  top: calc(100% + 6px);
  font-family: 'Arial', sans-serif;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   STEP 07 — MANIFESTO PIN BLOCK
   jjstone_home.html only
───────────────────────────────────────────── */
.jj-manifesto-pin {
  min-height: 250vh;
  position: relative;
}

.jj-manifesto-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jj-manifesto-text {
  font-size: clamp(2.2rem, 4vw, 5rem);
  font-weight: 300;
  color: #f5f0e8;
  text-align: center;
  line-height: 1.6;
  letter-spacing: 0.04em;
  padding: 0 40px;
}

/* ─────────────────────────────────────────────
   STEP 09 — FOOTER GHOST WATERMARK
───────────────────────────────────────────── */
footer {
  position: relative;
}

.jj-footer-ghost {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #f5f0e8;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

/* ─────────────────────────────────────────────
   UPGRADE B — Body base color
   Consistent first-paint background for color morph.
───────────────────────────────────────────── */
body {
  background-color: #111f0a;
}

/* ─────────────────────────────────────────────
   UPGRADE A — Sticky image sequences
   Desktop (pointer:fine) only. On coarse/touch
   devices every panel stacks in normal flow.
───────────────────────────────────────────── */
@media (pointer: fine) {
  .jj-sticky-seq {
    display: flex;
    gap: 0;
    align-items: flex-start;
  }

  .jj-sticky-seq__img-col {
    width: 50%;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
  }

  .jj-sticky-seq__img {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: none;
  }

  .jj-sticky-seq__img[data-seq-img="1"] {
    opacity: 1;
  }

  .jj-sticky-seq__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .jj-sticky-seq__text-col {
    width: 50%;
  }

  .jj-sticky-seq__panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 4rem 5%;
  }
}

/* FIX 1 — explicit coarse override: undo all sticky layout on touch devices */
@media (pointer: coarse) {
  .jj-sticky-seq { display: block; min-height: unset; }
  .jj-sticky-seq__img-col { display: none; }
  .jj-sticky-seq__text-col { width: 100%; }
  .jj-sticky-seq__panel { min-height: unset; padding: 2rem 5%; }
}
