@layer footer {
  .footer {
    background: #0F0B0A;
    color: oklch(80% 0.005 60);
    padding-block: 64px 48px;
    position: relative;
    margin-top: auto; /* sticky footer — see body rule in system.css */
  }

  /* ── Top: Brand header — full width ── */
  .footer-top {
    margin-bottom: 48px;
  }
  .footer-top .nav-logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
  }
  .footer-top .logo-text { color: #fff; }
  .footer-top .logo-dk {
    color: oklch(60% 0.02 60);
    font-weight: 400;
  }
  .footer-top p {
    font-size: 14px;
    line-height: 1.7;
    color: oklch(60% 0.01 60);
    max-width: 48ch;
    margin: 0;
  }

  /* ── Nav grid: 4 equal columns, headers start at same Y ── */
  .footer-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    align-items: start;
  }

  .footer-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .footer-group .footer-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: oklch(50% 0.01 60);
    font-weight: 600;
    margin: 0;
    padding: 0;
    line-height: 1;
  }
  .footer-group a {
    font-size: 14px;
    color: oklch(68% 0.01 60);
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1.4;
  }
  .footer-group a:hover {
    color: #fff;
  }

  /* "Cookie settings", injected into this column by js/consent.js. A <button>
     because it reopens the consent banner rather than navigating, so it needs
     the button chrome stripped back to match the <a> siblings above it. */
  .footer-cookies {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font-size: 14px;
    font-family: inherit;
    color: oklch(68% 0.01 60);
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease;
  }
  .footer-cookies:hover,
  .footer-cookies:focus-visible {
    color: #fff;
  }

  /* ── Bottom bar ── */
  .footer-bottom {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid oklch(100% 0 0 / 0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: oklch(45% 0.01 60);
  }
  .footer-social {
    display: flex;
    gap: 8px;
  }
  .footer-social a {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: oklch(100% 0 0 / 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: oklch(70% 0.01 60);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  }
  .footer-social a:hover {
    background: oklch(100% 0 0 / 0.12);
    color: #fff;
    transform: translateY(-2px);
  }

  @media (max-width: 900px) {
    .footer { padding-block: 48px 32px; }
    .footer-nav { grid-template-columns: repeat(2, 1fr); gap: 32px; }
    .footer-top p { max-width: none; }
  }
  @media (max-width: 640px) {
    .footer { padding-block: 36px 24px; }
    .footer-nav { grid-template-columns: 1fr; gap: 28px; }
    .footer-group a, .footer-cookies { font-size: 13px; }
    .footer-bottom { flex-direction: column; text-align: center; gap: 8px; font-size: 12px; }
  }
}

/* The two switches injected into the footer bottom bar by js/dom.js — "Reduce
   animations" and "Dark mode". Same control, same chrome; they share every rule
   below. Unlayered so they sit above @layer footer without needing to live
   inside it. */
.footer-motion-toggle,
.footer-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 4px 2px;
  font-size: 13px;
  color: oklch(70% 0.01 60);
  cursor: pointer;
  transition: color 0.2s ease;
}
.footer-motion-toggle:hover,
.footer-theme-toggle:hover { color: #fff; }
.footer-motion-toggle .fmt-switch,
.footer-theme-toggle .fmt-switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: oklch(100% 0 0 / 0.14);
  transition: background 0.2s ease;
}
.footer-motion-toggle .fmt-switch::after,
.footer-theme-toggle .fmt-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.footer-motion-toggle.active .fmt-switch,
.footer-theme-toggle.active .fmt-switch { background: #5962C0; }
.footer-motion-toggle.active .fmt-switch::after,
.footer-theme-toggle.active .fmt-switch::after { transform: translateX(14px); }
.footer-motion-toggle:focus-visible,
.footer-theme-toggle:focus-visible { outline: 2px solid #5962C0; outline-offset: 3px; border-radius: 6px; }

/* Desktop: the bottom bar is a row with justify-content:space-between, which
   strands the toggle in the dead centre. Push it (and the social icons after it)
   to the right so it reads as a utility control grouped with the social links,
   leaving the copyright alone on the left. Mobile keeps the stacked centred layout. */
@media (min-width: 641px) {
  /* The pair travels together: the first one pushed right takes the rest of
     the row with it. */
  .footer-theme-toggle { margin-left: auto; }
  .footer-motion-toggle { margin-right: 4px; }
}
