/* ==========================================================================
   Huabangxing — shared legal stylesheet
   Loaded ONLY by privacy.html and terms-of-service.html
   ========================================================================== */

.legal-page {
  background-color: #F7F5F0;
  color: #1A1A1A;
}

:root {
  --legal-bg: #F7F5F0;
  --legal-surface: #FFFFFF;
  --legal-surface-2: #F1EEE7;
  --legal-ink: #1A1A1A;
  --legal-ink-soft: #4B5563;
  --legal-accent: #2563EB;
  --legal-accent-dark: #1E40AF;
  --legal-accent-deep: #0F172A;
  --legal-accent-light: #93C5FD;
  --legal-line: #E3DFD5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--legal-ink);
  background-color: var(--legal-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--legal-accent);
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Scope isolation: neutralize any leaked background from other rules */
.legal-page .legal-content section {
  background-color: transparent !important;
}

/* ==========================================================================
   Legal header
   ========================================================================== */

.legal-header {
  background: linear-gradient(135deg, #0F172A 0%, #1E40AF 100%);
  padding: 56px 0 48px;
  color: #FFFFFF;
}

.legal-header-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 700;
  align-self: flex-start;
}

.legal-badge {
  position: relative;
  width: 30px;
  height: 34px;
  background-color: var(--legal-accent);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  flex: none;
}

.legal-badge::before {
  content: "";
  position: absolute;
  inset: 3px;
  background-color: #0F172A;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
}

.legal-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  background-color: var(--legal-accent-light);
  border-radius: 50%;
}

.legal-header h1 {
  font-size: 40px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.5px;
}

.legal-updated {
  font-size: 15px;
  color: #CBD5E1;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.legal-content {
  padding: 48px 0 72px;
}

.legal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

/* ==========================================================================
   Table of contents
   ========================================================================== */

.toc {
  position: sticky;
  top: 24px;
  background-color: var(--legal-surface);
  border: 1px solid var(--legal-line);
  border-radius: 14px;
  padding: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.toc h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--legal-accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.toc ul {
  list-style: none;
}

.toc li {
  margin-bottom: 10px;
}

.toc li:last-child {
  margin-bottom: 0;
}

.toc a {
  font-size: 14px;
  color: var(--legal-ink-soft);
  line-height: 1.4;
}

.toc a:hover {
  color: var(--legal-accent);
}

/* ==========================================================================
   Legal body
   ========================================================================== */

.legal-body {
  background-color: var(--legal-surface);
  border: 1px solid var(--legal-line);
  border-radius: 14px;
  padding: 48px;
}

.legal-body section {
  margin-bottom: 44px;
}

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

.legal-body h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--legal-accent-dark);
  letter-spacing: -0.3px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--legal-line);
}

.legal-body p {
  font-size: 16px;
  color: var(--legal-ink);
  margin-bottom: 16px;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */

.legal-footer {
  background-color: var(--legal-accent-deep);
  padding: 36px 0;
}

.legal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.legal-footer p {
  font-size: 14px;
  color: #94A3B8;
}

.legal-footer nav {
  display: flex;
  gap: 24px;
}

.legal-footer a {
  font-size: 14px;
  color: #CBD5E1;
  font-weight: 600;
}

.legal-footer a:hover {
  color: #FFFFFF;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
    order: -1;
  }

  .legal-body {
    padding: 32px;
  }
}

@media (max-width: 560px) {
  .legal-header h1 {
    font-size: 30px;
  }

  .legal-body {
    padding: 24px 20px;
  }

  .legal-body h2 {
    font-size: 22px;
  }
}
