/* Product case figures, drawn in the article-figure hand (Style G): a framed warm
   ground, a quiet base, one lifted element per figure, the case ink only on it.
   Loaded after the page CSS and pf-drawn.css; owns the .cf figures and the .cfd demo. */

.cf, .cfd {
  --cf-ground: #E7E2D8; --cf-card: #fff; --cf-bar: #D6D2CB; --cf-soft: #F2EFE9;
  --cf-rule: #CFCBC3; --cf-line: #B3AC9F; --cf-marker: #8A8479;
  --cf-green: #4A8055; --cf-terra: #C0664A; --cf-amber: #C79A3C;
  --cf-ink: var(--case-ink, #00529B);
  --cf-text: #1f1e1b; --cf-quiet: #5f5a51; --cf-mono: "JetBrains Mono", ui-monospace, monospace;
  --cf-rest: 0 1px 2px rgba(61,56,46,.06), 0 8px 24px -8px rgba(61,56,46,.10);
  --cf-lift: 0 2px 4px rgba(61,56,46,.08), 0 12px 28px -6px rgba(61,56,46,.16);
}

/* ---------- frame ---------- */
.cf { margin: clamp(28px, 4vw, 44px) 0 0; container-type: inline-size; }
.cf__g {
  position: relative; background: var(--cf-ground); border-radius: 12px; overflow: hidden;
  padding: clamp(28px, 8cqi, 72px) clamp(16px, 7cqi, 72px);
  display: grid; place-items: center;
}
.cf .cf-cap { font-size: 13px; line-height: 1.55; color: var(--muted, #6B6B66); margin: 14px 0 0; max-width: 60ch; }

.cf .cf__k { font-size: 13px; line-height: 1.3; font-weight: 500; color: var(--cf-quiet); letter-spacing: 0; }

/* base card and lifted card, the only two card roles */
.cf-card, .cf-chip, .cf-bit {
  background: var(--cf-card); border-radius: 12px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cf-rule) 55%, transparent), var(--cf-rest);
}
.cf-card { padding: 16px 18px; }
.cf .cf-card__n { font-size: 15px; line-height: 1.25; font-weight: 600; color: var(--cf-text); margin-top: 6px; }
.cf .cf-card__s { font-family: var(--cf-mono); font-size: 12px; line-height: 1.4; color: var(--cf-quiet); margin-top: 6px; }

.cf-hi {
  position: relative; z-index: 2;
  background: var(--cf-card); border-radius: 16px;
  padding: clamp(18px, 3.4cqi, 26px) clamp(18px, 3.4cqi, 28px);
  box-shadow: 0 0 0 1px var(--cf-rule), var(--cf-lift);
  --hi: var(--cf-ink);
}
.cf-hi--alert { --hi: var(--cf-terra); }
.cf .cf-hi__n, .cf-hi .cf-hi__n {
  display: block; font-size: clamp(19px, 3.6cqi, 26px); line-height: 1.12; font-weight: 600;
  letter-spacing: -0.015em; color: var(--cf-text); margin-top: 10px;
}
.cf .cf-hi__s, .cf-hi .cf-hi__s {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--cf-mono); font-size: 12.5px; line-height: 1.4; color: var(--hi); margin-top: 12px;
}
.cf-hi__s::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--hi);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--hi) 16%, transparent);
}

/* ---------- 1. scattered, the result lifted ---------- */
.cf1 { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 760px; }
.cf1__src { flex: none; min-width: 0; }
.cf1__src .cf__k { margin: 0 0 18px 4px; }
.cf1__bits { display: flex; align-items: flex-start; }
.cf-bit { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; flex: none; }
.cf-bit__n { font-size: 13.5px; line-height: 1.2; font-weight: 500; color: var(--cf-text); white-space: nowrap; }
.cf-bit__art { display: flex; flex-direction: column; gap: 7px; }
.cf-bit__art b { display: block; height: 5px; border-radius: 3px; background: var(--cf-bar); }
.cf-bit--paper { width: 128px; transform: rotate(-4deg); z-index: 1; }
.cf-bit--paper .cf-bit__art { padding: 4px 0 6px; gap: 10px; }
.cf-bit--paper .cf-bit__art b:nth-child(1) { width: 72%; }
.cf-bit--paper .cf-bit__art b:nth-child(2) { width: 90%; }
.cf-bit--paper .cf-bit__art b:nth-child(3) { width: 56%; }
.cf-bit--paper .cf-bit__art b:nth-child(4) { width: 80%; }
.cf-bit--deck { width: 148px; margin: 26px 0 0 -14px; transform: rotate(3deg); z-index: 2; }
.cf-bit--deck::before, .cf-bit--deck::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; background: var(--cf-card);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cf-rule) 55%, transparent);
  z-index: -1; transform: translate(6px, -6px);
}
.cf-bit--deck::after { transform: translate(12px, -12px); z-index: -2; background: var(--cf-soft); }
.cf-bit--deck .cf-bit__art { aspect-ratio: 16 / 9; background: var(--cf-soft); border-radius: 6px; padding: 10px; justify-content: flex-start; }
.cf-bit--deck .cf-bit__art b:nth-child(1) { width: 60%; height: 6px; background: var(--cf-bar); }
.cf-bit--deck .cf-bit__art b:nth-child(2) { width: 38%; background: color-mix(in srgb, var(--cf-bar) 60%, var(--cf-soft)); }
.cf-bit--note { width: 116px; margin: -6px 0 0 -12px; transform: rotate(-2deg); z-index: 3; }
.cf-bit--note .cf-bit__art { padding: 2px 0 4px; }
.cf-bit--note .cf-bit__art b:nth-child(1) { width: 64%; }
.cf-bit--note .cf-bit__art b:nth-child(2) { width: 44%; }
.cf1__out { z-index: 4; flex: 0 0 auto; width: clamp(220px, 34cqi, 280px); margin: 36px 0 0 -24px; }

@container (max-width: 699px) {
  .cf1 { flex-direction: column; align-items: stretch; max-width: 440px; }
  .cf1__bits { justify-content: flex-start; }
  .cf1__bits { padding: 0 2px; }
  .cf-bit { padding: 10px; gap: 10px; }
  .cf-bit--paper { width: 98px; }
  .cf-bit--deck { width: 110px; margin: 10px 0 0 -6px; }
  .cf-bit--deck::before { transform: translate(4px, -4px); }
  .cf-bit--deck::after { transform: translate(8px, -8px); }
  .cf-bit--note { width: 94px; margin: -2px 0 0 -4px; }
  .cf-bit__n { font-size: 12.5px; }
  .cf1__out { width: auto; margin: -6px 0 0 24px; }
}

/* ---------- 2. the loop, owned ---------- */
.cf2 {
  position: relative; width: 100%; max-width: 760px;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, .95fr);
  align-items: center; min-height: 260px;
}
.cf2__orbit { position: absolute; top: 4px; bottom: 4px; left: 17%; right: 15%; width: 68%; height: calc(100% - 8px); overflow: visible; }
.cf2__orbit ellipse { fill: none; stroke: var(--cf-line); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.cf2__chev { position: absolute; width: 9px; height: 9px; border: solid var(--cf-marker); border-width: 1.5px 1.5px 0 0; }
.cf2__chev--a { top: 4px; left: 51%; transform: translate(-50%, -50%) rotate(45deg); }
.cf2__chev--b { bottom: 4px; left: 51%; transform: translate(-50%, 50%) rotate(-135deg); }
.cf2__me { grid-column: 1; }
.cf2__loop {
  grid-column: 2; position: relative; z-index: 1; padding: 0 clamp(12px, 3cqi, 24px);
  text-align: center; font-size: 14px; line-height: 1.45; font-weight: 500; color: var(--cf-quiet);
}
.cf2__loop svg { display: block; width: 18px; height: 18px; margin: 0 auto 10px; color: var(--cf-ink); }
.cf2__bu { grid-column: 3; position: relative; z-index: 1; }

@container (max-width: 699px) {
  .cf2 { grid-template-columns: 1fr; gap: 26px; min-height: 0; max-width: 420px; }
  .cf2__me, .cf2__loop, .cf2__bu { grid-column: 1; }
  .cf2__me { margin-right: 32px; }
  .cf2__bu { margin-left: 48px; }
  .cf2__loop { padding: 0 18%; }
  .cf2__orbit { left: 12%; right: 12%; width: 76%; top: 12%; bottom: 12%; height: 76%; }
  .cf2__chev--a { top: 50%; left: auto; right: 12%; transform: translate(50%, -50%) rotate(135deg); }
  .cf2__chev--b { top: 50%; bottom: auto; left: 12%; transform: translate(-50%, -50%) rotate(-45deg); }
}

/* ---------- 3. testing, run with the business lifted ---------- */
.cf3 { width: 100%; max-width: 860px; display: grid; }
.cf3__plan {
  list-style: none; margin: 32px 0 0; padding: 26px 24px 24px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  background: var(--cf-card); border-radius: 12px; position: relative;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cf-rule) 55%, transparent), var(--cf-rest);
}
.cf3__plan::before { /* the track */
  content: ""; position: absolute; left: 32px; right: 32px; top: 30px; height: 1.5px; background: var(--cf-bar);
}
.cf3__step { position: relative; display: flex; flex-direction: column; padding-top: 20px; min-width: 0; }
.cf3__step::before {
  content: ""; position: absolute; top: 0; left: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--cf-card); box-shadow: 0 0 0 1.5px var(--cf-marker);
}
.cf3__n { font-size: 15px; line-height: 1.25; font-weight: 600; color: var(--cf-text); }
.cf3__s { font-family: var(--cf-mono); font-size: 12px; line-height: 1.4; color: var(--cf-quiet); margin-top: 6px; }
.cf3__step--hi { padding-top: 0; }
.cf3__step--hi::before { display: none; }
.cf3__step--hi .cf-hi { margin: -58px -12px 0; }
.cf3__return {
  height: 30px; margin: 0 calc(12.5% - 4px) 0 calc(12.5% - 4px); position: relative;
  border: 1.5px solid var(--cf-line); border-top: 0; border-radius: 0 0 16px 16px;
}
.cf3__return::after { /* arrowhead, pointing back up into Script */
  content: ""; position: absolute; left: -1px; top: -1px; width: 8px; height: 8px;
  border: solid var(--cf-marker); border-width: 1.5px 0 0 1.5px; transform: translate(-50%, 0) rotate(45deg); transform-origin: center;
}
.cf3__loop {
  justify-self: center; margin-top: -11px; padding: 0 14px; background: var(--cf-ground); position: relative;
  display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.5; font-weight: 500; color: var(--cf-quiet);
}
.cf3__loop svg { width: 16px; height: 16px; color: var(--cf-ink); flex: none; }

@container (max-width: 699px) {
  .cf3 { max-width: 440px; }
  .cf3__plan { grid-template-columns: 1fr; gap: 20px; margin: 0 20px 0 30px; padding: 22px 20px; grid-area: 1 / 1; }
  .cf3__plan::before { left: 24px; right: auto; top: 28px; bottom: 28px; width: 1.5px; height: auto; }
  .cf3__step { padding: 0 0 0 26px; }
  .cf3__step::before { top: 4px; left: 0; }
  .cf3__step--hi { padding: 0; }
  .cf3__step--hi .cf-hi { margin: 0 -40px 0 -8px; }
  .cf3__return {
    grid-area: 1 / 1; justify-self: start; align-self: stretch; width: 18px; height: auto;
    margin: 30px 0 30px 6px; border: 1.5px solid var(--cf-line); border-right: 0; border-radius: 14px 0 0 14px;
  }
  .cf3__return::after { left: auto; right: -2px; top: -1px; transform: translate(0, -50%) rotate(135deg); }
  .cf3__loop { justify-self: start; margin: 18px 0 0; padding: 0; background: none; font-size: 13.5px; }
}

/* ---------- 4. every unit into one shared tool ---------- */
.cf4 {
  width: 100%; max-width: 880px;
  display: grid; align-items: center;
  grid-template-columns: minmax(118px, .8fr) minmax(40px, .45fr) minmax(0, 1.25fr) minmax(0, .8fr);
}
.cf4__units { display: grid; gap: 10px; position: relative; }
.cf4__units .cf__k { position: absolute; bottom: calc(100% + 12px); left: 2px; white-space: nowrap; }
.cf-chip { height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 14px; font-size: 13.5px; font-weight: 500; color: var(--cf-text); white-space: nowrap; }
.cf-chip::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cf-marker); }
.cf4__join { align-self: stretch; position: relative; }
.cf4__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cf4__lines path { fill: none; stroke: var(--cf-line); stroke-width: 1.5; }
.cf4__lines--m { display: none; }
.cf4__tool { margin: 0 0 0 -2px; }
.cf4__out { position: relative; margin-left: 40px; }
.cf4__out::before { content: ""; position: absolute; right: 100%; top: 50%; width: 40px; height: 1.5px; background: var(--cf-line); }
.cf4__out::after { content: ""; position: absolute; left: -9px; top: 50%; width: 7px; height: 7px; border: solid var(--cf-marker); border-width: 1.5px 1.5px 0 0; transform: translate(0, -50%) rotate(45deg); }
.cf4__alt {
  grid-column: 1 / -1; justify-self: start; margin-top: 40px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; line-height: 1.45; color: var(--cf-quiet);
}
.cf4__alt::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--cf-terra); }

@container (max-width: 699px) {
  .cf4 { grid-template-columns: 1fr; max-width: 440px; }
  .cf4__units { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 28px; }
  .cf4__units .cf__k { bottom: auto; top: 0; }
  .cf-chip { height: auto; min-height: 44px; padding: 10px 8px; flex-direction: column; justify-content: center; gap: 7px; white-space: normal; text-align: center; font-size: 12.5px; line-height: 1.2; }
  .cf4__join { height: 44px; }
  .cf4__lines--d { display: none; }
  .cf4__lines--m { display: block; }
  .cf4__tool { margin: 0 12px; }
  .cf4__out { margin: 40px 0 0; justify-self: center; min-width: 60%; text-align: center; }
  .cf4__out::before { right: auto; left: 50%; top: auto; bottom: 100%; width: 1.5px; height: 40px; }
  .cf4__out::after { left: 50%; top: -9px; transform: translate(-50%, 0) rotate(135deg); }
  .cf4__alt { margin-top: 28px; }
}

/* ---------- the demo: route each request ---------- */
.cfd.case-mock { max-width: 820px; }
.cfd .onevoice.cfd__g { background: var(--cf-ground); border: 0; border-radius: 12px; padding: clamp(20px, 5vw, 44px); container-type: inline-size; }
.cfd p { margin: 0; }
.cfd__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.cfd__lead { font-size: 14px; line-height: 1.45; font-weight: 500; color: var(--cf-quiet); }
.cfd__reset {
  flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; cursor: pointer;
  font: 500 13.5px/1 var(--font, Inter, system-ui, sans-serif); color: var(--cf-text);
  background: color-mix(in srgb, var(--cf-card) 55%, transparent); transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.cfd__reset:hover { background: var(--cf-card); box-shadow: var(--cf-rest); }

.cfd__stage { display: grid; }
.cfd__meter {
  position: relative; z-index: 2; justify-self: end; width: min(340px, 62%);
  margin-bottom: -40px; padding: 18px 20px 20px; background: var(--cf-card); border-radius: 16px;
  box-shadow: 0 0 0 1px var(--cf-rule), var(--cf-lift);
}
.cfd__read { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cfd__label { font-size: 13px; font-weight: 500; color: var(--cf-quiet); }
.cfd__state { font-size: 22px; line-height: 1; font-weight: 600; letter-spacing: -0.01em; color: var(--cf-green); transition: color .35s ease; }
.cfd__g.is-build .cfd__state { color: #9C7A2A; }
.cfd__g.is-bloated .cfd__state { color: var(--cf-terra); }
.cfd__track {
  display: block; height: 18px; background: var(--cf-soft); border-radius: 4px; overflow: hidden;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 9px);
          mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 9px);
}
.cfd__track i { display: block; height: 100%; background: var(--cf-green); transition: width .35s ease, background .35s ease; }
.cfd__g.is-build .cfd__track i { background: var(--cf-amber); }
.cfd__g.is-bloated .cfd__track i { background: var(--cf-terra); }

.cfd__queue {
  margin-right: 28px; padding: 44px 0 6px; background: var(--cf-card); border-radius: 12px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cf-rule) 55%, transparent), var(--cf-rest);
}
.cfd__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 118px; align-items: center; gap: 14px;
  padding: 14px 18px;
}
.cfd__row + .cfd__row { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--cf-rule) 45%, transparent); }
.cfd__name { font-size: 14.5px; line-height: 1.3; font-weight: 500; color: var(--cf-text); }
.cfd__seg { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--cf-soft); border-radius: 11px; }
.cfd__opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 12px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer; white-space: nowrap;
  font: 500 13px/1 var(--font, Inter, system-ui, sans-serif); color: #6b665e;
  transition: background var(--t-brisk) ease, box-shadow var(--t-brisk) ease, color var(--t-brisk) ease, transform var(--t-brisk) ease;
}
.cfd__opt:hover { color: var(--cf-text); }
.cfd__opt:focus-visible, .cfd__reset:focus-visible { outline: 2px solid var(--cf-ink); outline-offset: 2px; }
.cfd__opt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity var(--t-brisk) ease; }
.cfd__opt.is-on { background: var(--cf-card); color: var(--cf-text); transform: translateY(-1px); box-shadow: 0 0 0 1px var(--cf-rule), var(--cf-lift); }
.cfd__opt--shared.is-on::before { opacity: 1; background: var(--cf-green); }
.cfd__opt--bespoke.is-on::before { opacity: 1; background: var(--cf-terra); }
.cfd .bu__verdict { white-space: nowrap; font-family: var(--cf-mono); font-size: 12px; line-height: 1.3; min-width: 0; text-align: right; color: var(--cf-quiet); }
.cfd .bu__verdict.is-shared { color: var(--cf-green); }
.cfd .bu__verdict.is-bespoke { color: var(--cf-terra); }
.cfd .cfd__note { font-size: 13.5px; line-height: 1.55; color: var(--cf-quiet); margin-top: 22px; max-width: 60ch; }

@container (max-width: 619px) {
  .cfd__top { align-items: flex-start; }
  .cfd__meter { width: auto; margin: 0 -2px -28px 16px; padding: 16px 16px 18px; justify-self: stretch; }
  .cfd__queue { margin-right: 14px; padding-top: 30px; }
  .cfd__row { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 10px; padding: 14px 16px; }
  .cfd .bu__verdict { text-align: left; }
  .cfd .bu__verdict:empty { display: none; }
  .cfd__name { font-size: 14px; }
  .cfd__seg { max-width: 420px; }
  .cfd__opt { min-height: 40px; padding: 0 8px; font-size: 13px; }
}
@media (pointer: coarse) { .cfd__opt, .cfd__reset { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) {
  .cfd__opt, .cfd__track i, .cfd__state, .cfd__reset { transition: none; }
  .cfd__opt.is-on { transform: none; }
}
