/* ==========================================================================
   tools.css — advanced tools: image-to-video morph + virtual try-on
   04 Motion   → source image ⇢ generated clip, split showcase
   05 Wardrobe → character with scanning effect + interactive outfit chips
   ========================================================================== */

.tool-section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px 32px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 84px);
  align-items: center;
}
.tool-section + .tool-section { margin-top: 110px; }

.tool-copy h2 {
  margin: 14px 0 14px;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}
.tool-sub {
  margin: -4px 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.tool-visual { position: relative; display: grid; place-items: center; }

/* ---------- 04 · Morph: source image → generated motion ---------- */

.morph {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.morph-half { display: flex; flex-direction: column; gap: 9px; }

.morph-media {
  position: relative;
  display: block;
  width: 232px;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.morph-media img,
.morph-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.morph-tag {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 12px;
  padding: 5px 11px;
  border-radius: 100px;
  background: rgba(10, 7, 16, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}
.morph-cap {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.morph-bridge {
  flex: none;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 30px rgba(255, 77, 141, 0.4);
}
.morph-bridge svg { width: 20px; height: 20px; }
.morph-bridge::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 77, 141, 0.4);
  animation: bridge-spin 14s linear infinite;
}
@keyframes bridge-spin { to { transform: rotate(360deg); } }

.morph-play {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 7, 16, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  transition: transform 0.25s ease, opacity 0.25s ease, border-color 0.25s ease;
}
.morph-play svg { width: 22px; height: 22px; margin-left: 3px; }
.morph-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  border-color: var(--accent);
}
.morph-media.is-playing .morph-play {
  opacity: 0;
  pointer-events: none;
}

.morph-progress {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.morph-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---------- 05 · Wardrobe: character + scanner + outfit chips ---------- */

.wardrobe-scene {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.mannequin {
  position: relative;
  width: 300px;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.mannequin img,
.mannequin video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}
.scan-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px);
  pointer-events: none;
}
.outfit-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.16), transparent 65%);
  mix-blend-mode: soft-light;
  transition: background 0.5s ease;
  pointer-events: none;
}
.mannequin-tag {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 100px;
  background: rgba(10, 7, 16, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.outfit-label {
  margin: 28px 0 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #d6cde0;
}
.outfit-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}
.outfit-chips button {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.outfit-chips button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}
.outfit-chips button.on {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 77, 141, 0.35);
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .tool-section { grid-template-columns: 1fr; gap: 40px; }
  .tool-copy { max-width: 620px; }
  .tool-wardrobe .tool-copy { order: 2; } /* copy first when stacked */
  .tool-wardrobe .tool-visual { order: 1; }
}

@media (max-width: 640px) {
  .tool-section { padding: 8px 20px 0; }
  .tool-section + .tool-section { margin-top: 76px; }

  .morph { gap: 8px; }
  .morph-media { width: 37vw; max-width: 158px; border-radius: 13px; } /* scales down so the pair + bridge never overflow */
  .morph-tag { left: 7px; bottom: 7px; font-size: 8px; padding: 3px 8px; }
  .morph-cap { font-size: 9px; }
  .morph-bridge { width: 34px; height: 34px; }
  .morph-bridge svg { width: 15px; height: 15px; }
  .morph-play { width: 46px; height: 46px; }
  .morph-play svg { width: 18px; height: 18px; }

  .mannequin { width: 236px; border-radius: 16px; }
  .outfit-label { margin-top: 22px; }
  .outfit-chips button { padding: 7px 13px; font-size: 11px; }
}
