/* Secondary page footers use the homepage's spacing and contact composition. */
body.site-v3:not(.home-page) footer.footer.site-footer {
  display: flex;
  flex-direction: column;
  padding-top: 0 !important;
}

/* Scene detail rules have a more specific section spacing declaration. */
body.site-v3.scene-detail-page:not(.home-page) footer.footer.site-footer.scene-footer {
  padding-top: 0 !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-grid {
  min-height: 206px;
  align-items: center !important;
  padding: 0 !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-grid > div:not(.footer-brand-block) {
  align-items: center !important;
  text-align: center !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-brand-block,
body.site-v3:not(.home-page) footer.footer.site-footer .footer-brand-block > p,
body.site-v3:not(.home-page) footer.footer.site-footer .footer-grid :is(h3, a, address, small, figcaption) {
  text-align: center !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-brand {
  justify-content: center;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact {
  display: grid !important;
  grid-template-columns: 96px minmax(0, 1fr);
  align-content: center;
  align-items: center !important;
  gap: 3px 12px;
  min-width: 0;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact h3 {
  grid-column: 2;
  width: 100%;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact > a,
body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact address {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact address {
  max-width: none;
  margin: 0;
  overflow-wrap: anywhere;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact > a[href^="mailto:"] {
  overflow-wrap: anywhere;
  word-break: normal;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact .footer-qrcode {
  grid-column: 1;
  grid-row: 2 / span 4;
  align-self: center;
  justify-self: center;
  width: 96px;
  margin: 0;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-qrcode img {
  width: 96px;
  height: 96px;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom {
  display: flex !important;
  min-height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: flex-start !important;
  gap: 0 16px;
  padding-block: 0;
  text-align: left !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom > span {
  text-align: left !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom > div {
  display: flex;
  justify-content: flex-end !important;
  flex-wrap: nowrap;
  gap: 8px 12px;
  margin: 0 0 0 auto !important;
  text-align: right !important;
}

body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom > div a {
  text-align: right !important;
}

/* About pages share the same red footer rhythm and QR/contact split. */
footer.about-footer .about-footer__top {
  min-height: 206px;
  align-items: center;
  padding-block: 0;
}

footer.about-footer .about-footer__brand,
footer.about-footer .about-footer__col,
footer.about-footer .about-footer__contact {
  justify-items: center;
  text-align: center;
}

footer.about-footer .about-footer__bottom {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: flex-start;
  gap: 0 16px;
  padding-block: 0;
  text-align: left;
}

footer.about-footer .about-footer__bottom > span { text-align: left; }
footer.about-footer .about-footer__bottom-links { margin-left: auto; justify-content: flex-end; flex-wrap: nowrap; gap: 8px 12px; }
footer.about-footer .about-footer__bottom-links a { text-align: right; }

footer.about-footer .about-footer__contact {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 3px 12px;
  min-width: 0;
}

footer.about-footer .about-footer__contact h3 {
  grid-column: 2;
  width: 100%;
}

footer.about-footer .about-footer__contact > a,
footer.about-footer .about-footer__contact address {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

footer.about-footer .about-footer__contact address {
  overflow-wrap: anywhere;
}

footer.about-footer .about-footer__contact > a[href^="mailto:"] {
  overflow-wrap: anywhere;
  word-break: normal;
}

footer.about-footer .about-footer__contact .footer-qrcode {
  grid-column: 1;
  grid-row: 2 / span 3;
  align-self: center;
  justify-self: center;
  width: 96px;
  margin: 0;
}

footer.about-footer .about-footer__contact .footer-qrcode img {
  width: 96px;
  height: 96px;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

footer.about-footer .about-footer__contact .footer-qrcode figcaption {
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 640px) {
  body.site-v3:not(.home-page) footer.footer.site-footer { padding-top: 0 !important; }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-grid {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 14px;
    padding-bottom: 5px !important;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-brand-block,
  body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact {
    grid-column: 1 / -1;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-grid > div:not(.footer-brand-block) {
    align-items: center !important;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact {
    grid-template-columns: 96px minmax(0, 1fr);
    align-content: center;
    align-items: center !important;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-contact .footer-qrcode img {
    width: 96px;
    height: 96px;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom {
    display: grid !important;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    min-height: 0;
    flex-basis: auto;
    gap: 4px 12px;
    padding: 5px 0 0;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom > div {
    grid-column: 1 / -1;
    justify-content: space-between !important;
    width: 100%;
    margin: 4px 0 0 !important;
    text-align: left !important;
  }

  body.site-v3:not(.home-page) footer.footer.site-footer .footer-bottom > div a {
    text-align: left !important;
  }

  footer.about-footer .about-footer__top {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 14px;
    padding: 0 0 5px;
  }

  footer.about-footer .about-footer__brand,
  footer.about-footer .about-footer__contact {
    grid-column: 1 / -1;
  }

  footer.about-footer .about-footer__bottom {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    min-height: 0;
    gap: 4px 12px;
    padding: 5px 0 0;
  }

  footer.about-footer .about-footer__bottom-links {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 8px 14px;
    margin: 4px 0 0;
  }

  footer.about-footer .about-footer__bottom-links a { text-align: left; }
}

/* Keep every public footer on the same content rail and finish it with the brand red rule. */
body.site-v3 .site-footer,
footer.about-footer {
  border-bottom: 3px solid var(--brand-red, #b5222a);
}

body.site-v3 .site-footer > .footer-grid,
body.site-v3 .site-footer > .footer-bottom,
footer.about-footer > :is(.about-footer__top, .about-footer__bottom) {
  width: min(var(--site-max-width, 1280px), calc(100% - (var(--site-gutter, 24px) * 2)));
  margin-inline: auto;
}
