/* ==========================================================================
   WABA Catalog Studio — Legal & Policy Document Stylesheet
   Inherits design tokens and variables from css/styles.css
   ========================================================================== */

/* Subpage Navigation override */
.legal-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px -8px rgba(7, 61, 54, 0.12);
  color: var(--text);
}
.legal-nav .menu a {
  color: var(--text);
  opacity: 0.85;
}
.legal-nav .menu a:hover {
  opacity: 1;
  background: rgba(13, 148, 136, 0.08);
  color: var(--emerald);
}
.legal-nav .menu a.active {
  color: var(--emerald);
  background: rgba(13, 148, 136, 0.12);
}

/* Page Header */
.legal-hero {
  background: radial-gradient(1000px 500px at 70% 20%, rgba(13, 148, 136, 0.25), transparent 60%),
              radial-gradient(700px 400px at 10% 90%, rgba(45, 212, 191, 0.15), transparent 60%),
              var(--dark);
  color: #fff;
  padding: 100px 0 60px;
  position: relative;
  isolation: isolate;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.legal-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 80%);
  z-index: -1;
}
.legal-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 1.2rem;
}
.legal-breadcrumbs a {
  color: var(--mint);
  transition: opacity 0.2s;
}
.legal-breadcrumbs a:hover {
  text-decoration: underline;
  opacity: 0.9;
}
.legal-hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  color: #fff;
  margin-bottom: 1rem;
}
.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 1rem;
  align-items: center;
}
.legal-meta .tag {
  background: rgba(45, 212, 191, 0.16);
  color: var(--mint);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(45, 212, 191, 0.28);
}
.legal-meta span.separator {
  opacity: 0.35;
}

/* Document Container & Two-Column Grid */
.legal-container {
  padding: 60px 0 100px;
  background: #fafcfb;
}
.legal-grid {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 3.5rem;
  align-items: start;
}

/* Sticky Table of Contents */
.legal-toc-wrapper {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 20px -6px rgba(7, 61, 54, 0.06);
}
.legal-toc-title {
  font-family: var(--h);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legal-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.legal-toc-list a {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  line-height: 1.35;
  border-left: 2px solid transparent;
}
.legal-toc-list a:hover {
  color: var(--emerald);
  background: var(--light);
}
.legal-toc-list a.active {
  color: var(--emerald);
  background: rgba(13, 148, 136, 0.09);
  font-weight: 600;
  border-left-color: var(--emerald);
}
.legal-toc-list small {
  display: inline-block;
  font-size: 0.74rem;
  opacity: 0.6;
  margin-right: 0.35rem;
}

/* Document Body Content */
.legal-body {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 3.5rem;
  box-shadow: 0 2px 10px rgba(7, 61, 54, 0.04);
  color: #243530;
  font-size: 1rem;
  line-height: 1.75;
}
.legal-section {
  scroll-margin-top: 100px;
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.legal-section h2 {
  font-size: 1.65rem;
  color: var(--teal);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.015em;
}
.legal-section h2 .sec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(13, 148, 136, 0.12);
  color: var(--emerald);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  flex: none;
}
.legal-section h3 {
  font-size: 1.22rem;
  color: var(--text);
  margin: 1.8rem 0 0.8rem;
  letter-spacing: -0.01em;
}
.legal-section h4 {
  font-size: 1.05rem;
  color: var(--teal);
  margin: 1.2rem 0 0.5rem;
}
.legal-section p {
  margin-bottom: 1rem;
}
.legal-section p:last-child {
  margin-bottom: 0;
}
.legal-section ul, .legal-section ol {
  margin: 0.8rem 0 1.2rem 1.6rem;
}
.legal-section li {
  margin-bottom: 0.5rem;
}
.legal-section strong {
  color: var(--teal);
  font-weight: 600;
}

/* Callout & Alert Boxes */
.legal-callout {
  background: var(--light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--emerald);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.94rem;
  line-height: 1.65;
}
.legal-callout.warning {
  background: #fffbf0;
  border-color: #f7dfa5;
  border-left-color: #d97706;
}
.legal-callout.important {
  background: #f0fdf9;
  border-color: #c7eedd;
  border-left-color: var(--emerald);
}
.legal-callout-title {
  font-family: var(--h);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legal-callout.warning .legal-callout-title {
  color: #92400e;
}

/* Steps Box (for Data Deletion & Setup) */
.deletion-step-card {
  display: flex;
  gap: 1.2rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin: 1rem 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.deletion-step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(7, 61, 54, 0.08);
}
.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald), #0b7f75);
  color: #fff;
  font-family: var(--h);
  font-weight: 800;
  font-size: 1.1rem;
  flex: none;
}
.step-details h4 {
  font-family: var(--h);
  font-size: 1.05rem;
  color: var(--teal);
  margin-bottom: 0.35rem;
}
.step-details p {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

/* Tables in Legal Docs */
.legal-table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(7, 61, 54, 0.04);
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: left;
}
.legal-table th {
  background: var(--light);
  color: var(--teal);
  font-family: var(--h);
  font-weight: 700;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.legal-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  line-height: 1.55;
}
.legal-table tr:last-child td {
  border-bottom: none;
}
.legal-table tr:nth-child(even) td {
  background: #fbfdfc;
}

/* Company / Contact Details Card */
.company-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  margin: 1.5rem 0;
}
.company-card-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.company-card-item small {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.company-card-item span, .company-card-item a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--teal);
}
.company-card-item a:hover {
  color: var(--emerald);
  text-decoration: underline;
}

/* Policy Switcher Quick Links */
.policy-switcher {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 2rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.policy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal);
  transition: all 0.2s;
}
.policy-pill:hover {
  background: #ffffff;
  border-color: var(--emerald);
  color: var(--emerald);
  transform: translateY(-1px);
}
.policy-pill.current {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .legal-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .legal-toc-wrapper {
    position: static;
    max-height: none;
  }
  .legal-body {
    padding: 2rem 1.5rem;
  }
}

@media print {
  .legal-nav, .legal-toc-wrapper, footer, .legal-breadcrumbs, .policy-switcher {
    display: none !important;
  }
  .legal-hero {
    background: #fff !important;
    color: #000 !important;
    padding: 20px 0 !important;
  }
  .legal-hero h1 {
    color: #000 !important;
  }
  .legal-body {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .legal-container {
    background: #fff !important;
    padding: 0 !important;
  }
}
