/* Design System / Variables */
:root {
  --color-bg: #faf8f9;
  --color-card-bg: rgba(255, 255, 255, 0.85);
  --color-text-primary: #2d2d2d;
  --color-text-muted: #666d75;
  --color-accent-mauve: #a8879d;
  --color-accent-mauve-light: #f5eff2;
  --color-accent-coral: #d27644;
  --color-accent-coral-light: #fdf5f0;
  --color-border: #e8e6e7;
  --color-shadow: rgba(168, 135, 157, 0.08);
  --font-sans: "Open Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base Styles */
.legal-page-wrapper {
  background-color: var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  line-height: 1.65;
  min-height: 100vh;
  padding: 40px 0;
  width: 100%;
}

/* Elegant Container */
.legal-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Gorgeous Header Banner */
.legal-header-section {
  text-align: center;
  padding: 50px 20px;
  background: linear-gradient(135deg, #fcf6f9 0%, #f6ebf1 50%, #fdf9f7 100%);
  border-radius: 20px;
  margin-bottom: 40px;
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 30px var(--color-shadow);
  position: relative;
  overflow: hidden;
}

.legal-header-section::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(210, 118, 68, 0.03) 0%, transparent 60%);
  pointer-events: none;
}

.legal-badge {
  display: inline-block;
  background-color: var(--color-accent-coral-light);
  color: var(--color-accent-coral);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 16px;
  border: 1px solid rgba(210, 118, 68, 0.15);
}

.legal-title {
  font-size: 38px;
  font-weight: 800;
  color: #222222;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.legal-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Premium TL;DR Quick-Summary Highlights */
.legal-tldr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.legal-tldr-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 15px var(--color-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.legal-tldr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(168, 135, 157, 0.12);
}

.legal-tldr-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-accent-mauve);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-tldr-card h3::before {
  content: "✦";
  color: var(--color-accent-coral);
  font-size: 18px;
}

.legal-tldr-card p {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

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

/* Sticky Sidebar / Table of Contents */
.legal-sidebar {
  position: sticky;
  top: 40px;
  background: var(--color-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 24px;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 24px var(--color-shadow);
}

.legal-sidebar h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

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

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

.legal-toc li a {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  transition: all 0.25s ease;
  border-radius: 0 6px 6px 0;
}

.legal-toc li a:hover {
  color: var(--color-accent-mauve);
  background-color: rgba(168, 135, 157, 0.04);
  padding-left: 16px;
}

.legal-toc li.active a {
  color: var(--color-accent-mauve);
  background-color: var(--color-accent-mauve-light);
  border-left-color: var(--color-accent-mauve);
  font-weight: 700;
  padding-left: 16px;
}

/* Legal Content Panel */
.legal-content-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 48px;
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 30px var(--color-shadow);
}

.legal-section {
  margin-bottom: 48px;
  scroll-margin-top: 60px; /* Smooth-scroll alignment */
}

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

.legal-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: #111111;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.legal-section p {
  font-size: 15px;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  line-height: 1.7;
}

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

.legal-section ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

.legal-section li {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--color-text-primary);
}

/* Warning / Medical Disclaimer Callout Card */
.legal-callout-card {
  background-color: var(--color-accent-coral-light);
  border-left: 4px solid var(--color-accent-coral);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
}

.legal-callout-card h4 {
  color: var(--color-accent-coral);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legal-callout-card p {
  font-size: 14px;
  color: #5c504a;
  line-height: 1.6;
  margin-bottom: 0;
}

/* CSS-Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Table of Contents converts to an horizontal scrolling list on smaller screens */
  .legal-sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 24px;
    border-radius: 0;
    margin: 0 -24px;
    border-left: none;
    border-right: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  }

  .legal-sidebar h4 {
    display: none; /* Hide TOC title to save space */
  }

  .legal-toc {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    white-space: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
  }

  .legal-toc::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .legal-toc li {
    margin-bottom: 0;
  }

  .legal-toc li a {
    padding: 6px 16px;
    font-size: 13px;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 100px;
    background: #f1eeef;
  }

  .legal-toc li.active a {
    border-bottom-color: var(--color-accent-mauve);
    border-left-color: transparent;
    background: var(--color-accent-mauve-light);
  }

  .legal-content-card {
    padding: 32px 24px;
  }
}

@media (max-width: 600px) {
  .legal-header-section {
    padding: 32px 16px;
    margin-bottom: 24px;
  }

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

  .legal-content-card {
    padding: 24px 16px;
  }
  
  .legal-section h2 {
    font-size: 18px;
  }
}
