/* ==========================================================================
   Field service capacity analyzer

   Brand tokens below are extracted from website/styles.css (the literal hex
   values used sitewide), the root stylesheet declares no custom properties.
   If a sitewide token layer lands, delete this :root block and point at it.
   ========================================================================== */

:root {
  --cap-ink:        #1a2b3c;  /* body text / headings */
  --cap-ink-muted:  #5a6670;  /* secondary text, 5.3:1 on white */
  --cap-ink-faint:  #8a9bab;
  --cap-accent:     #00b7e5;  /* brand accent, 2.4:1 on white: never body text */
  --cap-accent-dk:  #0092b8;  /* 3.6:1, large text and UI only */
  --cap-link:       #007a99;  /* 5.0:1, the only accent safe for body copy */
  --cap-cta:        #7ed321;  /* primary CTA */
  --cap-cta-dk:     #6cba1a;
  --cap-line:       #e0e4ea;
  --cap-line-soft:  #e8eaed;
  --cap-surface:    #ffffff;
  --cap-surface-2:  #f4f5f7;
  --cap-surface-3:  #f0f3f7;
  --cap-tint:       #d9f4fb;
  --cap-good:       #2f855a;
  --cap-bad:        #c53030;
  --cap-warn:       #8a6d1f;

  /* Day-bar segments. White separators mean adjacent segments never rely on
     color contrast alone; the legend repeats the data as text. */
  --cap-seg-service: #00b7e5;
  --cap-seg-travel:  #f5a623;
  --cap-seg-breaks:  #a0b0c0;
  --cap-seg-admin:   #7e8b99;
  --cap-seg-commute: #1a2b3c;

  --cap-radius: 10px;
}

/* ---------- layout ---------- */

.cap-main {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--cap-ink);
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 72px;
  line-height: 1.6;
}

.cap-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cap-breadcrumb ol {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 0 0 16px; padding: 0;
  font-size: 13px; color: var(--cap-ink-muted);
}
.cap-breadcrumb li + li::before { content: '/'; margin-right: 8px; color: var(--cap-ink-faint); }
.cap-breadcrumb a { color: var(--cap-ink-muted); text-decoration: none; }
.cap-breadcrumb a:hover { color: var(--cap-accent); text-decoration: underline; }

.cap-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.cap-intro { font-size: 18px; margin: 0 0 12px; max-width: 68ch; }
.cap-meta-line { font-size: 14px; color: var(--cap-ink-muted); margin: 0 0 32px; }

/* Tools hub only (not the analyzer, which shares .cap-hero/.cap-intro): a dark
   navy band behind the title and intro, same background and accent as the
   site footer, so this page's masthead reads as one system with it. Scoped
   to .tools-hero rather than changing .cap-hero itself. */
.tools-hero {
  background: var(--cap-ink);
  padding: 36px 32px;
  border-radius: var(--cap-radius);
  margin: 0 0 32px;
}
.tools-hero h1 { color: var(--cap-accent); }
.tools-hero .cap-intro { color: #fff; margin-bottom: 0; max-width: 70ch; }
.tools-hero .cap-breadcrumb ol { color: #8a9bab; }
.tools-hero .cap-breadcrumb a { color: #8a9bab; }
.tools-hero .cap-breadcrumb a:hover { color: #fff; }
.tools-hero .cap-breadcrumb li + li::before { color: #4a5c6e; }
@media (max-width: 640px) {
  .tools-hero { padding: 24px 20px; }
}

/* E-E-A-T byline. Sits between the H1 and the intro, so it stays quiet: the
   avatar earns trust at a glance without competing with the headline. */
.cap-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--cap-ink-muted);
  margin: 0 0 16px;
}
.cap-byline-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--cap-line);
}
/* Root styles.css sets `a { color: inherit; text-decoration: none }`, so any
   link here is invisible unless it is styled explicitly. */
.cap-byline .cap-author {
  color: var(--cap-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cap-byline .cap-author:hover { color: var(--cap-accent-dk); }

/* Amber callouts: the no-JS notice and the unsourced-benchmark warning. */
.cap-noscript, .cap-source-note {
  background: #fff8e1; border: 1px solid #f0d9a0; border-radius: 8px;
}
.cap-noscript { padding: 14px 16px; margin: 0 0 20px; font-size: 15px; }

/* ---------- tool grid ---------- */

.cap-tool { margin: 0 0 56px; }

.cap-tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.cap-form {
  background: var(--cap-surface-2);
  border: 1px solid var(--cap-line);
  border-radius: var(--cap-radius);
  padding: 18px;
  position: sticky;
  top: 16px;
}

/* ---------- fields ---------- */

.cap-field { margin: 0 0 14px; }
.cap-field:last-child { margin-bottom: 0; }

.cap-field label,
.cap-slider-head label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 5px;
  color: var(--cap-ink);
}

.cap-field input[type="text"],
.cap-field input[type="number"],
.cap-field input[type="email"],
.cap-field select,
.cap-details textarea {
  width: 100%;
  /* 16px prevents iOS auto-zoom on focus. */
  font-size: 16px;
  font-family: inherit;
  color: var(--cap-ink);
  background: var(--cap-surface);
  border: 1px solid var(--cap-line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  box-sizing: border-box;
}

.cap-details textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.cap-field input:focus-visible,
.cap-field select:focus-visible,
.cap-details textarea:focus-visible,
.cap-region-name:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cap-accent);
  outline-offset: 2px;
}

.cap-input-row { display: flex; align-items: center; gap: 8px; }
/* The three rules below must out-specify the `width: 100%` block above (and
   each other) or the unit dropdown squeezes the number input to nothing.
   Specificity is load-bearing here, check it before editing these selectors. */
.cap-field .cap-input-row input[type="number"] { flex: 1 1 auto; width: auto; min-width: 5.5em; }
.cap-suffix { font-size: 13px; color: var(--cap-ink-muted); flex: 0 0 auto; }
.cap-field select.cap-unit { flex: 0 0 auto; width: auto; min-width: 0; padding: 10px 8px; }
.cap-field .cap-input-row input.cap-num-narrow { flex: 0 0 76px; width: 76px; min-width: 0; max-width: 76px; }

.cap-hint { font-size: 12px; color: var(--cap-ink-muted); margin: 5px 0 0; line-height: 1.45; }

.cap-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cap-field-grid > .cap-field { margin-bottom: 0; }
/* Fields carrying two controls (number + unit) get the full row, half a
   380px sidebar is not enough for an input and a dropdown side by side. */
.cap-field-grid > .cap-field-wide { grid-column: 1 / -1; }

/* ---------- regions ---------- */

.cap-region {
  border: 1px solid var(--cap-line);
  background: var(--cap-surface);
  border-radius: var(--cap-radius);
  padding: 14px;
  margin: 0 0 12px;
}

.cap-region-legend { padding: 0; width: 100%; }
.cap-region-name {
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  width: 100%;
  min-height: 40px;
  font-family: inherit;
  color: var(--cap-ink);
}
.cap-region-name:hover { border-color: var(--cap-line); background: var(--cap-surface-2); }

.cap-region-actions { display: flex; gap: 6px; margin-top: 10px; }

.cap-btn-quiet {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--cap-ink-muted);
  background: transparent;
  border: 1px solid var(--cap-line);
  border-radius: 6px;
  padding: 8px 12px;
  min-height: 36px;
  cursor: pointer;
}
.cap-btn-quiet:hover { background: var(--cap-surface-2); color: var(--cap-ink); }
.cap-btn-quiet[disabled] { opacity: 0.45; cursor: not-allowed; }

.cap-region-add { margin: 4px 0 14px; }
.cap-add-hint { margin-top: 6px; }

.cap-btn-secondary {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--cap-ink);
  background: var(--cap-surface);
  border: 1px solid var(--cap-ink);
  border-radius: 8px;
  padding: 11px 18px;
  min-height: 44px;
  cursor: pointer;
}
.cap-btn-secondary:hover { background: var(--cap-ink); color: #fff; }

.cap-btn-primary {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--cap-ink);
  background: var(--cap-cta);
  border: none;
  border-radius: 8px;
  padding: 13px 24px;
  min-height: 46px;
  cursor: pointer;
  text-decoration: none;
}
.cap-btn-primary:hover { background: var(--cap-cta-dk); }

/* ---------- collapsibles ---------- */

.cap-details {
  border: 1px solid var(--cap-line);
  border-radius: 8px;
  background: var(--cap-surface);
  margin: 0 0 10px;
}
.cap-details > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  min-height: 44px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  list-style-position: inside;
}
.cap-details > summary:hover { background: var(--cap-surface-2); }
.cap-details-body { padding: 0 14px 14px; }

/* FAQ accordion: reuses .cap-details-body but not the compact sidebar look,
   since this sits in the wide prose column and its summary is a heading
   (h1-h6 is valid <summary> content per the HTML spec), not a plain label. */
.cap-faq-item {
  border: none;
  border-bottom: 1px solid var(--cap-line-soft);
  border-radius: 0;
  background: transparent;
  margin: 0;
}
.cap-faq-item:first-of-type { border-top: 1px solid var(--cap-line-soft); }
.cap-faq-item > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  min-height: 44px;
}
.cap-faq-item > summary::-webkit-details-marker { display: none; }
.cap-faq-item > summary > .cap-h3 { margin: 0; }
.cap-faq-item > summary::after {
  content: "+";
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 20px;
  line-height: 1;
  font-weight: 400;
  color: var(--cap-ink-muted);
}
.cap-faq-item[open] > summary::after { content: "\2212"; }
.cap-faq-item > summary:hover > .cap-h3 { color: var(--cap-link); }
.cap-faq-item .cap-details-body { padding: 0 0 18px; }
.cap-faq-item .cap-details-body p { margin: 0; }

.cap-slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cap-slider-out { font-size: 12px; font-weight: 600; color: var(--cap-accent-dk); }
.cap-field input[type="range"] { flex: 1 1 auto; min-width: 0; min-height: 44px; accent-color: var(--cap-accent); }

.cap-paste-status { font-size: 13px; color: var(--cap-ink-muted); margin: 10px 0 0; }
.cap-paste-status:empty { display: none; }

/* Upload */
.cap-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  margin-top: 10px;
  padding: 14px;
  border: 1.5px dashed var(--cap-line);
  border-radius: 8px;
  background: var(--cap-surface-2);
  cursor: pointer;
  text-align: center;
}
.cap-dropzone:hover,
.cap-dropzone.is-dragging { border-color: var(--cap-accent); background: var(--cap-tint); }
.cap-dropzone:focus-within { outline: 3px solid var(--cap-accent); outline-offset: 2px; }
.cap-dropzone-text { font-size: 14px; font-weight: 600; color: var(--cap-ink); }

/* The planned/reactive input, promoted out of the collapsed sections because
   it is the largest lever in the model. */
.cap-key-input {
  border: 1px solid var(--cap-line);
  border-left: 3px solid var(--cap-accent);
  border-radius: 8px;
  background: var(--cap-surface);
  padding: 14px;
  margin: 0 0 10px;
}

/* Current values shown in a collapsed section's summary, so it is never a
   black box. */
.cap-summary-state {
  font-weight: 400;
  font-size: 12px;
  color: var(--cap-ink-muted);
  margin-left: auto;
  padding-left: 10px;
  text-align: right;
}

/* ---------- validation ---------- */

.cap-validation:empty { display: none; }
.cap-validation { margin-top: 12px; font-size: 13px; }
.cap-msg { padding: 9px 12px; border-radius: 7px; margin: 0 0 6px; }
.cap-msg-error { background: #fdecea; color: var(--cap-bad); border: 1px solid #f5c6c2; }
.cap-msg-warn { background: #fff8e1; color: var(--cap-warn); border: 1px solid #f0d9a0; }

/* ---------- results ---------- */

.cap-results { min-height: 620px; container-type: inline-size; }

.cap-headline-card {
  background: var(--cap-ink);
  color: #fff;
  border-radius: var(--cap-radius);
  padding: 22px 24px;
  margin: 0 0 18px;
}
.cap-headline-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--cap-accent);
  margin: 0 0 8px;
}
.cap-headline { font-size: clamp(20px, 2.6vw, 28px); font-weight: 800; line-height: 1.25; margin: 0 0 6px; }
.cap-headline-sub { font-size: 15px; color: #c8d4de; margin: 0 0 14px; }
.cap-band { font-size: 15px; margin: 0 0 12px; color: #eef4f8; }
.cap-band strong { color: #fff; }
.cap-caveat {
  font-size: 12.5px; line-height: 1.5; color: #9fb0bf;
  margin: 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.14);
}

.cap-single-region-nudge {
  background: var(--cap-tint);
  border: 1px solid #a9e4f4;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 14px;
}
.cap-single-region-nudge p { margin: 0; }

/* ---------- tables ---------- */

.cap-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; }

.cap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 620px;
}
.cap-static-table { min-width: 460px; }

/* The results table has 8 columns and no natural room to spare in the squeeze
   zone where the 2-column tool grid narrows .cap-results below ~700px but
   stays above the card-layout container-query threshold. Rather than fight
   that gap with a fixed min-width, let this table shrink on its own terms:
   no floor, tighter padding, header labels allowed to wrap to two lines. */
#capBreakdown {
  min-width: 0;
  table-layout: auto;
}
#capBreakdown th, #capBreakdown td { padding: 8px 6px; }
#capBreakdown thead th { white-space: normal; }

.cap-table caption {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--cap-ink-muted);
  padding: 0 0 8px;
}
.cap-table th, .cap-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--cap-line-soft);
  text-align: left;
  vertical-align: top;
}
.cap-table thead th {
  background: var(--cap-surface-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cap-ink-muted);
  border-bottom: 2px solid var(--cap-line);
  white-space: nowrap;
}
.cap-table tbody th { font-weight: 600; }
.cap-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Two classes, to beat `.cap-table th, .cap-table td { text-align: left }`
   above, a plain `.cap-num` loses to it and the figures come out left-aligned. */
.cap-table .cap-num { text-align: right; }

.cap-row-worst { background: #fff6f5; }
.cap-row-best  { background: #f2fbf5; }
.cap-flag {
  display: inline-block;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 2px 6px; border-radius: 4px;
  margin-left: 8px; vertical-align: middle;
}
.cap-flag-worst { background: #fdecea; color: var(--cap-bad); }
.cap-flag-best  { background: #e6f6ec; color: var(--cap-good); }

.cap-pos { color: var(--cap-good); }
.cap-neg { color: var(--cap-bad); }

.cap-diagnostic {
  font-size: 15px;
  background: var(--cap-surface-3);
  border-left: 3px solid var(--cap-accent);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 18px;
}

/* ---------- stats ---------- */

.cap-stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 22px; }
.cap-stat {
  flex: 1 1 200px;
  border: 1px solid var(--cap-line);
  border-radius: var(--cap-radius);
  padding: 14px 16px;
  background: var(--cap-surface);
}
.cap-stat-value { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.cap-stat-label { display: block; font-size: 13px; color: var(--cap-ink-muted); margin-top: 4px; }

/* ---------- day bar ---------- */

.cap-daybar-block { margin: 0 0 22px; }
.cap-h3 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }

.cap-daybar {
  display: flex;
  width: 100%;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--cap-surface-2);
}
.cap-daybar-seg { display: block; height: 100%; box-shadow: inset -2px 0 0 #fff; }
.cap-daybar-seg:last-child { box-shadow: none; }

.cap-seg-service { background: var(--cap-seg-service); }
.cap-seg-travel  { background: var(--cap-seg-travel); }
.cap-seg-breaks  { background: var(--cap-seg-breaks); }
.cap-seg-admin   { background: var(--cap-seg-admin); }
.cap-seg-commute { background: var(--cap-seg-commute); }

.cap-daybar-legend {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 13px; color: var(--cap-ink-muted);
}
.cap-daybar-legend li { display: flex; align-items: center; gap: 7px; }
.cap-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }

/* ---------- scenarios ---------- */

.cap-scenarios, .cap-absorption { margin: 0 0 22px; }

.cap-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.cap-chip {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--cap-ink);
  background: var(--cap-surface);
  border: 1px solid var(--cap-line);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 40px;
  cursor: pointer;
  text-align: left;
}
.cap-chip:hover { border-color: var(--cap-accent); background: var(--cap-tint); }
.cap-chip[aria-pressed="true"] { border-color: var(--cap-accent); background: var(--cap-tint); }

.cap-delta-up { color: var(--cap-bad); font-weight: 700; }
.cap-delta-down { color: var(--cap-good); font-weight: 700; }

.cap-absorb-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.cap-absorb-row .cap-field { flex: 1 1 150px; margin-bottom: 0; }
.cap-absorb-row .cap-btn-secondary { flex: 0 0 auto; }
.cap-chip-result:empty, .cap-absorb-result:empty { display: none; }
.cap-chip-result, .cap-absorb-result {
  margin-top: 12px; font-size: 14px;
  background: var(--cap-surface-3); border-radius: 8px; padding: 12px 14px;
}

/* ---------- maths ---------- */

.cap-maths { margin: 0 0 18px; }
.cap-maths-trace {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  background: var(--cap-surface-2);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 12px;
  white-space: pre;
}
.cap-maths h4 { font-size: 13px; margin: 14px 0 6px; }

.cap-independence-note {
  font-size: 13px;
  color: var(--cap-ink-muted);
  border-top: 1px solid var(--cap-line-soft);
  padding-top: 14px;
  margin: 0 0 22px;
}

/* ---------- gate ---------- */

.cap-gate-card {
  border: 1px solid var(--cap-line);
  border-radius: var(--cap-radius);
  background: var(--cap-surface-2);
  padding: 20px;
  margin: 0 0 22px;
}
.cap-gate-card p { font-size: 14px; margin: 0 0 14px; }

.cap-gate-form-wrap { margin-top: 16px; }
.cap-gate-form { display: grid; gap: 12px; max-width: 460px; }
.cap-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; }
.cap-consent input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; }
.cap-processing-notice { font-size: 12px; color: var(--cap-ink-muted); line-height: 1.5; margin: -4px 0 0; }
.cap-processing-notice a { color: var(--cap-link); text-decoration: underline; }
.cap-gate-status { font-size: 13px; }
.cap-gate-status.cap-msg-error { display: block; }

/* Honeypot, off-screen, never focusable, never announced. */
.cap-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

.cap-unlocked-note { font-size: 13px; color: var(--cap-ink-muted); margin-top: 10px; }
.cap-unlocked-note button {
  background: none; border: none; padding: 0;
  color: var(--cap-link); text-decoration: underline;
  cursor: pointer; font-family: inherit; font-size: 13px;
}

.cap-cta {
  border: 1px solid var(--cap-line);
  border-left: 4px solid var(--cap-accent);
  border-radius: var(--cap-radius);
  padding: 18px 20px;
  background: var(--cap-surface);
}
.cap-cta p { font-size: 15px; margin: 0 0 14px; }
/* What is still available when the verdict is "consistent", stated from the
   user's own figures rather than as a vendor claim. */
.cap-headroom-note {
  border-bottom: 1px solid var(--cap-line);
  padding-bottom: 12px;
  color: var(--cap-ink);
}

/* ---------- prose ---------- */

.cap-prose { max-width: 76ch; margin: 0 auto; }
.cap-prose section { margin: 0 0 44px; }
.cap-prose h2 {
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  scroll-margin-top: 20px;
}
.cap-prose p { margin: 0 0 14px; }
.cap-prose ul, .cap-prose ol { margin: 0 0 14px; padding-left: 22px; }
.cap-prose li { margin: 0 0 8px; }

/* The root stylesheet sets `a { text-decoration: none; color: inherit }`, so
   without this every in-prose link renders as plain body text and is invisible.
   Buttons are excluded: they carry their own treatment. */
.cap-prose a:not(.cap-btn-primary):not(.cap-btn-secondary),
.cap-cta a:not(.cap-btn-primary):not(.cap-btn-secondary),
.cap-headroom-note a {
  color: var(--cap-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.cap-prose a:not(.cap-btn-primary):not(.cap-btn-secondary):hover,
.cap-cta a:not(.cap-btn-primary):not(.cap-btn-secondary):hover {
  color: var(--cap-ink);
  text-decoration-thickness: 2px;
}

.cap-prose code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.92em;
  background: var(--cap-surface-2);
  padding: 2px 5px;
  border-radius: 4px;
}

.cap-pre {
  background: var(--cap-surface-2);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.cap-pre code { background: none; padding: 0; font-size: 13px; line-height: 1.7; }

.cap-formula-list li { margin-bottom: 10px; }
.cap-formula-list code { display: inline-block; }

.cap-dl { margin: 0 0 14px; }
.cap-dl dt { font-weight: 700; margin: 12px 0 3px; }
.cap-dl dd { margin: 0 0 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--cap-line); color: var(--cap-ink-muted); }

.cap-source-note { padding: 12px 14px; font-size: 14px; }

.cap-levers { list-style: decimal; }
.cap-levers > li { margin-bottom: 18px; }
.cap-levers h3 { margin-bottom: 6px; }

.cap-final-cta {
  background: var(--cap-surface-2);
  border-radius: var(--cap-radius);
  padding: 24px;
  text-align: center;
}
.cap-final-cta h2 { margin-bottom: 10px; }

/* ---------- answer box, benchmark facts, gold stat ---------- */

/* The front-loaded definition. Visually distinct from body copy so a reader
   can take the answer without reading on, which is also what makes it
   extractable. Accent border rather than a filled panel: the amber callouts
   already mean "caveat" on this page and this is not one. */
.cap-answerbox {
  background: var(--cap-surface-2);
  border-left: 4px solid var(--cap-accent-dk);
  border-radius: 0 var(--cap-radius) var(--cap-radius) 0;
  padding: 18px 20px;
  margin: 0 0 32px;
  max-width: 72ch;
}
.cap-answerbox-text { margin: 0; font-size: 16px; line-height: 1.62; }
/* The box runs to several paragraphs on the hub; variants inject a single one,
   so space between siblings rather than giving every paragraph a bottom margin. */
.cap-answerbox-text + .cap-answerbox-text { margin-top: 12px; }
.cap-answerbox-text strong { color: var(--cap-ink); }

/* Attributed benchmark stats. The claim leads in bold, the qualifier follows,
   the source trails muted, so the quotable unit is the first clause. */
.cap-benchmark-facts { list-style: none; padding: 0; margin: 0 0 18px; }
.cap-benchmark-facts > li {
  padding: 12px 0 12px 16px;
  border-left: 3px solid var(--cap-line);
  margin-bottom: 10px;
  line-height: 1.6;
}
.cap-benchmark-facts > li strong { display: block; margin-bottom: 3px; }
.cap-source { color: var(--cap-ink-muted); font-size: 13px; white-space: nowrap; }

/* The one sentence per page most worth quoting. Tinted, so it reads as the
   page's own claim rather than a borrowed one. */
.cap-goldstat {
  background: var(--cap-tint);
  border-radius: var(--cap-radius);
  padding: 16px 18px;
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.6;
}
.cap-goldstat strong { font-weight: 700; }

/* ---------- trade selector band ---------- */

/* Hub-to-spoke and spoke-to-spoke linking. The current trade renders as a
   marked span rather than a self-link. */
.cap-trades { margin: 40px 0; }
.cap-industry-link { margin: 20px 0 0; font-weight: 400; }
.cap-industry-link a { color: var(--cap-link); text-decoration: underline; text-underline-offset: 2px; }
.cap-industry-link a:hover { color: var(--cap-accent-dk); }

/* Variant-only how-to-use walkthrough, replacing the hub's trade picker in
   the same v:tradesection region. 4 columns, with an "OR" divider straddling
   the border between column 3 (the free walkthrough) and column 4 (the
   direct-to-demo shortcut).

   .cap-prose caps out at 76ch (~650-700px), which isn't enough width for 4
   columns of ~55-60 character sentences to wrap to 2 lines. Above 1024px this
   breaks out symmetrically (negative margin + widened box) to use more of
   .cap-main's 1140px inner content width, capped with a hard max-width so it
   can never exceed .cap-main's own edges regardless of how wide 76ch actually
   renders in a given browser/font. Below 1024px (where it stacks to one
   column anyway) the breakout is reset to normal document flow. */
.cap-howto-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--cap-line);
  border-radius: var(--cap-radius);
  background: var(--cap-surface);
  margin: 16px 0 28px;
}
@media (min-width: 1025px) {
  .cap-howto-grid {
    width: calc(100% + 260px);
    max-width: 1120px;
    margin-left: -130px;
  }
}
.cap-howto-col {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 26px;
  border-left: 1px solid var(--cap-line-soft);
}
.cap-howto-col:first-child { border-left: none; }
.cap-howto-num {
  flex-shrink: 0;
  align-self: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cap-accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cap-howto-col p {
  margin: 0;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--cap-ink);
}
.cap-howto-col-cta { padding: 20px 20px 26px; }
.cap-howto-or {
  position: absolute;
  top: 50%;
  left: 75%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cap-surface);
  border: 1px solid var(--cap-line);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cap-cta-dk);
}
@media (max-width: 1024px) {
  .cap-howto-grid { grid-template-columns: 1fr; }
  .cap-howto-col { border-left: none; border-top: 1px solid var(--cap-line-soft); padding: 16px 4px 20px; }
  .cap-howto-col:first-child { border-top: none; }
  .cap-howto-or {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    margin: 10px auto;
  }
}

.cap-trade-links {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.cap-trade-links a,
.cap-trade-links .cap-trade-current {
  display: block;
  padding: 10px 13px;
  border: 1px solid var(--cap-line);
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  color: var(--cap-ink);
}
.cap-trade-links a:hover { border-color: var(--cap-accent-dk); background: var(--cap-surface-2); }
.cap-trade-links a:focus-visible { outline: 2px solid var(--cap-accent-dk); outline-offset: 2px; }
.cap-trade-links .cap-trade-current {
  background: var(--cap-surface-2);
  color: var(--cap-ink-muted);
  font-weight: 600;
  cursor: default;
}

/* ---------- example figures / awaiting input ---------- */

.cap-example-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--cap-surface-2);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cap-ink-muted);
}

/* A button that reads as a link. Kept quiet on purpose: clearing the form is
   the right move for accuracy but a blank twelve-field form is a real exit
   risk, so it must not compete with the filled-in example. */
.cap-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--cap-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.cap-linkbtn:hover { color: var(--cap-accent-dk); }
.cap-linkbtn:focus-visible { outline: 2px solid var(--cap-accent-dk); outline-offset: 2px; border-radius: 3px; }

/* The last good result stays in the DOM when validation fails, which is right
   while someone is mid-edit but wrong once they have deliberately emptied the
   form: the example answer would read as theirs. Fade it and say so. */
.cap-results.is-awaiting-input { position: relative; }
.cap-results.is-awaiting-input > * { opacity: 0.25; filter: grayscale(1); }
.cap-results.is-awaiting-input::after {
  content: "Enter your figures on the left to see your result.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--cap-ink);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--cap-radius);
}

/* ---------- tools hub ---------- */

/* One tool today, and the layout must not advertise that. A featured card with
   its trade grid fills the page honestly, and a second tool is one more
   <article class="tool-card"> in this grid with no CSS change. */
.tools-hub { display: grid; gap: 24px; }

.tool-card {
  border: 1px solid var(--cap-line);
  border-radius: var(--cap-radius);
  background: var(--cap-surface);
  padding: 28px;
}

.tool-card-head { display: flex; gap: 16px; align-items: flex-start; }
.tool-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--cap-tint);
  color: var(--cap-accent-dk);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tool-icon svg { width: 26px; height: 26px; }

.tool-kicker {
  margin: 0 0 3px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cap-ink-muted);
}
.tool-card h2 { margin: 0; font-size: 22px; line-height: 1.25; }
/* Root styles.css strips link colour sitewide, so every link here is explicit. */
.tool-card h2 a { color: var(--cap-ink); text-decoration: none; }
.tool-card h2 a:hover { color: var(--cap-link); text-decoration: underline; }

.tool-card-body { margin: 14px 0 0; max-width: 80ch; font-size: 15px; color: var(--cap-ink); }

.tool-facts {
  list-style: none; padding: 0;
  margin: 16px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tool-facts li {
  font-size: 13px;
  color: var(--cap-ink-muted);
  background: var(--cap-surface-2);
  border-radius: 999px;
  padding: 5px 12px;
}

.tool-card-actions { margin: 18px 0 0; }
.tool-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600;
  color: var(--cap-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tool-cta:hover { color: var(--cap-accent-dk); }

.tool-variants {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--cap-line);
}
.tool-variants-title { margin: 0 0 4px; font-size: 16px; }
.tool-variants-sub { margin: 0 0 16px; font-size: 15px; color: var(--cap-ink-muted); max-width: 80ch; }

.industry-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px;
}
.industry-grid a {
  display: flex; gap: 11px; align-items: flex-start;
  height: 100%;
  padding: 12px 13px;
  border: 1px solid var(--cap-line);
  border-radius: 9px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}
.industry-grid a:hover { border-color: var(--cap-accent-dk); background: var(--cap-surface-2); }
.industry-grid a:focus-visible { outline: 2px solid var(--cap-accent-dk); outline-offset: 2px; }
.industry-grid svg { width: 20px; height: 20px; color: var(--cap-accent-dk); flex-shrink: 0; margin-top: 2px; }
.ind-name { display: block; font-size: 14px; font-weight: 600; color: var(--cap-ink); line-height: 1.3; }
.ind-desc { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--cap-ink-muted); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 1024px) {
  .cap-tool-grid { grid-template-columns: 1fr; }
  .cap-form { position: static; }
  .cap-results { min-height: 0; }
}

@media (max-width: 640px) {
  .cap-answerbox { padding: 14px 16px; margin-bottom: 24px; }
  .cap-answerbox-text { font-size: 15px; }
  .cap-source { white-space: normal; }
  .tool-card { padding: 20px 16px; }
  .tool-card h2 { font-size: 19px; }
  .tool-icon { width: 40px; height: 40px; border-radius: 10px; }
  .tool-icon svg { width: 22px; height: 22px; }
  /* Single column below 640: two 228px tiles would force a horizontal scroll at 360. */
  .industry-grid { grid-template-columns: 1fr; }

  .cap-main { padding: 20px 14px 48px; }
  .cap-field-grid { grid-template-columns: 1fr; }
  .cap-headline-card { padding: 18px 16px; }
  .cap-stat-row { gap: 10px; }
  .cap-stat { flex: 1 1 100%; }
  .cap-stat-value { font-size: 26px; }
  .cap-absorb-row .cap-field { flex: 1 1 100%; }
  .cap-absorb-row .cap-btn-secondary { width: 100%; }
  .cap-region-actions { flex-wrap: wrap; }
  .cap-chip { flex: 1 1 100%; }
  .cap-daybar-legend { flex-direction: column; gap: 6px; }
  .cap-prose { max-width: none; }
  /* Reserve space so live recalculation does not shift the page (CLS). */
  .cap-headline { min-height: 2.5em; }
}

/* Regional breakdown: 8 columns need real room. Rather than keying this off
   the viewport, it keys off the actual rendered width of .cap-results (see
   `container-type: inline-size` above), because the results column can drop
   below the table's 620px min-width on a mid-size desktop window too, while
   the 2-column tool grid is still active and the viewport itself reads as
   "desktop". Below that width it becomes a stack of cards instead of a
   scrolling table. nth-child labels (not data-label attrs) so this works on
   both the static example row and every row ui.js re-renders, with no
   HTML/JS change needed. */
@container (max-width: 640px) {
  #capBreakdown, #capBreakdown thead, #capBreakdown tbody, #capBreakdown tr { display: block; width: 100%; min-width: 0; }
  #capBreakdown thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  #capBreakdown tbody tr {
    border: 1px solid var(--cap-line-soft);
    border-radius: 8px;
    padding: 4px 12px;
    margin: 0 0 10px;
    background: var(--cap-surface);
  }
  #capBreakdown tbody tr:last-child { margin-bottom: 0; }
  #capBreakdown th[scope="row"] {
    display: block;
    padding: 8px 0 6px;
    border-bottom: 1px solid var(--cap-line);
    font-size: 15px;
  }
  #capBreakdown td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--cap-line-soft);
    text-align: left !important;
  }
  #capBreakdown tr > td:last-child { border-bottom: 0; }
  #capBreakdown td::before {
    font-weight: 600; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--cap-ink-muted);
  }
  #capBreakdown td:nth-child(2)::before { content: "Jobs/day"; }
  #capBreakdown td:nth-child(3)::before { content: "Techs today"; }
  #capBreakdown td:nth-child(4)::before { content: "Modeled"; }
  #capBreakdown td:nth-child(5)::before { content: "Gap"; }
  #capBreakdown td:nth-child(6)::before { content: "Jobs/tech/day"; }
  #capBreakdown td:nth-child(7)::before { content: "Travel/job"; }
  #capBreakdown td:nth-child(8)::before { content: "Travel share"; }
}

@media (max-width: 380px) {
  .cap-main { padding: 16px 10px 40px; }
  .cap-field .cap-input-row input.cap-num-narrow { flex-basis: 64px; width: 64px; max-width: 64px; }
}
