/* ============================================
   COMPANYWISE — how-it-works.css
   "How it Works" section · Mobile-first
   Colour palette: design tokens
   ============================================ */

/* ---- Section ---- */
.hiw-section {
  position: relative;
  overflow: hidden;
  padding: var(--section-gap) 0;
  background: var(--page);
}

/* ---- Background Pattern ---- */
.hiw-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    color-mix(in srgb, var(--text) 4%, transparent) 1px,
    transparent 1px
  );
  background-size: var(--space-6) var(--space-6);
  pointer-events: none;
}

/* ---- Blur Accents ---- */
.hiw-blur-accent {
  position: absolute;
  width: var(--space-64);
  height: var(--space-64);
  border-radius: var(--rounded-full);
  opacity: var(--opacity-0);
  pointer-events: none;
  filter: blur(var(--blur-3xl));
  transition: opacity var(--duration-700) var(--ease-out);
}

.hiw-blur-accent.is-visible {
  opacity: var(--opacity-25);
}

.hiw-blur-accent--left {
  top: 0;
  left: calc(-1 * var(--space-32));
  background: var(--brand);
}

.hiw-blur-accent--right {
  bottom: 0;
  right: calc(-1 * var(--space-32));
  background: var(--cta);
}

@media (min-width: 1024px) {
  .hiw-blur-accent {
    width: var(--space-96);
    height: var(--space-96);
  }

  .hiw-blur-accent--left {
    left: calc(-1 * var(--space-24));
  }

  .hiw-blur-accent--right {
    right: calc(-1 * var(--space-24));
  }
}

/* ---- Container ---- */
.hiw-container {
  max-width: var(--max-w-7xl);
  margin: 0 auto;
  padding: 0 var(--space-4);
  width: 100%;
  position: relative;
  z-index: var(--z-10);
}

@media (min-width: 768px) {
  .hiw-container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .hiw-container {
    padding: 0 var(--space-8);
  }
}

/* ============================================
   Section Header
   ============================================ */

.hiw-header {
  text-align: center;
  margin-bottom: var(--space-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .hiw-header {
    margin-bottom: var(--space-14);
    gap: var(--space-4);
  }
}

/* Label Pill */
.hiw-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-2-5);
  background: linear-gradient(
    to bottom right,
    var(--brand-bg),
    color-mix(in srgb, var(--blue-500) 8%, transparent)
  );
  border: var(--border-1) solid color-mix(in srgb, var(--brand) 15%, transparent);
  border-radius: var(--rounded-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--brand);
}

.hiw-label i {
  font-size: var(--text-sm);
}

/* Title */
.hiw-title {
  font-size: clamp(var(--text-2xl), 5vw, var(--text-4xl));
  font-weight: var(--font-medium);
  color: var(--text);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

/* Subtitle */
.hiw-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
  max-width: var(--max-w-2xl);
}

@media (min-width: 768px) {
  .hiw-subtitle {
    font-size: var(--text-lg);
  }
}

/* ============================================
   Steps Grid
   ============================================ */

.hiw-steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 768px) {
  .hiw-steps-grid {
    gap: var(--space-8);
  }
}

@media (min-width: 1024px) {
  .hiw-steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   Step Card
   ============================================ */

.hiw-step-card {
  position: relative;
}

.hiw-step-card-inner {
  position: relative;
  background: var(--surface);
  border-radius: var(--rounded-2xl);
  border: var(--border-1) solid var(--border);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition:
    box-shadow var(--duration-200) var(--ease-in-out),
    transform var(--duration-200) var(--ease-in-out);
}

@media (min-width: 768px) {
  .hiw-step-card-inner {
    padding: var(--space-6);
  }
}

.hiw-step-card-inner:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(calc(-1 * var(--space-0-5)));
}

/* ---- Step Number Badge ---- */
.hiw-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-8);
  height: var(--space-8);
  border-radius: var(--rounded-xl);
  background: var(--muted);
  margin-bottom: var(--space-3);
}

.hiw-step-number span {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
}

/* ---- Step Icon ---- */
.hiw-step-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--space-12);
  height: var(--space-12);
  border-radius: var(--rounded-xl);
  margin-bottom: var(--space-4);
  background: var(--brand-bg);
  color: var(--brand);
}

.hiw-step-icon i {
  position: relative;
  z-index: var(--z-10);
  font-size: var(--text-xl);
}

.hiw-step-icon-bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: var(--opacity-50);
}

/* Icon Colour Variants */
.hiw-step-icon--amber {
  background: var(--warning-bg);
  color: var(--warning);
}

.hiw-step-icon--emerald {
  background: var(--success-bg);
  color: var(--success);
}

/* ---- Step Content ---- */
.hiw-step-content {
  margin-bottom: var(--space-4);
}

.hiw-step-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin: 0 0 var(--space-2) 0;
  line-height: var(--leading-snug);
}

.hiw-step-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* ============================================
   Step Visuals
   ============================================ */

.hiw-step-visual {
  margin-top: auto;
}

/* ---- Search Preview (Step 1) ---- */
.hiw-search-preview {
  background: var(--page);
  border-radius: var(--rounded-xl);
  border: var(--border-1) solid var(--border);
  overflow: hidden;
}

.hiw-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2-5) var(--space-3);
  border-bottom: var(--border-1) solid var(--border);
  background: var(--surface);
}

.hiw-search-bar i {
  color: var(--text-faint);
  font-size: var(--text-base);
  flex-shrink: 0;
}

.hiw-search-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.hiw-search-cursor {
  width: var(--space-0-5);
  height: var(--space-4);
  background: var(--brand);
  border-radius: var(--rounded-full);
  opacity: var(--opacity-100);
  transition: opacity var(--duration-150) var(--ease-in-out);
}

.hiw-search-cursor.blink {
  opacity: var(--opacity-0);
}

.hiw-search-results {
  display: flex;
  flex-direction: column;
}

.hiw-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2-5) var(--space-3);
  gap: var(--space-2);
}

.hiw-search-result:first-child {
  background: color-mix(in srgb, var(--brand) 5%, transparent);
}

.hiw-search-result + .hiw-search-result {
  border-top: var(--border-1) solid var(--border);
}

.hiw-result-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text);
}

.hiw-result-number {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ---- Analysis Preview (Step 2) ---- */
.hiw-analysis-preview {
  background: var(--page);
  border-radius: var(--rounded-xl);
  border: var(--border-1) solid var(--border);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2-5);
}

.hiw-signal-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.hiw-signal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--space-5);
  height: var(--space-5);
  border-radius: var(--rounded-full);
  flex-shrink: 0;
}

.hiw-signal i {
  font-size: var(--text-xs);
}

.hiw-signal--green {
  background: var(--success-bg);
  color: var(--success);
}

.hiw-signal--amber {
  background: var(--warning-bg);
  color: var(--warning);
}

.hiw-progress-bar {
  height: var(--space-1-5);
  background: var(--muted);
  border-radius: var(--rounded-full);
  overflow: hidden;
  margin-top: var(--space-1);
}

.hiw-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(to right, var(--brand), var(--success));
  border-radius: var(--rounded-full);
  transition: width var(--duration-700) var(--ease-out-expo);
}

/* ---- Verdict Preview (Step 3) ---- */
.hiw-verdict-preview {
  background: var(--page);
  border-radius: var(--rounded-xl);
  border: var(--border-1) solid var(--border);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.hiw-verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-2-5);
  border-radius: var(--rounded-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  width: fit-content;
}

.hiw-verdict-badge--low {
  background: var(--success-bg);
  color: var(--success);
  border: var(--border-1) solid color-mix(in srgb, var(--success) 20%, transparent);
}

.hiw-verdict-badge i {
  font-size: var(--text-sm);
}

.hiw-verdict-rec {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.hiw-verdict-rec i {
  color: var(--cta);
  font-size: var(--text-base);
  flex-shrink: 0;
  margin-top: var(--space-0-5);
}

/* ============================================
   Connectors
   ============================================ */

.hiw-connector {
  display: none;
}

@media (min-width: 1024px) {
  .hiw-connector {
    display: block;
    position: absolute;
    top: 50%;
    right: calc(-1 * var(--space-8));
    transform: translateY(-50%);
    width: var(--space-8);
    color: var(--text-faint);
  }

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

  .hiw-step-card:last-child .hiw-connector {
    display: none;
  }
}

/* ============================================
   Bottom CTA
   ============================================ */

.hiw-cta {
  text-align: center;
  margin-top: var(--space-10);
}

@media (min-width: 768px) {
  .hiw-cta {
    margin-top: var(--space-14);
  }
}

.hiw-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3-5) var(--space-6);
  background: var(--cta);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  text-decoration: none;
  border: none;
  border-radius: var(--rounded-2xl);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--duration-200) var(--ease-in-out);
  width: 100%;
}

@media (min-width: 640px) {
  .hiw-cta-btn {
    width: auto;
  }
}

@media (min-width: 768px) {
  .hiw-cta-btn {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
  }
}

.hiw-cta-btn:hover {
  background: var(--cta-hover);
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.hiw-cta-btn i {
  font-size: var(--text-lg);
}

/* ============================================
   Animations
   ============================================ */

.fade-in-up {
  opacity: var(--opacity-0);
  transform: translateY(var(--space-5));
  transition:
    opacity var(--duration-500) var(--ease-out),
    transform var(--duration-500) var(--ease-out);
}

.fade-in-up.is-visible {
  opacity: var(--opacity-100);
  transform: translateY(0);
}
