/* CRM Harness. Own palette from the CRM Harness mark (navy #17496b, sky #6db4e0). Light and dark. */
:root {
  color-scheme: light dark;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #0f2233;
  --muted: #4a5d6e;
  --line: #d5dee6;
  --brand: #17496b;
  --brand-ink: #ffffff;
  --accent: #1f6fa3;
  --accent-soft: #dcecf7;
  --ok: #19703f;
  --err: #a3271c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 34, 51, .06), 0 8px 24px rgba(15, 34, 51, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1620;
    --surface: #10202d;
    --surface-2: #142a3a;
    --ink: #e8f0f6;
    --muted: #9fb3c4;
    --line: #23394a;
    --brand: #6db4e0;
    --brand-ink: #06121b;
    --accent: #8cc8ef;
    --accent-soft: #15344a;
    --ok: #6fd39a;
    --err: #ff9a8f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--font); -webkit-tap-highlight-color: transparent; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; padding-top: max(18px, env(safe-area-inset-top)); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.site-header nav { display: flex; gap: 6px 18px; flex-wrap: wrap; align-items: center; font-size: .95rem; }
.site-header nav a { color: var(--ink); text-decoration: none; padding: 10px 2px; min-height: 44px; display: inline-flex; align-items: center; }
@media (hover: hover) and (pointer: fine) { .site-header nav a:hover { color: var(--accent); } }
.nav-cta { background: var(--brand); color: var(--brand-ink) !important; padding: 10px 16px !important; border-radius: 999px; font-weight: 600; }

/* Buttons */
.button, button[type="submit"] { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 0; background: var(--brand); color: var(--brand-ink); font: 600 1rem/1 var(--font); text-decoration: none; cursor: pointer; touch-action: manipulation; transition: transform .12s ease, filter .12s ease; }
.button.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.button:active, button[type="submit"]:active { transform: scale(.97); filter: brightness(.95); }
@media (hover: hover) and (pointer: fine) { .button:hover, button[type="submit"]:hover { filter: brightness(1.08); } }
button[disabled] { opacity: .7; cursor: progress; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 40px 0 56px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--accent); margin-bottom: .8em; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 40ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 14px; }
.micro { font-size: .9rem; color: var(--muted); }
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { font-size: .88rem; color: var(--muted); margin-top: 10px; }
.d-box { fill: var(--surface-2); stroke: var(--line); }
.d-core { fill: var(--brand); }
.d-core-t { fill: var(--brand-ink); font: 700 15px var(--font); }
.d-t { fill: var(--ink); font: 600 13px var(--font); }
.d-s { fill: var(--muted); font: 400 11px var(--font); }
.d-line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-dasharray: 5 5; }

/* Sections */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-head p { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p { color: var(--muted); margin: 0; }
.card .tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.card .tag.live { background: var(--brand); color: var(--brand-ink); }
.card .card-link { display: inline-block; margin-top: 14px; font-weight: 600; min-height: 44px; padding-top: 10px; }
.steps { counter-reset: step; }
.steps .card h3::before { counter-increment: step; content: "0" counter(step) "  "; color: var(--accent); font-family: var(--mono); font-weight: 600; }

/* JOEY case */
.case { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); padding: 32px; box-shadow: var(--shadow); }
.case ul { margin: 0 0 18px; padding-left: 1.2em; color: var(--muted); }
.case li { margin-bottom: 8px; }
.case .facts { background: var(--surface-2); border-radius: var(--radius); padding: 20px; }
.case .facts dt { font-weight: 700; font-size: .85rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.case .facts dd { margin: 2px 0 14px; font-size: 1.05rem; }

/* Value math */
.math { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.math form { display: grid; gap: 14px; }
.field label, .field legend { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select, textarea { width: 100%; font: 400 16px/1.4 var(--font); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; }
textarea { min-height: 110px; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
.math-out { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); align-self: start; }
.math-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
/* :WHY? rows are visible by default (works without JS and in full-page captures); only math.js opts into the reveal. */
.math-out.anim .math-row { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.math-out.anim .math-row.show { opacity: 1; transform: none; }
.math-row span:last-child { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.math-row.total { border-bottom: 0; font-size: 1.15rem; }
.math-row.total span:last-child { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .math-out.anim .math-row { opacity: 1; transform: none; } }
.note { font-size: .88rem; color: var(--muted); }

/* Lead form */
.form-section { display: grid; grid-template-columns: .9fr 1.1fr; gap: 32px; }
.form-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.form-panel form { display: grid; gap: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead-status { min-height: 1.4em; margin: 0; font-weight: 600; }
.lead-status.ok { color: var(--ok); }
.lead-status.err { color: var(--err); }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { font-weight: 600; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details p { color: var(--muted); margin-top: 8px; }

/* Article */
.article { max-width: 760px; padding: 32px 0 56px; }
.article h2 { margin-top: 1.6em; font-size: 1.5rem; }
.article p, .article li { color: var(--ink); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0; padding-bottom: max(36px, env(safe-area-inset-bottom)); font-size: .92rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 24px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink); }
.footer-label { font-weight: 700; color: var(--ink); margin-bottom: 8px; }

@media (max-width: 860px) {
  .hero, .case, .math, .form-section { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .grid, .field-row { grid-template-columns: 1fr; }
  .case { padding: 20px; }
  .site-header nav { gap: 0 14px; }
  .hero { padding-top: 16px; }
}

/* v2: industry, CRM type and roadmap pages */
.page-hero { padding: 32px 0 48px; max-width: 860px; }
.page-hero .lede { max-width: 60ch; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.pill.live { background: var(--brand); color: var(--brand-ink); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card .card-meta { margin-top: 10px; font-size: .92rem; }
.card.roadmap { border-style: dashed; }
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  /* :WHY? six nav links wrap into three rows at 375 px; one row that scrolls sideways inside the header keeps the
   * page itself free of horizontal scroll (standard A2) and the call to action one swipe away. */
  .site-header nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; overscroll-behavior-x: contain; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { white-space: nowrap; flex: none; }
}
