/* ============================================================
   outreach.css — "Outreach that fills the book" (CxOutreach)
   Signature visual: the CADENCE LADDER. A vertical path draws
   itself, a patient token descends Text → Voicemail → Email,
   the reply lands at step 3, and the two remaining rungs dim.
   CSS-only, one 12s looping timeline (--ou-t). Everything is
   namespaced under .cx-ou; keyframes are cxOu-prefixed since
   keyframe names are global. Base (non-animated) styles equal
   the FINAL scene, so prefers-reduced-motion shows the story's
   conclusion as a still. Tokens inherited from styles.css;
   comms accent = teal, layered under house indigo.
   ============================================================ */

.cx-ou {
  --cx-teal: #5a82c2;
  --cx-teal-deep: #3d63a4;
  --cx-teal-lite: #8aa6dd;
  --cx-teal-wash: color-mix(in srgb, #5a82c2 8%, #fff);
  --mint-wash: color-mix(in srgb, var(--mint) 10%, #fff);
  --ou-t: 6s;          /* one full cadence cycle */
  --ou-sh: 84px;        /* rung height */
  --ou-ix: 16px;        /* per-rung escalation indent */
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(70% 55% at 92% 18%, var(--cx-teal-wash), transparent 62%),
    linear-gradient(180deg, #fff, var(--paper));
}

.cx-ou .eyebrow { color: var(--cx-teal-deep); }
.cx-ou .h2 { margin: 14px 0 12px; }
.cx-ou .lead { max-width: 54ch; }

.cx-ou-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
}

/* ── left column: triggers + editorial footnotes ── */
.cx-ou-triggers { margin-top: clamp(24px, 3vw, 34px); }
.cx-ou-triggers-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-40);
  margin-bottom: 12px;
}
.cx-ou-chiplist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 8px;
}
.cx-ou-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: #fff;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-70);
  transition: border-color .2s ease, color .2s ease;
}
.cx-ou-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--cx-teal);
  opacity: .75;
}
.cx-ou-chip:hover {
  border-color: color-mix(in srgb, var(--cx-teal) 40%, var(--line));
  color: var(--ink);
}

.cx-ou-notes {
  list-style: none;
  margin: clamp(22px, 3vw, 32px) 0 0;
  padding: 0;
  max-width: 52ch;
}
.cx-ou-notes li {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-60);
}
.cx-ou-notes b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 4px;
}

/* ============================================================
   THE STAGE — one soft surface holding the open stepped path
   ============================================================ */
.cx-ou-stage {
  position: relative;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(80% 50% at 0% 0%, var(--periwinkle), transparent 55%),
    radial-gradient(70% 60% at 100% 100%, var(--cx-teal-wash), transparent 60%),
    linear-gradient(165deg, #fff, var(--paper));
  box-shadow: var(--shadow-float);
  padding: clamp(18px, 2.2vw, 26px) clamp(16px, 2vw, 24px) clamp(14px, 1.8vw, 20px);
  overflow: hidden;
}

/* header strip */
.cx-ou-stagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.cx-ou-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cx-teal-deep);
}
.cx-ou-live i {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--mint);
  animation: cxOuLive 1.4118s ease-out infinite;
}
.cx-ou-who { color: var(--ink-40); }

/* ── ladder geometry ── */
.cx-ou-ladder {
  position: relative;
  height: calc(var(--ou-sh) * 5);
}

/* the rail: draws top→down; lower half dims after the reply */
.cx-ou-rail {
  position: absolute;
  left: 21px;
  width: 2px;
  border-radius: 2px;
  transform-origin: top center;
  transform: scaleY(1); /* base = final scene */
}
.cx-ou-rail--a {
  top: 42px;
  height: calc(var(--ou-sh) * 2);
  background: linear-gradient(180deg, var(--cx-teal), var(--cx-teal-deep));
  animation: cxOuRailA var(--ou-t) ease infinite both;
}
.cx-ou-rail--b {
  top: calc(42px + var(--ou-sh) * 2);
  height: calc(var(--ou-sh) * 2);
  background: linear-gradient(180deg, var(--cx-teal-deep), color-mix(in srgb, var(--cx-teal) 30%, var(--line)));
  opacity: .25; /* base = final scene: dimmed */
  animation: cxOuRailB var(--ou-t) ease infinite both;
}

/* the patient token descending the rail */
.cx-ou-token {
  position: absolute;
  left: 15px;
  top: 35px;
  width: 14px;
  height: 14px;
  border-radius: var(--r-pill);
  z-index: 1;
  /* base = final scene: docked at step 3, booked */
  background: var(--mint);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--mint) 18%, transparent),
    0 2px 6px color-mix(in srgb, var(--mint) 35%, transparent);
  transform: translateY(calc(var(--ou-sh) * 2)) scale(1);
  animation: cxOuToken var(--ou-t) ease infinite both;
}

/* ── rungs ── */
.cx-ou-step {
  position: relative;
  height: var(--ou-sh);
  opacity: 1; /* base = final scene */
}
.cx-ou-step.is-skipped { opacity: .32; }

/* escalation tick: rail → label, growing longer per rung */
.cx-ou-step::before {
  content: "";
  position: absolute;
  left: 40px;
  top: 41px;
  height: 2px;
  width: calc(14px + var(--i) * var(--ou-ix));
  border-radius: 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cx-teal) 45%, var(--line)), var(--line-2));
}

.cx-ou-step--1 { animation: cxOuStep1 var(--ou-t) ease infinite both; }
.cx-ou-step--2 { animation: cxOuStep2 var(--ou-t) ease infinite both; }
.cx-ou-step--3 { animation: cxOuStep3 var(--ou-t) ease infinite both; }
.cx-ou-step--4 { animation: cxOuStep4 var(--ou-t) ease infinite both; }
.cx-ou-step--5 { animation: cxOuStep5 var(--ou-t) ease infinite both; }

/* channel medallion sitting on the rail */
.cx-ou-node {
  position: absolute;
  left: 6px;
  top: calc((var(--ou-sh) - 32px) / 2);
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-1);
  display: grid;
  place-items: center;
  z-index: 2;
}
.cx-ou-glyph {
  font-size: 14px;
  line-height: 1;
  filter: saturate(.55);
}

/* sent / booked node states — base = final scene, keyframes replay the journey */
.cx-ou-step--1 .cx-ou-node,
.cx-ou-step--2 .cx-ou-node {
  background: var(--cx-teal-wash);
  border-color: color-mix(in srgb, var(--cx-teal) 45%, #fff);
}
.cx-ou-step--3 .cx-ou-node {
  background: var(--mint-wash);
  border-color: color-mix(in srgb, var(--mint) 45%, #fff);
}
.cx-ou-step--1 .cx-ou-node { animation: cxOuSent1 var(--ou-t) ease infinite both; }
.cx-ou-step--2 .cx-ou-node { animation: cxOuSent2 var(--ou-t) ease infinite both; }
.cx-ou-step--3 .cx-ou-node { animation: cxOuSent3 var(--ou-t) ease infinite both; }

/* send ping — expanding ring at the moment each message goes out */
.cx-ou-ping {
  position: absolute;
  inset: -5px;
  border-radius: var(--r-pill);
  border: 2px solid var(--cx-teal);
  opacity: 0; /* base: pings are transient */
  pointer-events: none;
}
.cx-ou-step--1 .cx-ou-ping { animation: cxOuPing1 var(--ou-t) ease-out infinite both; }
.cx-ou-step--2 .cx-ou-ping { animation: cxOuPing2 var(--ou-t) ease-out infinite both; }
.cx-ou-step--3 .cx-ou-ping { animation: cxOuPing3 var(--ou-t) ease-out infinite both; }

/* booked ✓ badge on the reply node */
.cx-ou-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 15px;
  height: 15px;
  border-radius: var(--r-pill);
  background: var(--mint);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
  animation: cxOuBadge var(--ou-t) ease infinite both;
}

/* rung label block, indented further per rung (escalation) */
.cx-ou-meta {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding-left: calc(64px + var(--i) * var(--ou-ix));
}
.cx-ou-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.cx-ou-ch {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.cx-ou-day {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-40);
  font-variant-numeric: tabular-nums;
}
.cx-ou-never {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-40);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px 8px;
  background: var(--paper);
  animation: cxOuNever var(--ou-t) ease infinite both;
}

/* outbound snippet bubble under the first rung */
.cx-ou-snippet {
  margin: 0;
  max-width: 320px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-60);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  border-top-left-radius: 3px;
  padding: 7px 11px;
  box-shadow: var(--shadow-1);
}

/* the patient's reply, landing to the right of step 3 */
.cx-ou-reply {
  position: absolute;
  right: 0;
  top: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  max-width: min(52%, 240px);
  text-align: right;
  animation: cxOuReply var(--ou-t) ease infinite both;
}
.cx-ou-reply-bubble {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--mint-wash);
  border: 1px solid color-mix(in srgb, var(--mint) 35%, #fff);
  border-radius: 12px;
  border-bottom-right-radius: 3px;
  padding: 7px 11px;
}
.cx-ou-reply-status {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--mint) 80%, var(--ink));
}

/* audit footnote across the stage floor */
.cx-ou-audit {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--line-2);
  font-family: var(--mono);
  animation: cxOuAudit var(--ou-t) ease infinite both;
}
.cx-ou-audit-k {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-teal-deep);
}
.cx-ou-audit-v {
  font-size: 11.5px;
  color: var(--ink-60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   TIMELINE — one 12s cycle (each 1% ≈ 120ms)
   0–14   the path draws, rungs slide in
   12     text sent (ping) · 20–27 token descends to voicemail
   30     voicemail sent   · 40–47 token descends to email
   48     email sent       · 53–58 the reply lands, token → mint
   62–70  postcard + certified dim, "never sent"
   95–100 soft reset
   ============================================================ */

@keyframes cxOuRailA {
  0%       { transform: scaleY(0); opacity: 1; }
  8%       { transform: scaleY(1); }
  95%      { opacity: 1; }
  100%     { transform: scaleY(1); opacity: 0; }
}
@keyframes cxOuRailB {
  0%, 6%   { transform: scaleY(0); opacity: 1; }
  14%      { transform: scaleY(1); }
  62%      { opacity: 1; }
  68%      { opacity: .25; }
  95%      { opacity: .25; }
  100%     { transform: scaleY(1); opacity: 0; }
}

@keyframes cxOuStep1 {
  0%, 5%   { opacity: 0; transform: translateX(-10px); }
  9%       { opacity: 1; transform: none; }
  95%      { opacity: 1; }
  100%     { opacity: 0; }
}
@keyframes cxOuStep2 {
  0%, 9%   { opacity: 0; transform: translateX(-10px); }
  13%      { opacity: 1; transform: none; }
  95%      { opacity: 1; }
  100%     { opacity: 0; }
}
@keyframes cxOuStep3 {
  0%, 13%  { opacity: 0; transform: translateX(-10px); }
  17%      { opacity: 1; transform: none; }
  95%      { opacity: 1; }
  100%     { opacity: 0; }
}
@keyframes cxOuStep4 {
  0%, 17%  { opacity: 0; transform: translateX(-10px); }
  21%      { opacity: 1; transform: none; }
  62%      { opacity: 1; }
  68%      { opacity: .32; }
  95%      { opacity: .32; }
  100%     { opacity: 0; }
}
@keyframes cxOuStep5 {
  0%, 21%  { opacity: 0; transform: translateX(-10px); }
  25%      { opacity: 1; transform: none; }
  62%      { opacity: 1; }
  68%      { opacity: .32; }
  95%      { opacity: .32; }
  100%     { opacity: 0; }
}

@keyframes cxOuToken {
  0%, 6% {
    opacity: 0;
    transform: translateY(0) scale(.4);
    background: var(--indigo);
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--indigo) 15%, transparent),
      0 2px 6px color-mix(in srgb, var(--indigo) 30%, transparent);
  }
  10%      { opacity: 1; transform: translateY(0) scale(1); }
  20%      { transform: translateY(0) scale(1); animation-timing-function: cubic-bezier(.65,.05,.35,1); }
  27%      { transform: translateY(calc(var(--ou-sh) * 1)) scale(1); }
  40%      { transform: translateY(calc(var(--ou-sh) * 1)) scale(1); animation-timing-function: cubic-bezier(.65,.05,.35,1); }
  47%      { transform: translateY(calc(var(--ou-sh) * 2)) scale(1); }
  53% {
    background: var(--indigo);
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--indigo) 15%, transparent),
      0 2px 6px color-mix(in srgb, var(--indigo) 30%, transparent);
  }
  57% {
    background: var(--mint);
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--mint) 18%, transparent),
      0 2px 6px color-mix(in srgb, var(--mint) 35%, transparent);
  }
  95%      { opacity: 1; }
  100%     { transform: translateY(calc(var(--ou-sh) * 2)) scale(1); opacity: 0; }
}

@keyframes cxOuSent1 {
  0%, 10%  { background: #fff; border-color: var(--line); }
  14%      { background: var(--cx-teal-wash); border-color: color-mix(in srgb, var(--cx-teal) 45%, #fff); }
}
@keyframes cxOuSent2 {
  0%, 28%  { background: #fff; border-color: var(--line); }
  32%      { background: var(--cx-teal-wash); border-color: color-mix(in srgb, var(--cx-teal) 45%, #fff); }
}
@keyframes cxOuSent3 {
  0%, 47%  { background: #fff; border-color: var(--line); }
  51%      { background: var(--cx-teal-wash); border-color: color-mix(in srgb, var(--cx-teal) 45%, #fff); }
  55%      { background: var(--mint-wash); border-color: color-mix(in srgb, var(--mint) 45%, #fff); }
}

@keyframes cxOuPing1 {
  0%, 12%  { opacity: 0; transform: scale(.4); }
  13%      { opacity: .5; }
  24%      { opacity: 0; transform: scale(2.1); }
  100%     { opacity: 0; transform: scale(2.1); }
}
@keyframes cxOuPing2 {
  0%, 29%  { opacity: 0; transform: scale(.4); }
  30%      { opacity: .5; }
  41%      { opacity: 0; transform: scale(2.1); }
  100%     { opacity: 0; transform: scale(2.1); }
}
@keyframes cxOuPing3 {
  0%, 48%  { opacity: 0; transform: scale(.4); }
  49%      { opacity: .5; }
  58%      { opacity: 0; transform: scale(2.1); }
  100%     { opacity: 0; transform: scale(2.1); }
}

@keyframes cxOuBadge {
  0%, 52%  { opacity: 0; transform: scale(.3); }
  57%      { opacity: 1; transform: scale(1); }
}
@keyframes cxOuReply {
  0%, 53%  { opacity: 0; transform: translateY(10px) scale(.97); }
  58%      { opacity: 1; transform: none; }
}
@keyframes cxOuNever {
  0%, 66%  { opacity: 0; }
  70%      { opacity: 1; }
}
@keyframes cxOuAudit {
  0%, 30%  { opacity: 0; transform: translateY(6px); }
  34%      { opacity: 1; transform: none; }
  95%      { opacity: 1; }
  100%     { opacity: 0; }
}
@keyframes cxOuLive {
  0%       { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint) 40%, transparent); }
  70%      { box-shadow: 0 0 0 7px transparent; }
  100%     { box-shadow: 0 0 0 0 transparent; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 940px) {
  .cx-ou-grid { grid-template-columns: 1fr; gap: 40px; }
  .cx-ou-stage { max-width: 620px; }
}
@media (max-width: 700px) {
  .cx-ou { --ou-ix: 8px; --ou-sh: 80px; }
  .cx-ou-stage { padding: 16px 14px 12px; }
  .cx-ou-snippet { max-width: 230px; }
  .cx-ou-reply { max-width: 48%; }
  .cx-ou-who { display: none; }
}
@media (max-width: 460px) {
  .cx-ou { --ou-sh: 92px; }
  .cx-ou-ch { font-size: 13.5px; }
  .cx-ou-meta { padding-left: calc(56px + var(--i) * var(--ou-ix)); }
  .cx-ou-reply { max-width: 60%; }
}

/* reduced motion — freeze on the final scene (reply landed, tail dimmed) */
@media (prefers-reduced-motion: reduce), (max-width: 700px) {
  .cx-ou *,
  .cx-ou *::before,
  .cx-ou *::after {
    animation: none !important;
    transition: none !important;
  }
}
