/*
 * ============================================================
 * Browns Digital — Proprietary Software
 * ============================================================
 * Copyright (c) 2026 Robert Brown / Browns Digital. All rights reserved.
 *
 * CONFIDENTIAL — NOT FOR DISTRIBUTION
 *
 * Unauthorised reproduction, distribution, modification, or
 * reverse engineering of this material is strictly prohibited.
 * No licence is granted except by express written agreement.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
 * Governing Law: Republic of South Africa | contact@brownsdigital.org
 * ============================================================
 */
.legal-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: #1d1d1f;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(168, 196, 255, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 20%, rgba(91, 140, 255, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse 45% 35% at 0% 75%, rgba(53, 92, 255, 0.12) 0%, transparent 45%),
    linear-gradient(180deg, #f8faff 0%, #ffffff 45%, #fafbff 100%);
  background-attachment: fixed;
}

.legal-top {
  display: none;
}

.legal-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #355cff, #6366f1);
  z-index: 1001;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ── Hero ── */
.legal-hero {
  max-width: 980px;
  margin: 0 auto;
  padding: 88px 22px 32px;
  text-align: center;
}

.legal-hero h1 {
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 12px;
  color: #1d1d1f;
}

.legal-meta {
  font-size: 14px;
  color: #6e6e73;
  margin: 0 0 24px;
}

.legal-badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.legal-badge--accent {
  color: #2563eb;
  background: rgba(53, 92, 255, 0.08);
  border-color: rgba(53, 92, 255, 0.2);
}

.legal-summary {
  max-width: 680px;
  margin: 0 auto;
  font-size: 19px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #6e6e73;
  text-align: left;
  padding: 28px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.legal-summary strong {
  color: #1d1d1f;
  font-weight: 600;
}

.legal-hero__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 28px;
}

.legal-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.legal-stat svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.legal-callout {
  margin: 24px 0;
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid rgba(53, 92, 255, 0.18);
  background: linear-gradient(135deg, rgba(53, 92, 255, 0.06) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.legal-callout--neutral {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
}

.legal-callout--warn {
  border-color: rgba(255, 149, 0, 0.25);
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.08) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.legal-callout__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #355cff;
  margin: 0 0 8px;
}

.legal-callout--warn .legal-callout__title {
  color: #c93400;
}

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

.legal-def-list {
  margin: 16px 0 20px;
  padding: 0;
  list-style: none;
}

.legal-def-list > div {
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.legal-def-list > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legal-def-list dt {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 4px;
}

.legal-def-list dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #6e6e73;
}

.legal-section__lead {
  font-size: 18px;
  line-height: 1.5;
  color: #6e6e73;
  margin: -4px 0 20px;
  letter-spacing: -0.01em;
}

.legal-ref-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.legal-ref-list li {
  margin-bottom: 10px;
  padding-left: 0;
}

.legal-ref-list a {
  font-weight: 500;
}

/* ── Layout: TOC + content ── */
.legal-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 22px 80px;
}

.legal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ── Sticky TOC ── */
.legal-toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

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

.legal-toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legal-toc a {
  display: block;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  color: #6e6e73;
  text-decoration: none;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.legal-toc a:hover {
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.03);
}

.legal-toc a.is-active {
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.04);
  border-left-color: #1d1d1f;
}

/* ── Main content ── */
.legal-main {
  min-width: 0;
  max-width: 720px;
}

.legal-section {
  padding: 40px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  scroll-margin-top: 110px;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

.legal-section:last-of-type {
  border-bottom: none;
}

.legal-section h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.16667;
  color: #1d1d1f;
  margin: 0 0 16px;
}

.legal-section h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1d1d1f;
  margin: 28px 0 10px;
}

.legal-section p {
  font-size: 17px;
  line-height: 1.47059;
  color: #1d1d1f;
  margin: 0 0 16px;
  opacity: 0.88;
}

.legal-section ul {
  margin: 0 0 16px;
  padding-left: 1.25em;
}

.legal-section li {
  font-size: 17px;
  line-height: 1.47059;
  color: #1d1d1f;
  opacity: 0.88;
  margin-bottom: 8px;
}

.legal-section li::marker {
  color: #6e6e73;
}

.legal-section strong {
  font-weight: 600;
  opacity: 1;
}

.legal-section code {
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.legal-link {
  color: #2563eb;
  font-weight: 500;
  text-decoration: none;
}

.legal-link:hover {
  text-decoration: underline;
}

/* ── Tables ── */
.legal-table-wrap {
  overflow-x: auto;
  margin: 20px 0 24px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}

.legal-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e6e73;
  background: #f5f5f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.legal-table td {
  padding: 12px 16px;
  color: #1d1d1f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: top;
}

.legal-table tr:last-child td {
  border-bottom: none;
}

.legal-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.015);
}

/* ── Rights grid ── */
.legal-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0 8px;
}

.legal-card {
  padding: 16px 18px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.25s ease;
}

.legal-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
/* @bd-origin:BD-8260-177F-24B7 */

.legal-card strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 4px;
}

.legal-card span {
  font-size: 13px;
  line-height: 1.45;
  color: #6e6e73;
}

/* ── CTA row ── */
.legal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 48px;
  margin-bottom: 0;
  padding-top: 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.legal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 32px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.legal-btn--primary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
  color: #111827;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 16px 40px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.legal-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 24px 56px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.legal-btn--secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.55));
  color: #424245;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.05),
    0 12px 32px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  text-decoration: none;
}

.legal-btn--secondary:hover {
  color: #111827;
  transform: translateY(-2px);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.07),
    0 20px 48px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* ── Bottom disclaimer (below CTA buttons) ── */
.legal-section .legal-disclaimer {
  margin: 64px 0 0;
  padding: 0;
  max-width: 40rem;
  border: none;
  opacity: 1;
}

.legal-disclaimer__panel {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 24px 28px 26px;
  border-radius: 32px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.78) 0%,
    rgba(255, 255, 255, 0.5) 55%,
    rgba(248, 250, 255, 0.62) 100%
  );
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 24px 56px rgba(15, 23, 42, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 0 0 1px rgba(53, 92, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.legal-disclaimer__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 60% at 0% 0%,
    rgba(53, 92, 255, 0.07) 0%,
    transparent 55%
  );
}

.legal-disclaimer__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-top: 1px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  font-style: normal;
  color: #355cff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(237, 242, 255, 0.9));
  border: 1px solid rgba(53, 92, 255, 0.14);
  box-shadow:
    0 2px 8px rgba(53, 92, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  position: relative;
  z-index: 1;
}

.legal-disclaimer__content {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.legal-section .legal-disclaimer__label {
  margin: 0 0 6px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #355cff;
  line-height: 1.2;
  opacity: 1;
}

.legal-section .legal-disclaimer__text {
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: #6e6e73;
  opacity: 1;
}

.legal-disclaimer__text .legal-link {
  font-weight: 500;
}

.legal-main {
  padding-bottom: 24px;
}

.legal-body .site-footer {
  margin-top: auto;
  padding-top: 16px;
}

/* ── Mobile TOC toggle ── */
.legal-toc-mobile {
  display: none;
  margin-bottom: 24px;
}

.legal-toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #1d1d1f;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}

.legal-toc-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.25s ease;
}

.legal-toc-mobile.is-open .legal-toc-toggle svg {
  transform: rotate(180deg);
}

.legal-toc-drawer {
  display: none;
  margin-top: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  max-height: 50vh;
  overflow-y: auto;
}

.legal-toc-mobile.is-open .legal-toc-drawer {
  display: block;
}

.legal-toc-drawer a {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  color: #6e6e73;
  text-decoration: none;
  border-radius: 8px;
}

.legal-toc-drawer a:hover,
.legal-toc-drawer a.is-active {
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.04);
}

html.low-power .legal-summary,
html.low-power .legal-card,
html.low-power .legal-disclaimer__panel {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(255, 255, 255, 0.94) !important;
}

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

  .legal-toc {
    display: none;
  }

  .legal-toc-mobile {
    display: block;
  }

  .legal-main {
    max-width: none;
  }

  .legal-hero {
    padding-top: 72px;
    text-align: left;
  }

  .legal-summary {
    font-size: 17px;
  }

  .legal-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .legal-section h2 {
    font-size: 21px;
  }

  .legal-actions {
    flex-direction: column;
  }

  .legal-section .legal-disclaimer {
    margin-top: 52px;
  }

  .legal-disclaimer__panel {
    padding: 20px 22px 22px;
    gap: 14px;
    border-radius: 28px;
  }

  .legal-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-card:hover {
    transform: none;
  }

  .legal-btn--primary:hover,
  .legal-btn--secondary:hover {
    transform: none;
  }
}
