/* ============================================================
   LEGAL PAGES — Privacy Policy & Terms of Service
   Clean document layout matching Spark.Ai brand
   ============================================================ */

/* ---------- Page Layout ---------- */
.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #1f1f1f;
  font-family: "Google Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.legal-page .nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e6e8ec;
}

.legal-page .nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 2.8vw, 48px);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Brand (matches main site exactly) ---------- */
.legal-page .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1f1f1f;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.legal-page .brand-wrapper {
  position: relative;
  display: inline-block;
  line-height: 1;
  padding-bottom: 0;
}

.legal-page .brand-name {
  font-size: clamp(14px, 1.25vw, 20px);
}

.legal-page .brand-arrow {
  position: absolute;
  bottom: clamp(-6px, -0.5vw, -9px);
  left: 6%;
  width: 88%;
  height: clamp(6px, 0.6vw, 10px);
  pointer-events: none;
}

.legal-page .spark-star {
  width: clamp(18px, 1.67vw, 28px);
  height: clamp(18px, 1.67vw, 28px);
  display: inline-block;
  position: relative;
  background: conic-gradient(from 130deg, #1a73e8, #7b4dff, #e9428b, #f59e0b, #1a73e8);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 67% 58%, 79% 92%, 50% 72%, 21% 92%, 33% 58%, 2% 35%, 39% 35%);
  border-radius: 2px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
  transform-style: preserve-3d;
  flex-shrink: 0;
  animation: starSpinOnce 1.2s ease-out forwards;
}

.legal-page .spark-star::before {
  content: "";
  position: absolute;
  inset: 18% 18% 20% 20%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), transparent 55%);
  opacity: 0.7;
}

.legal-page .spark-star::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), transparent 45%);
  mix-blend-mode: screen;
  opacity: 0.5;
}

@keyframes starSpinOnce {
  0% { transform: rotateZ(0deg) rotateX(0deg); }
  100% { transform: rotateZ(360deg) rotateX(0deg); }
}

/* Back link in nav */
.legal-page .nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #5f6368;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.legal-page .nav-back:hover {
  color: #1f1f1f;
}

.legal-page .nav-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Content Layout ---------- */
.legal-body {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(32px, 4vw, 64px) clamp(20px, 2.8vw, 48px);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: clamp(32px, 4vw, 64px);
  width: 100%;
  box-sizing: border-box;
}

/* ---------- Sidebar / Table of Contents ---------- */
.legal-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.legal-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-toc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9aa0a6;
  margin-bottom: 12px;
}

.legal-toc li {
  margin-bottom: 2px;
}

.legal-toc a {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: #5f6368;
  text-decoration: none;
  border-radius: 6px;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.legal-toc a:hover {
  color: #1f1f1f;
  background: #f8f9fa;
}

.legal-toc a.active {
  color: #1f1f1f;
  background: #f1f3f4;
  font-weight: 500;
}

/* ---------- Main Content ---------- */
.legal-content {
  max-width: 760px;
}

.legal-header {
  margin-bottom: clamp(28px, 3vw, 48px);
  padding-bottom: clamp(20px, 2vw, 32px);
  border-bottom: 1px solid #e6e8ec;
}

.legal-title {
  font-family: "Space Grotesk", "Google Sans", sans-serif;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 600;
  color: #1f1f1f;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 12px 0;
}

.legal-meta {
  font-size: 14px;
  color: #9aa0a6;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Sections ---------- */
.legal-section {
  margin-bottom: clamp(32px, 3.5vw, 52px);
  scroll-margin-top: 80px;
}

.legal-section h2 {
  font-family: "Space Grotesk", "Google Sans", sans-serif;
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 600;
  color: #1f1f1f;
  letter-spacing: -0.015em;
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.legal-section h3 {
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 600;
  color: #1f1f1f;
  margin: 20px 0 10px 0;
  line-height: 1.4;
}

.legal-section p {
  font-size: 15px;
  color: #3c4043;
  line-height: 1.7;
  margin: 0 0 14px 0;
}

.legal-section ul,
.legal-section ol {
  padding-left: 24px;
  margin: 0 0 14px 0;
}

.legal-section li {
  font-size: 15px;
  color: #3c4043;
  line-height: 1.7;
  margin-bottom: 6px;
}

.legal-section a {
  color: #FF9900;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.legal-section a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.legal-section strong {
  font-weight: 600;
  color: #1f1f1f;
}

/* Highlight box for important notices */
.legal-highlight {
  background: #f8f9fa;
  border-left: 3px solid #FF9900;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 16px 0;
}

.legal-highlight p {
  margin: 0;
  font-size: 14px;
  color: #3c4043;
}

/* ---------- Footer (reused) ---------- */
.legal-page .legal-footer {
  border-top: 1px solid #e6e8ec;
  padding: clamp(24px, 2.5vw, 40px) clamp(20px, 2.8vw, 48px);
  margin-top: auto;
}

.legal-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1f1f1f;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.legal-footer-brand .brand-wrapper {
  position: relative;
  display: inline-block;
  line-height: 1;
  padding-bottom: 0;
}

.legal-footer-brand .brand-arrow {
  position: absolute;
  bottom: clamp(-6px, -0.5vw, -9px);
  left: 6%;
  width: 88%;
  height: clamp(6px, 0.6vw, 10px);
  pointer-events: none;
}

.legal-footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.legal-footer-links a {
  font-size: 13px;
  color: #5f6368;
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-footer-links a:hover {
  color: #1f1f1f;
}

.legal-footer-copy {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #9aa0a6;
  margin-top: 16px;
}

/* ---------- Responsive ---------- */

/* Tablet and below: collapse sidebar */
@media (max-width: 860px) {
  .legal-body {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .legal-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    margin-bottom: clamp(24px, 3vw, 40px);
    padding-bottom: clamp(16px, 2vw, 24px);
    border-bottom: 1px solid #e6e8ec;
  }

  .legal-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .legal-toc-label {
    width: 100%;
    margin-bottom: 8px;
  }

  .legal-toc a {
    padding: 6px 12px;
    font-size: 12px;
    background: #f8f9fa;
    border-radius: 20px;
  }

  .legal-toc a:hover,
  .legal-toc a.active {
    background: #f1f3f4;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .legal-page .nav-inner {
    height: 52px;
  }

  .legal-title {
    font-size: 24px;
  }

  .legal-section h2 {
    font-size: 17px;
  }

  .legal-section p,
  .legal-section li {
    font-size: 14px;
  }

  .legal-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .legal-footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}
