/*
 * KAN-37: footer rework.
 * - The footer columns stay on black. As in the ticket mockup, a white band
 *   sits directly above them (.footer-logos, see page.html.twig) with the
 *   "Our venues", "Our funders" and "Our supporters" logo walls. Each wall
 *   is fed by an editable block placed in the matching theme region (venues,
 *   funders, supporters), so the black logo versions show on a light
 *   background. The band shows on every page, the Partnerships page
 *   included, so these blocks have no second placement there.
 * Loaded as a separate stylesheet: the theme's main CSS is Compass/SASS-built
 * and that Ruby compile chain does not run in the local environment.
 *
 * Fluid sizes are Utopia clamps computed with themer lib/fluid_clamp.py
 * (anchors 360px and 1440px viewport), never hand-written.
 */

/* Footer columns: once the third column is empty (its funder logos moved to
   the "Our funders" wall), the newsletter and "Follow us" blocks take its
   place instead of leaving a hole. The 800px query is the theme's own
   column breakpoint (breekpunt medium), a layout jump rather than a size. */
@media (min-width: 800px) {
  .footer .footercolumns:not(:has(.region-footer3)) .region-footer1,
  .footer .footercolumns:not(:has(.region-footer3)) .region-footer2 {
    grid-row: 1 / span 2;
  }

  .footer .footercolumns:not(:has(.region-footer3)) .region-footer5 {
    grid-column: 3 / span 2;
    grid-row: 1;
    padding-top: 0;
  }

  .footer .footercolumns:not(:has(.region-footer3)) .region-footer4 {
    grid-column: 3 / span 2;
    grid-row: 2;
  }
}

/* The white logo band above the black footer. The horizontal padding mirrors
   the footer's own (mixin mobilepadding: 5%, 2% from 800px) so the walls line
   up with the footer columns below them. */
.footer-logos {
  clear: both;
  background: #fff;
  color: #000;
  padding: clamp(2rem, 1.3333rem + 2.963vw, 4rem) 5%;
}

@media (min-width: 800px) {
  .footer-logos {
    padding-left: 2%;
    padding-right: 2%;
  }
}

/* WHY: 2500px is the theme's $maxsitewidth, the same cap the footer columns
   use, so the band content never runs wider than the rest of the site. */
.footer-logos > .inner {
  width: 100%;
  max-width: 2500px;
  margin-left: auto;
  margin-right: auto;
}

.footer-logos a {
  color: inherit;
}

/* Vertical rhythm between the stacked logo walls. */
.footer-logos .logo-wall + .logo-wall {
  margin-top: clamp(2rem, 1.3333rem + 2.963vw, 4rem);
}

/* Section headings ("Our venues", "Our funders", "Our supporters") share one
   size. The venues heading was white for the black footer
   (.region-venues h2), so the colour is reset to the band's text colour.
   WHY the ID selector: the main stylesheet sizes the venues heading with
   #block-views-block-venues-white-logos-block-1 h2 (2.1rem, no bottom
   margin), which outranks .footer-logos h2; this selector restores the
   shared heading inside the band. */
.footer-logos h2,
.footer-logos #block-views-block-venues-white-logos-block-1 h2 {
  color: inherit;
  font-size: clamp(1.5rem, 1.2917rem + 0.9259vw, 2.125rem);
  margin: 0 0 clamp(0.875rem, 0.625rem + 1.1111vw, 1.625rem);
}

/* Venues: the logo carousel had a white rule under it for the black footer. */
.footer-logos .view-venues-white-logos {
  border-bottom: 0;
}

/* Funders: partner logos on one flowing row, with the funding disclaimer
   alongside them. */
.footer-logos .funders .field--name-body,
.logo-wall__logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1.5rem, 1rem + 2.2222vw, 3rem);
}

.logo-wall__text {
  flex: 1 1 20rem;
  font-size: clamp(0.8125rem, 0.7708rem + 0.1852vw, 0.9375rem);
  line-height: 1.4;
}

.logo-wall__text p {
  margin: 0;
}

.logo-wall__text p + p {
  margin-top: clamp(0.75rem, 0.5rem + 1.1111vw, 1.5rem);
}

/* One shared logo height, so a small source file (Pro Helvetia) matches the
   others; the width follows each logo's own aspect ratio. */
.footer-logos .funders img {
  display: block;
  height: clamp(2.5rem, 2rem + 2.2222vw, 4rem);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Supporters: a responsive grid of equally sized logo cells. The block is a
   "Logo wall" (block type logo_wall) with one logo_link paragraph per logo,
   each optionally linked (paragraph--logo-link.html.twig); every paragraph
   is one grid cell. */
.footer-logos .supporters .field--name-field-logo-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(4.5rem, 3.7083rem + 3.5185vw, 6.875rem), 1fr));
  gap: clamp(0.75rem, 0.5rem + 1.1111vw, 1.5rem);
  align-items: center;
}

/* The link and the media wrappers inside a cell fill it, so a linked and an
   unlinked logo get the same size. */
.logo-wall__item,
.logo-wall__link,
.logo-wall__item .media {
  display: block;
}

.footer-logos .supporters img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
}

/* A linked logo shows a clear keyboard focus ring (WCAG 2.4.7). The ring
   takes the text colour, black on the white band (.footer-logos a inherits
   it); the 2px width and offset are a focus detail, not a size that
   scales. */
.logo-wall__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Quiet logo walls: on the white band every logo shows as a light grey
   (grayscale also tones down colour logos the team adds later) and returns
   to its own colours on hover or keyboard focus. Logos carry no contrast
   requirement (WCAG 1.4.3 exempts logotypes), and the alt text stays the
   accessible name. */
.footer-logos .logo-wall img {
  filter: grayscale(1);
  opacity: 0.4;
  transition: opacity 180ms cubic-bezier(0.25, 1, 0.5, 1),
    filter 180ms cubic-bezier(0.25, 1, 0.5, 1);
}

.footer-logos .logo-wall a:hover img,
.footer-logos .logo-wall a:focus-visible img,
.footer-logos .logo-wall img:hover {
  filter: none;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .footer-logos .logo-wall img {
    transition-duration: 120ms;
  }
}
