/* ==========================================================================
   Motion & Animation Vault - Category 2: Scroll-Driven Motion
   Demos 9 to 15:
   9. Staggered Reveal
   10. Sticky Stacking Cards
   11. Parallax Depth
   12. Scroll-Linked Scrubbing
   13. Clip-Path / Curtain Reveal
   14. Horizontal Scroll Track
   15. Reading Progress Bar
   ========================================================================== */

/* --------------------------------------------------------------------------
   Mini Scroll Viewport & Scrubber Architecture (CRITICAL UX REQUIREMENT)
   -------------------------------------------------------------------------- */
.cat2-stage {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.mini-scroll-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Scrubber Control Bar */
.mini-scroll-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(19, 23, 34, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-sizing: border-box;
}

.mini-scroll-label {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.mini-scroll-scrubber {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: ew-resize;
}

.mini-scroll-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6366f1;
  box-shadow: 0 0 10px #6366f1;
  cursor: ew-resize;
  transition: transform 0.1s ease;
}

.mini-scroll-scrubber::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.mini-scroll-val {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #818cf8;
  min-width: 32px;
  text-align: right;
}

/* Self-contained Scrollable Viewport (max-height ~200px) */
.mini-scroll-viewport {
  position: relative;
  width: 100%;
  height: 185px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0b0d14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-sizing: border-box;
  scroll-behavior: auto; /* Instant tracking for scrubber */
}

/* Custom Sleek Scrollbar */
.mini-scroll-viewport::-webkit-scrollbar {
  width: 5px;
}
.mini-scroll-viewport::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.mini-scroll-viewport::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.45);
  border-radius: 4px;
}
.mini-scroll-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.8);
}

/* --------------------------------------------------------------------------
   Demo 9: Staggered Reveal
   -------------------------------------------------------------------------- */
.cat2-stagger-track {
  padding: 14px 12px 140px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat2-stagger-card {
  position: relative;
  background: #141926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  will-change: transform, opacity, filter;
  transition: border-color calc(var(--duration, 0.2s) / var(--speed-mult, 1)) ease;
}

.cat2-stagger-card.is-active {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.cat2-stagger-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat2-stagger-index {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.cat2-stagger-name {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.cat2-stagger-tag {
  font-size: 10px;
  color: #64748b;
  font-family: ui-monospace, monospace;
}

/* --------------------------------------------------------------------------
   Demo 10: Sticky Stacking Cards
   -------------------------------------------------------------------------- */
.cat2-sticky-track {
  position: relative;
  height: 520px;
  padding: 12px;
  box-sizing: border-box;
}

.cat2-sticky-wrapper {
  position: sticky;
  top: 10px;
  height: 140px;
  perspective: 1000px;
}

.cat2-stack-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120px;
  border-radius: 10px;
  padding: 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  will-change: transform, filter, opacity;
  transform-origin: center top;
}

.cat2-stack-card-1 {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(148, 163, 184, 0.3);
  z-index: 1;
}

.cat2-stack-card-2 {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  border-color: rgba(129, 140, 248, 0.4);
  z-index: 2;
}

.cat2-stack-card-3 {
  background: linear-gradient(135deg, #065f46 0%, #064e3b 100%);
  border-color: rgba(52, 211, 153, 0.4);
  z-index: 3;
}

.cat2-stack-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cat2-stack-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.cat2-stack-num {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
}

.cat2-stack-desc {
  font-size: 11px;
  color: #cbd5e1;
}

/* --------------------------------------------------------------------------
   Demo 11: Parallax Depth
   -------------------------------------------------------------------------- */
.cat2-parallax-track {
  position: relative;
  height: 500px;
}

.cat2-parallax-viewport {
  position: sticky;
  top: 0;
  width: 100%;
  height: 185px;
  overflow: hidden;
  background: #090c14;
}

.cat2-parallax-bg {
  position: absolute;
  inset: -40px;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 70px 60px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 120px 40px, #818cf8, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 180px 110px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 220px 70px, #38bdf8, rgba(0,0,0,0));
  background-size: 240px 160px;
  will-change: transform;
}

.cat2-parallax-mid {
  position: absolute;
  top: 30px;
  left: 20px;
  right: 20px;
  height: 120px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  pointer-events: none;
  will-change: transform;
}

.cat2-parallax-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.cat2-parallax-hex {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  transform: rotate(45deg);
}

.cat2-parallax-fg {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  background: rgba(24, 29, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  text-align: center;
  will-change: transform;
}

.cat2-parallax-fg-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.cat2-parallax-fg-sub {
  font-size: 10px;
  color: #818cf8;
  font-family: ui-monospace, monospace;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Demo 12: Scroll-Linked Scrubbing
   -------------------------------------------------------------------------- */
.cat2-scrub-track {
  position: relative;
  height: 520px;
}

.cat2-scrub-sticky {
  position: sticky;
  top: 0;
  height: 185px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  perspective: 800px;
}

.cat2-scrub-prism {
  position: relative;
  width: 60px;
  height: 60px;
  transform-style: preserve-3d;
  will-change: transform, filter;
}

.cat2-prism-face {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 1.5px solid rgba(99, 102, 241, 0.8);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.cat2-face-front  { transform: translateZ(30px); }
.cat2-face-back   { transform: rotateY(180deg) translateZ(30px); }
.cat2-face-right  { transform: rotateY(90deg) translateZ(30px); }
.cat2-face-left   { transform: rotateY(-90deg) translateZ(30px); }
.cat2-face-top    { transform: rotateX(90deg) translateZ(30px); }
.cat2-face-bottom { transform: rotateX(-90deg) translateZ(30px); }

.cat2-scrub-badge {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------
   Demo 13: Clip-Path / Curtain Reveal
   -------------------------------------------------------------------------- */
.cat2-curtain-track {
  position: relative;
  height: 500px;
}

.cat2-curtain-sticky {
  position: sticky;
  top: 0;
  height: 185px;
  overflow: hidden;
  border-radius: 6px;
}

.cat2-curtain-under,
.cat2-curtain-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
}

.cat2-curtain-under {
  background: #090c14;
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

.cat2-blueprint-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.6;
}

.cat2-blueprint-label {
  position: relative;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #64748b;
  letter-spacing: 0.1em;
}

.cat2-curtain-over {
  background: linear-gradient(135deg, #4338ca 0%, #0284c7 100%);
  color: #ffffff;
  will-change: clip-path;
  z-index: 2;
}

.cat2-curtain-content {
  text-align: center;
}

.cat2-curtain-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0;
}

.cat2-curtain-sub {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 4px;
}

.cat2-curtain-laser {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 0 20px #0284c7;
  z-index: 3;
  pointer-events: none;
  will-change: top;
}

/* --------------------------------------------------------------------------
   Demo 14: Horizontal Scroll Track
   -------------------------------------------------------------------------- */
.cat2-horizontal-track-container {
  position: relative;
  height: 520px;
}

.cat2-horizontal-sticky {
  position: sticky;
  top: 0;
  height: 185px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.cat2-horizontal-strip {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  width: max-content;
  will-change: transform;
}

.cat2-horizontal-card {
  width: 130px;
  height: 120px;
  background: #151a27;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  transition: border-color calc(var(--duration, 0.2s) / var(--speed-mult, 1)) ease;
}

.cat2-horizontal-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

.cat2-h-step {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #818cf8;
}

.cat2-h-title {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.cat2-h-desc {
  font-size: 10px;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Demo 15: Reading Progress Bar
   -------------------------------------------------------------------------- */
.cat2-progress-sticky-bar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  background: #111522;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
  padding: 8px 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat2-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cat2-progress-chapter {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
}

.cat2-progress-percent {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #818cf8;
}

.cat2-progress-track-bg {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.cat2-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  box-shadow: 0 0 8px #6366f1;
  border-radius: 2px;
  will-change: width;
}

.cat2-article-body {
  padding: 14px 16px 200px 16px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.6;
}

.cat2-article-h3 {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  margin: 16px 0 6px 0;
}

.cat2-article-h3:first-child {
  margin-top: 4px;
}

.cat2-article-p {
  margin: 0 0 10px 0;
}

/* --------------------------------------------------------------------------
   Reduced Motion Simulator Support
   -------------------------------------------------------------------------- */
.reduced-motion .cat2-stagger-card,
.reduced-motion .cat2-stack-card,
.reduced-motion .cat2-parallax-bg,
.reduced-motion .cat2-parallax-mid,
.reduced-motion .cat2-parallax-fg,
.reduced-motion .cat2-scrub-prism,
.reduced-motion .cat2-curtain-over,
.reduced-motion .cat2-horizontal-strip,
.reduced-motion .cat2-progress-fill {
  transition: none !important;
}
