/* 11-how-it-works (prefix: thiw) */
.thiw-root {
  margin: 0;
  padding: clamp(1.2rem, 2.5vw, 2rem) 0;
  background: var(--tcr-cream, #f2f3f5);
  color: var(--tcr-navy, #212326);
  font-family: var(--tcr-font-sans, 'Inter', system-ui, sans-serif);
  max-width: 100%;
  overflow-x: clip;
}

.thiw-shell {
  max-width: var(--tcr-max, 1280px);
  margin: 0 auto;
  padding: clamp(1rem, 2.4vw, 1.75rem);
  background: var(--tcr-warm, #FAF7F2);
  border: 1px solid var(--tcr-line-strong, #c8ccd2);
  border-radius: var(--tcr-radius-lg, 20px);
  box-shadow: var(--tcr-shadow, 0 12px 32px -12px rgba(14, 122, 142, 0.14));
}

.thiw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.15rem;
}

.thiw-head-copy {
  min-width: 0;
}

.thiw-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tcr-teal-ink, #0a6575);
}

.thiw-title {
  margin: 0;
  font-family: var(--tcr-font-display, 'Quicksand', system-ui, sans-serif);
  font-size: clamp(1.25rem, 2.3vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--tcr-navy, #212326);
}

.thiw-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.thiw-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  max-width: 100%;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--tcr-teal-soft, #e6f4f7);
  border: 1px solid rgba(10, 101, 117, 0.24);
  color: var(--tcr-teal-ink, #0a6575);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
}

.thiw-replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1.5px solid var(--tcr-teal, #0e7a8e);
  background: #ffffff;
  color: var(--tcr-teal-ink, #0a6575);
  font: 700 0.82rem/1.1 var(--tcr-font-sans, 'Inter', sans-serif);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.thiw-replay:hover {
  background: var(--tcr-teal, #0e7a8e);
  color: #ffffff;
}

.thiw-motion-slot {
  display: inline-flex;
  align-items: center;
}

.thiw-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

@media (min-width: 960px) {
  .thiw-grid {
    grid-template-columns: minmax(0, 1.32fr) minmax(320px, 0.96fr);
    gap: 1.4rem;
  }
}

.thiw-stage-col {
  min-width: 0;
}

.thiw-stage {
  border-radius: var(--tcr-radius, 14px);
  overflow: hidden;
  border: 1.5px solid #163944;
  background: #0b1d23;
  box-shadow: 0 12px 30px -14px rgba(10, 31, 36, 0.45);
}

.thiw-svg {
  display: block;
  width: 100%;
  height: auto;
}

.thiw-caption {
  margin: 0.6rem 0 0;
  padding: 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--tcr-text, #434549);
  line-height: 1.45;
}

/* Ordered 5-step list */
.thiw-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.62rem;
  min-width: 0;
}

.thiw-step-item {
  min-width: 0;
}

.thiw-step {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.72rem 0.9rem;
  text-align: left;
  background: #ffffff;
  border: 1.5px solid var(--tcr-line, #e0e1e4);
  border-radius: var(--tcr-radius, 14px);
  color: var(--tcr-navy, #212326);
  cursor: pointer;
  transition: border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.thiw-step:hover {
  border-color: var(--tcr-teal, #0e7a8e);
  background: #f6fbfc;
}

.thiw-step.thiw-is-active {
  border-color: var(--tcr-teal, #0e7a8e);
  background: #ffffff;
  box-shadow: 0 8px 20px -12px rgba(14, 122, 142, 0.45), inset 4px 0 0 0 var(--tcr-teal, #0e7a8e);
}

.thiw-num {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tcr-cream, #f2f3f5);
  border: 1.5px solid var(--tcr-line-strong, #c8ccd2);
  color: var(--tcr-navy, #212326);
  font-family: var(--tcr-font-display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  transition: background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.thiw-step.thiw-is-active .thiw-num {
  background: var(--tcr-teal, #0e7a8e);
  border-color: var(--tcr-teal, #0e7a8e);
  color: #ffffff;
}

.thiw-step-body {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.thiw-step-title {
  font-family: var(--tcr-font-display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--tcr-navy, #212326);
}

.thiw-step.thiw-is-active .thiw-step-title {
  color: var(--tcr-teal-ink, #0a6575);
}

.thiw-step-desc {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--tcr-text, #434549);
}

/* Stage visibility by data-step (resting default = step 5 finished lit scene) */
.thiw-layer {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.42s ease, transform 0.42s ease;
  pointer-events: none;
}

.thiw-root[data-step="1"] .thiw-s1,
.thiw-root[data-step="2"] .thiw-s2,
.thiw-root[data-step="3"] .thiw-s3,
.thiw-root[data-step="4"] .thiw-s4,
.thiw-root[data-step="5"] .thiw-s5 {
  opacity: 1;
  transform: translateY(0);
}

/* Stage build replay effects when .thiw-play is active */
.thiw-root.thiw-play .thiw-draw {
  stroke-dasharray: 110;
  stroke-dashoffset: 0;
}

.thiw-root.thiw-replaying .thiw-draw {
  animation: thiw-stroke-draw 0.85s ease forwards;
}

.thiw-root.thiw-replaying .thiw-tape-blade {
  transform-origin: 147px 234px;
  animation: thiw-tape-extend 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.thiw-root.thiw-replaying .thiw-swatch-1 {
  animation: thiw-swatch-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.thiw-root.thiw-replaying .thiw-swatch-2 {
  animation: thiw-swatch-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.thiw-root.thiw-replaying .thiw-swatch-3 {
  animation: thiw-swatch-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.thiw-root.thiw-replaying .thiw-s5 .thiw-led-wash {
  animation: thiw-led-bloom 0.85s ease both;
}

.thiw-garment-a,
.thiw-garment-b {
  transform-box: fill-box;
  transform-origin: 50% 0%;
}

.thiw-cad-scan {
  transform: translateX(0);
}

.thiw-finish-glint {
  transform: translateX(0);
}

@keyframes thiw-stroke-draw {
  from { stroke-dashoffset: 110; }
  to { stroke-dashoffset: 0; }
}

@keyframes thiw-tape-extend {
  from { transform: scaleX(0.08); }
  to { transform: scaleX(1); }
}

@keyframes thiw-swatch-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes thiw-led-bloom {
  from { opacity: 0.15; }
  to { opacity: 1; }
}

/* Freeze / Reduced Motion Parity */
html.tcrm-paused .thiw-root *,
html.tcrm-paused .thiw-root *::before,
html.tcrm-paused .thiw-root *::after {
  animation-play-state: paused !important;
  transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .thiw-root *,
  .thiw-root *::before,
  .thiw-root *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .thiw-shell {
    padding: 0.85rem;
    border-radius: 14px;
  }
  .thiw-head-actions {
    width: 100%;
    gap: 0.4rem;
  }
  .thiw-badge {
    font-size: 0.69rem;
    padding: 0.25rem 0.52rem;
    min-height: 32px;
  }
  .thiw-replay {
    font-size: 0.74rem;
    padding: 0.42rem 0.68rem;
  }
  .thiw-motion-slot {
    margin-left: auto;
  }
  .thiw-step {
    padding: 0.65rem 0.72rem;
  }
}
