:root { --footer-sky: #0b7aca; }

main > :is(.final-cta, .contact):last-child { background: var(--footer-sky); }
main > :is(.final-cta, .contact):last-child p { color: var(--white); }
main > :is(.final-cta, .contact):last-child::after { display: none; }

.site-footer {
  --footer-text: #c4d1d7;
  --footer-accent: #6ee7b7;
  padding: 0;
  color: var(--white);
  background: var(--ink);
  overflow-wrap: anywhere;
}

.footer-panorama {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 1;
  overflow: hidden;
}

.footer-panorama img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.footer-panorama::before,
.footer-panorama::after {
  position: absolute;
  z-index: 1;
  inset-inline: 0;
  pointer-events: none;
  content: "";
}

/* The sky joins only pages whose final section is the blue enquiry CTA. */
main:has(> :is(.final-cta, .contact):last-child) + .site-footer .footer-panorama::before {
  top: 0;
  height: 20%;
  background: linear-gradient(
    to bottom,
    var(--footer-sky),
    color-mix(in srgb, var(--footer-sky) 86%, transparent) 16%,
    color-mix(in srgb, var(--footer-sky) 45%, transparent) 50%,
    transparent
  );
}

.footer-panorama::after {
  bottom: 0;
  height: 38%;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--ink) 30%, transparent) 32%,
    color-mix(in srgb, var(--ink) 82%, transparent) 70%,
    var(--ink) 96%
  );
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
  gap: 36px;
  padding-block: 48px 52px;
}

.footer-main > * { min-width: 0; }

.site-footer .footer-brand {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 52px;
}

.site-footer .footer-brand img { width: 232px; max-width: 100%; height: auto; }
.footer-brand-block > p { max-width: 30ch; margin: 24px 0 0; color: var(--footer-text); font-size: 1rem; line-height: 1.65; }
.footer-contact { max-width: 32ch; margin-top: 12px; color: var(--footer-text); font-size: .875rem; font-style: normal; line-height: 1.7; }
.footer-contact a { display: inline-block; min-height: 44px; padding-block: 8px; color: var(--footer-accent); text-underline-offset: 4px; }

.footer-project-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  max-width: 100%;
  min-height: 52px;
  margin-top: 24px;
  padding-block: 10px;
  border-bottom: 1px solid var(--footer-accent);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.footer-project-link span { flex: 0 0 auto; color: var(--footer-accent); transition: transform 180ms ease-out; }
.footer-nav h2 { display: flex; align-items: center; min-height: 52px; margin: 0 0 16px; color: var(--white); font-size: 1rem; font-weight: 600; line-height: 1.5; letter-spacing: 0; }
.footer-nav ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.footer-nav a, .footer-legal a { display: flex; align-items: center; width: fit-content; min-width: 44px; max-width: 100%; min-height: 44px; padding-block: 8px; color: var(--footer-text); font-size: .9375rem; line-height: 1.5; text-underline-offset: 5px; transition: color 160ms ease-out; }
.site-footer a:focus-visible { outline: 2px solid var(--footer-accent); outline-offset: 5px; box-shadow: none; }
.footer-nav a:focus-visible, .footer-legal a:focus-visible, .footer-project-link:focus-visible { color: var(--footer-accent); text-decoration: underline; }

.site-footer .footer-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 32px;
  padding-block: 22px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid rgb(255 255 255 / 18%);
  color: var(--footer-text);
}

.footer-meta p { margin: 0; font-size: .8125rem; line-height: 1.6; }
.footer-meta p + p { margin-top: 4px; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-legal a { font-size: .8125rem; }
.footer-back-to-top { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgb(255 255 255 / 40%); border-radius: 50%; color: var(--white); font-size: 1.5rem; line-height: 1; transition: border-color 160ms ease-out, background-color 160ms ease-out; }

@media (hover: hover) and (pointer: fine) {
  .footer-nav a:hover, .footer-legal a:hover, .footer-project-link:hover { color: var(--footer-accent); text-decoration: underline; }
  .footer-back-to-top:hover { border-color: var(--footer-accent); background: rgb(110 231 183 / 10%); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .footer-project-link:hover span { transform: translate(2px, -2px); }
}

@media (min-width: 861px) and (max-width: 1120px) {
  .footer-main { grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 28px; }
}

@media (max-width: 860px) {
  .footer-main { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-block: 32px 40px; }
  .footer-brand-block { grid-column: 1 / -1; padding-bottom: 24px; border-bottom: 1px solid rgb(255 255 255 / 18%); }
  .footer-brand-block > p { max-width: 48ch; }
  .footer-nav h2 { min-height: 32px; margin-bottom: 12px; }
  .site-footer .footer-bottom { gap: 20px; }
}

@media (max-width: 620px) {
  .footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
  .footer-nav:last-child { grid-column: 1 / -1; }
  .footer-nav:last-child ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .site-footer .footer-bottom { grid-template-columns: minmax(0, 1fr) 48px; }
  .footer-legal { grid-column: 1; gap: 4px 20px; }
  .footer-back-to-top { grid-column: 2; grid-row: 1 / 3; align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .site-footer a, .footer-project-link span { transition: none; }
}
