/* ==========================================================================
   AR Trace & Sketch - Legal & Policy Pages Stylesheet
   Modern, accessible, responsive design with dark mode and print optimization.
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --brand-primary: #f4813f;
  --brand-secondary: #f1556a;
  --brand-gradient: linear-gradient(135deg, #f4813f 0%, #f1556a 100%);
  --brand-glow: rgba(244, 129, 63, 0.15);

  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-accent-subtle: #fff7ed;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --text-on-brand: #ffffff;

  --border-light: #e2e8f0;
  --border-focus: #f4813f;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-content-width: 1200px;
  --header-height: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0b0f19;
    --bg-surface: #131c2e;
    --bg-surface-elevated: #1a243a;
    --bg-muted: #1e293b;
    --bg-accent-subtle: rgba(244, 129, 63, 0.12);

    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-dim: #64748b;

    --border-light: #243247;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.6);
  }
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation Header */
.legal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .legal-header {
    background: rgba(19, 28, 46, 0.85);
  }
}

.header-container {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  transition: opacity 0.2s ease;
}

.brand-link:hover {
  opacity: 0.9;
}

.brand-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(244, 129, 63, 0.35);
}

.brand-name {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}

.nav-link.active {
  color: #ffffff;
  background: var(--brand-gradient);
  box-shadow: 0 2px 8px rgba(244, 129, 63, 0.3);
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(180deg, var(--bg-accent-subtle) 0%, var(--bg-page) 100%);
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(244, 129, 63, 0.25);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 1.5rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Main Layout Grid */
.legal-container {
  max-width: var(--max-content-width);
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* Sidebar Navigation */
.sidebar-wrapper {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.sidebar-nav {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--brand-primary);
  background: var(--bg-muted);
  transform: translateX(2px);
}

/* Content Area */
.legal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem 3rem;
  box-shadow: var(--shadow-sm);
}

/* Highlights Box / Quick Summary */
.summary-card {
  background: var(--bg-accent-subtle);
  border: 1px solid rgba(244, 129, 63, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  gap: 1rem;
}

.summary-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(244, 129, 63, 0.3);
}

.summary-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.summary-text {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Document Sections */
.legal-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--border-light);
}

.legal-section:last-of-type {
  border-bottom: none;
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.section-heading {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--brand-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.sub-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 1.5rem 0 0.75rem;
}

.legal-text {
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.legal-text strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Feature Grid / Service Cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.feature-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-box:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 129, 63, 0.4);
}

.feature-box-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
  font-size: 1rem;
}

.feature-box-icon {
  color: var(--brand-primary);
  font-size: 1.1rem;
}

.feature-box-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Third-Party Service Badges List */
.service-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.925rem;
  transition: all 0.2s ease;
}

.service-item:hover {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  transform: translateX(4px);
}

.service-name {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.service-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--bg-accent-subtle);
  color: var(--brand-primary);
  font-weight: 600;
}

.service-arrow {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Ordered / Unordered Lists */
.legal-list {
  margin: 0.75rem 0 1.25rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.7;
}

.legal-list li {
  margin-bottom: 0.5rem;
}

.legal-list li strong {
  color: var(--text-main);
}

/* Callout Note */
.callout-note {
  border-left: 4px solid var(--brand-primary);
  background: var(--bg-accent-subtle);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.25rem 0;
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.callout-note strong {
  color: var(--text-main);
}

/* Contact Cards Grid */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.contact-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
}

.contact-card-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.contact-card-value a {
  color: var(--brand-primary);
  text-decoration: none;
}

.contact-card-value a:hover {
  text-decoration: underline;
}

/* Footer */
.legal-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 2.5rem 1.5rem;
}

.footer-container {
  max-width: var(--max-content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--brand-primary);
}

/* Floating Back To Top Button */
.back-to-top {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  font-size: 1.2rem;
  opacity: 0.9;
  transition: all 0.25s ease;
  z-index: 90;
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(244, 129, 63, 0.4);
}

/* Responsive Media Queries */
@media (max-width: 991px) {
  .legal-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem auto 3rem;
  }

  .sidebar-wrapper {
    position: static;
  }

  .sidebar-nav {
    max-height: none;
  }

  .legal-content {
    padding: 1.75rem 1.5rem;
  }

  .hero-title {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  .hero-title {
    font-size: 1.65rem;
  }

  .header-nav .nav-link {
    padding: 0.4rem 0.65rem;
    font-size: 0.825rem;
  }

  .brand-name {
    font-size: 1.1rem;
  }

  .legal-content {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
  }

  .summary-card {
    flex-direction: column;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }
}

/* Print Optimization */
@media print {
  .legal-header,
  .sidebar-wrapper,
  .back-to-top,
  .legal-footer {
    display: none !important;
  }

  .legal-container {
    display: block;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .legal-content {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}
