/* Narrow-screen adjustments for the APEL homepage and shared footer. */
#footer-nav #footer-socials > .socials:has(+ .apel-mobile-footer-socials) {
  display: none;
}

#footer-nav #footer-socials > .apel-mobile-footer-socials {
  display: flex !important;
  flex-wrap: nowrap;
  gap: 3px;
}

#footer-nav #footer-socials .apel-mobile-footer-socials .socials-item {
  padding: 0;
  color: #c5d0da;
  text-decoration: none;
}

#footer-nav #footer-socials .apel-mobile-footer-socials .socials-item-icon {
  color: inherit !important;
  font-size: 20px;
}

#footer-nav #footer-socials .apel-mobile-footer-socials i.socials-item-icon.twitter::before {
  display: inline;
  width: auto !important;
  height: auto !important;
  background: none !important;
  border-radius: 0;
  text-indent: 0;
  content: '\e675' !important;
}

#footer-nav #footer-socials .apel-mobile-footer-socials .socials-item:active {
  color: #fff;
}


@media (min-width: 768px) {
  #footer-nav #footer-socials > .apel-mobile-footer-socials {
    justify-content: center;
    align-items: center;
    margin: 0;
  }

  #footer-nav #footer-socials .apel-mobile-footer-socials .socials-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    height: 32px;
    margin: 0;
  }

  #footer-nav #footer-socials .apel-mobile-footer-socials .socials-item-icon {
    font-size: 17px;
  }
}

@media (min-width: 992px) {
  #footer-nav #footer-socials > .apel-mobile-footer-socials {
    justify-content: flex-end;
  }
}

@media (max-width: 767px) {
  /* Centre the list while preserving the alignment of the icon and label. */
  #post-9 .no-padding-quick .quickfinder {
    width: min(100%, 352px);
    margin-inline: auto;
    padding-inline: 18px;
  }

  #post-9 .no-padding-quick .quickfinder-item {
    padding-inline: 0;
  }

  #post-9 .no-padding-quick .quickfinder-icon-position-center-float .quickfinder-item-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
  }

  #post-9 .no-padding-quick .quickfinder-item-inner .quickfinder-item-image {
    width: auto;
    height: auto;
    padding: 0;
    flex: 0 0 auto;
  }

  #post-9 .no-padding-quick .quickfinder-item-title {
    font-size: clamp(16px, 4.4vw, 18px);
    line-height: 1.25;
  }

  /* Make the two services compact, with their controls on a shared axis. */
  #post-9 .border-topbottom:has(.fa-book-reader) {
    padding-block: 12px !important;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) > .vc_column_container {
    width: 100%;
    margin: 0;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) > .vc_column_container > .vc_column-inner {
    padding: 0 20px !important;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) > .vc_column_container > .vc_column-inner > .wpb_wrapper {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 4px 14px;
    width: 100%;
    max-width: 352px;
    margin-inline: auto;
    padding-block: 17px;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) > .vc_column_container + .vc_column_container > .vc_column-inner > .wpb_wrapper {
    border-top: 1px solid #dce3e7;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) :is(.vc_icon_element-outer, .wpb_text_column, .gem-button-container) {
    margin: 0;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) .vc_icon_element-outer {
    grid-row: span 2;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) .vc_icon_element-inner {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) .vc_icon_element-icon {
    position: static;
    font-size: 28px !important;
    transform: none;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) h3 {
    margin: 0;
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.2;
    text-align: left !important;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) .gem-button-container {
    text-align: left;
  }

  #post-9 .border-topbottom:has(.fa-book-reader) .gem-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 0 16px;
    background-color: #475f75 !important;
    color: #fff !important;
  }

  .custom-footer .row-footer-1 .wpb_single_image:has(img[title="apellogomini"]) {
    text-align: center;
  }

  .custom-footer .row-footer-1 > .vc_column_container:has(a[target="subscribe"]) {
    text-align: center;
  }

  .custom-footer .row-footer-1 > .vc_column_container:has(a[target="subscribe"]) p {
    text-align: center !important;
  }

  .custom-footer .row-footer-1 a[target="subscribe"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-inline: 0;
    background-color: #475f75 !important;
    color: #fff !important;
  }

  /* Fit six 44px touch targets even at 320px, with smaller symbols inside. */
  .custom-footer .row-footer-1 .socials-list {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: clamp(2px, 1vw, 8px);
    margin: 8px auto 24px;
  }

  .custom-footer .row-footer-1 .socials-list .socials-item {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0 !important;
    padding: 0;
    line-height: 1;
  }

  .custom-footer .row-footer-1 .socials-list .socials-item-icon {
    display: grid;
    place-items: center;
    font-size: 28px !important;
    line-height: 1;
  }

  .custom-footer .row-footer-1 .socials-list i.socials-item-icon.twitter::before {
    width: 28px !important;
    height: 28px !important;
  }

  /* Keep the utility links and copyright together, with no orphan separators. */
  #footer-nav {
    padding: 20px 0 24px;
    background-color: #4e667c;
  }

  #footer-nav > .container > .row {
    display: grid;
    justify-items: center;
    gap: 4px;
    /* The theme offsets this row to compensate for margins on its columns. */
    margin-block-start: 0;
  }

  #footer-nav > .container > .row > div {
    width: 100%;
    margin: 0;
  }

  #footer-nav > .container > .row::before,
  #footer-nav > .container > .row::after,
  #footer-nav #footer-menu::before,
  #footer-nav #footer-menu::after {
    display: none;
  }

  #footer-nav :is(#footer-socials, #footer-navigation, .footer-site-info) {
    margin: 0;
    padding: 0;
    text-align: center;
  }

  #footer-nav #footer-socials .socials,
  #footer-nav #footer-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
  }

  #footer-nav #footer-socials > .apel-mobile-footer-socials {
    flex-wrap: nowrap;
  }

  #footer-nav #footer-menu .menu-item {
    margin: 0;
    padding: 0;
    border: 0;
    list-style: none;
  }

  #footer-nav #footer-menu .menu-item + .menu-item {
    border: 0;
  }

  #footer-nav #footer-menu .menu-item::before,
  #footer-nav #footer-menu .menu-item > a::before {
    display: none;
  }

  #footer-nav #footer-socials .socials-item,
  #footer-nav #footer-menu .menu-item > :is(a, button),
  #footer-nav #footer-menu .apel-footer-cookies :is(a, button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 8px;
    color: #fff;
  }

  #footer-nav .footer-site-info {
    padding-top: 6px;
    color: #e2edf5;
    font-size: 13px;
    line-height: 1.5;
  }

  #footer-nav .footer-site-info a {
    color: #fff;
  }

  :is(#post-9 .no-padding-quick, #post-9 .border-topbottom, .custom-footer .row-footer-1, #footer-nav) a {
    touch-action: manipulation;
  }

  :is(#post-9 .no-padding-quick, #post-9 .border-topbottom, .custom-footer .row-footer-1, #footer-nav) :is(a, button):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
  }

  :is(#post-9 .border-topbottom, .custom-footer .row-footer-1) :is(.gem-button, .socials-item):active {
    opacity: .78;
  }
}
