/* The animated CRM illustration (crm-demo.js): one fictional lead (Sarah Mitchell / Nova Roofing)
   moving through five pipeline stages, with its conversation, next action and activity feed.
   Moved from styles.css when the homepage's CRM slide became the CRM film; it now illustrates the
   Services page's "CRM in action" section. Rules unchanged. */
.crm-visual-wrap { display: flex; justify-content: center; width: 100%; }
.crm-card {
  /* Fixed-size "monitor" box, like the site's own phone-mockup pattern:
     width and height are literal constants, not derived from content.
     Every section above .crm-activity keeps its natural (already-fixed)
     height; .crm-activity is the one flexible region and absorbs any
     remaining space, scrolling internally rather than growing the card
     if its content ever needs more room than that. The outer box itself
     never changes size, position, or scale during playback. */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 700px;
  padding: 32px 24px;
  border-radius: var(--radius-xl);
  border: 1px solid oklch(62% 0.06 265 / 0.28);
  background: linear-gradient(165deg, oklch(20% 0.014 262 / 0.94), oklch(14% 0.012 262 / 0.97));
  box-shadow:
    inset 0 1px 0 0 oklch(100% 0 0 / 0.06),
    inset 0 0 70px -24px oklch(60% 0.16 265 / 0.3),
    0 34px 90px -24px oklch(0% 0 0 / 0.55),
    0 0 70px -12px oklch(65% 0.18 270 / 0.35);
  box-sizing: border-box;
}

.crm-contact {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}
.crm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  background: radial-gradient(circle at 35% 30%, oklch(30% 0.03 240 / 0.6), var(--surface-2) 70%);
  border: 1px solid oklch(68% 0.16 235 / 0.35);
}
.crm-contact-info { min-width: 0; }
.crm-contact-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text-primary);
}
.crm-contact-business { font-size: var(--fs-micro); color: var(--text-secondary); }
.crm-lead-source {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  transition: color 400ms var(--ease-standard), background 400ms var(--ease-standard), border-color 400ms var(--ease-standard);
}

.crm-conversation {
  /* Fixed height (not min-height) + hidden overflow: a 1-line vs.
     2-line wrapped message must never change the card's rendered
     height mid-animation. Sized for two lines at this line-height. */
  height: 40px;
  overflow: hidden;
  margin-top: var(--space-md);
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--text-secondary);
  font-style: italic;
}

.crm-stages { display: flex; flex-direction: column; gap: var(--space-lg); margin-top: var(--space-lg); }
.crm-stage { display: flex; align-items: center; gap: var(--space-md); position: relative; padding: 2px 0; }
.crm-stage::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 32px;
  width: 1px;
  height: calc(100% + var(--space-lg) - 20px);
  background: var(--border-subtle);
}
.crm-stage:last-child::before { display: none; }
.crm-stage .icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
  transition: box-shadow 400ms var(--ease-standard), border-color 400ms var(--ease-standard), background 400ms var(--ease-standard);
}
.crm-stage-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text-tertiary);
  transition: color 400ms var(--ease-standard);
}
.crm-stage.is-current .icon-badge { border-color: var(--accent-blue); box-shadow: 0 0 0 5px oklch(68% 0.19 255 / 0.15); }
.crm-stage.is-current .crm-stage-label { color: var(--text-primary); }
.crm-stage.is-done .icon-badge { border-color: var(--state-success); }
.crm-stage.is-done .crm-stage-label { color: var(--text-secondary); }
.crm-stage.is-won .icon-badge {
  border-color: var(--state-success);
  background: oklch(72% 0.16 152 / 0.14);
  box-shadow: 0 0 0 5px oklch(72% 0.16 152 / 0.18);
}
.crm-stage.is-won .crm-stage-label { color: var(--text-primary); }

.crm-meta-row {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}
.crm-meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crm-meta-label { font-size: var(--fs-micro); color: var(--text-tertiary); }
.crm-meta-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-activity {
  /* The one flexible region inside the now fixed-height .crm-card:
     activity lines accumulate from 0 to 3 during the animation, so this
     fills whatever space remains below the fixed sections above it and
     scrolls internally if it ever needs more — the card itself never
     grows. */
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.crm-activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 500ms var(--ease-emphasized), transform 500ms var(--ease-emphasized);
}
.crm-activity-item.is-visible { opacity: 1; transform: translateY(0); }
.crm-activity-item .check { color: var(--state-success); font-weight: 700; }

@media (max-width: 900px) {
  .crm-visual-wrap { margin-top: var(--space-lg); }
  .crm-card { max-width: 420px; }
  .crm-contact { text-align: left; }
}
