/* =========================================================
   ONE CLAP — 25 CINEMA CRAFTS DOSSIER & PAPER CRUSH MOTION SYSTEM
   Physics-based bidirectional crumple/uncrumple & responsive ribbons
   ========================================================= */

/* 1. Fullscreen Bidirectional "Paper Crush" Physics */

/* Open Animation: Heavily crumpled, miniature state expanding smoothly into full view */
@keyframes paperUncrushFullscreen {
  0% {
    transform: scale(0.12) rotate(-20deg) skew(16deg, 12deg) translateY(180px);
    opacity: 0;
    filter: contrast(350%) brightness(35%) blur(6px);
    clip-path: polygon(48% 46%, 54% 45%, 52% 56%, 45% 53%);
  }
  30% {
    transform: scale(0.42) rotate(10deg) skew(-10deg, -6deg) translateY(80px);
    opacity: 0.75;
    filter: contrast(240%) brightness(65%) blur(3px);
    clip-path: polygon(22% 16%, 84% 9%, 76% 89%, 14% 82%);
  }
  65% {
    transform: scale(0.78) rotate(-3deg) skew(4deg, 2deg) translateY(20px);
    opacity: 0.94;
    filter: contrast(150%) brightness(90%) blur(0.5px);
    clip-path: polygon(7% 5%, 94% 3%, 97% 95%, 4% 96%);
  }
  85% {
    transform: scale(0.98) rotate(1deg) skew(-1deg, -0.5deg) translateY(-4px);
    opacity: 0.98;
    filter: contrast(110%) brightness(98%);
    clip-path: polygon(1% 1%, 99% 0%, 100% 99%, 0% 100%);
  }
  100% {
    transform: scale(1) rotate(0deg) skew(0deg, 0deg) translateY(0);
    opacity: 1;
    filter: contrast(100%) brightness(100%) blur(0px);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
}

/* Close Animation: Squeezes rapidly into an irregular paper ball before unmounting */
@keyframes paperCrushFullscreen {
  0% {
    transform: scale(1) rotate(0deg) skew(0deg) translateY(0);
    opacity: 1;
    filter: contrast(100%) brightness(100%) blur(0px);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
  20% {
    transform: scale(0.92) rotate(3deg) skew(-4deg, -3deg) translateY(-10px);
    opacity: 0.95;
    filter: contrast(140%) brightness(90%);
    clip-path: polygon(4% 3%, 96% 2%, 98% 97%, 3% 95%);
  }
  45% {
    transform: scale(0.65) rotate(-11deg) skew(9deg, 7deg) translateY(40px);
    opacity: 0.85;
    filter: contrast(210%) brightness(75%) blur(1.5px);
    clip-path: polygon(18% 14%, 86% 10%, 80% 86%, 12% 82%);
  }
  75% {
    transform: scale(0.32) rotate(15deg) skew(-16deg, -10deg) translateY(120px);
    opacity: 0.55;
    filter: contrast(300%) brightness(50%) blur(4px);
    clip-path: polygon(32% 28%, 70% 24%, 66% 74%, 28% 70%);
  }
  100% {
    transform: scale(0.1) rotate(24deg) skew(20deg, 16deg) translateY(240px);
    opacity: 0;
    filter: contrast(450%) brightness(20%) blur(8px);
    clip-path: polygon(49% 48%, 52% 47%, 51% 53%, 48% 52%);
  }
}

.paper-uncrush-active,
.spring-reveal-enter {
  animation: paperUncrushFullscreen 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity, filter, clip-path;
  transform-origin: center center;
}

.paper-crush-active,
.paper-crush-exit {
  animation: paperCrushFullscreen 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  pointer-events: none !important;
  will-change: transform, opacity, filter, clip-path;
  transform-origin: center center;
}

/* 1B. WebGL Real 3D Paper Stage Container & Orbit Mode */
#craft-dossier-3d-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
}

#craft-dossier-3d-stage.orbit-active {
  pointer-events: auto !important;
  cursor: grab;
  z-index: 50;
  background: rgba(4, 5, 8, 0.88);
}
#craft-dossier-3d-stage.orbit-active:active {
  cursor: grabbing;
}

.dossier-sheet-3d-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.dossier-sheet-3d-visible {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: scale(1);
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Vertical Typography & Ribbon Layout */
.vertical-ribbon-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

.craft-ribbon-card {
  transition: flex 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.4s ease, 
              border-color 0.3s ease;
}

/* Category Filtered Ribbon Flex Distribution: stretches dynamically across 100% width */
.ribbon-deck-adaptive {
  display: flex;
  width: 100%;
  gap: 0.75rem;
}

.ribbon-deck-adaptive .craft-ribbon-card {
  flex: 1 1 0%;
  min-width: 0;
}

.ribbon-deck-adaptive .craft-ribbon-card:hover,
.ribbon-deck-adaptive .craft-ribbon-card:focus-within {
  flex: 2.2 1 0%;
}

/* 3. Paper Grain & Slate Texture */
.paper-slate-texture {
  background-color: #08080c;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08) 0%, transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, #08080c 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

/* 4. Ribbon Carousel Custom Scrollbar */
#cinema-carousel::-webkit-scrollbar,
#ribbonStage::-webkit-scrollbar {
  height: 6px;
}
#cinema-carousel::-webkit-scrollbar-track,
#ribbonStage::-webkit-scrollbar-track {
  background: #09090d;
}
#cinema-carousel::-webkit-scrollbar-thumb,
#ribbonStage::-webkit-scrollbar-thumb {
  background: #2E2002;
  border-radius: 9999px;
  border: 1px solid rgba(212, 175, 55, 0.3);
}
#cinema-carousel::-webkit-scrollbar-thumb:hover,
#ribbonStage::-webkit-scrollbar-thumb:hover {
  background: #856612;
}

/* 5. High-Priority Fullscreen Modal Layering & Mobile Navigation Isolation */
#craft-dossier-modal {
  z-index: 100000 !important;
  position: fixed !important;
  inset: 0 !important;
}

body.dossier-modal-open .mobile-bottom-nav {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 640px) {
  #craft-dossier-sheet {
    max-height: 94vh !important;
    margin: auto 4px !important;
    border-radius: 20px !important;
    padding: 1.25rem 1rem !important;
  }
  .dossier-spec-grid {
    grid-template-columns: 1fr !important;
  }
  .dossier-rubrics-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 6. Exact Reference UI Self-Contained Styles */
.dossier-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1.25rem;
}
.dossier-badge-box {
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #d4af37;
  background: rgba(0, 0, 0, 0.75);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dossier-badge-box .badge-lbl {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(212, 175, 55, 0.85);
  text-transform: uppercase;
  line-height: 1;
}
.dossier-badge-box .badge-num {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 900;
  color: #f5ce38;
  line-height: 1;
  margin-top: 3px;
}
.dossier-pills-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.pill-dept {
  padding: 0.15rem 0.65rem;
  border-radius: 9999px;
  background: #f5ce38;
  color: #050508;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pill-code {
  padding: 0.15rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.pill-verified {
  padding: 0.15rem 0.65rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.dossier-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.dossier-title-en {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #ffffff;
  letter-spacing: 0.025em;
  margin: 0;
  line-height: 1.2;
}
.dossier-title-te {
  font-family: system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f5ce38;
}
.dossier-close-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.dossier-close-btn:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.dossier-card-sec {
  position: relative;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: hidden;
}
.dossier-sec-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #f5ce38;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dossier-sec-watermark {
  position: absolute;
  right: 1.5rem;
  bottom: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 4.5rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  pointer-events: none;
  user-select: none;
  line-height: 1;
}
.dossier-sec1-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}
.dossier-sec1-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #cbd5e1;
  max-width: 900px;
  margin: 0;
}
.dossier-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.dossier-spec-box {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.dossier-spec-box .lbl {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: rgba(212, 175, 55, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dossier-spec-box .val {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #2dd4bf;
}
.dossier-spec-box .val.val-gold {
  color: #f5ce38;
}
.dossier-spec-box .val.val-light {
  color: #e2e8f0;
  font-weight: 500;
}

.dossier-ch-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.dossier-ch-card {
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.dossier-ch-card:hover {
  background: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.25);
}
.dossier-ch-card.active {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid #f5ce38;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.15);
}
.dossier-ch-num {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dossier-ch-card.active .dossier-ch-num {
  border-color: #f5ce38;
  background: rgba(212, 175, 55, 0.2);
  color: #f5ce38;
}
.dossier-ch-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  letter-spacing: 0.025em;
}
.dossier-ch-sub {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
  line-height: 1.4;
}
.dossier-pill-duration {
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f5ce38;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dossier-pill-active {
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: #f5ce38;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.dossier-rubrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.dossier-rubric-card {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.dossier-rubric-card .metric-name {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}
.dossier-rubric-card .metric-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}
.dossier-rubric-card .pts-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #f5ce38;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dossier-rules-box {
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  background: rgba(120, 53, 15, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dossier-rules-box .rules-title {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dossier-rules-box ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}

.dossier-footer-card {
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.dossier-btn-cancel {
  padding: 0.55rem 1rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.dossier-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.dossier-btn-accept {
  padding: 0.55rem 1.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe266 0%, #f5ce38 50%, #b08b20 100%);
  border: none;
  color: #050508;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.35);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.dossier-btn-accept:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}


