/**
 * The Kintsugi Mender — Workbench Styles
 * 4-Step Interactive Kintsugi Ritual & Craft Interface
 */

/* ==========================================================================
   Workbench Stepper Indicator
   ========================================================================== */
.workbench-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.workbench-stepper::-webkit-scrollbar {
  display: none;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.step-item.is-active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.step-item.is-active .step-num {
  background: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 10px var(--kin-glow);
}

.step-item.is-done {
  color: var(--text-muted);
}

.step-item.is-done .step-num {
  background: var(--border);
  color: var(--text);
}

/* ==========================================================================
   Technique Selector Cards (Kin, Gin, Shu, Yobitsugi)
   ========================================================================== */
.technique-selector-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.technique-selector-title {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.technique-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xs);
  width: 100%;
}

.technique-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.technique-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.technique-card.is-selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold), var(--shadow-sm);
  background: var(--surface-2);
}

.technique-card.tech-kin.is-selected {
  border-color: var(--kin-color);
  box-shadow: 0 0 12px var(--kin-glow);
}

.technique-card.tech-gin.is-selected {
  border-color: var(--gin-color);
  box-shadow: 0 0 12px var(--gin-glow);
}

.technique-card.tech-shu.is-selected {
  border-color: var(--shu-color);
  box-shadow: 0 0 12px var(--shu-glow);
}

.technique-card.tech-yobitsugi.is-selected {
  border-color: var(--yobitsugi-color);
  box-shadow: 0 0 12px var(--yobitsugi-glow);
}

.technique-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.tech-kin .technique-swatch {
  background: radial-gradient(circle at 35% 35%, #fce29d 0%, #d9a73e 65%, #966e1e 100%);
}

.tech-gin .technique-swatch {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #cbd5e1 65%, #64748b 100%);
}

.tech-shu .technique-swatch {
  background: radial-gradient(circle at 35% 35%, #f87171 0%, #c93b2b 65%, #7f1d1d 100%);
}

.tech-yobitsugi .technique-swatch {
  background: linear-gradient(135deg, #1e3a5f 50%, #c48b20 50%);
}

.technique-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
}

.technique-name {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.technique-cost-badge {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
}

.tech-kin .technique-cost-badge {
  background: rgba(217, 167, 62, 0.15);
  color: var(--accent-gold-ink);
}

.technique-tagline {
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* ==========================================================================
   Workbench Board & Vessel Canvas Stage (.workbench-board)
   ========================================================================== */
.workbench-board {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-xl) var(--space-md);
  background: radial-gradient(circle at 50% 50%, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-inner);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Wood border trim accent */
.workbench-board::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed var(--border);
  border-radius: calc(var(--radius-xl) - 4px);
  pointer-events: none;
  opacity: 0.6;
}

/* Centered Vessel Wrapper (#vessel-svg-wrap) */
#vessel-svg-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  filter: drop-shadow(0 12px 24px rgba(36, 27, 20, 0.18));
}

#vessel-svg-stage {
  width: 100%;
  height: 100%;
  display: block;
}

/* Maki-e Canvas Overlay */
#makie-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* Active interactive states for drawing/dusting/burnishing */
.workbench-board[data-interactive="true"] #vessel-svg-wrap,
.workbench-board[data-step="2"] #vessel-svg-wrap,
.workbench-board[data-step="3"] #makie-canvas,
.workbench-board[data-step="4"] #vessel-svg-wrap {
  touch-action: none;
}

.workbench-board[data-step="3"] #makie-canvas {
  pointer-events: auto;
  cursor: crosshair;
}

.workbench-board[data-step="2"] #vessel-svg-wrap {
  cursor: pointer;
}

.workbench-board[data-step="4"] #vessel-svg-wrap {
  cursor: grab;
}

/* Crack paths & highlights */
.crack-path {
  transition: stroke 300ms ease, stroke-width 300ms ease, filter 300ms ease;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crack-guide {
  stroke: rgba(180, 160, 140, 0.35);
  stroke-dasharray: 4 4;
}

.crack-sealed {
  transition: stroke 160ms ease;
}

.crack-gold {
  stroke: var(--kin-color);
  filter: drop-shadow(0 0 3px var(--kin-glow));
}

.crack-silver {
  stroke: var(--gin-color);
  filter: drop-shadow(0 0 3px var(--gin-glow));
}

.crack-vermilion {
  stroke: var(--shu-color);
  filter: drop-shadow(0 0 3px var(--shu-glow));
}

/* ==========================================================================
   Step 1: Awase Shard Tray (#awase-tray)
   ========================================================================== */
#awase-tray {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.awase-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.awase-tray-title {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.awase-tray-counter {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.shard-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: 72px;
}

.shard-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 64px;
  min-height: 64px;
  padding: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  touch-action: manipulation;
}

.shard-btn:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.shard-btn.is-selected {
  border-color: var(--accent-gold);
  background: var(--surface);
  box-shadow: 0 0 10px var(--kin-glow);
}

.shard-btn.is-snapped {
  opacity: 0.35;
  border-style: dashed;
  pointer-events: none;
  transform: none;
}

.shard-btn-icon {
  width: 32px;
  height: 32px;
  transition: transform 160ms ease;
}

.shard-btn-label {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Accessible click-fallback action bar */
.awase-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: 4px;
}

.awase-angle-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 68px;
  user-select: none;
}

#awase-easy-orient-btn.is-active {
  border-color: var(--accent-gold);
  color: var(--accent-gold-ink);
  background: var(--surface);
}

@keyframes shardSnapPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.025);
    filter: drop-shadow(0 0 6px var(--kin-glow));
  }
  100% {
    transform: scale(1);
    filter: none;
  }
}

.is-just-snapped {
  animation: shardSnapPulse 420ms ease-out;
  transform-origin: center;
}

/* ==========================================================================
   Step 2/3/4: Live Tool Feedback & Progress Bar
   ========================================================================== */
.tool-feedback-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
  margin-top: var(--space-sm);
}

.tool-indicator-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.tool-feedback-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--text);
}

.stillness-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--accent-gold);
  box-shadow: 0 0 6px var(--kin-glow);
}

.tool-verdict {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
}

.step-progress-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.step-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-gold), var(--kin-shimmer));
  border-radius: var(--radius-full);
  transition: width 120ms ease-out;
}

.reassurance-note {
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 640px) {
  .technique-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .workbench-stepper {
    padding: 4px 6px;
  }

  .step-item {
    padding: 4px 8px;
  }

  .step-item span:last-child {
    display: none;
  }

  #vessel-svg-wrap {
    max-width: 290px;
  }

  .workbench-board {
    padding: var(--space-lg) var(--space-xs);
  }
}
