/* ============================================================
   fx.css — studio polish layer (ported from the DN Portfolio)
   View transitions · case-study reading progress · magnetic CTAs
   Every effect degrades to a static page and honours
   prefers-reduced-motion.
   ============================================================ */

/* ---------- Cross-document view transitions ---------- */
@view-transition { navigation: auto; }

.nav { view-transition-name: site-nav; }
/* Case-study H1 is the morph target. Named in CSS so it is set before first
   paint, even if fx.js arrives late. */
:root:has(.case-hero) .case-hero__title { view-transition-name: cs-title; }

/* The H1 uses .reveal (starts at opacity 0). While a transition runs, show it
   as-is so the morph lands on visible text, not an empty box. */
:root:active-view-transition .case-hero__title.reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
::view-transition-group(cs-title) {
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
::view-transition-old(cs-title),
::view-transition-new(cs-title) {
  height: 100%;
  object-fit: none;
  overflow: clip;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- Case-study reading progress + chapter chip ---------- */
.read-progress {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  height: 2px;
  z-index: 999;
  pointer-events: none;
}
.read-progress__bar {
  display: block;
  height: 100%;
  background: var(--blaze-orange);
  transform: scaleX(var(--read, 0));
  transform-origin: left;
}
.chapter-chip {
  position: fixed;
  left: var(--pad-x);
  bottom: 24px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warm-white);
  background: rgba(20,20,20,0.88);
  border: 0.5px solid var(--gray-mid);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  pointer-events: none;
}
.chapter-chip.is-visible { opacity: 1; transform: none; }
.chapter-chip__num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 767px) { .chapter-chip { display: none; } }

/* ---------- Magnetic CTA ---------- */
.is-magnetic {
  transition: transform 0.5s var(--ease), background 0.2s, box-shadow 0.3s var(--ease);
  will-change: transform;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .is-magnetic { transition: none; }
  .chapter-chip { transition: none; }
}
