/* CMS legal documents use their own reading layout, separate from lead forms. */
.legal-modal .fancybox-slide--html {
  padding: 24px;
}

.popup.legal-popup {
  width: 1120px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.legal-popup__layout {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.legal-popup__header {
  flex: 0 0 auto;
  padding: 28px 76px 24px 40px;
  border-bottom: 1px solid rgba(5, 64, 66, 0.16);
}

.legal-popup__title {
  font-family: "Unbounded", sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
  color: #053334;
}

.legal-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 32px 40px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  color: #303b3b;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  text-align: left;
}

.legal-content p,
.legal-content ul,
.legal-content ol,
.legal-content dl,
.legal-content blockquote,
.legal-content figure {
  margin: 0 0 1.15em;
}

/* Imported justified paragraphs produce large gaps on small screens. */
.legal-content [style*="text-align: justify"] {
  text-align: left !important;
}

.legal-content h1,
.legal-content h2,
.legal-content h3,
.legal-content h4,
.legal-content h5,
.legal-content h6 {
  margin: 1.8em 0 0.7em;
  color: #053334;
  font-weight: 600;
  line-height: 1.45;
}

.legal-content h1 { font-size: 1.5em; }
.legal-content h2 { font-size: 1.25em; }
.legal-content h3 { font-size: 1.125em; }

.legal-content > :first-child { margin-top: 0; }
.legal-content > :last-child { margin-bottom: 0; }

.legal-content strong,
.legal-content b {
  font-weight: 600;
}

.legal-content em,
.legal-content i {
  font-style: italic;
}

.legal-content ul,
.legal-content ol {
  padding-left: 1.6em;
}

.legal-content ul > li { list-style: disc; }
.legal-content ol > li { list-style: decimal; }
.legal-content li + li { margin-top: 0.5em; }
.legal-content li > ul,
.legal-content li > ol { margin-top: 0.5em; }
.legal-content dd { margin-left: 1.6em; }

.legal-content a {
  color: #054042;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: normal;
}

.legal-content a:hover { text-decoration-thickness: 2px; }

.legal-content blockquote {
  padding-left: 20px;
  border-left: 3px solid rgba(5, 64, 66, 0.3);
}

.legal-table-scroll {
  max-width: 100%;
  margin: 24px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #b9c8c5;
  border-radius: 6px;
}

.legal-content table {
  width: 100%;
  min-width: 600px;
  margin: 0;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.legal-content td,
.legal-content th {
  padding: 14px 18px;
  border: 1px solid #cbd5d1;
  vertical-align: top;
  text-align: left;
}

.legal-content tr > :first-child:nth-last-child(2) {
  width: 30%;
}

.legal-content th,
.legal-content thead td,
.legal-content tbody > tr:first-child > td {
  background: #e2e9e4;
  color: #053334;
  font-weight: 600;
}

.legal-content tbody > tr:nth-child(odd):not(:first-child) {
  background: rgba(5, 64, 66, 0.035);
}

.legal-content td > :last-child,
.legal-content th > :last-child {
  margin-bottom: 0;
}

.legal-popup__footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 16px 40px;
  border-top: 1px solid rgba(5, 64, 66, 0.16);
}

.legal-popup .legal-popup__footer .btn {
  width: auto;
  min-width: 144px;
  margin: 0;
  padding: 14px 28px;
}

.legal-popup .fancybox-close-small {
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
}

.legal-popup :focus-visible {
  outline: 2px solid #054042;
  outline-offset: -3px;
}

@media (max-width: 768px) {
  /* Keep both documents reachable: the base mobile footer hides this list. */
  .footer .footer__copyright {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 24px;
    font-size: 14px;
    line-height: 1.5;
  }

  .footer .footer__copyright li + li { margin-top: 0; }
}

@media (max-width: 767px) {
  .legal-modal .fancybox-slide--html { padding: 8px; }

  .popup.legal-popup {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 8px;
  }

  .legal-popup__header { padding: 20px 60px 18px 20px; }
  .legal-popup__title { font-size: 17px; }
  .legal-content { padding: 24px 20px; font-size: 15px; }
  .legal-content table { font-size: 14px; }
  .legal-table-scroll::before {
    content: "Scroll horizontally to view all columns \2192";
    position: sticky;
    left: 0;
    display: block;
    width: 100%;
    padding: 10px 14px;
    color: #405c58;
    background: #e2e9e4;
    font-size: 12px;
    line-height: 1.5;
  }
  .legal-content td,
  .legal-content th { padding: 12px 14px; }
  .legal-popup__footer { padding: 12px 20px max(12px, env(safe-area-inset-bottom)); }
  .legal-popup .fancybox-close-small { top: 10px; right: 10px; }
}
