/* One footer composition for the home shell, service pages and Hong Kong journal.
   The existing legal names, navigation, social links and copyright remain
   untouched. Load after the legacy, brand and shared service styles. */

#journey.og-site .ed-footer,
#site-root .sd-chrome-footer {
  --lv-footer-ink: #183c5d;
  --lv-footer-muted: #526c81;
  --lv-footer-line: rgba(52, 91, 121, .16);
  --lv-footer-brand-indent: 26px;
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lv-footer-muted);
  font-family: var(--lv-ui-font, var(--sans, var(--sd-font, system-ui)));
  text-align: left;
}

#journey.og-site .ed-footer .ed-footer-inner,
#site-root .sd-chrome-footer .sd-chrome-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "brand nav social"
    "legal copyright copyright";
  align-items: start;
  gap: 6px 24px;
  box-sizing: border-box;
  width: min(1240px, calc(100% - 64px));
  min-width: 0;
  min-height: 0;
  margin-inline: auto;
  padding: 20px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--lv-footer-line);
}

#journey.og-site .ed-footer .ed-footer-brand,
#site-root .sd-chrome-footer .sd-chrome-footer-brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  align-self: center;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  margin: 0;
  padding: 0;
  color: var(--lv-footer-ink);
  font: 650 14px/1.5 var(--lv-ui-font, var(--sans, var(--sd-font, system-ui)));
  letter-spacing: -.015em;
  white-space: nowrap;
  text-decoration: none;
}

#journey.og-site .ed-footer .ed-footer-brand > svg,
#site-root .sd-chrome-footer .sd-chrome-footer-brand > svg {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

#journey.og-site .ed-footer .ed-footer-nav,
#site-root .sd-chrome-footer .sd-chrome-footer-nav {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  align-self: center;
  gap: 4px 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

#journey.og-site .ed-footer .ed-footer-nav > a,
#site-root .sd-chrome-footer .sd-chrome-footer-nav > a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0;
  padding: 0;
  color: var(--lv-footer-muted);
  font: 450 12px/1.6 var(--lv-ui-font, var(--sans, var(--sd-font, system-ui)));
  white-space: nowrap;
  text-decoration: none;
}

#journey.og-site .ed-footer .ed-footer-socials,
#site-root .sd-chrome-footer .sd-chrome-footer-socials {
  grid-area: social;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  align-self: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

#journey.og-site .ed-footer .ed-footer-social-link,
#site-root .sd-chrome-footer .sd-chrome-footer-socials .sd-chrome-social-link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lv-footer-muted);
}

#journey.og-site .ed-footer .ed-footer-social-link svg,
#site-root .sd-chrome-footer .sd-chrome-footer-socials svg {
  width: 16px;
  height: 16px;
}

/* Legal identity sits directly beneath the wordmark, not between controls.
   Reset the earlier mobile grid-column/width/margin rules in one place. */
#journey.og-site .ed-footer .ed-footer-inner > .lv-brand-legal,
#site-root .sd-chrome-footer .sd-chrome-footer-inner > .lv-brand-legal {
  grid-area: legal !important;
  display: flex !important;
  flex-flow: row wrap;
  align-items: baseline;
  justify-content: flex-start !important;
  justify-self: start !important;
  align-self: start;
  gap: 2px 12px;
  box-sizing: border-box;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 0 0 var(--lv-footer-brand-indent);
  color: var(--lv-footer-muted);
  font: 400 12px/1.6 var(--lv-ui-font, var(--sans, var(--sd-font, system-ui)));
  letter-spacing: 0;
  text-align: left !important;
}

#journey.og-site .ed-footer .lv-brand-legal > span,
#site-root .sd-chrome-footer .lv-brand-legal > span {
  display: inline;
  min-width: 0;
  margin: 0;
  padding: 0;
  white-space: normal;
  overflow-wrap: break-word;
}

#journey.og-site .ed-footer .lv-brand-legal > .lv-legal-separator,
#site-root .sd-chrome-footer .lv-brand-legal > .lv-legal-separator {
  display: none !important;
}

#journey.og-site .ed-footer .ed-footer-inner > small,
#site-root .sd-chrome-footer .sd-chrome-footer-inner > small {
  grid-area: copyright !important;
  display: block;
  justify-self: end !important;
  align-self: end;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
  color: var(--lv-footer-muted);
  font: 400 11px/1.6 var(--lv-ui-font, var(--sans, var(--sd-font, system-ui)));
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: right !important;
}

#journey.og-site .ed-footer a:hover,
#site-root .sd-chrome-footer a:hover {
  color: #1769a1;
}

#journey.og-site .ed-footer a:focus-visible,
#site-root .sd-chrome-footer a:focus-visible {
  outline: 2px solid #236ba4;
  outline-offset: 4px;
  border-radius: 3px;
}

@media (max-width: 760px) {
  #journey.og-site .ed-footer .ed-footer-inner,
  #site-root .sd-chrome-footer .sd-chrome-footer-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand social"
      "legal legal"
      "nav nav"
      "copyright copyright";
    width: calc(100% - 40px);
    gap: 4px 14px;
    padding-top: 16px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }

  #journey.og-site .ed-footer .ed-footer-brand,
  #site-root .sd-chrome-footer .sd-chrome-footer-brand {
    min-height: 44px;
    font-size: 13px;
  }

  #journey.og-site .ed-footer .ed-footer-nav,
  #site-root .sd-chrome-footer .sd-chrome-footer-nav {
    justify-content: flex-start;
    justify-self: start;
    gap: 2px 20px;
    padding-left: var(--lv-footer-brand-indent);
  }

  #journey.og-site .ed-footer .ed-footer-nav > a,
  #site-root .sd-chrome-footer .sd-chrome-footer-nav > a {
    min-height: 44px;
    font-size: 12px;
  }

  #journey.og-site .ed-footer .ed-footer-social-link,
  #site-root .sd-chrome-footer .sd-chrome-footer-socials .sd-chrome-social-link {
    width: 36px;
    height: 44px;
    min-height: 44px;
  }

  #journey.og-site .ed-footer .ed-footer-inner > small,
  #site-root .sd-chrome-footer .sd-chrome-footer-inner > small {
    justify-self: start !important;
    padding-left: var(--lv-footer-brand-indent);
    text-align: left !important;
  }
}

/* The journal has no wrapper or copyright node. Keep its dark palette and
   existing outer divider while grouping its actual four children explicitly.
   In particular, the legal identity must never compete for 100% of a flex row. */
#journal-view .jr-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand contact"
    "legal signature";
  align-items: center;
  gap: 4px 24px;
  min-width: 0;
  padding-top: 20px;
  padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  color: var(--jr-muted);
  font-family: var(--lv-ui-font, var(--sans, system-ui));
  letter-spacing: 0;
  text-align: left;
}

#journal-view .jr-footer > .jr-wordmark {
  grid-area: brand;
  display: block;
  justify-self: start;
  align-self: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: -.035em;
  white-space: nowrap;
}

#journal-view .jr-footer > span {
  grid-area: signature;
  display: block;
  justify-self: end;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--jr-muted);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: .02em;
  white-space: normal;
  text-align: right;
}

#journal-view .jr-footer > .lv-brand-legal {
  grid-area: legal;
  display: flex;
  flex-flow: row wrap;
  align-items: baseline;
  justify-content: flex-start;
  justify-self: start;
  gap: 2px 12px;
  box-sizing: border-box;
  min-width: 0;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: var(--jr-muted);
  font: 400 12px/1.6 var(--lv-ui-font, var(--sans, system-ui));
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
  text-shadow: none;
}

/* Journal text may contain nested neon runs. Undo the old blanket block-span
   rule at every depth without changing the text or the journal's lamp colors. */
#journal-view .jr-footer .lv-brand-legal span {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  line-height: inherit;
  white-space: inherit;
}

#journal-view .jr-footer .lv-brand-legal > span {
  white-space: nowrap;
}

#journal-view .jr-footer .lv-brand-legal > .lv-legal-separator {
  display: none !important;
}

#journal-view .jr-footer > a:not(.jr-wordmark) {
  grid-area: contact;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-height: 44px;
  margin: 0;
  padding: 0;
  color: var(--jr-ink);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0;
  white-space: nowrap;
}

#journal-view .jr-footer > a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 3px;
}

@media (max-width: 760px) {
  #journal-view .jr-footer {
    grid-template-areas:
      "brand contact"
      "legal legal"
      "signature signature";
    gap: 4px 16px;
    padding-top: 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  #journal-view .jr-footer > .jr-wordmark {
    font-size: 18px;
  }

  #journal-view .jr-footer > span {
    justify-self: start;
    margin-top: 2px;
    text-align: left;
  }
}

@media (forced-colors: active) {
  #journey.og-site .ed-footer,
  #site-root .sd-chrome-footer {
    --lv-footer-ink: CanvasText;
    --lv-footer-muted: CanvasText;
    --lv-footer-line: CanvasText;
  }
  #journey.og-site .ed-footer a:hover,
  #site-root .sd-chrome-footer a:hover { color: LinkText; }
}
