/* ==========================================================================
   Section 7 — Commitments · "We only look good when your portfolio does"
   Three columns split by hairlines. Each is the usual vendor line, edited
   by Finflow in pen:
       Start from ~~our templates~~       Ship ~~at~~ your loan officers
                  ‸ your products               ‸ with
   Reveal (once per item, .is-visible from reveal.js):
     0.35s  a two-pass blue scribble crosses out the vendor words
     0.60s  the struck words settle to grey
     0.80s  a caret pops in under them
     0.95s  our words are "handwritten" above, wiped in left to right
   Base styles are the final state, so without JS or with reduced motion
   the edits are simply there. Screen readers get the plain commitment.
   Prefixed .cs- and scoped to .commitments.
   ========================================================================== */

.commitments {
  /* Colour psychology (previous all-blue version: backups/commitments.v1-blue.css)
     paper   warm off-white  → a working document, human, not a cold sales page
     old     cool slate      → the vendor way recedes: distant, past, inert
     ink     deep ink blue   → the correction carries authority, signed in ink
     promise growth green    → what we write in is the healthy outcome, the
                               same green as "paid"/good across the site, and
                               the heading stays brand blue like every section  */
  --cs-bg:      #FAF8F4;
  --cs-dot:     rgba(110,92,64,0.20);
  --cs-old:     #9AA2AE;
  --cs-ink:     #0D47A1;
  --cs-promise: #0F8A76;

  position: relative;
  overflow: hidden;
  padding: clamp(80px, 10vw, 136px) var(--page-px);
  background: var(--cs-bg);
  border-top: 1px solid var(--border);
}
:root[data-theme="dark"] .commitments {
  --cs-bg:      #071733;
  --cs-dot:     rgba(147,190,240,0.16);
  --cs-old:     #5F6E86;
  --cs-ink:     #93BEF0;
  --cs-promise: #4FD1B0;
}
/* Dot grid, like a dotted notebook page: an even, deliberate grid across
   the whole section, fading only at the top and bottom edges */
.commitments::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--cs-dot) 1.4px, transparent 1.6px);
  background-size: 24px 24px;
  background-position: center 12px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

.cs-inner {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
}
.cs-title {
  max-width: 640px;
  margin-bottom: clamp(44px, 5.5vw, 72px);
  font-size: var(--fs-section-title);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.cs-title em { font-style: normal; color: var(--accent); }

/* ─── Three columns, hairline-divided ─────────────────────────────────── */
/* Each item spans two shared rows (statement, text) via
   subgrid, so all three line up across the columns whatever wraps */
.cs-list {
  --cs-gap: clamp(40px, 5.2vw, 80px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto;
  column-gap: var(--cs-gap);
}
.cs-item {
  position: relative;
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  align-content: start;
}
.cs-item + .cs-item::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--cs-gap) / -2);
  width: 1px;
  background: var(--border-strong);
}


/* Big printed line, with room above each line for the pen */
.cs-statement {
  margin: 0 0 18px;
  padding-top: 0.45em;
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 600;
  line-height: 2.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.cs-text {
  max-width: 360px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ─── The edit ────────────────────────────────────────────────────────── */
.cs-edit {
  position: relative;
  display: inline-block;
  line-height: 1.2;
}
.cs-old {
  color: var(--cs-old);
  transition: color 0.3s ease-out 0.6s;
}
.cs-scribble {
  position: absolute;
  left: -5%;
  top: 22%;
  width: 110%;
  height: 62%;
  overflow: visible;
  fill: none;
  stroke: var(--cs-ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  clip-path: inset(-6px -6px -6px -6px);
  transition: clip-path 0.45s cubic-bezier(0.65, 0, 0.35, 1) 0.35s;
}
.cs-scribble path { vector-effect: non-scaling-stroke; }
.cs-scribble path + path { stroke-width: 2; opacity: 0.85; }

.cs-caret {
  position: absolute;
  left: 50%;
  bottom: -0.34em;
  width: 0.5em;
  height: 0.32em;
  overflow: visible;
  fill: none;
  stroke: var(--cs-ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateX(-50%);
  transition:
    opacity 0.2s ease-out 0.8s,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s;
}

.cs-new {
  position: absolute;
  left: 50%;
  bottom: 88%;
  font-family: 'Caveat', cursive;
  font-size: 0.98em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--cs-promise);
  transform: translateX(-50%) rotate(-3deg);
  clip-path: inset(-0.3em -0.2em -0.3em -0.2em);
  transition: clip-path 0.6s var(--ease-out) 0.95s;
}

/* Before the item is revealed: the vendor line, untouched */
html.has-js .cs-item:not(.is-visible) .cs-old      { color: var(--text-primary); }
html.has-js .cs-item:not(.is-visible) .cs-scribble { clip-path: inset(-6px 100% -6px -6px); }
html.has-js .cs-item:not(.is-visible) .cs-caret    { opacity: 0; transform: translateX(-50%) scale(0.3); }
html.has-js .cs-item:not(.is-visible) .cs-new      { clip-path: inset(-0.3em 100% -0.3em -0.2em); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .cs-list { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 64px; }
  .cs-item { display: flex; flex-direction: column; grid-row: auto; }
  .cs-item + .cs-item::before {
    top: -32px; bottom: auto;
    left: 0; right: 0;
    width: auto; height: 1px;
  }
  .cs-text { max-width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-old, .cs-scribble, .cs-caret, .cs-new { transition: none; }
}
