/* WHAT WE DO – desktop: left scrolls, right sticky; mobile: stacked */
#what-we-do {
  margin-bottom: 10px;
}

.wwd-layout {
  display: grid;
  gap: 20px;
  align-items: flex-start;
  margin-top: 20px;
}

@media (min-width: 880px) {
  .wwd-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
  }
}

.wwd-left {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-right: 8px;
}

@media (max-width: 879px) {
  .wwd-layout {
    display: block;
  }

  .wwd-left {
    padding-right: 0;
  }
}

.wwd-step {
  min-height: 50vh; /* page-like on desktop */
  display: flex;
  align-items: center;
  padding: 10vh 0;
}

@media (max-width: 879px) {
  .wwd-step {
    min-height: auto;
    padding: 40px 0;
    flex-direction: column;      /* stack text + visual vertically */
    align-items: flex-start;     /* left-align content */
  }
}

.wwd-step-inner {
  max-width: 540px;
}

.step-index-label {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.step-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 10px;
  color: #222222;
}

.step-body {
  font-size: 0.98rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Mobile visuals inside each step */
.wwd-mobile-visual {
  display: none;
  margin-top: 14px;
  width: 100%;
  max-width: 540px;
}

.wwd-mobile-visual-box {
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
  background: var(--bg-alt);
  padding: 10px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wwd-mobile-visual-box img {
  border-radius: 8px;
}

.wwd-mobile-visual-caption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Platform mobile variant: text clusters instead of image */
.wwd-platform-mobile {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.wwd-platform-mobile .wwd-platform-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 2px;
}

.wwd-platform-mobile .wwd-platform-text {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 4px;
}

@media (max-width: 879px) {
  .wwd-mobile-visual {
    display: block;
  }
}

.wwd-right {
  position: sticky;
  top: 80px;
}

@media (max-width: 879px) {
  .wwd-right {
    display: none; /* hide sticky panel on mobile */
  }
}

.wwd-right-inner {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-alt);
  padding: 18px 16px 16px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* vertical center header + visual + caption */
}

.wwd-right-header {
  margin-bottom: 12px;
}

.wwd-right-title {
  font-size: 1.3rem;
  margin: 0 0 6px;
  color: #222222;
}

.wwd-right-text {
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.45;
}

.wwd-right-visual {
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;        /* center audio visual horizontally */
  justify-content: center;    /* center audio visual vertically */
  text-align: left;
  margin-top: 10px;
  color: var(--muted);
}

.wwd-right-visual img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
}

.wwd-right-caption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
}

/* PLATFORM GROUPS (inside right visual, platform step only) */
.wwd-platform {
  display: none; /* shown only for platform step via JS */
  width: 100%;
}

.wwd-platform-group {
  margin-bottom: 22px;     /* more breathing room */
}

.wwd-platform-group:last-child {
  margin-bottom: 0;
}

.wwd-platform-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 3px;
}

.wwd-platform-text {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* Desktop explainability container inside right panel */
.wwd-explainability-desktop {
  display: none; /* shown only for explain step via JS */
  width: 100%;
}

/* Keep the insomnia chat visible while scrolling through the Explainability step on mobile */
@media (max-width: 768px) {
  .wwd-step[data-step="explain"] .mira-chat-demo-mobile {
    position: sticky;
    top: 12px;
    z-index: 1;
  }
}


/* ===========================
   AUDIO RATING VISUAL (desktop)
   =========================== */

.wwd-audio-visual {
  display: none; /* shown only for audio step via JS */
  width: 100%;
  padding: 20px 18px;
  min-height: 260px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Base layout */
.wwd-audio-visual .audio-layout {
  display: flex;
  align-items: center;
  justify-content: center;   /* state 1: centered */
  gap: 32px;
  height: 100%;
  max-width: 88%;
  margin: 0 auto;
  transition:
    max-width 0.5s ease,
    justify-content 0.6s ease,
    transform 0.6s ease;
}

.wwd-audio-visual .audio-left {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  flex: 0 0 auto;
  transition: transform 0.6s ease;
}

.wwd-audio-visual .audio-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.audio-icon {
  width: 200px;
  height: 200px;
  object-fit: contain;
  display: none;          /* IMPORTANT: remove from layout */
  opacity: 0;
  transition: opacity 0.4s ease;
  margin: 0 auto;
}


/* -------- Waveform (diamond shape, breathing) -------- */

.audio-wave {
  display: flex;
  align-items: center;      /* diamond instead of baseline */
  gap: 5px;
  height: 88px;
  opacity: 0;               /* default off; enabled in states */
  transition: opacity 0.5s ease;
}

.audio-wave-bar {
  width: 6px;
  border-radius: 999px;
  background: #111111;
  transform-origin: center;
  animation: audio-wave 1.3s ease-in-out infinite;
}

/* diamond profile */
.audio-wave-bar:nth-child(1),
.audio-wave-bar:nth-child(10) {
  height: 26px;
}
.audio-wave-bar:nth-child(2),
.audio-wave-bar:nth-child(9) {
  height: 52px;
}
.audio-wave-bar:nth-child(3),
.audio-wave-bar:nth-child(8) {
  height: 78px;
}
.audio-wave-bar:nth-child(4),
.audio-wave-bar:nth-child(7) {
  height: 95px;
}
.audio-wave-bar:nth-child(5),
.audio-wave-bar:nth-child(6) {
  height: 110px;
}

/* small phase shifts */
.audio-wave-bar:nth-child(1),
.audio-wave-bar:nth-child(10) { animation-delay: 0s; }
.audio-wave-bar:nth-child(2),
.audio-wave-bar:nth-child(9)  { animation-delay: 0.08s; }
.audio-wave-bar:nth-child(3),
.audio-wave-bar:nth-child(8)  { animation-delay: 0.16s; }
.audio-wave-bar:nth-child(4),
.audio-wave-bar:nth-child(7)  { animation-delay: 0.24s; }
.audio-wave-bar:nth-child(5),
.audio-wave-bar:nth-child(6)  { animation-delay: 0.32s; }

@keyframes audio-wave {
  0%   { transform: scaleY(0.9); }
  40%  { transform: scaleY(1.08); }
  80%  { transform: scaleY(0.95); }
  100% { transform: scaleY(0.9); }
}

/* -------- Arrow (smooth grow) -------- */

.audio-arrow {
  flex-shrink: 0;
  width: 120px;
  height: 0;
  border-top: 4px solid #111111;
  position: relative;
  opacity: 0;
  transform-origin: left center;
  transform: scaleX(0);
  transition:
    opacity 0.6s ease,
    transform 0.8s cubic-bezier(0.25, 0.9, 0.25, 1.02);
}

.audio-arrow::after {
  content: "";
  position: absolute;
  right: -13px;
  top: -10px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #111111;
}

/* -------- Scores / pills -------- */

.audio-scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.audio-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
}

.audio-score-label {
  flex: 1;
  color: var(--text);
}

.audio-score-pill {
  flex-shrink: 0;
  min-width: 104px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border: 1px solid transparent;
}

/* severity colours (aligned with explainability palette) */
.audio-pill-mild {
  background: #fffd7e;
  /* border-color: #facc15; */
  color: #000000;
}

.audio-pill-moderate {
  background: #ffdf7e;
  /* border-color: #f59e0b; */
  color: #000000;
}

.audio-pill-severe {
  background: #ffa77e;
  /* border-color: #ea580c; */
  color: #000000;
}

.audio-pill-absent {
  background: #c5ff7e;
  /* border-color: #84cc16; */
  color: #000000;
}


/* ===========================
   Scroll states (desktop)
   =========================== */

/* Base transitions */
.wwd-audio-visual .audio-layout {
  transition:
    max-width 0.5s ease,
    justify-content 0.6s ease,
    transform 0.6s ease;
}

.wwd-audio-visual .audio-left {
  transition: transform 0.6s ease;
}


/* ---------- STATES 3: OPEN LAYOUT, WAVEFORM LEFT, NO ARROW/SCORES ---------- */

.audio-state-3 .audio-layout {
  justify-content: space-between;
}

.audio-state-3 .audio-left {
  transform: translateX(0%); /* slide waveform to the left */
}

.audio-state-3 .audio-wave {
  opacity: 1;
}

.audio-state-3 .audio-arrow {
  opacity: 0;
  transform: scaleX(0);
}

.audio-state-3 .audio-scores {
  opacity: 0;
  transform: translateY(8px);
}

/* ---------- STATES 4–5: ARROW + SCORES, WAVEFORM STAYS VISIBLE ---------- */

.audio-state-4 .audio-layout,
.audio-state-5 .audio-layout {
  justify-content: space-between;
}

.audio-state-4 .audio-left,
.audio-state-5 .audio-left {
  transform: translateX(0%);
}

.audio-state-4 .audio-wave,
.audio-state-5 .audio-wave {
  opacity: 1; /* keep waveform visible to the end */
}

.audio-state-4 .audio-arrow,
.audio-state-5 .audio-arrow {
  opacity: 1;
  transform: scaleX(1);
}

.audio-state-4 .audio-scores,
.audio-state-5 .audio-scores {
  opacity: 1;
  transform: translateY(0);
}
