/* .cta — the home page's closing call to action (CTA redesign spec, 2026-11-26): a navy band (the
   picture's own navy, decision 51) with a teal line top and bottom (border-top border-bottom
   border-blue-base in the HTML); the section head and the two
   site buttons; a monochrome picture of the industries' equipment. The section is the band and
   the query container (review C4); its one div paints the picture and keeps room for it. Narrow
   first; at a band of 60rem and up the picture is behind the words (decision 46, review C5). */

/* The band's width as a length the heading can read (review C2): set on the band's div, where
   100cqi is the band (cta-band), and inherited as px, so the h2 inside the header's own container
   (cta) still reads the band, not the header. */
@property --cta-band-w {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.cta {
  --cta-phone-ratio: calc(1024 / 1410); /* cta-art-phone-*.webp, height / width (review H6) */
  --cta-fit: calc(0.92 / 11.79);        /* the wide heading: 92% of the band per em of "Need a Fastener Partner" (W2 11.79em, the larger of the web and fallback fonts; measure.md "T6 W2"). A new wording re-measures (decision 54). */
  container: cta-band / inline-size;
  background: var(--color-cta-band);
  /* Past 1920 (decision 57): the navy and both lines run on to the screen edges, the 1920 band is
     the div; the outside fades out over the inner half of its room. --cta-out, the room each side
     of the 1920 box, is 0 up to 1920, so nothing changes there. */
  --cta-out: max(0px, (100cqi - var(--measure-page)) / 2); /* 100cqi: the window without its scrollbar (html, globals.css) */
  /* lint-allow: restated(margin-inline) — 0 up to 1920, the widest shot size; it acts only past it; cta_test.rb "2560: past 1920 … to the screen edges" */
  margin-inline: calc(-1 * var(--cta-out));
  /* lint-allow: restated(padding-inline) — 0 up to 1920, the widest shot size; it acts only past it; cta_test.rb "2560: past 1920 … the 1920 band centred inside" */
  padding-inline: var(--cta-out);
  mask-image: linear-gradient(to right, transparent calc(var(--cta-out) / 2), var(--color-black) var(--cta-out) calc(100% - var(--cta-out)), transparent calc(100% - var(--cta-out) / 2));
}

/* Narrow: the words full width; the phone crop as a strip under the buttons, a little wider than
   the band so its floor runs off both sides, capped (decision 56); its outer 5% fades into the
   navy, which shows only when the cap holds. The fade is a gradient layer over the picture, not a
   mask (a mask on this div would fade the words too). The room under the buttons is the strip +
   --space-lg; above the heading, half the wide bottom space (decision 44). A plain url() first for
   browsers without image-set(); then 1x → 860, 2x and up → 1290 (review C7, H5). At the bottom,
   centred, once: bg-bottom bg-no-repeat in the HTML. */
.cta > div {
  --cta-band-w: 100cqi;                                                /* the band's width, for the heading's fit */
  --cta-pad-end: calc(var(--space-3xl) + var(--space-lg));             /* the mockup's 3xl + 30px (assumption 4; "Open for Mitchell" item 3) */
  --cta-strip-w: min(110cqi, var(--cta-strip-max));
  --cta-strip-fade: linear-gradient(to right, var(--color-cta-band), hsl(var(--color-cta-band-hsl) / 0) 5% 95%, var(--color-cta-band));
  padding-block: calc(var(--cta-pad-end) / 2) calc(var(--cta-strip-w) * var(--cta-phone-ratio) + var(--space-lg));
  /* lint-allow: restated(background-image) — the plain file for browsers without image-set() (Safari before 17; review C7, H5); kept by plan "Open for Mitchell" item 1 */
  background-image: var(--cta-strip-fade), url("/assets/cta-art-phone-860-0dc7bc64.webp");
  background-image: var(--cta-strip-fade), image-set(url("/assets/cta-art-phone-860-0dc7bc64.webp") 1x, url("/assets/cta-art-phone-1290-dd8507e0.webp") 2x);
  background-size: var(--cta-strip-w) calc(var(--cta-strip-w) * var(--cta-phone-ratio));
}

/* The heading (decision 53): mixed case, as the hero's h1; every other section stays uppercase. A
   strong navy shadow, as on a wide band it may cross the picture (decision 43): --shadow-heading,
   shared with the hero h1 (Mitchell 2026-11-27; was two CTA-only layers, ruled B 2026-11-26). */
.cta h2 {
  text-transform: none;
  text-shadow: var(--shadow-heading);
}

/* Wide: the whole picture behind the words (decision 43), sized to fit the band and at its bottom;
   the band is the words' height (Mitchell 2026-11-27: no min height, so a wide screen does not grow
   it; the picture shrinks to the band instead). Shifted right by 10% of the band, at most its 1440
   value (--cta-art-shift-max), its cut edge faded; when narrower than the band it sits 60% across,
   so 40% of the slack goes toward the words. The words at the top, --space-xl under the line; the
   text column 40% of the band, the gutter outside it (review M9). */
@container cta-band (width >= 60rem) {
  .cta > div {
    padding-block: var(--space-xl) var(--cta-pad-end);
    background:
      linear-gradient(to left, var(--color-cta-band), hsl(var(--color-cta-band-hsl) / 0) 15%),
      url("/assets/cta-art-91c2251c.webp") calc(60% + min(10cqi, var(--cta-art-shift-max))) bottom / contain no-repeat; /* 10% of the band past the right edge, clear of the words, its cut edge faded over the last 15% (Mitchell 2026-11-27, trial values) */
  }

  .cta header {
    box-sizing: content-box;
    max-inline-size: 40%;
  }

  /* The three lines as written, each unbroken (decision 40, review C1); they may run past the 40%
     column over the picture, never past the band's gutter (cta_test "inside the band's gutters"). */
  .cta h2 > span {
    display: block;
    white-space: nowrap;
  }

  /* The heading fits the band (review C2): the band's width × --cta-fit, at most the site h2 size,
     at least --step-3 (the phone h2 size at these widths; --h2-phone-cap, 9.2vw, is larger here). */
  .cta h2 {
    font-size: max(var(--step-3), min(var(--step-5), calc(var(--cta-band-w) * var(--cta-fit))));
  }
}

/* The two buttons: paragraph → buttons one step more than the head's gap, as News (globals.css,
   section header > div); not stretched to the header's width (items-start on the header, in the
   HTML); between them --space-lg (old decision 23). Equal size (old decision 36): a grid
   of equal tracks, each as wide as the wider button and rows as tall as the taller (stretched, so a
   label that wraps keeps them equal), one under the other until the header has room for both. */
.cta .cluster {
  --cluster-space: var(--space-lg);
  --cluster-vertical-alignment: stretch;
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-rows: 1fr;
}

/* An inline-size container: its width comes from its parent, never its content, so it must not sit
   in an auto-width track (it would collapse to nothing). Its own name: the band is cta-band. */
.cta header {
  container: cta / inline-size;
}

/* Side by side once both fit on one line each. Measured in Chrome (2026-11-25, windows 540-800, the
   phone text size): two of the wider button's one-line width plus the gap needs 550 px of header at
   a 620 window (552 px there), so 35rem (560 px, from a 628 window). On a wide band the header is
   40% of it (T5d), so the buttons stack on bands from 960 to about 1400 and sit side by side above.
   The desktop text is larger, so there the two can need a little more than the header: the grid is
   max-content wide, each track the wider one-line label (Mitchell, 2026-11-27: the arrow of "Contact
   our Team" wrapped at 1440), a few px past the 40% column, as the heading already runs. Never past
   the header's own box (its right gutter): a longer label wraps there, no sideways scroll. */
@container cta (width >= 35rem) {
  .cta .cluster {
    grid-auto-flow: column;
    inline-size: max-content;
    max-inline-size: calc(100% + var(--page-side-right));
  }
}
