/* ===================================================================
   SECTION UNLOCK — Game UI progress bar + sequential unlock system
   =================================================================== */

/* --- Compact section spacing --- */
.expandable + .expandable {
  margin-top: var(--space-xs);
}

.expandable:last-of-type {
  margin-bottom: var(--space-xl);
}

/* --- Progress bar track (bottom of peek header) --- */
.unlock-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
  z-index: 3;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.is-expanded .unlock-progress-track,
.is-progressing .unlock-progress-track {
  opacity: 1;
}

.unlock-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--section-grad);
  transition: width 6s linear;
  position: relative;
}

/* Glowing leading edge */
.unlock-progress-fill::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -3px;
  bottom: -3px;
  width: 24px;
  background: linear-gradient(90deg, transparent, var(--section-h1));
  filter: blur(6px);
  opacity: 0.9;
}

.unlock-progress-fill.is-complete {
  transition: none;
  width: 100%;
  opacity: 0.4;
}

.unlock-progress-fill.is-complete::after {
  display: none;
}

/* --- Progress label --- */
.unlock-progress-label {
  position: absolute;
  bottom: 10px;
  left: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--section-h1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease, color 0.3s ease;
  z-index: 4;
  pointer-events: none;
}

.unlock-progress-label.is-visible {
  opacity: 0.8;
}

.unlock-progress-label.is-complete {
  color: #22dd66;
}

/* --- Locked section styling --- */
.section-locked .expandable-peek {
  opacity: 0.35;
  filter: grayscale(0.7) brightness(0.7);
  cursor: not-allowed;
  transition: opacity 0.5s ease, filter 0.5s ease, border-color 0.4s ease, box-shadow 0.5s ease,
              max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
}

/* Suppress all hover effects on locked sections */
.section-locked .expandable-peek:hover {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 2px rgba(0, 0, 0, 0.3);
}

.section-locked .expandable-peek:hover::before {
  animation: none !important;
}

.section-locked .expandable-peek:hover .expandable-peek-title {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
  background-clip: initial;
}

.section-locked .expandable-peek:hover .expandable-peek-icon {
  transform: none;
}

.section-locked .expandable-peek:hover .expandable-peek-toggle {
  color: var(--color-text-dim);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.section-locked .expandable-peek:hover .expandable-peek-preview {
  border-color: rgba(255, 255, 255, 0.08);
}

.section-locked .expandable-peek:hover .expandable-peek-preview img {
  transform: none;
}

/* Locked subtitle override */
.section-locked .expandable-peek-subtitle {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.7rem;
}

/* Diagonal hatch overlay on locked sections */
.section-locked .expandable-peek::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.015) 10px,
    rgba(255, 255, 255, 0.015) 11px
  );
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

/* Lock icon — hide chevron, show lock */
.section-locked .expandable-peek-toggle .toggle-chevron {
  display: none;
}

.unlock-lock-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
  z-index: 1;
  display: none;
}

.section-locked .unlock-lock-icon {
  display: block;
}

/* --- Deny / shake animation --- */
@keyframes sectionDeny {
  0%, 100% { transform: translateX(0); }
  12% { transform: translateX(-6px); }
  25% { transform: translateX(5px); }
  37% { transform: translateX(-4px); }
  50% { transform: translateX(3px); }
  62% { transform: translateX(-2px); }
  75% { transform: translateX(1px); }
}

.section-denied .expandable-peek {
  animation: sectionDeny 0.5s ease;
  border-color: rgba(255, 45, 120, 0.5) !important;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(255, 45, 120, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* --- Unlock animation --- */
@keyframes unlockGlow {
  0% {
    opacity: 0.35;
    filter: grayscale(0.7) brightness(0.7);
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.4),
      0 0 0 transparent;
  }
  40% {
    opacity: 1;
    filter: grayscale(0) brightness(1.1);
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.4),
      0 0 40px var(--section-glow),
      0 0 80px var(--section-glow-soft);
    border-color: var(--section-h1);
  }
  100% {
    opacity: 1;
    filter: none;
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.4),
      0 8px 24px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      inset 0 -1px 2px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

@keyframes unlockSweep {
  0% { left: -60%; opacity: 1; }
  100% { left: 120%; opacity: 1; }
}

.section-unlocking .expandable-peek {
  animation: unlockGlow 1.2s ease forwards;
  cursor: pointer;
}

/* Bright sweep on unlock */
.section-unlocking .expandable-peek::before {
  animation: unlockSweep 0.8s ease 0.3s forwards !important;
  background: linear-gradient(
    105deg,
    transparent 30%,
    var(--section-glow-soft) 42%,
    var(--section-glow) 48%,
    rgba(255, 255, 255, 0.15) 50%,
    var(--section-glow) 52%,
    var(--section-glow-soft) 58%,
    transparent 70%
  );
}

/* Remove hatch during unlock */
.section-unlocking .expandable-peek::after {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* --- Cursor-following glass refraction glow (replaces scan sweep) --- */
.expandable-peek .peek-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.expandable-peek:hover .peek-glow {
  opacity: 1;
}

.section-locked .expandable-peek:hover .peek-glow {
  opacity: 0;
}

.peek-glow-inner {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--section-glow) 0%,
    var(--section-glow-soft) 35%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(8px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .unlock-progress-label {
    left: var(--space-md);
    font-size: 0.6rem;
  }
}
