/* .footer — the site footer (footer spec 2026-11-27, D2), on every page that uses the layout.
   Its layout is the compositions in the HTML (the tree in docs/analysis/2026-11-27-footer/footer.md);
   this file holds only what T6–T8's tries prove nothing else gives. No rule reads what comes before
   the footer (25.5). */

.footer {
  --footer-out: max(0px, (100cqi - var(--measure-page)) / 2); /* the room right of the 1920 box, 0 up to 1920 (as cta.css --cta-out); 100cqi: the window without its scrollbar (html, globals.css) */
}

/* The glow (D2; footer.md "## T6"): a diagonal band of light in the bottom-right that fades in, peaks
   and fades back toward the corner, like a wave (Mitchell, live 2026-11-30: two stops ended brightest
   in the corner; a radial oval read as a "blob"); strength judged live (ruling 7). A layer behind the
   footer (it isolates) that runs on to the window's right edge, so past 1920 the room there can fade
   out (a mask) without fading the words; the band itself stays with the dot triangle (Mitchell,
   2026-12-01: "why does the gradient follow the width of the screen and not stay with the triangle?",
   then "it should be fading out"). */
.footer::before {
  /* The band's end: the dot triangle's corner (the content's right edge), measured back from the
     window's corner along the 135deg line (cos 45deg). */
  --footer-glow-end: calc((var(--page-side-right) + var(--footer-out)) * 0.7071068);
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--footer-out)) 0 0;
  z-index: -1;
  background: linear-gradient(135deg, /* a set angle and stops measured back from the corner, so a tall
      phone footer keeps the band in its bottom corner (Mitchell, iPhone 2026-12-01: "one long gradient
      that stretches all the way down the page"); 135deg lays the band's edges at 45deg, along the dot
      triangle's long side (Mitchell, 2026-12-01); the band's length is the 1440 look */
      transparent calc(100% - var(--footer-glow-end) - var(--footer-glow) * 1),
      hsl(var(--color-blue-base-hsl) / var(--alpha-10)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.83),
      hsl(var(--color-blue-base-hsl) / var(--alpha-20)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.69),
      hsl(var(--color-blue-base-hsl) / var(--alpha-30)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.58),
      hsl(var(--color-blue-base-hsl) / var(--alpha-40)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.47),
      hsl(var(--color-blue-base-hsl) / var(--alpha-40)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.39), /* a short plateau, not a single peak: the crest read as a line (Mitchell, live 2026-11-30) */
      hsl(var(--color-blue-base-hsl) / var(--alpha-30)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.28),
      hsl(var(--color-blue-base-hsl) / var(--alpha-20)) calc(100% - var(--footer-glow-end) - var(--footer-glow) * 0.17),
      hsl(var(--color-blue-base-hsl) / var(--alpha-10)) calc(100% - var(--footer-glow-end))); /* and on into the corner, as up to 1920 */
  mask-image:
    linear-gradient(to left, transparent, var(--color-black) var(--footer-out)), /* past 1920 the room right of the box fades out to the window's edge; up to 1920 all shown */
    linear-gradient(to bottom, transparent, var(--color-black) 50%); /* and the band fades out toward the footer's top, so it never ends on a line there (Mitchell, 2026-12-01: "it doesn't reach all the way to the top of the footer, so it makes this line") */
  mask-composite: intersect; /* both fades at once */
}

/* The lists' links at half the stack's default gap (Mitchell, live on 3002, 2026-11-30: "half that amount"). */
.footer nav ul {
  --stack-space: var(--space-2xs-xs);
}

/* The lists fill the row (Mitchell, live 2026-11-30): auto-fit collapses empty tracks (25.12), the
   minimum sets how many fit (25.10), each track as wide as its list, the first at the left edge, the
   last at the right, the spare room shared between them. The grid composition has no knob for the
   track's maximum, so the template is set here. */
.footer nav {
  grid-template-columns: repeat(auto-fit, minmax(min(var(--footer-col-min), 100%), max-content));
  row-gap: var(--space-xl); /* stacked lists apart, the same room as above the lists (Mitchell, live 2026-11-30) */
}

/* A small right-angle triangle of teal dots in the bottom-right corner, its two short sides even
   (Mitchell, iPhone 2026-12-01: "more even" than the first, a 16:9 cut): a square grid of whole tiles,
   cut along its diagonal with the diagonal's dots kept whole; behind the text (the footer isolates). */
.footer [data-dots] {
  /* The last dots' right edge on the content's, where "Request a Quote" ends (Mitchell, live 2026-11-30):
     each dot sits centred in its tile, so out by half a tile less the dot's radius. */
  inset-inline-end: calc(var(--page-side-right) - var(--space-s) / 2 + var(--space-4xs) * 0.75);
  z-index: -1;
  inline-size: var(--footer-dots-w); /* a whole number of tiles, so the diagonal runs through dot centres */
  aspect-ratio: 1;
  background: radial-gradient(circle, hsl(var(--color-blue-base-hsl) / var(--alpha-60)) calc(var(--space-4xs) * 0.75), transparent 0) 100% 100% / var(--space-s) var(--space-s); /* tiled from the bottom-right, so the right column is whole */
  clip-path: polygon(calc(100% - var(--space-s) / 2) 0, 100% 0, 100% 100%, 0 100%, 0 calc(100% - var(--space-s) / 2)); /* the lower-right triangle, its line half a tile out so the diagonal's dots stay whole */
}
