/* Footer layout. The parent theme continues to own typography and colours. */
#widget-area-qube {
  & .footer-primary-layout {
    & .footer-primary-columns {
      display: flex;
      align-items: flex-start;
      gap: 28px;
      padding-top: 60px;

      & > .widget,
      & > .footer-icaew-mark {
        flex: 1 1 0;
        min-width: 0;
      }

      & > .widget {
        float: none;
        width: auto !important;
        margin: 0;
        padding: 0;
      }

      & #text-6 {
        & .textwidget,
        & .textwidget p {
          display: block;
          width: auto !important;
        }
      }

      & .footer-icaew-mark {
        display: flex;
        align-items: flex-start;

        & img {
          display: block;
          width: 100%;
          height: auto;
        }
      }
    }

    & .footer-accreditations-row {
      display: flex;
      justify-content: flex-end;
      margin-top: 30px;

      & .accreditations {
        display: block;
        float: none;
        width: min(500px, 100%);
        height: auto;
        margin: 0;
      }
    }
  }
}

#widget-area-qube-secondary {
  & .width-container-pro {
    display: flex;
    align-items: flex-start;
    gap: 48px;
    margin-top: 30px;

    & > .widget {
      float: none;
      flex: 1 1 0;
      width: auto !important;
      margin: 0;
      padding: 20px 0 25px;
    }

    & > .clearfix-pro {
      display: none;
    }
  }
}

footer#site-footer {
  & #copyright-pro {
    padding: 20px 0;
  }

  & h4.widget-title {
    color: #ffffff !important;
    margin-bottom: 10px;
    font-size: 16px !important;
  }
}

/* Intentional three-plus-two wrap for intermediate screens. */
@media (min-width: 769px) and (max-width: 1199px) {
  #widget-area-qube {
    & .footer-primary-layout .footer-primary-columns {
      flex-wrap: wrap;

      & > .widget,
      & > .footer-icaew-mark {
        flex: 0 0 calc((100% - 56px) / 3);
      }

      & > :nth-child(n + 4) {
        flex-basis: calc((100% - 28px) / 2);
      }

      & .footer-icaew-mark img {
        width: min(100%, 320px);
      }
    }
  }
}

/* Preserve the existing mobile order and two-address-column composition. */
@media (max-width: 768px) {
  #widget-area-qube {
    & .footer-primary-layout {
      & .footer-primary-columns {
        flex-wrap: wrap;
        gap: 30px 16px;
        padding-top: 30px;

        & > .widget,
        & > .footer-icaew-mark {
          flex: 0 0 100%;
        }

        & > :nth-child(-n + 2) {
          flex-basis: calc((100% - 16px) / 2);
        }

        & .footer-icaew-mark img {
          width: min(100%, 320px);
        }
      }

      & .footer-accreditations-row {
        justify-content: flex-start;
      }
    }
  }

  #widget-area-qube-secondary {
    & .width-container-pro {
      flex-direction: column;
      gap: 0;

      & > .widget {
        flex-basis: auto;
        width: 100% !important;
      }
    }
  }
}
