/* ==============================================
   POST-WORKOUT CELEBRATION MODAL (SHARED)
   ============================================== */

.post-workout-celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background-color: var(--color-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.post-workout-celebration-modal {
  width: min(560px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  border-radius: var(--radius-standard);
  border: 1px solid var(--bg-tertiary);
  background-color: var(--bg-secondary);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.post-workout-celebration-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-workout-celebration-title {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.post-workout-celebration-meta {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-muted-text-light);
  line-height: var(--line-height-normal);
}

.post-workout-celebration-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-workout-celebration-overlay-minimal-fullscreen {
  padding: 0;
  background-color: var(--bg-primary);
  overflow: hidden;
}

.post-workout-celebration-modal-minimal {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  position: relative;
  z-index: 1;
  border: none;
  border-radius: 0;
  background-color: var(--bg-primary);
  padding:
    calc(var(--space-xl) + var(--safe-area-top))
    calc(var(--space-lg) + var(--safe-area-right))
    calc(var(--space-xl) + var(--safe-area-bottom))
    calc(var(--space-lg) + var(--safe-area-left));
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  justify-items: center;
  gap: var(--space-sm);
}

.post-workout-celebration-title-minimal {
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
}

.post-workout-celebration-modal-minimal .post-workout-celebration-header {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  align-items: center;
  justify-content: center;
}

.post-workout-celebration-modal-minimal .post-workout-celebration-footer {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  justify-content: center;
}

.post-workout-celebration-body-minimal {
  position: relative;
  z-index: 2;
  min-height: 0;
  width: min(520px, 100%);
  align-items: center;
  justify-content: center;
}

.post-workout-celebration-modal-minimal > canvas[data-post-workout-confetti="true"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.post-workout-milestone-info-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-sm) 0 var(--space-md);
  gap: var(--space-md);
}

.post-workout-milestone-info-illustration {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-workout-milestone-info-illustration-media {
  position: relative;
  width: var(--milestones-list-illustration-width);
  height: var(--milestones-list-illustration-height);
  border-radius: var(--radius-standard);
  overflow: hidden;
}

.post-workout-milestone-info-illustration-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: inherit;
  display: block;
}

.post-workout-milestone-info-illustration-grayscale {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  filter: grayscale(1) saturate(0);
  transition: clip-path 1.1s ease;
}

.post-workout-milestone-info-stack {
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.post-workout-milestone-info-name {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.post-workout-milestone-stagger-item {
  opacity: 0;
  transform: translateY(10px);
  animation: post-workout-milestone-fade-in 0.42s ease forwards;
}

.post-workout-milestone-stagger-item.is-step-1 {
  animation-delay: 0.04s;
}

.post-workout-milestone-stagger-item.is-step-2 {
  animation-delay: 0.16s;
}

.post-workout-milestone-stagger-item.is-step-3 {
  animation-delay: 0.28s;
}

.post-workout-milestone-stagger-item.is-step-4 {
  animation-delay: 0.4s;
}

@keyframes post-workout-milestone-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-workout-celebration-modal-minimal .post-workout-celebration-btn-row {
  min-width: 132px;
  width: min(320px, 100%);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-lg);
}

.post-workout-powerlifting-stage {
  gap: var(--space-lg);
}

.post-workout-powerlifting-title {
  font-size: var(--text-base);
  font-weight: 600;
  text-align: center;
}

.post-workout-powerlifting-rank-media {
  width: min(360px, 100%);
  height: auto;
  min-height: 164px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--bg-tertiary);
  background-color: var(--bg-secondary);
}

.post-workout-powerlifting-metric-card {
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-standard);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
}

.post-workout-powerlifting-metric-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-muted-text-light);
  font-weight: 500;
  line-height: var(--line-height-tight);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.post-workout-powerlifting-rank-value {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
  font-variant-numeric: tabular-nums;
}

.post-workout-powerlifting-weight-value {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
  font-variant-numeric: tabular-nums;
}

.post-workout-powerlifting-exercise {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.post-workout-powerlifting-climb {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-primary-text);
  font-weight: 500;
  line-height: var(--line-height-normal);
}

.post-workout-powerlifting-weight-progress {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-muted-text-light);
  font-weight: 500;
  line-height: var(--line-height-normal);
}

.post-workout-powerlifting-post-animation {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.post-workout-powerlifting-climb.is-visible {
  animation: post-workout-milestone-fade-in 0.42s ease forwards;
}

.post-workout-powerlifting-weight-progress.is-visible {
  animation: post-workout-milestone-fade-in 0.42s ease 0.06s forwards;
}

.post-workout-powerlifting-continue.is-visible {
  animation: post-workout-milestone-fade-in 0.42s ease 0.12s forwards;
  pointer-events: auto;
}

.post-workout-rank-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-workout-rank-item {
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-standard);
  background-color: var(--bg-tertiary);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-workout-rank-item-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-sm);
}

.post-workout-rank-exercise {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-primary-text);
  font-weight: 600;
  line-height: var(--line-height-tight);
}

.post-workout-rank-column-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-muted-text-light);
  line-height: var(--line-height-tight);
}

.post-workout-rank-reel-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: center;
}

.post-workout-rank-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.post-workout-reel-viewport {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-standard);
  background-color: var(--bg-primary);
  height: calc(var(--text-base) * 2);
  width: 100%;
}

.post-workout-reel-track {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

.post-workout-reel-item {
  height: calc(var(--text-base) * 2);
  min-height: calc(var(--text-base) * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-sm);
  line-height: 1;
  white-space: nowrap;
}

.post-workout-rank-weight-item {
  color: var(--color-primary-text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.post-workout-rank-after-item {
  color: var(--color-accent-blue);
  font-size: var(--text-base);
  font-weight: 600;
}

.post-workout-rank-item.is-settled .post-workout-rank-after-reel {
  border-color: color-mix(in srgb, var(--color-accent-blue) 55%, var(--bg-tertiary));
}

.post-workout-rank-context {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-muted-text-light);
  line-height: var(--line-height-normal);
}

.post-workout-celebration-footer {
  display: flex;
  justify-content: flex-end;
}

.post-workout-celebration-btn-row {
  min-width: 132px;
}

@media (max-width: 767px) {
  .post-workout-celebration-modal {
    padding: var(--space-md);
  }

  .post-workout-celebration-modal-minimal {
    padding:
      calc(var(--space-lg) + var(--safe-area-top))
      calc(var(--space-md) + var(--safe-area-right))
      calc(var(--space-lg) + var(--safe-area-bottom))
      calc(var(--space-md) + var(--safe-area-left));
  }

  .post-workout-rank-item-top {
    justify-content: flex-start;
  }

  .post-workout-rank-reel-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-workout-celebration-footer {
    justify-content: stretch;
  }

  .post-workout-celebration-btn-row {
    width: 100%;
  }

  .post-workout-celebration-modal-minimal .post-workout-celebration-btn-row {
    width: min(320px, 100%);
  }

  .post-workout-powerlifting-rank-media {
    min-height: 148px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-workout-milestone-info-illustration-grayscale {
    transition: none;
  }

  .post-workout-milestone-stagger-item {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
