/* ==========================================================================
   GNC SG — Footer Layout
   ========================================================================== */

.site-footer {
  background-color: var(--color-footer-bg);
  color: var(--color-text-inverse);
  padding-top: var(--space-12);
  padding-bottom: var(--space-8);
}

.site-footer a {
  color: var(--color-grey-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: var(--color-white);
  text-decoration: none;
}

/* ---- 5-column grid ---- */

.footer-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .footer-columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

/*
 * The five columns are not evenly sized in footer.png. Measuring the heading
 * positions at the design's 1920px width — brand at x=260, FUNCTION 806,
 * CATEGORY 1172, ABOUT GNC 1353, LEGAL 1540, content ending at 1660 — and
 * subtracting the 40px gaps gives 506 / 326 / 141 / 147 / 120, which sums to
 * exactly 1240, the 1400px content box less its four gutters. Those are the
 * ratios below.
 *
 * The width matters beyond fidelity: FUNCTION carries a two-up link grid, and
 * an even 1fr split left each sub-column at 88px, which wrapped
 * "Pro-performance" onto two lines.
 */
@media (min-width: 1024px) {
  .footer-columns {
    grid-template-columns: 4.22fr 2.72fr 1.18fr 1.23fr 1fr;
    gap: var(--space-10);
  }
}

/* ---- Footer column ---- */

.footer-col__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-white);
  margin-bottom: var(--space-4);
}

/*
 * js/footer-accordion.js wraps every column title in a <button>, at every
 * width — it has to, so the columns can collapse and expand as the viewport
 * crosses 768px without a reload. Above that breakpoint the button must be
 * invisible as a control and read purely as the heading it replaced, which is
 * what these resets do; without them the browser's default button chrome
 * (border, grey fill, centred text) lands in the middle of the footer.
 */
.footer-col__toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: default;
}

/* Only meaningful once the columns actually collapse. */
.footer-col__chevron {
  display: none;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-col a {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

/* ---- FUNCTION column: 2-column link grid (matches design) ---- */

.footer-col--function ul {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 var(--space-8);
}

/* ---- Brand column (first column, wider) ---- */

.footer-col--brand {
  padding-right: var(--space-8);
}

.footer-col--brand .footer-logo {
  height: 40px;
  width: auto;
  margin-bottom: var(--space-4);
}

.footer-col--brand p {
  font-size: var(--font-size-sm);
  color: var(--color-grey-400);
  line-height: var(--line-height-relaxed);
  margin-bottom: 0;
}

/* ---- Mobile: columns become accordions ----
   js/footer-accordion.js wraps each column title in a button and toggles
   .is-open. All sections start collapsed. */

@media (max-width: 767px) {
  .footer-columns {
    gap: 0;
  }

  .footer-col--collapsible {
    border-top: 1px solid var(--color-footer-rule);
  }

  .footer-col--collapsible .footer-col__title {
    margin-bottom: 0;
  }

  .footer-col__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 52px;
    padding: var(--space-3) 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    cursor: pointer;
  }

  .footer-col__chevron {
    display: block;
    flex: none;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform var(--transition-base);
  }

  .footer-col--collapsible.is-open .footer-col__chevron {
    transform: rotate(180deg);
  }

  .footer-col--collapsible ul {
    display: none;
    padding-bottom: var(--space-4);
  }

  .footer-col--collapsible.is-open ul {
    display: block;
  }

  /* The FUNCTION column is a 2-up grid on desktop; stacked here. */
  .footer-col--function ul {
    grid-template-columns: 1fr;
  }

  .footer-col li {
    margin-bottom: var(--space-3);
  }
}

/* ---- Bottom bar (copyright) ---- */

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-footer-rule-strong);
}

.footer-bottom p {
  font-size: var(--font-size-xs);
  color: var(--color-grey-500);
  margin: 0;
}
