:root {
  --legal-blue: #1e40af;
  --legal-blue-bright: #2563eb;
  --legal-navy: #071b42;
  --legal-yellow: #fbbf24;
  --legal-ink: #334155;
}

/* Keep the pull-down canvas continuous with the fixed header and legal page. */
html.legal-page-root,
html.legal-page-root body,
html.legal-page-root body > .rt-top-nav,
html.legal-page-root body > .legal-page {
  background-color: #f7f9fc !important;
  background-image:
    radial-gradient(circle, rgba(37, 99, 235, 0.18) 1.2px, transparent 1.6px),
    radial-gradient(circle, rgba(251, 191, 36, 0.2) 1.2px, transparent 1.6px),
    radial-gradient(circle at 16% 18%, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(251, 191, 36, 0.15), transparent 24%) !important;
  background-position: 0 0, 14px 14px, center, center !important;
  background-size: 28px 28px, 28px 28px, auto, auto !important;
  background-repeat: repeat, repeat, no-repeat, no-repeat !important;
  background-attachment: scroll, scroll, scroll, scroll !important;
}

html.legal-page-root {
  overscroll-behavior-y: auto;
}

.legal-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  padding: clamp(28px, 4vw, 52px) 20px clamp(64px, 8vw, 96px);
  overflow: hidden;
  background-color: #f7f9fc;
  background-image:
    radial-gradient(circle, rgba(37, 99, 235, 0.18) 1.2px, transparent 1.6px),
    radial-gradient(circle, rgba(251, 191, 36, 0.2) 1.2px, transparent 1.6px),
    radial-gradient(circle at 16% 18%, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(251, 191, 36, 0.15), transparent 24%);
  background-position: 0 0, 14px 14px, center, center;
  background-size: 28px 28px, 28px 28px, auto, auto;
}

.legal-page::before {
  position: absolute;
  z-index: -1;
  top: clamp(76px, 8vw, 118px);
  right: clamp(-320px, -16vw, -130px);
  width: clamp(560px, 62vw, 940px);
  aspect-ratio: 419 / 454;
  background: url("/assets/dex-icon-blue.svg") center / contain no-repeat;
  content: "";
  opacity: 0.11;
  pointer-events: none;
}

.legal-hero {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(26px, 4vw, 48px) 0 clamp(48px, 7vw, 82px);
  text-align: center;
}

.legal-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
  padding: 8px 16px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  color: var(--legal-blue);
  background: rgba(37, 99, 235, 0.08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.legal-hero h1 {
  display: flex;
  min-height: clamp(56px, 7vw, 76px);
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--legal-navy);
  font-family: "Inter Tight", "Poppins", sans-serif;
  font-size: clamp(46px, 7vw, 76px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.legal-hero h1 span {
  color: transparent;
  background: linear-gradient(135deg, var(--legal-blue-bright) 20%, var(--legal-yellow) 84%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal-description {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  margin: 22px auto 0;
  color: #475569;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 500;
  line-height: 1.7;
}

.legal-meta {
  margin: 18px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.legal-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.legal-nav a {
  display: inline-flex;
  min-height: 40px;
  padding: 9px 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 9px;
  color: var(--legal-blue);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.legal-nav a[aria-current="page"] {
  border-color: var(--legal-blue-bright);
  color: #fff;
  background: var(--legal-blue-bright);
  box-shadow: 0 9px 24px rgba(37, 99, 235, 0.2);
}

.legal-panel-wrap {
  width: min(1600px, 100%);
  margin: 0 auto;
}

.legal-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 58px);
  border-radius: clamp(24px, 4vw, 48px);
  background: var(--legal-blue);
  box-shadow: 0 32px 78px rgba(7, 27, 66, 0.22);
}

.legal-panel::before {
  position: absolute;
  inset: 0;
  background: url("/assets/dex-triangle-mark.png") right center / min(430px, 40vw) auto no-repeat;
  content: "";
  opacity: 0.12;
  pointer-events: none;
}

.legal-panel::after {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.15) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  content: "";
  pointer-events: none;
}

.legal-article {
  position: relative;
  z-index: 1;
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3.5vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: clamp(18px, 2.5vw, 28px);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 64px rgba(7, 24, 78, 0.24);
}

.legal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 26px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  background: #eef4ff;
}

.legal-actions p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

.legal-actions button {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 1px solid var(--legal-blue-bright);
  border-radius: 9px;
  color: #fff;
  background: var(--legal-blue-bright);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.legal-content {
  color: var(--legal-ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.68;
}

.legal-content h2 {
  margin: 40px 0 14px;
  padding-top: 4px;
  color: var(--legal-navy);
  font-family: "Inter Tight", "Poppins", sans-serif;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.025em;
  scroll-margin-top: 120px;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content h3 {
  margin: 26px 0 10px;
  color: #123fa9;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.35;
  scroll-margin-top: 120px;
}

.legal-content p {
  margin: 0 0 14px;
}

.legal-content ul,
.legal-content ol {
  display: grid;
  gap: 8px;
  margin: 10px 0 20px;
  padding-left: 24px;
}

.legal-content li::marker {
  color: var(--legal-blue-bright);
  font-weight: 800;
}

.legal-content strong {
  color: #142b55;
  font-weight: 750;
}

.legal-content a {
  color: var(--legal-blue);
  font-weight: 700;
  text-decoration-color: rgba(30, 64, 175, 0.35);
  text-underline-offset: 3px;
}

.legal-content hr {
  height: 1px;
  margin: 30px 0;
  border: 0;
  background: rgba(37, 99, 235, 0.13);
}

.legal-table-wrap {
  width: 100%;
  margin: 18px 0 24px;
  overflow-x: auto;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.legal-content table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.legal-content th,
.legal-content td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
  vertical-align: top;
}

.legal-content th {
  color: var(--legal-navy);
  background: #eef4ff;
  font-weight: 800;
}

.legal-content tr:last-child td {
  border-bottom: 0;
}

.legal-contact {
  padding: 18px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: 14px;
  background: #fff9e7;
}

/* Legal page heroes: compact, reference-led title treatment. */
.legal-compact-page .legal-page {
  padding-top: clamp(10px, 1.4vw, 18px);
}

.legal-compact-page .legal-hero {
  padding-top: clamp(16px, 2vw, 24px);
  padding-bottom: clamp(28px, 3.2vw, 42px);
}

.legal-compact-page .legal-kicker {
  margin-bottom: clamp(14px, 1.6vw, 18px);
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--legal-blue-bright);
  background: transparent;
  font-size: clamp(12px, 1.1vw, 14px);
  letter-spacing: 0.16em;
}

.legal-compact-page .legal-hero h1 {
  min-height: 0;
  gap: 0.16em;
  font-size: clamp(46px, 6.2vw, 72px);
  line-height: 1;
}

.legal-compact-page .legal-hero h1 .legal-title-base {
  color: #0b1530;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.legal-compact-page .legal-hero h1 .legal-title-accent {
  color: transparent;
  background: linear-gradient(105deg, #3169d9 5%, #718db8 48%, #d7aa32 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal-compact-page .legal-description {
  min-height: 0;
  margin-top: clamp(14px, 1.8vw, 20px);
  text-align: center;
}

.legal-compact-page .legal-meta {
  margin-top: 12px;
}

.legal-compact-page .legal-nav {
  margin-top: clamp(16px, 1.8vw, 22px);
}

.legal-nav a:focus-visible,
.legal-content a:focus-visible,
.legal-actions button:focus-visible {
  outline: 3px solid var(--legal-yellow);
  outline-offset: 3px;
}

@media (max-width: 767px) {
  .legal-page {
    padding-right: 12px;
    padding-left: 12px;
  }

  .legal-hero {
    padding-bottom: 44px;
  }

  .legal-hero h1 {
    min-height: 116px;
    font-size: clamp(42px, 15vw, 58px);
  }

  .legal-description {
    min-height: 104px;
  }

  .legal-panel {
    padding: 10px;
    border-radius: 24px;
  }

  .legal-article {
    padding: 18px 16px 22px;
    border-radius: 18px;
  }

  .legal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .legal-actions button {
    width: 100%;
  }

  .legal-content {
    font-size: 15px;
    line-height: 1.65;
  }

  .legal-content h2 {
    margin-top: 34px;
  }

  .legal-compact-page .legal-page {
    padding-top: 8px;
  }

  .legal-compact-page .legal-hero {
    padding-top: 12px;
    padding-bottom: 26px;
  }

  html.legal-page-root body.legal-compact-page .legal-hero h1 {
    min-height: 0;
    gap: 0.13em;
    font-size: clamp(40px, 12.5vw, 52px) !important;
    white-space: nowrap;
  }

  html.legal-page-root body.legal-compact-page .legal-description {
    min-height: 0;
    margin-top: 14px;
    line-height: 1.55;
    text-align: center !important;
  }

  .legal-compact-page .legal-meta {
    margin-top: 10px;
  }

  .legal-compact-page .legal-nav {
    margin-top: 16px;
  }

  html.legal-page-root body.terms-and-conditions-page .legal-hero h1 {
    font-size: clamp(34px, 10.5vw, 42px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-page *,
  .legal-page *::before,
  .legal-page *::after {
    scroll-behavior: auto !important;
  }
}
