/* Rock card container */
.rock-card {
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.rock-card__name {
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
  word-break: break-word;
}

.rock-card__progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Rock SVG wrapper */
.rock {
  position: relative;
  width: 160px;
  height: 140px;
}

.rock__svg {
  width: 100%;
  height: 100%;
}

.rock__body {
  fill: var(--stone-500);
  stroke: var(--stone-700);
  stroke-width: 1.5;
  transition: fill var(--transition-slow);
}

/* Stage-based darkening */
.rock--stage-1 .rock__body {
  fill: var(--stone-400);
}

.rock--stage-2 .rock__body {
  fill: var(--stone-500);
}

.rock--stage-3 .rock__body {
  fill: var(--stone-600);
}

/* Crack lines */
.rock__crack {
  stroke: var(--stone-800);
  stroke-width: 1.5;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.rock__crack--visible {
  stroke-dashoffset: 0;
}

/* Progress ring */
.rock__progress-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.rock__progress-bg {
  fill: none;
  stroke: var(--stone-700);
  stroke-width: 3;
  opacity: 0.3;
}

.rock__progress-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chisel hit animation */
@keyframes chisel-hit {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  20% {
    transform: translate(-3px, 1px) rotate(-1deg);
  }

  40% {
    transform: translate(2px, -1px) rotate(1deg);
  }

  60% {
    transform: translate(-1px, 2px) rotate(-0.5deg);
  }

  80% {
    transform: translate(1px, -1px) rotate(0.5deg);
  }

  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

.rock--chisel-hit {
  animation: chisel-hit 0.4s ease-out;
}

/* Dust particles */
.rock__dust {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.dust-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--stone-400);
  opacity: 0;
}

@keyframes dust-fly {
  0% {
    opacity: 0.8;
    transform: translate(0, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.3);
  }
}

.dust-particle--active {
  animation: dust-fly 0.6s ease-out forwards;
}

/* Shatter effect */
.rock__fragment {
  position: absolute;
  transition: none;
}

@keyframes shatter-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(0.2);
  }
}

.rock--shattering .rock__fragment {
  animation: shatter-fly 0.8s cubic-bezier(0.25, 0, 0.5, 1) forwards;
}

/* Completion checkmark */
.rock__checkmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  opacity: 0;
}

.rock__checkmark-circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
}

.rock__checkmark-path {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}

@keyframes draw-circle {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}

.rock--completed .rock__checkmark {
  opacity: 1;
}

.rock--completed .rock__checkmark-circle {
  animation: draw-circle 0.5s 0.8s ease forwards;
}

.rock--completed .rock__checkmark-path {
  animation: draw-check 0.3s 1.2s ease forwards;
}

/* Stage indicators */
.rock-card__stages {
  display: flex;
  gap: var(--space-xs);
}

.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--border-default);
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.stage-dot--dev {
  border-color: var(--stage-dev);
}

.stage-dot--review {
  border-color: var(--stage-review);
}

.stage-dot--delivery {
  border-color: var(--stage-delivery);
}

.stage-dot--complete.stage-dot--dev {
  background: var(--stage-dev);
}

.stage-dot--complete.stage-dot--review {
  background: var(--stage-review);
}

.stage-dot--complete.stage-dot--delivery {
  background: var(--stage-delivery);
}

.stage-dot--active {
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px currentColor;
}

/* ── Collapsible stages ─────────────────────────── */

.stage-section {
  margin-bottom: var(--space-lg);
}

.stage-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-xs);
}

.stage-header:hover {
  opacity: 0.85;
}

.stage-header__chevron {
  display: inline-flex;
  font-size: 0.75rem;
  transition: transform var(--transition-normal);
  color: var(--text-muted);
  flex-shrink: 0;
  width: 1em;
}

.stage-header__chevron--expanded {
  transform: rotate(90deg);
}

.stage-header__title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  flex-shrink: 0;
}

.stage-header__spacer {
  flex: 1;
  min-width: var(--space-sm);
}

.stage-header__progress {
  width: 60px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.stage-header__progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.stage-header__summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-header__pct {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 2.5em;
  text-align: right;
}

.stage-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.stage-body--collapsed {
  max-height: 0 !important;
  opacity: 0;
}

.stage-body--expanded {
  opacity: 1;
}

/* ── Ingot (for completed tasks in Stockpile) ─────────────────────────── */

.ingot {
  position: relative;
  width: 160px;
  height: 120px;
}

.ingot__svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: filter var(--transition-normal), transform var(--transition-normal);
}

.rock-card:hover .ingot__svg {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
  transform: translateY(-2px);
}

.ingot__front,
.ingot__top {
  transition: opacity var(--transition-fast);
}

.ingot__shine {
  pointer-events: none;
}

.ingot__stamp {
  font-family: system-ui, sans-serif;
  user-select: none;
}

/* Sparkle effects */
.ingot__sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ingot__sparkle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #fff 0%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  animation: sparkle 3s var(--delay) infinite;
}

@keyframes sparkle {

  0%,
  100% {
    opacity: 0;
    transform: scale(0.5);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Make sparkles shine brighter on hover */
.rock-card:hover .ingot__sparkle {
  animation-duration: 1.5s;
}