/*
 * Site footer. lib/chrome.mjs writes the markup and scripts/build_site_chrome.mjs
 * stamps it into every page together with the <link> that loads this file. It
 * loads from inside the footer block because the homepage runs on a year-cached
 * bundle (css/home-20261004.css) that never sees an edit to style.css.
 *
 * After any edit here, bump FOOT_CSS in lib/chrome.mjs and rebuild. The
 * Cloudflare zone keeps CSS at the edge for hours.
 *
 * The footer sits on --navy. Small text there needs --ink-dim or stronger:
 * --ink-soft measures 4.49:1 on the light skin's --navy, under the 4.5:1 floor.
 *
 * Older rules for a bare `footer` still live in style.css and the homepage
 * bundle (pages with hand-written footers use them). Everything here is scoped
 * to .site-foot and wins over those on specificity.
 */

footer.site-foot {
  position: relative;
  z-index: 10;
  padding: 0;
  background: var(--navy);
  border-top: 1px solid var(--hairline);
  color: var(--ink-dim);
}

.site-foot .sf-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding-top: 3.6rem;
  padding-bottom: max(2.2rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(1.4rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.4rem, env(safe-area-inset-right, 0px));
}

/* ---- the sign-off line */
.site-foot .sf-sign {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

/* ---- about + contact, then the link groups */
.site-foot .sf-grid {
  display: grid;
  gap: 3rem;
  margin-top: 2.4rem;
  padding-top: 2.4rem;
  border-top: 1px solid var(--hairline);
}

.site-foot .sf-brand {
  display: grid;
  gap: 1.8rem;
  align-content: start;
  min-width: 0;
}

.site-foot .sf-entity {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 60ch;
}
.site-foot .sf-entity a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-foot .sf-contact {
  font-style: normal;
  display: grid;
  gap: 0.1rem;
  align-content: start;
}
.site-foot .sf-contact a {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  align-items: baseline;
  column-gap: 1rem;
  padding-block: 0.4rem;
  color: var(--ink);
}
.site-foot .sf-k { color: var(--ink-dim); }
.site-foot .sf-v {
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.site-foot .sf-contact a:hover .sf-v { text-decoration: underline; text-underline-offset: 3px; }
.site-foot .sf-nw { white-space: nowrap; }

/* Each group spans two rows of the parent grid (heading, list) through subgrid, so a
   heading that wraps on a phone ("Websites & Systems") pushes its whole row down
   together and the lists side by side still start on one line. Spacing is margin,
   not row-gap: a subgrid shares the parent's row gaps, which would also open up
   between a heading and its own list. */
.site-foot .sf-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  min-width: 0;
}

.site-foot .sf-group {
  min-width: 0;
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
}

.site-foot .sf-h {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--accent-text);
  margin-bottom: 0.8rem;
  align-self: end;
}

.site-foot .sf-group ul { margin-bottom: 2.4rem; }

.site-foot .sf-group ul,
.site-foot .sf-legal { list-style: none; }

/* each link is a 30px+ tall target: WCAG 2.2 target size wants 24 */
.site-foot .sf-group a {
  display: inline-block;
  padding-block: 0.3rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-dim);
}
.site-foot .sf-group a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-foot a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
/* on a contact row, mark the value only, not the label beside it */
.site-foot .sf-contact a[aria-current="page"] { text-decoration: none; }
.site-foot .sf-contact a[aria-current="page"] .sf-v { text-decoration: underline; text-underline-offset: 4px; }

/* ---- the base line: name, legal, back to top.
   margin-top is short because the last row of link lists already carries 2.4rem below it. */
.site-foot .sf-base {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-dim);
}
.site-foot .sf-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.6rem;
}
.site-foot .sf-legal a,
.site-foot .to-top {
  display: inline-block;
  padding: 0.55rem 0;
  margin: 0;
  color: var(--ink-dim);
}
.site-foot .sf-legal a:hover,
.site-foot .to-top:hover { color: var(--ink); }

/* thicker ring than the site default, on a tinted surface */
.site-foot :is(a, button):focus-visible { outline-width: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .site-foot a,
  .site-foot .to-top { transition: color 0.2s ease; }
}

@media (min-width: 640px) {
  .site-foot .sf-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-foot .sf-brand {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    column-gap: 3rem;
  }
  .site-foot .sf-base {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 2rem;
  }
}

@media (min-width: 701px) {
  .site-foot .sf-inner {
    padding-top: 4.6rem;
    padding-bottom: max(2.4rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(2.2rem, env(safe-area-inset-left, 0px));
    padding-right: max(2.2rem, env(safe-area-inset-right, 0px));
  }
}

@media (min-width: 1024px) {
  .site-foot .sf-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
    column-gap: 4.5rem;
  }
  .site-foot .sf-brand { grid-template-columns: minmax(0, 1fr); }
  /* legal goes right only where the base line fits on one row; on a tablet it
     wraps, and a lone right-aligned pair on its own line looked stranded */
  .site-foot .sf-legal { margin-left: auto; }
}
