/* /companies. Sits on top of /home/home.css and only adds what this page needs: the one order figure, the first map,
   and a few fixes to shared colours.

   home.css is shared with the front door and this page may not change it, so the contrast fixes live here. The dimmed
   steps, --ink-3 and white on orange all fall under the design board's contrast line.
   Orange means a leak and indigo means time that came back, as on the front door. */

:root { --ink-3: #666D90; }
.js .step:not(.is-on) h2 { color: #858BA9; }
.js .step:not(.is-on) p, .js .step:not(.is-on) .causes { color: #6A7194; }
.tag { color: var(--night); }

.step p, .sec-lead, .row-note, .prog, .lead, .first-steps p, .consult-copy p { text-wrap: pretty; }

.nb { white-space: nowrap; }

/* The headline holds two lines. "Days of waiting." is about 7.6em wide and the text column stops growing at the
   site's maximum width, so the type is sized to that line, not to the screen. */
.hero h1 { font-size: min(5.3vw, 4.15rem); }
/* The drop stays clear of the lead below it. */
.hero h1 .drop { font-size: 0.75em; }
.hero .lead { margin-top: 32px; }

/* ---------- The one order ----------
   One row per step. A bar sits on a 32-hour axis, four working days. --x is where it starts and --w how long it runs,
   both in hours, and companies.js moves them. Rows carry the labels, so every step stays readable on a phone. */
.proc { --name: minmax(0, 10.75rem); display: grid; gap: 10px; }
/* The HTML holds the finished picture. Until the script has wound it back, it stays hidden and nothing slides. */
.js .panel:not(.is-ready) .proc { visibility: hidden; }
.js .panel:not(.is-ready) .p-bar, .js .panel:not(.is-ready) .p-tg { transition: none; }

.p-axis, .p-row, .p-total { display: grid; grid-template-columns: var(--name) minmax(0, 1fr); column-gap: 12px; align-items: center; }
.p-days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-days span { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); line-height: 1; }
.p-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }

.p-name { display: grid; gap: 1px; min-width: 0; }
.p-who { font-size: 0.6875rem; line-height: 1.2; color: var(--ink-3); }
.p-what { font-size: 0.8125rem; font-weight: 700; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.45s; }
.p-row.is-closed .p-what { color: var(--primary-deep); }

.p-track {
  position: relative; height: 26px; border-radius: 5px;
  background: repeating-linear-gradient(to right, var(--grid) 0 1px, transparent 1px 25%);
}
.p-bar {
  position: absolute; inset-block: 3px;
  left: calc(var(--x) * 100% / 32); width: calc(var(--w) * 100% / 32);
  min-width: 3px; border-radius: 3px; background: #CBD3FA;
  transition: left 0.95s var(--ease), width 0.95s var(--ease), background-color 0.5s, opacity 0.4s;
}
/* The page opens on the leak, so the cost is the first thing anyone sees. Then the step that names the three hours of
   work picks those two bars out of the orange. */
.p-row[data-kind="leak"] .p-bar { background: var(--lift); }
.panel[data-step="1"] .p-row[data-kind="work"] .p-bar { background: var(--ink-2); }
.p-row.is-closed .p-bar { opacity: 0; }

/* Traced: each leak gets its cause, the same letters as the list in the step. */
.p-tg {
  position: absolute; top: 50%; left: calc((var(--x) + var(--w)) * 100% / 32); margin-left: 4px;
  width: 15px; height: 15px; border-radius: 4px; display: grid; place-items: center;
  font: 700 0.625rem/1 var(--mono); background: var(--lift); color: var(--night);
  transform: translateY(-50%) scale(0); transition: transform 0.4s var(--ease), left 0.95s var(--ease);
}
.panel[data-step="2"] .p-tg { transform: translateY(-50%) scale(1); }

.p-total { padding-top: 10px; border-top: 1px solid var(--rule); }
.p-total .p-name { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 8px; }
.p-num { font-size: 0.8125rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.p-sum { background: var(--ink-2); }
.p-back { background: var(--primary); }

/* The aside inside step 3. */
.step-aside { font-size: var(--t-small); }
.step-aside a { font-weight: 700; }

/* ---------- Results: two cards, one for each side of the work ---------- */
.proof { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2vw, 24px); }
.proof-card { display: grid; gap: 22px; align-content: start; padding: clamp(24px, 3vw, 38px); background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-float); }
.pf { display: grid; gap: 14px; }
.pf-k { font-size: 0.9375rem; font-weight: 700; color: var(--ink); }
.pf-k .when { margin-left: 8px; font-size: 0.75rem; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.pf-fig { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px clamp(14px, 1.8vw, 26px); }
.pf-fig .val { font-size: clamp(2rem, 1.15rem + 2.1vw, 3rem); }
.pf-fig .arrow { display: block; padding: 0.3em 0 0; font-size: 1.4rem; }
.pf-fig .unit { margin-top: 8px; }
.js .pf:not(.is-cut) .before .val::after { transform: scaleX(0); }
.pf-note { color: var(--ink-2); }
.pf-more { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--rule); }
.pf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pf-list li { position: relative; padding-left: 18px; color: var(--ink-2); text-wrap: pretty; }
.pf-list li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.pf-text { color: var(--ink-2); text-wrap: pretty; }
.pf-tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pf-tools li { padding: 0.4em 0.85em; border-radius: 999px; font-size: 0.875rem; font-weight: 600; color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule); }

/* ---------- The first conversation ---------- */
.first { padding-top: 0; }
.first-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
.first-copy .sec-head { margin-bottom: 30px; }
.first-steps { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 20px; counter-reset: first; }
.first-steps li { position: relative; display: grid; gap: 4px; padding-left: 44px; counter-increment: first; }
.first-steps li::before {
  content: counter(first); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 700 0.8125rem/1 var(--mono); color: var(--primary-deep); background: var(--primary-tint);
}
.first-steps h3 { font-size: 1.25rem; line-height: 1.5rem; }
.first-steps p { color: var(--ink-2); }
.first-copy .cta-row { margin-top: 22px; }

.map-card { margin: 0; padding: clamp(22px, 2.6vw, 32px); display: grid; gap: 16px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-float); }
.map-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.map-ex { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.map-title { font-family: var(--serif); font-weight: 700; font-size: var(--t-h3); line-height: 1.1; letter-spacing: -0.018em; }
.map { list-style: none; margin: 0; padding: 0; display: grid; }
.map li {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: baseline;
  padding: 9px 0 9px 24px; font-size: 0.9375rem; font-weight: 600; color: var(--ink);
}
/* The rail: one line through the steps, a dot on each. */
.map li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--rule); }
.map li:first-child::before { top: 18px; }
.map li:last-child::before { bottom: calc(100% - 18px); }
.map li::after { content: ""; position: absolute; left: 1px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink-3); }
.map .is-leak { color: var(--lift-ink); }
.map .is-leak::after { background: var(--lift); box-shadow: none; }
.m-t { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.map-card figcaption { font-size: 0.75rem; color: var(--ink-3); }

/* ---------- Narrower screens ---------- */
@media (max-width: 900px) {
  /* One column. The card folds as the steps come up under it, the same way as the front door: --c runs from 0 (full)
     to 1 (folded) and follows the scroll, from companies.js. home.css folds the meters and the caption. The rows keep
     their labels when folded, because bars without names mean nothing.
     home.css puts a paper ground behind the card so text can pass under it. Here that ground only appears once the
     card starts to fold, so it does not show as a pale block behind the card at the top of the page. */
  .hero h1 { font-size: clamp(2.2rem, 11.2vw, 3.6rem); }
  .story-visual { padding-bottom: 10px; background: none; }
  .story-visual::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: calc(var(--c) * 4);
    background: linear-gradient(to bottom, var(--paper) 88%, rgba(246, 247, 252, 0));
  }
  .proc { gap: calc(6px - 2px * var(--c)); }
  .p-axis, .p-row, .p-total { grid-template-columns: 8.1rem minmax(0, 1fr); }
  .p-axis { height: calc(11px * (1 - var(--c))); overflow: hidden; opacity: calc(1 - var(--c) * 3); }
  .p-who { display: none; }
  .p-what, .p-num { font-size: 0.6875rem; line-height: calc(17px - 4px * var(--c)); }
  .p-rows { gap: calc(2px * (1 - var(--c))); }
  .p-track { height: calc(17px - 4px * var(--c)); }
  .p-bar { inset-block: 2px; }
  .p-days span { font-size: 0.5625rem; letter-spacing: 0.08em; }
  .p-tg { width: 12px; height: 12px; font-size: 0.5625rem; margin-left: 2px; }
  .p-total { padding-top: calc(6px - 2px * var(--c)); }
  .proof { grid-template-columns: minmax(0, 1fr); }
  .pf-fig { column-gap: 12px; }
  .pf-fig .val { font-size: clamp(1.5rem, 7vw, 2.4rem); }
  .pf-fig .arrow { display: block; }
  .first-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The smallest phones: the before and the after stack, so the card keeps its padding. */
@media (max-width: 360px) {
  .pf-fig { flex-direction: column; row-gap: 8px; }
  .pf-fig .arrow { display: none; }
  .pf-fig .val { font-size: 1.75rem; }
}

/* A phone on its side: even folded, the card would fill the screen, so it scrolls away with the page. */
@media (max-width: 900px) and (max-height: 480px) {
  .story-visual { position: static; }
}
