.sophistec-legal {
  background: #f6f8f9;
  padding: 90px 0 110px;
}

.sophistec-legal-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 60px;
  align-items: end;
  padding-bottom: 60px;
  border-bottom: 1px solid #dce3e8;
}

.sophistec-legal-eyebrow,
.sophistec-legal-meta span,
.sophistec-legal-nav > span,
.sophistec-legal-nav-switch > span,
.sophistec-legal-contact span {
  display: block;
  color: #1f78b4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.sophistec-legal-intro h2 {
  max-width: 760px;
  margin: 16px 0 18px;
  color: #1b2b59;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.12;
}

.sophistec-legal-intro p {
  max-width: 710px;
  margin: 0;
  color: #405269;
  font-size: 18px;
  line-height: 1.7;
}

.sophistec-legal-meta {
  display: grid;
  gap: 7px;
  padding: 24px;
  background: #fff;
  border-left: 3px solid #1f78b4;
  box-shadow: 0 14px 40px rgba(23, 40, 50, 0.05);
}

.sophistec-legal-meta span:not(:first-child) { margin-top: 12px; }
.sophistec-legal-meta strong,
.sophistec-legal-meta a {
  color: #1b2b59;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.sophistec-legal-meta a:hover { text-decoration: underline; }

.sophistec-legal-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 70px;
  padding-top: 58px;
}

.sophistec-legal-nav {
  align-self: start;
  position: sticky;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.sophistec-legal-nav > span { margin-bottom: 8px; }
.sophistec-legal-nav > a {
  color: #48545e;
  font-size: 14px;
  line-height: 1.4;
  transition: color 0.2s ease;
}
.sophistec-legal-nav > a:hover,
.sophistec-legal-nav-switch a:hover { color: #1f78b4; }

.sophistec-legal-nav-switch {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 25px;
  border-top: 1px solid #dce3e8;
}
.sophistec-legal-nav-switch a {
  color: #1b2b59;
  font-size: 14px;
  font-weight: 700;
}

/* The theme's body overflow creates a non-scrolling sticky container.
   Clip horizontal overflow without creating one on both legal pages. */
html:has(.sophistec-legal[data-legal-kind]),
body:has(.sophistec-legal[data-legal-kind]) {
  overflow-x: clip;
  overflow-y: visible;
}

[data-legal-kind] .sophistec-legal-nav {
  top: 110px;
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
}

[data-legal-kind] .sophistec-legal-nav a:focus-visible {
  outline: 2px solid #1f78b4;
  outline-offset: -2px;
}

[data-legal-kind] .sophistec-legal-section {
  scroll-margin-top: 130px;
}

.sophistec-legal-section {
  scroll-margin-top: 28px;
  margin-bottom: 16px;
  padding: 38px 42px;
  background: #fff;
  border: 1px solid #e4eaed;
  border-radius: 8px;
}
.sophistec-legal-section h3 {
  margin: 0 0 16px;
  color: #1b2b59;
  font-size: 24px;
  line-height: 1.3;
}
.sophistec-legal-section p,
.sophistec-legal-section li {
  color: #405269;
  font-size: 16px;
  line-height: 1.8;
}
.sophistec-legal-section p:last-child { margin-bottom: 0; }
.sophistec-legal-section ul { margin: 10px 0 0; padding-left: 22px; }
.sophistec-legal-section li { margin-bottom: 8px; }

.sophistec-legal-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 25px;
  padding: 40px 42px;
  background: #2d3c71;
  border-radius: 8px;
}
.sophistec-legal-contact h3 {
  margin: 8px 0;
  color: #fff;
  font-size: 28px;
}
.sophistec-legal-contact > div > span {
  color: #8eddf8;
}
.sophistec-legal-contact p {
  margin: 0;
  color: #b8c5cc;
  font-size: 15px;
}
.sophistec-legal-contact > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 13px 20px;
  color: #1b2b59 !important;
  background: #fff;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}
.sophistec-legal-contact > a svg { flex: 0 0 auto; }
.sophistec-legal-contact > a:hover { background: #dceeff; }
.sophistec-legal-contact > a:focus-visible {
  outline: 2px solid #8eddf8;
  outline-offset: 4px;
}

@media (max-width: 991px) {
  .sophistec-legal-intro,
  .sophistec-legal-layout { grid-template-columns: 1fr; gap: 30px; }
  .sophistec-legal-nav { position: static; display: none; }
  [data-legal-kind] .sophistec-legal-layout { display: block; }
  [data-legal-kind] .sophistec-legal-nav {
    position: sticky;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    z-index: 5;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #dce3e8;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(27, 43, 89, 0.06);
  }
  [data-legal-kind] .sophistec-legal-nav > span,
  [data-legal-kind] .sophistec-legal-nav > a {
    flex: 0 0 auto;
    white-space: nowrap;
    margin: 0;
  }
  [data-legal-kind] .sophistec-legal-nav > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  [data-legal-kind] .sophistec-legal-nav-switch { display: none; }
  [data-legal-kind] .sophistec-legal-section { scroll-margin-top: 206px; }
}
@media (max-width: 575px) {
  .sophistec-legal { padding: 60px 0 75px; }
  .sophistec-legal-intro { padding-bottom: 36px; }
  .sophistec-legal-section,
  .sophistec-legal-contact { padding: 26px 22px; }
  .sophistec-legal-contact { align-items: flex-start; flex-direction: column; }
}
