/* ============================================================
   LEGAL PAGE — Consolidated Styles
   Layered on top of ../styles.css custom properties
   ============================================================ */

/* ---- Page wrapper ---- */
.legal-page {
  min-height: 100vh;
  background-color: #FFFBFA;
  position: relative;
  font-family: var(--font, 'Figtree', system-ui, -apple-system, sans-serif);
  color: var(--text-secondary, #3D3552);
}

.legal-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 65% at 90% 40%, rgba(235, 95, 77, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 10% 60%, rgba(95, 77, 235, 0.05) 0%, transparent 50%);
}

/* ---- Nav override for legal page (non-fixed) ---- */
.legal-page .topnav {
  position: relative;
}

/* ---- Container ---- */
.legal-container {
  max-width: var(--max-w, 76rem);
  margin: 0 auto;
  padding-left: var(--pad, clamp(1.25rem, 5vw, 3rem));
  padding-right: var(--pad, clamp(1.25rem, 5vw, 3rem));
  position: relative;
  z-index: 1;
}

/* ============================================================
   TWO-COLUMN LAYOUT
   ============================================================ */
.legal-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  padding-top: 1.5rem;
  padding-bottom: 4rem;
}

/* ---- Sidebar ---- */
.legal-sidebar {
  position: sticky;
  top: 1.5rem;
  align-self: start;
}

.legal-sidebar__heading {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary, #6B6280);
  margin-bottom: 0.25rem;
}

.legal-sidebar__contact {
  font-size: 0.75rem;
  color: var(--text-tertiary, #6B6280);
  margin-bottom: 1rem;
}

.legal-sidebar__contact a {
  color: var(--brand, #5F4DEB);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.legal-sidebar__contact a:hover {
  color: var(--brand-hover, #4B3CD4);
}

.legal-sidebar__nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}

.legal-sidebar__link {
  display: block;
  padding: 0.375rem 0.625rem;
  border-left: 2px solid transparent;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-tertiary, #6B6280);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.legal-sidebar__link:hover {
  color: var(--text-primary, #060214);
}

.legal-sidebar__link:focus-visible {
  outline: 2px solid var(--brand, #5F4DEB);
  outline-offset: 2px;
}

.legal-sidebar__link.is-active,
.legal-sidebar__link[aria-current="page"] {
  color: var(--text-primary, #060214);
  font-weight: 600;
  border-left-color: var(--brand, #5F4DEB);
}

/* ---- Content area ---- */
.legal-content {
  max-width: 48rem;
  min-width: 0;
}

/* ---- Hidden sections ---- */
.legal-doc[hidden] {
  display: none;
}

/* ============================================================
   DOCUMENT CONTENT TYPOGRAPHY
   ============================================================ */
.legal-content__title {
  font-size: 2.125rem;
  font-weight: 500;
  color: var(--text-primary, #060214);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.legal-content__meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6B6280);
  margin-bottom: 1.25rem;
}

/* ---- Draft banner ---- */
.legal-draft-banner {
  background: var(--brand, #5F4DEB);
  color: #fff;
  border-radius: 6px;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

/* ---- Intro text ---- */
.legal-content__intro {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary, #3D3552);
  margin-bottom: 0.75rem;
}

.legal-content__intro--secondary {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-tertiary, #6B6280);
  margin-bottom: 1.75rem;
}

/* ---- Section headings ---- */
.legal-content h2 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary, #060214);
  margin-top: 2.25rem;
  margin-bottom: 0.625rem;
  line-height: 1.3;
}

.legal-content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary, #060214);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

/* ---- Body paragraphs ---- */
.legal-content p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-secondary, #3D3552);
  margin-bottom: 0.75rem;
}

/* ---- Links within text ---- */
.legal-content a {
  color: var(--brand, #5F4DEB);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.legal-content a:hover {
  color: var(--brand-hover, #4B3CD4);
}

.legal-content a:focus-visible {
  outline: 2px solid var(--brand, #5F4DEB);
  outline-offset: 2px;
}

/* ---- Lists ---- */
.legal-content ul,
.legal-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.375rem;
}

.legal-content ul {
  list-style-type: disc;
}

.legal-content ol {
  list-style-type: decimal;
}

.legal-content li {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-secondary, #3D3552);
  margin-bottom: 0.25rem;
}

.legal-content li::marker {
  color: var(--text-tertiary, #6B6280);
}

/* ---- Tables ---- */
.legal-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.55;
}

.legal-content thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary, #060214);
  background: var(--surface-muted, #F3F2FF);
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border, #DDD9EA);
  white-space: nowrap;
}

.legal-content tbody td {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-subtle, #EDEAF5);
  color: var(--text-secondary, #3D3552);
  vertical-align: top;
}

.legal-content tbody tr:nth-child(even) {
  background: rgba(243, 242, 255, 0.35);
}

/* ---- Strong (subsection labels) ---- */
.legal-content p strong {
  color: var(--text-primary, #060214);
}

/* ---- Acceptance block (Beta Terms) ---- */
.legal-acceptance {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface-muted, #F3F2FF);
  border: 1px solid var(--brand-border, #CBC4F5);
  border-radius: 8px;
}

.legal-acceptance p {
  margin-bottom: 0.625rem;
}

.legal-acceptance p:last-child {
  margin-bottom: 0;
}

.legal-acceptance__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary, #3D3552);
  margin-bottom: 0.875rem;
  padding: 0.875rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #DDD9EA);
  border-radius: 6px;
}

.legal-acceptance__checkbox input[type="checkbox"] {
  margin-top: 0.1875rem;
  flex-shrink: 0;
  accent-color: var(--brand, #5F4DEB);
  width: 1rem;
  height: 1rem;
}

.legal-acceptance__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.75rem;
  background: var(--brand, #5F4DEB);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font, 'Figtree', sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.5;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.legal-acceptance__btn--active {
  cursor: pointer;
  opacity: 1;
}

.legal-acceptance__btn--active:hover {
  background: var(--brand-hover, #4B3CD4);
  transform: translateY(-1px);
}

/* ============================================================
   FOOTER
   ============================================================ */
.legal-footer {
  border-top: 1px solid var(--border-subtle, #EDEAF5);
  padding: 1.75rem 0;
  position: relative;
  z-index: 1;
}

.legal-footer .legal-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.legal-footer__copy {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6B6280);
}

.legal-footer__links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

.legal-footer__links a {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6B6280);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-footer__links a:hover {
  color: var(--brand, #5F4DEB);
}

.legal-footer__links a:focus-visible {
  outline: 2px solid var(--brand, #5F4DEB);
  outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 1rem;
  }

  /* Sidebar becomes horizontal scrollable tab bar */
  .legal-sidebar {
    position: static;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle, #EDEAF5);
  }

  .legal-sidebar__heading {
    margin-bottom: 0.375rem;
  }

  .legal-sidebar__contact {
    margin-bottom: 0.75rem;
  }

  .legal-sidebar__nav {
    flex-direction: row;
    gap: 0.375rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.25rem;
  }

  .legal-sidebar__nav::-webkit-scrollbar {
    display: none;
  }

  .legal-sidebar__link {
    border-left: none;
    border-radius: 999px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    white-space: nowrap;
    background: var(--surface, #fff);
    border: 1px solid var(--border-subtle, #EDEAF5);
    text-align: center;
    flex-shrink: 0;
  }

  .legal-sidebar__link:hover {
    border-color: var(--brand, #5F4DEB);
    color: var(--text-primary, #060214);
  }

  .legal-sidebar__link.is-active,
  .legal-sidebar__link[aria-current="page"] {
    background: var(--brand, #5F4DEB);
    color: #fff;
    border-color: var(--brand, #5F4DEB);
    font-weight: 600;
  }

  .legal-content__title {
    font-size: 1.75rem;
  }

  .legal-content h2 {
    margin-top: 1.75rem;
  }

  .legal-footer .legal-container {
    flex-direction: column;
    text-align: center;
  }

  .legal-footer__links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .legal-sidebar__link {
    font-size: 0.75rem;
    padding: 0.3125rem 0.625rem;
  }

  .legal-content__title {
    font-size: 1.5rem;
  }
}
