/* =========================================================================
   Enso Dynamics — the case study's charts and method diagram
   (/case-studies/enso-method-in-practice/). The page's sections, titles and
   opening band come from pages.css.

   Chart shades are the case study's own and stay as they are (site redesign
   AC-LOOK-01, AC-PAGE-03): code cobalt, tests light cobalt, docs warm,
   commits navy, the heatmap's six blues and the diagram's cobalt phases. The
   three bar colors were checked for colorblind separation, and the numbers
   table under the chart carries the values for anyone who can't separate
   them. Frames, axes and labels take the site palette.
   ========================================================================= */

/* ---------- The four headline figures, in the opening band ---------- */

.cs-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 40px clamp(24px, 3vw, 44px); margin: clamp(40px, 4.4vw, 64px) 0 0; }
.cs-metric { padding-top: 14px; border-top: 1px solid rgba(242, 237, 227, 0.45); }
.cs-metric dt { font-family: var(--serif); font-size: clamp(64px, 7vw, 104px); line-height: 0.9; letter-spacing: -0.03em; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ivory); }
.cs-metric dd { margin: 20px 0 0; font-size: 15px; line-height: 1.55; color: var(--ivory-cool); }
.cs-metric dd strong { display: block; margin-bottom: 6px; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ivory); }

/* ---------- Weekly lines of code: stacked bars over a separate commits panel ---------- */

.cs-card { padding: clamp(22px, 3vw, 36px); }
.cs-chart { margin: clamp(36px, 4vw, 52px) 0 0; }
.cs-chart-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 32px; margin-bottom: 36px; }
.cs-chart-title { font-size: clamp(26px, 2.2vw, 30px); line-height: 1.08; letter-spacing: -0.012em; }
.cs-chart-note { margin-top: 8px; max-width: 60ch; font-size: 14.5px; line-height: 1.55; color: var(--text-soft); }
.cs-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--text-body); }
.cs-legend li { display: inline-flex; align-items: center; gap: 8px; }
.cs-key { width: 12px; height: 12px; border-radius: 2px; }
.cs-key--code, .cs-seg--code { background: #2E6FB5; }
.cs-key--tests, .cs-seg--tests { background: #5FA0DE; }
.cs-key--docs, .cs-seg--docs { background: #D9783D; }
.cs-key--commits { width: 14px; height: 2px; border-radius: 0; background: var(--navy); }
.cs-plot-row { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); }
.cs-plot-row + .cs-plot-row { margin-top: 2.5rem; }
.cs-plot-row + .cs-plot-row-weeks { margin-top: 0; }
.cs-axis { position: relative; font-size: 12.5px; color: var(--text-soft); }
.cs-axis span { position: absolute; right: 0.6rem; transform: translateY(50%); }
.cs-plot { position: relative; height: 260px; border-bottom: 1px solid rgba(20, 23, 28, 0.4); }
.cs-plot--commits { height: 110px; }
.cs-gridline { position: absolute; left: 0; right: 0; height: 1px; background: rgba(20, 23, 28, 0.1); }
.cs-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cs-bar-col, .cs-commit-col { position: relative; }
.cs-bar { position: absolute; inset: 0 24%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.cs-bar-total, .cs-dot-label { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.cs-bar-total { margin-bottom: 4px; text-align: center; }
.cs-seg { display: block; }
.cs-seg--docs { border-radius: 2px 2px 0 0; }
.cs-commit-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cs-dot { position: absolute; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); box-shadow: 0 0 0 2px var(--white); transform: translate(-50%, 50%); }
.cs-dot-label { position: absolute; left: 50%; transform: translate(-50%, -10px); }
.cs-weeks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; text-align: center; font-size: 13px; color: var(--text-soft); }
.cs-numbers { margin-top: 24px; border-top: 1px solid rgba(20, 23, 28, 0.12); }
.cs-numbers summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--text); }
.cs-table-wrap { overflow-x: auto; }
.cs-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.cs-table th, .cs-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid rgba(20, 23, 28, 0.1); }
.cs-table th { font-weight: 600; color: var(--text); border-bottom-color: rgba(20, 23, 28, 0.3); }
.cs-table th:first-child, .cs-table td:first-child { text-align: left; }
.cs-table tbody tr:last-child td { font-weight: 600; color: var(--text); }

/* ---------- Agents working in parallel: figures beside a one week heatmap ---------- */

.cs-agents { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px clamp(36px, 5vw, 72px); align-items: start; margin-top: clamp(56px, 6vw, 84px); }
.cs-agents-title { font-size: clamp(30px, 3vw, 40px); line-height: 1.04; letter-spacing: -0.018em; }
.cs-agents-text { margin-top: 16px; max-width: 46ch; font-size: 16.5px; line-height: 1.65; }
.cs-stats { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 20px; margin: 32px 0 0; }
.cs-stats dt, .cs-stats dd { padding: 14px 0; border-top: 1px solid var(--rule); }
.cs-stats dt:last-of-type, .cs-stats dd:last-of-type { border-bottom: 1px solid var(--rule); }
.cs-stats dt { font-family: var(--serif); font-size: 44px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.cs-stats dd { display: flex; align-items: center; margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--text-body); }
.cs-heat-card { margin: 0; }
.cs-heat-caption { margin-bottom: 18px; font-size: 14.5px; line-height: 1.55; color: var(--text-soft); }
.cs-heat-caption strong { font-weight: 600; color: var(--text); }
.cs-heat-scroll { overflow-x: auto; }
.cs-heat { min-width: 380px; }
.cs-heat-row, .cs-heat-hours { display: grid; grid-template-columns: 2.5rem repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; margin-bottom: 2px; }
.cs-heat-hours { grid-template-columns: 2.5rem repeat(4, minmax(0, 1fr)); margin-top: 6px; font-size: 12.5px; color: var(--text-soft); }
.cs-heat-day { font-size: 12.5px; color: var(--text-soft); }
.cs-heat-cell { aspect-ratio: 1; border-radius: 2px; }
.cs-heat-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; font-size: 12.5px; color: var(--text-soft); }
.cs-heat-legend .cs-heat-cell { width: 14px; height: 14px; margin-left: 6px; }
.cs-heat-cell.l0 { background: #ECEEF1; }
.cs-heat-cell.l1 { background: #D3E3F4; }
.cs-heat-cell.l2 { background: #A7C8EC; }
.cs-heat-cell.l3 { background: #6FA0D8; }
.cs-heat-cell.l4 { background: #2E6FB5; }
.cs-heat-cell.l5 { background: #14365E; }

/* ---------- The method diagram: decide first, then each project's phases built by agents
   (dependent phases in order, independent ones side by side), each proven. It sits on a cream
   card so it reads the same inside a dark section. Lane and proof rows share fixed heights so
   they line up across columns. ---------- */

.cs-flow { margin: clamp(36px, 4vw, 52px) 0 0; padding: clamp(22px, 3.4vw, 40px); color: var(--text-body); }
.cs-flow-scroll { overflow-x: auto; }
.cs-flow-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 5.6fr) minmax(0, 1.5fr); row-gap: 28px; min-width: 860px; }
.cs-flow-head { padding: 0 28px; border-left: 1px solid rgba(20, 23, 28, 0.14); }
.cs-flow-head:first-child { padding-left: 0; border-left: 0; }
.cs-flow-step { font-family: var(--serif); font-size: 28px; line-height: 1.05; letter-spacing: -0.012em; color: var(--text); }
.cs-flow-sub { margin-top: 8px; font-size: 15px; line-height: 1.5; }
.cs-plan { display: flex; align-items: center; }
.cs-plan-docs { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.cs-plan-doc { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--white); border: 1px solid rgba(20, 23, 28, 0.16); border-radius: 2px; font-size: 14.5px; font-weight: 500; line-height: 1.3; color: var(--text); }
.cs-plan-doc svg { flex: none; width: 18px; height: 18px; color: var(--ink-body); }
.cs-wire { height: 2px; background: rgba(20, 23, 28, 0.4); }
.cs-plan .cs-wire { flex: none; width: 28px; }
.cs-lanes { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.cs-lanes::before { content: ""; position: absolute; left: 0; top: 28px; bottom: 28px; width: 2px; background: rgba(20, 23, 28, 0.4); }
.cs-lane { display: grid; grid-template-columns: 22px 88px minmax(0, 1fr) 22px; align-items: center; height: 48px; }
.cs-lane--fork { height: 76px; }
.cs-lane-name { padding-left: 6px; font-size: 13px; font-weight: 500; }
.cs-phases { display: flex; align-items: center; min-width: 0; }
.cs-phases svg { flex: none; color: rgba(20, 23, 28, 0.4); }
.cs-phase { flex: 1; display: flex; align-items: center; min-width: 0; height: 34px; padding-left: 10px; border-radius: 2px; background: #2E6FB5; color: #FFFFFF; font-size: 13px; font-weight: 500; white-space: nowrap; }
.cs-phase-pair { flex: 1.3; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cs-phase-pair .cs-phase { flex: none; height: 30px; }
.cs-lanes-note { margin-top: 14px; padding-left: 116px; font-size: 13px; line-height: 1.5; color: var(--text-soft); }
.cs-proofs { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.cs-proof { display: flex; align-items: center; gap: 10px; height: 48px; padding-left: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.cs-proof--fork { height: 76px; }
.cs-proof svg { flex: none; color: var(--gold-line); }
.cs-statement { margin-top: clamp(36px, 4vw, 52px); max-width: 30ch; font-family: var(--serif); font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -0.016em; color: var(--text); text-wrap: balance; }

@media (max-width: 960px) {
  .cs-agents { grid-template-columns: minmax(0, 1fr); }
}
