/* How It Works v2 — true to docs/discovery/page-how-it-works.png */

.hiw-v2-page {
  color: var(--navy);
  background: #fff;
}

.hiw-v2-page .hiw-section {
  padding: 3rem 0;
}

.hiw-v2-page .hiw-section-soft {
  background: #f4f5fa;
}

.hiw-v2-page .hiw-section-tight {
  padding: 1.25rem 0;
}

.hiw-v2-page .hiw-section-cta {
  padding: 2rem 0 3.5rem;
}

/* —— Hero —— */
.hiw-hero-media {
  position: relative;
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 1.25rem;
}

.hiw-hero-glow {
  position: absolute;
  inset: -8% 0 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0 28%, rgba(255, 180, 210, 0.28) 44%, rgba(120, 140, 255, 0.14) 60%, transparent 74%);
  pointer-events: none;
  z-index: 0;
}

.hiw-sync-pill {
  position: relative;
  z-index: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}

.hiw-sync-pill span {
  color: var(--green);
  font-weight: 800;
}

.hiw-flow-strip {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 1rem 0.75rem;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  background: linear-gradient(100deg, rgba(255, 140, 60, 0.12), rgba(255, 80, 140, 0.12), rgba(120, 90, 255, 0.14));
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.hiw-flow-strip li {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy);
  position: relative;
}

.hiw-flow-strip li + li::before {
  content: "";
  position: absolute;
  left: -18%;
  top: 22px;
  width: 36%;
  border-top: 1.5px dashed rgba(36, 48, 103, 0.25);
}

.hiw-flow-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--navy);
}

.hiw-flow-icon svg {
  width: 22px;
  height: 22px;
}

/* —— Step cards —— */
.hiw-steps {
  display: grid;
  gap: 1.25rem;
}

.hiw-step-card,
.hiw-step-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.35fr);
  gap: 1.5rem 2rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.hiw-step-copy h2 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.hiw-step-copy p {
  margin: 0;
  color: var(--navy-soft);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 36ch;
}

.hiw-step-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--purple);
  letter-spacing: -0.03em;
  margin-bottom: 0.45rem;
}

.hiw-step-media {
  min-width: 0;
}

.hiw-ui-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 8px 24px rgba(11, 27, 58, 0.05);
}

.hiw-ui-card > strong {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.98rem;
}

/* Roster table */
.hiw-table-wrap {
  overflow-x: auto;
}

.hiw-roster-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  min-width: 560px;
}

.hiw-roster-card th,
.hiw-roster-card td {
  padding: 0.55rem 0.45rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #eef0f5;
}

.hiw-roster-card th {
  color: #8a93a8;
  font-weight: 700;
  font-size: 0.68rem;
}

.hiw-roster-card td {
  color: var(--navy);
  font-weight: 600;
}

/* Language step */
.hiw-lang-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.hiw-chat-bubble {
  background: #f0edff;
  border-radius: 18px 18px 18px 6px;
  padding: 0.95rem 1rem;
  align-self: start;
}

.hiw-chat-bubble p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
}

.hiw-chat-bubble span {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  color: #8a93a8;
  font-weight: 600;
}

.hiw-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.hiw-lang-grid button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  font-weight: 700;
  color: var(--navy);
  cursor: default;
  text-align: left;
}

.hiw-lang-grid button.is-selected {
  border-color: var(--purple);
  color: var(--purple);
  box-shadow: 0 0 0 1px rgba(107, 58, 247, 0.15);
}

.hiw-lang-confirm {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafbfe;
}

.hiw-lang-confirm img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.hiw-lang-confirm strong {
  display: block;
  font-size: 0.9rem;
}

.hiw-lang-confirm p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--navy-soft);
  font-weight: 600;
}

.hiw-confirm-check {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Audience */
.hiw-audience-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0.85rem;
}

.hiw-audience-split label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy-soft);
}

.hiw-audience-split label span {
  color: var(--navy);
}

.hiw-selected {
  margin: 0.85rem 0 0.65rem;
  font-size: 0.92rem;
}

.hiw-mini-avatars {
  display: flex;
  align-items: center;
}

.hiw-mini-avatars img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -6px;
  object-fit: cover;
}

.hiw-mini-avatars img:first-child {
  margin-left: 0;
}

.hiw-mini-avatars span {
  margin-left: 0.45rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--navy-soft);
}

.hiw-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.hiw-group-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.hiw-group-list li::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='9' r='3' fill='none' stroke='%236b3af7' stroke-width='2'/%3E%3Cpath d='M6 19c.8-3 2.8-4.5 6-4.5s5.2 1.5 6 4.5' fill='none' stroke='%236b3af7' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")
      center / 14px no-repeat,
    rgba(107, 58, 247, 0.12);
}

/* Compose */
.hiw-compose-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.hiw-compose-tabs button {
  border: 0;
  background: none;
  padding: 0.35rem 0 0.7rem;
  font-weight: 700;
  color: var(--navy-soft);
  cursor: default;
  position: relative;
}

.hiw-compose-tabs button.is-active {
  color: var(--purple);
}

.hiw-compose-tabs button.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--purple);
}

.hiw-compose-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hiw-compose-fields label {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--navy);
}

.hiw-select,
.hiw-audience-chip {
  display: block;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy-soft);
  background: #fafbfe;
}

.hiw-preview strong {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
}

.hiw-preview p {
  margin: 0;
  padding: 0.9rem;
  border-radius: 12px;
  background: #f4f5fa;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.45;
}

.hiw-preview-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.hiw-btn-ghost,
.hiw-btn-solid {
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: default;
}

.hiw-btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}

.hiw-btn-solid {
  border: 0;
  background: var(--purple);
  color: #fff;
}

/* Step 05 gradient */
.hiw-step-grad {
  background: var(--grad);
  border: 0;
  color: #fff;
  align-items: stretch;
}

.hiw-step-grad .hiw-step-num,
.hiw-step-grad h2,
.hiw-step-grad p {
  color: #fff;
}

.hiw-step-grad p {
  max-width: 32ch;
}

.hiw-translate-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  position: relative;
}

.hiw-msg-card {
  background: #fff;
  color: var(--navy);
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.hiw-msg-card header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hiw-msg-card img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.hiw-msg-card strong {
  font-size: 0.72rem;
}

.hiw-msg-card p {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
  max-width: none;
}

.hiw-msg-card time {
  margin-top: auto;
  font-size: 0.68rem;
  color: #8a93a8;
  font-weight: 600;
}

.hiw-flow-arrow {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* Listen step */
.hiw-listen-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: stretch;
}

.hiw-listen-flow > .hiw-flow-arrow {
  color: #9aa3b5;
  align-self: center;
}

.hiw-pulse-q {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy-soft);
}

.hiw-pulse-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.hiw-pulse-bars li {
  display: grid;
  grid-template-columns: 5.5rem 1fr 1.2rem;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.hiw-pulse-bars b {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #6fd3a4);
  width: var(--w);
}

.hiw-pulse-bars .is-alert b {
  background: linear-gradient(90deg, #ff4d6d, #ff8aa0);
}

.hiw-pulse-bars .is-alert span,
.hiw-pulse-bars .is-alert em {
  color: #d12b4c;
}

.hiw-pulse-total {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-soft);
}

.hiw-alert-card .hiw-alert-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #d12b4c;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}

.hiw-alert-card p {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
}

.hiw-manager {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.35rem 0 0.85rem;
}

.hiw-manager img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.hiw-manager strong {
  display: block;
  font-size: 0.9rem;
}

.hiw-manager p {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--navy-soft);
  font-weight: 600;
}

.hiw-task {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
}

/* Record step */
.hiw-step-navy {
  background: var(--navy);
  border: 0;
  color: #fff;
}

.hiw-step-navy .hiw-step-num,
.hiw-step-navy h2,
.hiw-step-navy p {
  color: #fff;
}

.hiw-record-layout {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1.2fr) minmax(140px, 0.85fr);
  gap: 0.85rem;
  align-items: stretch;
}

.hiw-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.hiw-profile-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.hiw-profile-card strong {
  display: block;
  font-size: 0.95rem;
}

.hiw-profile-card p {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  max-width: none;
}

.hiw-history {
  list-style: none;
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 0.7rem;
  align-content: center;
}

.hiw-history li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
}

.hiw-history li span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
}

.hiw-history time {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.hiw-search-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem;
  border-radius: 18px;
  background: #fff;
  color: var(--navy-soft);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  align-self: center;
}

/* Workflow bar */
.hiw-workflow-bar {
  list-style: none;
  margin: 0;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.hiw-workflow-bar li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy);
  position: relative;
  padding-right: 1.1rem;
}

.hiw-workflow-bar li + li::before {
  content: "→";
  position: absolute;
  left: -0.85rem;
  color: #9aa3b5;
  font-weight: 700;
}

.hiw-workflow-bar li:first-child::before {
  display: none;
}

.hiw-workflow-bar span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  color: var(--navy);
}

.hiw-workflow-bar svg {
  width: 18px;
  height: 18px;
}

/* CTA */
.hiw-cta {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 3rem 1.75rem;
  text-align: center;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow);
}

.hiw-cta::before,
.hiw-cta::after {
  content: "";
  position: absolute;
  top: 50%;
  width: min(96px, 18vw);
  height: 64px;
  transform: translateY(-50%);
  opacity: 0.22;
  background:
    radial-gradient(circle at 10% 50%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 22% 35%, #fff 0 4px, transparent 5px),
    radial-gradient(circle at 34% 50%, #fff 0 6px, transparent 7px),
    radial-gradient(circle at 46% 30%, #fff 0 5px, transparent 6px),
    radial-gradient(circle at 58% 55%, #fff 0 7px, transparent 8px),
    radial-gradient(circle at 70% 40%, #fff 0 4px, transparent 5px),
    radial-gradient(circle at 82% 50%, #fff 0 3px, transparent 4px);
  pointer-events: none;
}

.hiw-cta::before { left: 0.75rem; }
.hiw-cta::after { right: 0.75rem; transform: translateY(-50%) scaleX(-1); }

.hiw-cta h2,
.hiw-cta p,
.hiw-cta .btn-row {
  position: relative;
  z-index: 1;
}

.hiw-cta h2 {
  color: #fff;
  margin-bottom: 0.65rem;
}

.hiw-cta p {
  margin: 0 auto 1.35rem;
  max-width: 48ch;
  color: rgba(255, 255, 255, 0.94);
}

.hiw-cta .btn-row {
  justify-content: center;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .hiw-translate-flow {
    grid-template-columns: 1fr;
  }

  .hiw-translate-flow > .hiw-flow-arrow {
    display: none;
  }

  .hiw-listen-flow {
    grid-template-columns: 1fr;
  }

  .hiw-listen-flow > .hiw-flow-arrow {
    display: none;
  }

  .hiw-record-layout {
    grid-template-columns: 1fr;
  }

  .hiw-step-grad,
  .hiw-step-navy {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .hiw-step-card {
    grid-template-columns: 1fr;
  }

  .hiw-flow-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .hiw-flow-strip li + li::before {
    display: none;
  }

  .hiw-lang-layout,
  .hiw-audience-split,
  .hiw-compose-body {
    grid-template-columns: 1fr;
  }

  .hiw-workflow-bar {
    border-radius: 22px;
    justify-content: flex-start;
  }

  .hiw-workflow-bar li {
    padding-right: 0.5rem;
  }

  .hiw-workflow-bar li + li::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .hiw-sync-pill {
    justify-self: stretch;
    text-align: center;
  }

  .hiw-flow-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hiw-cta::before,
  .hiw-cta::after {
    display: none;
  }

  .hiw-step-card,
  .hiw-step-panel {
    padding: 1.25rem;
    border-radius: 22px;
  }
}
