/* /consulting/ — the full case-study page. Builds on ../styles.css tokens and classes;
   diagram.css styles the diagrams, chips, drawers and explainers. Generated markup: scripts/consulting/build.js */

.cpage { font-size: 16px; }
.cwrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); container-type: inline-size; }

/* ---------- nav ---------- */
.cnav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--pad);
  background: rgba(10, 12, 20, 0.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.cnav .nav-mark { white-space: nowrap; flex-shrink: 0; }
.cnav-links { display: flex; gap: clamp(10px, 2.4vw, 26px); font-family: var(--font-mono); font-size: 12px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.cnav-links::-webkit-scrollbar { display: none; }
.cnav-links a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.cnav-links a:hover { color: var(--text); }

/* ---------- hero ---------- */
.chero { padding: clamp(40px, 8vh, 92px) 0 clamp(28px, 5vh, 56px); border-bottom: 1px solid var(--line-soft); }
.chero-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(30px, 5.6vw, 58px); line-height: 1.04; letter-spacing: -0.015em;
  max-width: 20ch; text-wrap: balance; margin: 10px 0 22px;
}
.chero-lede { font-size: clamp(16px, 1.3vw, 18px); color: var(--muted); max-width: 72ch; text-wrap: pretty; }
.chero-lede, .chero .detail-kicker { margin-bottom: 0; }
.facts { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 28px; margin-top: 36px; border-top: 1px solid var(--line-soft); padding-top: 22px; }
.facts li { font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.facts b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; color: var(--text); margin-bottom: 8px; }
.facts em { font-style: normal; font-weight: 500; }
.kq-t { color: var(--live); } .km-t { color: var(--skill); } .kv-t { color: var(--project); }

/* ---------- summary + index ---------- */
.csum { padding-top: clamp(36px, 6vh, 64px); }
.csum-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.csum h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 2.2vw, 26px); letter-spacing: -0.01em; margin: 8px 0 14px; }
.csum p { font-size: 15.5px; color: var(--muted); text-wrap: pretty; margin-bottom: 12px; }
.csum p b { color: var(--text); font-weight: 500; }
.howread { list-style: none; display: grid; gap: 8px; margin-top: 16px; }
.howread li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--muted); }
.howread i { flex-shrink: 0; display: inline-block; width: 14px; height: 14px; margin-top: 4px; border-radius: 2px; border: 1.5px solid var(--line); background: #161B2B; }
.howread .hw-hex { border-color: var(--k-fast); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: rgba(111, 211, 230, 0.25); }
.howread .hw-llm { border-color: var(--skill); border-style: dashed; background: rgba(242, 185, 99, 0.12); }
.howread .hw-blk { border-color: hsl(232 70% 72% / 0.8); border-style: dashed; background: hsl(232 70% 70% / 0.14); }
.howread .hw-box { }
.index { list-style: none; counter-reset: idx; border-top: 1px solid var(--line-soft); }
.index li { counter-increment: idx; border-bottom: 1px solid var(--line-soft); }
.index a { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; padding: 12px 4px; text-decoration: none; color: inherit; transition: background 0.2s; }
.index a:hover { background: var(--surface); }
.index a::before { content: counter(idx, decimal-leading-zero); font-family: var(--font-mono); font-size: 12px; color: var(--skill); padding-top: 3px; grid-row: span 2; }
.index b { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text); }
.index span { grid-column: 2; font-size: 13px; color: var(--dim); text-wrap: pretty; }

/* ---------- sections ---------- */
.csec { padding: clamp(48px, 8vh, 96px) 0 0; scroll-margin-top: 56px; }
.csec > h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(21px, 2.6vw, 30px); line-height: 1.22; letter-spacing: -0.01em;
  max-width: 34ch; text-wrap: balance; margin: 10px 0 26px;
}
.subh { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 40px 0 12px; letter-spacing: -0.005em; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.twocol-wide { gap: 40px; align-items: start; }
.threecol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.card { border: 1px solid var(--line-soft); border-radius: 4px; background: var(--surface); padding: 20px 22px; }
.card h3 { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--skill); margin-bottom: 12px; }
.card p { font-size: 14.5px; color: var(--muted); text-wrap: pretty; }
.case-list { list-style: none; display: grid; gap: 10px; }
.case-list li { font-size: 14.5px; color: var(--muted); padding-left: 14px; position: relative; text-wrap: pretty; }
.case-list li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 5px; height: 5px; border-radius: 50%; background: var(--project); }
.case-list b { color: var(--text); font-weight: 500; }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.backrow { margin: 28px 0 56px; }
.cpage .footer { margin-top: 48px; }

/* tables */
.tscroll { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line-soft); border-radius: 4px; scrollbar-width: thin; }
.tscroll table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tscroll th, .tscroll td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.tscroll th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 500; background: var(--ink-2); position: sticky; top: 0; }
.tscroll tr:last-child td { border-bottom: none; }
.decisions td { color: var(--muted); }
.decisions .dec-topic { color: var(--text); font-weight: 500; white-space: nowrap; }
.decisions td:last-child { font-size: 12.5px; min-width: 16ch; }

/* ---------- pattern + System One ---------- */
.hexword { color: var(--k-fast); } .llmword { color: var(--skill); }
.s1 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin: 18px 0; }
.s1-card { border: 1px solid var(--line-soft); border-top: 2px solid var(--k-fast); border-radius: 4px; padding: 20px 22px; background: var(--surface); }
.s1-card h4 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 6px 0 10px; }
.s1-card > p { font-size: 14px; color: var(--muted); text-wrap: pretty; margin-bottom: 12px; }
.s1-card .eyebrow-sm { margin: 0; }
.claims { width: 100%; border-collapse: collapse; font-size: 13px; }
.claims th { text-align: left; font-weight: 500; color: var(--text); padding: 7px 10px 7px 0; width: 32%; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.claims td { color: var(--muted); padding: 7px 0; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.claims tr:last-child th, .claims tr:last-child td { border-bottom: none; }
.vfit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.vfit div { border-left: 2px solid var(--line); padding-left: 14px; }
.vfit div:first-child { border-color: var(--k-fast); } .vfit div:nth-child(2) { border-color: var(--skill); }
.vfit small, .vnote small, .rkd small { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.vfit p { font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.vnote { font-size: 13.5px; color: var(--muted); text-wrap: pretty; margin-bottom: 10px; }

/* ---------- flows ---------- */
.flowh { font-family: var(--font-display); font-weight: 700; font-size: clamp(18px, 2vw, 22px); margin: 44px 0 10px; display: flex; align-items: center; gap: 12px; scroll-margin-top: 64px; }
.flowletter { font-family: var(--font-mono); font-size: 13px; color: var(--ink); background: var(--skill); border-radius: 3px; padding: 2px 8px; }
.flowintro { max-width: 76ch; }
.flowblock { margin-bottom: 10px; }
.flowcap { font-size: 13.5px; color: var(--dim); margin: 10px 0 16px; max-width: 80ch; text-wrap: pretty; }

/* ---------- priorities ---------- */
.weights { display: flex; width: 100%; gap: 3px; margin: 10px 0 20px; }
.weights .w { display: block; flex: var(--w) 1 0; min-width: 0; font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.weights .wbar { display: block; height: 6px; border-radius: 2px; background: var(--project); opacity: 0.9; margin-bottom: 6px; }
.weights .w:nth-child(2) .wbar { opacity: 0.7; } .weights .w:nth-child(3) .wbar { opacity: 0.55; } .weights .w:nth-child(4) .wbar { opacity: 0.42; } .weights .w:nth-child(5) .wbar { opacity: 0.3; }
.weights .w b { display: block; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weights .w em { font-style: normal; }
.top5 { list-style: none; display: grid; gap: 12px; }
.pick { display: grid; grid-template-columns: 44px 1fr; gap: 14px; border: 1px solid var(--line-soft); border-radius: 4px; background: var(--surface); padding: 16px 18px 16px 14px; }
.pick .rank { font-family: var(--font-display); font-weight: 800; font-size: 30px; color: var(--skill); line-height: 1; }
.pick-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.pick-head h4 { font-family: var(--font-display); font-weight: 700; font-size: 17px; flex: 1 1 auto; }
.pick .score { font-family: var(--font-mono); font-size: 13px; color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; }
.pick-why { font-size: 14px; color: var(--muted); text-wrap: pretty; margin-bottom: 12px; }
.crit { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.crit small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crit .bar { height: 5px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.crit .bar i { display: block; height: 100%; background: var(--project); }
.crit .mono { color: var(--dim); font-size: 11px; }
.pick-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--dim); margin-top: 10px; }
.quadfig { margin: 0 0 10px; }
.quad { width: 100%; height: auto; display: block; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: 4px; font-family: var(--font-mono); }
.q-frame { fill: transparent; stroke: var(--line); }
.q-mid { stroke: var(--line-soft); stroke-dasharray: 4 4; }
.q-zone { fill: var(--dim); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.q-tick { fill: var(--dim); font-size: 11px; }
.q-axis { fill: var(--muted); font-size: 12px; }
.q-pt circle { fill: rgba(143, 160, 255, 0.35); stroke: var(--project); stroke-width: 1; }
.q-pt.is-top circle { fill: var(--skill); stroke: var(--skill); }
.q-pt text { fill: var(--ink); font-size: 11px; font-weight: 700; pointer-events: none; }
.q-pt:hover circle { fill: var(--project); }
.quadfig figcaption { font-size: 12.5px; color: var(--dim); margin-top: 8px; text-wrap: pretty; }
.start-list { list-style: none; counter-reset: s; display: grid; gap: 8px; }
.start-list li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 4px 10px; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.start-list li::before { content: counter(s); font-family: var(--font-mono); font-size: 12px; color: var(--skill); grid-row: span 2; padding-top: 2px; }
.start-list b { color: var(--text); font-weight: 500; }
.start-list b .xl { color: var(--text); border-bottom-color: rgba(143, 160, 255, 0.5); }
.start-list b .xl:hover { color: var(--project); }
.start-list span { color: var(--dim); font-size: 13px; grid-column: 2; }
.ranked th, .ranked td { white-space: nowrap; }
.ranked td:nth-child(2), .ranked th:nth-child(2) { white-space: normal; min-width: 22ch; }
.ranked td.rk-blk { white-space: normal; min-width: 20ch; font-size: 12.5px; }
.ranked .is-top td { background: rgba(242, 185, 99, 0.05); }
.ranked .score-cell { color: var(--text); }
.ranked tr.rk { scroll-margin-top: 120px; transition: background 0.4s; }
.ranked tr.is-flash td { background: rgba(143, 160, 255, 0.18); }
.rk-btn { font: inherit; color: var(--text); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; text-decoration: underline dotted rgba(154, 163, 184, 0.6); text-underline-offset: 3px; }
.rk-btn:hover { text-decoration-color: var(--project); }
.rk-btn[aria-expanded="true"] { color: var(--project); }
.uc-voice { margin: 0 0 12px; padding: 2px 0 2px 12px; border-left: 2px solid var(--project); font-size: 14px; line-height: 1.55; color: var(--text); text-wrap: pretty; max-width: 72ch; }
.uc-voice small { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; font-style: normal; }
.rkd .uc-voice { grid-column: 1 / -1; margin-bottom: 2px; }
.rk-detail td { background: var(--ink-2); white-space: normal; }
.rkd { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; padding: 6px 0 4px; }
.rkd > * { min-width: 0; }
.rkd p { font-size: 13.5px; color: var(--muted); text-wrap: pretty; max-width: 70ch; }
.stars { font-family: var(--font-mono); color: var(--k-fast); letter-spacing: 0.1em; }
.stars-off { color: var(--line); }
.stars-none { color: var(--dim); }

/* ---------- data & access ---------- */
.mxctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 12px; font-size: 12.5px; }
.mx-counts { font-family: var(--font-mono); font-size: 12px; color: var(--dim); margin-left: 6px; }
.btn-sm { font-size: 11.5px; padding: 5px 12px; margin-left: auto; cursor: pointer; border: 0; }
.rdy { display: inline-block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.rdy-go { color: var(--live); border-color: rgba(110, 231, 160, 0.5); background: rgba(110, 231, 160, 0.08); }
.rdy-open { color: var(--skill); border-color: rgba(242, 185, 99, 0.45); }
.rdy-blocked { color: #F49B9B; border-color: rgba(244, 155, 155, 0.5); background: rgba(244, 155, 155, 0.08); }
.matrix th, .matrix td { padding: 6px 6px; text-align: center; }
.matrix th.mx-src { vertical-align: bottom; padding: 0 2px 6px; height: 128px; }
.matrix .mx-flow { text-align: center; width: 36px; }
.matrix .mx-block { text-align: left; white-space: nowrap; min-width: 22ch; font-size: 13px; color: var(--text); }
.matrix .mx-block .xl { color: var(--text); }
.matrix .mx-block .xl:hover { color: var(--project); }
.matrix .mx-st { text-align: left; white-space: nowrap; }
.src-btn { font: inherit; background: none; border: 0; color: var(--dim); cursor: pointer; width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.src-btn span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; line-height: 1; padding: 6px 4px; border-radius: 3px; border: 1px solid transparent; }
.src-btn:hover span { color: var(--text); border-color: var(--line); }
.src-btn[data-state="ready"] span { color: var(--live); border-color: rgba(110, 231, 160, 0.6); background: rgba(110, 231, 160, 0.1); }
.src-btn[data-state="not"] span { color: #F49B9B; border-color: rgba(244, 155, 155, 0.6); background: rgba(244, 155, 155, 0.08); text-decoration: line-through; }
.mx-cell i { font-style: normal; color: var(--project); font-size: 12px; }
.mx-cell.on[data-state="ready"] i { color: var(--live); }
.mx-cell.on[data-state="not"] i { color: #F49B9B; }
.mx-cell.on { background: rgba(143, 160, 255, 0.05); }
tr.is-go .mx-block, tr.is-go .mx-block .xl { color: var(--live); }
tr.is-blocked .mx-block, tr.is-blocked .mx-block .xl { color: #F49B9B; }
.access td { color: var(--muted); font-size: 13px; min-width: 18ch; }
.access .acc-src { color: var(--text); font-weight: 500; white-space: nowrap; }
.access .acc-confirm { color: var(--skill); }
.qlist { padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.qlist li::marker { font-family: var(--font-mono); color: var(--skill); }
.morerows { margin: 16px 0 10px; border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 16px; }
.morerows summary { cursor: pointer; font-family: var(--font-mono); font-size: 13px; color: var(--project); padding: 12px 0; list-style: none; }
.morerows summary::-webkit-details-marker { display: none; }
.morerows summary::before { content: "+"; display: inline-block; width: 16px; }
.morerows[open] summary::before { content: "−"; }
.morerows > :not(summary) { margin-top: 6px; }
.morerows > .tscroll:last-child, .morerows > .qlist:last-child { margin-bottom: 16px; }

/* ---------- roadmap ---------- */
.phaseboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.ph { border: 1px solid var(--line-soft); border-radius: 4px; background: var(--surface); padding: 18px 18px 16px; display: flex; flex-direction: column; }
.phh { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 12px; }
.phh b { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.phh span { font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.ph ul { list-style: none; display: grid; gap: 6px; margin-bottom: 14px; }
.ph li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text); padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.ph li .mono { margin-right: 4px; }
.ph li .xl { color: var(--text); }
.ph li .xl:hover { color: var(--project); }
.ph p { font-size: 13.5px; color: var(--muted); text-wrap: pretty; margin-top: auto; }

/* ---------- departments ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line-soft); margin: 10px 0 26px; }
.tabs [role="tab"] { font-family: var(--font-mono); font-size: 13px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; margin-bottom: -1px; cursor: pointer; }
.tabs [role="tab"] small { color: var(--dim); font-size: 11px; margin-left: 4px; }
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--skill); }
.pane { outline: none; }
.pane .flowh { margin-top: 30px; }
.planes { margin: 6px 0 10px; }
.chips-plain li { color: var(--muted); border-color: var(--line); }
.prio2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.notes { margin-top: 20px; }
.feats-1 { grid-template-columns: 1fr; }

/* ---------- "back to where you were" after a cross-link jump ---------- */
.backjump { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(0); z-index: 30; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); background: var(--project); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; box-shadow: 0 10px 30px rgba(10, 12, 20, 0.6); transition: transform 0.3s var(--ease-out), opacity 0.3s; }
.backjump[hidden] { display: none; }
.backjump:hover { background: #A7B4FF; }

/* grid/flex children must be allowed to shrink below their min-content width (phones) */
:where(.twocol, .twocol-wide, .prio2, .s1, .threecol, .phaseboard, .vfit, .facts, .rkd, .crit, .pick, .pick-head, .weights, .phh, .dctl, .flowblock, .csec, .cwrap, .csum-grid) > * { min-width: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .twocol, .twocol-wide, .s1, .prio2, .rkd, .csum-grid { grid-template-columns: 1fr; }
  .threecol, .vfit, .phaseboard { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cnav { padding: 10px var(--pad); }
  .facts { grid-template-columns: 1fr 1fr; gap: 16px; }
  .facts b { font-size: 32px; }
  .crit { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .crit small { font-size: 9px; }
  .pick { grid-template-columns: 32px 1fr; padding: 14px; }
  .pick .rank { font-size: 24px; }
}
@media (max-width: 400px) {
  .facts { grid-template-columns: 1fr; }
  .weights .w { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .cpage *, .cpage *::before, .cpage *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
