/* Archive Experience Layer — Custom UX for 1,087 Works
   Extends Material Design 3 with archival discovery patterns:
   - Timeline era navigation
   - Serendipity/random work discovery
   - Archive scale visualization

   Phased implementation for tactile, contemplative exploration
   Live: 2026-09-22 */

/* ── TIMELINE ERA NAVIGATOR ──────────────────────────────────────────────── */

.timeline-navigator {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-navbar);
  background: var(--color-paper);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  opacity: 0;
  animation: slideUpFade 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.timeline-navigator.visible {
  display: flex;
  gap: 8px;
}

.timeline-era {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-grey);
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.timeline-era::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0);
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.timeline-era:hover {
  border-color: var(--color-gold-alt);
  color: var(--color-gold-alt);
  background: rgba(212, 175, 55, 0.05);
}

.timeline-era.active {
  border-color: var(--color-gold-alt);
  color: var(--color-gold-alt);
  background: rgba(212, 175, 55, 0.12);
  font-weight: 600;
}

.timeline-era:active::before {
  transform: scale(1.5);
  opacity: 1;
}

.timeline-era-count {
  font-size: 10px;
  color: var(--color-grey);
  margin-left: 4px;
  opacity: 0.7;
}

.timeline-era.active .timeline-era-count {
  color: var(--color-gold-alt);
  opacity: 1;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ── SERENDIPITY / EXPLORE BUTTON ────────────────────────────────────────── */

.btn-explore {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-navbar);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-gold-alt);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-button-text-dark);
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
  transition: all 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.btn-explore::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0);
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.btn-explore:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.4);
}

.btn-explore:active::before {
  transform: scale(1.5);
  opacity: 1;
}

.btn-explore:focus-visible {
  outline: 2px solid var(--color-button-text-dark);
  outline-offset: 2px;
}

.btn-explore-tooltip {
  position: absolute;
  bottom: 72px;
  right: 0;
  background: var(--color-paper);
  color: var(--color-text-on-dark);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid rgba(212, 175, 55, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-explore:hover .btn-explore-tooltip {
  opacity: 1;
}

/* ── ARCHIVE SCALE DISPLAY ───────────────────────────────────────────────── */

.archive-scale {
  /* In flow, one quiet row: title, three figures, then the pigment bar.
     Was a fixed card at top-right that covered page text and artwork. */
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 28px;
  margin: 0 clamp(16px, 3.4vw, 48px);
  padding: 12px 0 14px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  opacity: 0;
  animation: archiveScaleIn 240ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

.archive-scale.visible {
  opacity: 1;
}

.archive-scale-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gold-alt);
}

.archive-scale-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.archive-scale-stat-label {
  color: var(--color-grey);
  font-weight: 400;
}

.archive-scale-stat-value {
  color: var(--color-gold-alt);
  font-weight: 600;
  font-family: var(--mono);
}

.archive-scale-bar {
  flex: 1 0 100%;
  margin-top: 4px;
  height: 6px;
  background: var(--pigment-strip, transparent);
}

/* A plain fade. The old entrance and bar fill used overshoot easing, which the
   motion rules no longer allow. */
@keyframes archiveScaleIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .archive-scale { animation: none; opacity: 1; }
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .archive-scale {
    display: none;
  }

  .btn-explore {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .timeline-navigator {
    bottom: 72px;
    left: 16px;
    right: 16px;
    transform: translateX(0);
    width: auto;
  }
}

/* ── ACCESSIBILITY ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .timeline-navigator,
  .archive-scale,
  .btn-explore,
  .timeline-era,
  .archive-scale-bar-fill {
    animation: none;
    transition: none;
  }
}
