/* ==========================================================================
   Shared site footer
   Markup: components/site-footer.js   Avatar: /js/site-footer.js
   Values mirror the sproutgoodhabits.com landing footer. Colours resolve
   through the page's theme tokens when present (docs.css `--docs-*`, then
   sprout-tokens.css `--theme-*`) and fall back to the landing-page hexes, so
   the footer matches its page in light and dark mode everywhere.
   ========================================================================== */

.site-footer {
  --site-footer-bg: var(--docs-bg-primary, var(--theme-bg-primary, #f5f5f2));
  --site-footer-fg: var(--docs-fg-primary, var(--theme-fg-primary, #262323));
  --site-footer-fg-muted: var(--docs-fg-secondary, var(--theme-fg-secondary, #5c5959));
  --site-footer-border: var(--docs-border-secondary, var(--theme-border-secondary, #dedddc));
  --site-footer-avatar-bg: var(--brand-100, #e0f2fe);

  background-color: var(--site-footer-bg);
  color: var(--site-footer-fg);
  border-top: 1px solid var(--site-footer-border);
  padding: 48px 40px 40px 40px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.site-footer-inner {
  max-width: 92rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.site-footer-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Brand column */
.site-footer-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 16px;
  color: var(--site-footer-fg);
  text-decoration: none;
}

.site-footer-logo img {
  /* Same size as the nav wordmark. */
  height: 16px;
  width: auto;
  max-width: calc(100% - 36px);
}

.site-footer-avatar {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--site-footer-avatar-bg);
  overflow: hidden;
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.site-footer-rive {
  position: absolute;
  left: 50%;
  top: -17px;
  transform: translateX(-50%);
  width: 86px;
  height: 92px;
  pointer-events: none;
}

.site-footer-coppa {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
}

.site-footer-coppa img {
  display: block;
  height: 40px;
  width: auto;
}

/* Link columns */
.site-footer-heading {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: inherit;
  color: var(--site-footer-fg);
}

.site-footer-link {
  display: block;
  padding: 4px 0;
  font-size: 13px;
  color: var(--site-footer-fg-muted);
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--site-footer-fg);
}

.site-footer-link:focus-visible,
.site-footer-logo:focus-visible,
.site-footer-coppa:focus-visible {
  outline: 2px solid var(--site-footer-fg);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Responsive
   >= 1160  four equal columns (brand + 3 link groups)
   641-1159 brand row on top, 3 link groups underneath (wordmark stays nav-size)
   <= 640   brand row, then link groups as a wrapping row: 3-up while they fit,
            otherwise 2-up with the last group spanning the row (no orphan column)
   Side padding steps down with the page content: 40 -> 24 -> 16px. */
@media (max-width: 1159px) {
  .site-footer-inner {
    grid-template-columns: repeat(3, 1fr);
  }
  .site-footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .site-footer {
    padding: 40px 24px 32px;
  }
}

@media (max-width: 640px) {
  .site-footer-inner {
    display: flex;
    flex-wrap: wrap;
  }
  .site-footer-brand {
    flex: 1 1 100%;
  }
  .site-footer-col:not(.site-footer-brand) {
    flex: 1 1 130px;
  }
}

@media (max-width: 480px) {
  .site-footer {
    padding: 40px 16px 32px;
  }
}

@media (max-width: 400px) {
  .site-footer-inner {
    gap: 24px;
  }
}
