/* public/assets/css/legal.css - Redesigned */

body {
  background: var(--bg0, #0a0a0b);
  color: var(--text, #f9fafb);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Base structural additions for legal pages */
.legal-page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.legal-main-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

@media (min-width: 1024px) {
  .legal-main-wrap {
    grid-template-columns: 280px 1fr;
    gap: 60px;
  }
}

/* Sidebar navigation */
.legal-sidebar {
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding-right: 20px;
}

.legal-sidebar-sticky {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.legal-sidebar-sticky::-webkit-scrollbar {
  width: 4px;
}

.legal-sidebar-sticky::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.legal-nav-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 20px;
}

.legal-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-nav-list a {
  display: flex;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.legal-nav-list a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.legal-nav-list a.active {
  background: rgba(124, 58, 237, 0.1);
  color: #a78bfa;
  border-left-color: #8b5cf6;
}

/* Article Content */
.legal-article {
  background: rgba(17, 20, 33, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
  .legal-article {
    padding: 60px 80px;
  }
}

.legal-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  color: #c4b5fd;
  border: 1px solid rgba(124, 58, 237, 0.2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.badge-alt {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Typography styles inside article */
.legal-article h2 {
  margin: 48px 0 24px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.legal-article h2:first-of-type {
  margin-top: 0;
}

.legal-article p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.7);
}

.legal-article ul {
  margin: 0 0 24px;
  padding-left: 24px;
  color: rgba(255, 255, 255, 0.7);
}

.legal-article li {
  margin-bottom: 12px;
  line-height: 1.7;
  position: relative;
}

.legal-article li::marker {
  color: #8b5cf6;
}

.legal-article strong {
  color: #f8fafc;
  font-weight: 600;
}

.legal-article a:not(.btn) {
  color: #93c5fd;
  text-decoration: none;
  border-bottom: 1px solid rgba(147, 197, 253, 0.3);
  transition: border-bottom-color 0.2s, color 0.2s;
}

.legal-article a:not(.btn):hover {
  border-bottom-color: #93c5fd;
  color: #bfdbfe;
}

.legal-article .hr {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 40px 0;
}

/* Language Dropdown (Header overrides context) */
.lang-dropdown {
  position: relative;
  margin-right: 8px;
}

.lang-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-list {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #0f0f11;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  min-width: 160px;
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}

.lang-dropdown:hover .lang-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  border-radius: 8px;
  transition: background 0.1s;
  text-decoration: none;
  border: none;
}

.lang-list a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: none;
}

.lang-list a.active {
  background: rgba(124, 58, 237, 0.1);
  color: #a78bfa;
  border: none;
}

.lang-code {
  font-weight: 700;
  opacity: 0.5;
  width: 20px;
  text-transform: uppercase;
}

.lang-name {
  flex: 1;
}

/* Long-form legal pages */
.legal-html {
  scroll-padding-top: 110px;
}

body.legal-page {
  background-color: #07070a;
  background-image:
    radial-gradient(circle at 12% 14%, rgba(124, 58, 237, 0.12), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(59, 130, 246, 0.12), transparent 24%),
    linear-gradient(180deg, #07070a 0%, #0b0c10 100%);
  color: #f8fafc;
  overflow-x: hidden;
}

body.legal-page * {
  box-sizing: border-box;
  min-width: 0;
}

.legal-page-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  padding-bottom: 96px;
}

.legal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.legal-backdrop-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.34;
}

.legal-backdrop-orb--violet {
  top: 72px;
  left: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.42) 0%, rgba(124, 58, 237, 0) 72%);
}

.legal-backdrop-orb--blue {
  top: 120px;
  right: -110px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.34) 0%, rgba(59, 130, 246, 0) 74%);
}

.legal-backdrop-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 85%);
  opacity: 0.2;
}

.legal-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
}

.legal-hero {
  position: relative;
  padding: 118px 0 34px;
}

.legal-hero-card {
  position: relative;
  padding: clamp(28px, 4vw, 48px);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.legal-hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0));
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}

.legal-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #60a5fa);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.6);
}

.legal-hero-grid {
  display: grid;
  gap: 28px;
  align-items: end;
  margin-top: 22px;
}

.legal-hero h1 {
  margin: 0 0 18px;
  max-width: 14ch;
  font-size: clamp(2.45rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  color: #fff;
}

.legal-lead {
  margin: 0;
  max-width: 72ch;
  font-size: clamp(1rem, 1.8vw, 1.14rem);
  line-height: 1.8;
  color: rgba(226, 232, 240, 0.76);
}

.legal-meta-panel {
  display: grid;
  gap: 12px;
}

.legal-meta-chip {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.legal-meta-chip span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.legal-meta-chip strong {
  display: block;
  margin-top: 9px;
  font-size: 1rem;
  line-height: 1.45;
  color: #fff;
}

.legal-hero-note {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.94rem;
  line-height: 1.75;
  color: rgba(226, 232, 240, 0.62);
}

.legal-layout {
  display: grid;
  gap: 28px;
  align-items: start;
}

.legal-sidebar {
  position: relative;
  border-right: 0;
  padding-right: 0;
}

.legal-card {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.2);
}

.legal-card--sticky {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.legal-card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

.legal-card-copy {
  margin: 14px 0 0;
  font-size: 0.95rem;
  line-height: 1.75;
  color: rgba(226, 232, 240, 0.66);
}

.legal-toc-scroll {
  margin-top: 18px;
  padding-right: 4px;
  max-height: calc(100vh - 248px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.legal-toc-scroll::-webkit-scrollbar {
  width: 6px;
}

.legal-toc-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.legal-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-toc-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  text-decoration: none;
  color: rgba(226, 232, 240, 0.72);
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.legal-toc-list a:hover,
.legal-toc-list a.active {
  color: #fff;
  border-color: rgba(124, 58, 237, 0.24);
  background: rgba(124, 58, 237, 0.12);
  transform: translateX(4px);
}

.legal-toc-number {
  padding-top: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #c4b5fd;
}

.legal-document {
  max-width: 100%;
  padding: clamp(24px, 4vw, 42px);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(8, 10, 16, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.legal-document-intro {
  display: grid;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-document-intro p {
  margin: 0;
  font-size: 1.01rem;
  line-height: 1.86;
  color: rgba(226, 232, 240, 0.8);
}

.legal-section {
  padding-top: 4px;
}

.legal-section + .legal-section {
  margin-top: 42px;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-section-header {
  margin-bottom: 22px;
}

.legal-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(96, 165, 250, 0.08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #bfdbfe;
}

.legal-section h2 {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: #fff;
}

.legal-section-anchor {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(196, 181, 253, 0.9);
  text-decoration: none;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.legal-section-anchor:hover {
  color: #fff;
  border-color: rgba(124, 58, 237, 0.26);
  background: rgba(124, 58, 237, 0.18);
  transform: translateY(-1px);
}

.legal-paragraph {
  margin: 0 0 18px;
  font-size: 1.02rem;
  line-height: 1.92;
  color: rgba(226, 232, 240, 0.8);
  overflow-wrap: anywhere;
}

.legal-paragraph:last-child {
  margin-bottom: 0;
}

.legal-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 16px;
}

.legal-list:last-child {
  margin-bottom: 0;
}

.legal-list-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

.legal-list-marker {
  width: 40px;
  min-width: 40px;
  padding-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #c4b5fd;
}

.legal-list-body {
  display: grid;
  gap: 12px;
}

.legal-list-text,
.legal-sublist-text {
  margin: 0;
  color: rgba(226, 232, 240, 0.8);
  line-height: 1.84;
  overflow-wrap: anywhere;
}

.legal-sublist {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.legal-sublist-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.legal-sublist-marker {
  min-width: 30px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(147, 197, 253, 0.9);
}

.legal-doc-footer {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-inline-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.legal-inline-card--warning {
  border-color: rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.08);
}

.legal-inline-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.legal-inline-card p {
  margin: 0;
  max-width: 58ch;
  font-size: 0.96rem;
  line-height: 1.72;
  color: rgba(226, 232, 240, 0.72);
}

.legal-inline-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legal-inline-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.legal-inline-links a:hover {
  border-color: rgba(124, 58, 237, 0.26);
  background: rgba(124, 58, 237, 0.14);
  transform: translateY(-1px);
}

@media (min-width: 960px) {
  .legal-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  }
}

@media (min-width: 1024px) {
  .legal-layout {
    grid-template-columns: minmax(270px, 320px) minmax(0, 860px);
    justify-content: center;
  }
}

@media (max-width: 1023px) {
  .legal-card--sticky {
    position: static;
    max-height: none;
  }

  .legal-toc-scroll {
    max-height: none;
  }

  .legal-toc-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal-toc-list a:hover,
  .legal-toc-list a.active {
    transform: none;
  }
}

@media (max-width: 767px) {
  .legal-html,
  body.legal-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .legal-shell {
    width: min(100% - 16px, 100%);
  }

  .legal-page-main {
    padding-bottom: 72px;
  }

  .legal-hero {
    padding: 92px 0 20px;
  }

  .legal-hero-card,
  .legal-card,
  .legal-document {
    padding: 20px;
    border-radius: 22px;
  }

  .legal-hero h1 {
    max-width: none;
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .legal-lead,
  .legal-hero-note,
  .legal-card-copy,
  .legal-document-intro p,
  .legal-paragraph,
  .legal-list-text,
  .legal-sublist-text,
  .legal-inline-card p {
    font-size: 0.96rem;
    line-height: 1.78;
  }

  .legal-meta-chip {
    padding: 14px 16px;
    border-radius: 18px;
  }

  .legal-layout {
    gap: 18px;
  }

  .legal-toc-list {
    grid-template-columns: 1fr;
  }

  .legal-section + .legal-section {
    margin-top: 32px;
    padding-top: 24px;
  }

  .legal-section h2 {
    font-size: 1.45rem;
    line-height: 1.24;
  }

  .legal-section-anchor {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .legal-list-item {
    gap: 12px;
  }

  .legal-list-marker {
    width: 34px;
    min-width: 34px;
  }

  .legal-inline-card {
    padding: 18px;
  }
}
