/* ==========================================================================
   NIEdge Legal & Policies — Documentation CSS
   Style: Professional documentation (GitHub/Stripe/Notion legal reference)
   Version: 2.1
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Selection colour */
::selection {
  background-color: var(--accent-primary);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   2. Container & Document Width
   -------------------------------------------------------------------------- */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Documentation-width constraint — all legal content lives inside this */
.legal-doc-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------------------------
   3. Navbar offset — push content below fixed navbar
   -------------------------------------------------------------------------- */
.legal-page-wrapper {
  padding-top: 90px;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   4. Page title block
   -------------------------------------------------------------------------- */
.legal-page-title-block {
  padding: 56px 0 28px;
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: 0;
}

.legal-page-title-block h1 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   5. Document metadata row
   -------------------------------------------------------------------------- */
.legal-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.legal-meta-row .meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legal-meta-row .meta-sep {
  color: var(--border-primary);
  font-size: 0.7rem;
}

/* --------------------------------------------------------------------------
   6. Breadcrumb
   -------------------------------------------------------------------------- */
.legal-breadcrumb-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legal-breadcrumb-line a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-breadcrumb-line a:hover {
  color: var(--accent-primary);
}

.legal-breadcrumb-line .bc-sep {
  margin: 0 5px;
  opacity: 0.5;
}

.legal-breadcrumb-line .bc-current {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   7. Table of Contents
   -------------------------------------------------------------------------- */
.legal-toc-block {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: 0;
}

.legal-toc-block h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.legal-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  counter-reset: toc-counter;
}

.legal-toc-list > li {
  border-bottom: 1px solid var(--border-secondary);
}

.legal-toc-list > li:last-child {
  border-bottom: none;
}

.legal-toc-list a {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 0;
  transition: color 0.15s ease;
  line-height: 1.5;
}

.legal-toc-list a:hover,
.legal-toc-list a.toc-active {
  color: var(--accent-primary);
}

.legal-toc-list a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   8. Document body — long-form content
   -------------------------------------------------------------------------- */
.legal-document-body {
  padding: 48px 0 0;
}

/* Sections */
.legal-doc-section {
  margin-bottom: 52px;
  scroll-margin-top: 100px;
}

.legal-doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-secondary);
  letter-spacing: -0.01em;
}

.legal-doc-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 10px;
}

.legal-doc-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 20px;
  margin-bottom: 8px;
}

.legal-doc-section p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.82;
  margin-bottom: 14px;
  max-width: 72ch;
}

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

.legal-doc-section ul,
.legal-doc-section ol {
  margin: 10px 0 16px 0;
  padding-left: 22px;
}

.legal-doc-section li {
  font-size: 0.91rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 5px;
  padding-left: 4px;
}

.legal-doc-section a {
  color: var(--accent-hover);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.legal-doc-section a:hover {
  opacity: 0.8;
}

/* Note / emphasis block — minimal */
.doc-note {
  border-left: 3px solid var(--border-primary);
  padding: 10px 16px;
  margin: 18px 0;
  background: var(--bg-secondary);
  border-radius: 0 6px 6px 0;
}

.doc-note p {
  font-size: 0.87rem !important;
  color: var(--text-muted) !important;
  margin-bottom: 0 !important;
  font-style: italic;
}

/* Important notice — red left border */
.doc-important {
  border-left: 3px solid var(--danger, #ef4444);
  padding: 10px 16px;
  margin: 18px 0;
  background: rgba(239, 68, 68, 0.04);
  border-radius: 0 6px 6px 0;
}

.doc-important p {
  font-size: 0.87rem !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0 !important;
}

/* Accent border — amber */
.doc-accent {
  border-left: 3px solid var(--accent-primary);
  padding: 10px 16px;
  margin: 18px 0;
  background: var(--bg-secondary);
  border-radius: 0 6px 6px 0;
}

.doc-accent p {
  font-size: 0.87rem !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0 !important;
}

/* Inline section divider */
.doc-divider {
  border: none;
  border-top: 1px solid var(--border-secondary);
  margin: 48px 0 0;
}

/* --------------------------------------------------------------------------
   9. Legal Hub Index — simple list layout
   -------------------------------------------------------------------------- */
.legal-hub-list {
  list-style: none;
  margin-top: 20px;
}

.legal-hub-list li {
  border-bottom: 1px solid var(--border-secondary);
}

.legal-hub-list li:first-child {
  border-top: 1px solid var(--border-secondary);
}

.legal-hub-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.legal-hub-list li a:hover {
  color: var(--accent-primary);
}

.legal-hub-list li a .hub-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.legal-hub-list li a:hover .hub-arrow {
  color: var(--accent-primary);
  transform: translateX(3px);
}

.legal-hub-list li a .hub-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 12px;
  flex: 1;
}

.hub-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   10. Contact page — simple layout
   -------------------------------------------------------------------------- */
.contact-block {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: 24px;
}

.contact-email-display {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.contact-email-display a {
  color: var(--accent-hover);
  text-decoration: none;
  font-size: 1.05rem;
}

.contact-email-display a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   11. Footer
   -------------------------------------------------------------------------- */
footer {
  background: var(--dark-color);
  color: var(--white);
  padding: 80px 0 30px;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 0;
  width: 100%;
  height: 100px;
  background: var(--bg-primary);
  transform: skewY(-2deg);
  transform-origin: top left;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 50px;
  margin-bottom: 50px;
}

.footer-about {
  flex: 1;
  min-width: 300px;
}

.footer-about h3 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--primary-color);
  font-weight: 700;
}

.footer-about p {
  color: #bdc3c7;
  margin-bottom: 25px;
  line-height: 1.7;
}

.social-icons {
  display: flex;
  gap: 20px;
}

.social-icon {
  width: 50px;
  height: 50px;
  background: var(--gradient-1);
  color: var(--dark-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.social-icon:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--shadow-medium);
}

.quick-links, .connect-with-us, .legal-links {
  flex: 1;
  min-width: 160px;
}

.quick-links h3, .connect-with-us h3, .legal-links h3 {
  font-size: 1.5rem;
  margin-bottom: 25px;
  color: var(--primary-color);
  font-weight: 600;
}

.quick-links ul, .connect-with-us ul, .legal-links ul {
  list-style: none;
}

.quick-links li, .connect-with-us li, .legal-links li {
  margin-bottom: 12px;
}

.quick-links a, .connect-with-us a, .legal-links a {
  color: #bdc3c7;
  text-decoration: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}

.quick-links a:hover, .connect-with-us a:hover, .legal-links a:hover {
  color: var(--primary-color);
  transform: translateX(8px);
}

.footer-bottom {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 193, 7, 0.2);
  color: #bdc3c7;
  font-size: 0.9rem;
}

.footer-credits {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.footer-credits a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(189, 195, 199, 0.5);
  transition: all 0.25s ease;
  font-weight: 600;
}

.footer-credits a:hover {
  color: var(--primary-color);
  border-bottom: 1px solid var(--primary-color);
}

/* --------------------------------------------------------------------------
   11b. New legal UI elements
   -------------------------------------------------------------------------- */

/* Print Document button */
.legal-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.legal-print-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* See Also list */
.legal-see-also-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legal-see-also-list li a {
  font-size: 0.92rem;
  color: var(--accent-hover);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}
.legal-see-also-list li a:hover {
  opacity: 0.75;
}

/* Document History table */
.legal-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  margin-bottom: 14px;
}
.legal-history-table th,
.legal-history-table td {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border-secondary);
  color: var(--text-secondary);
}
.legal-history-table th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.legal-history-table tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* Section anchor copy button */
.legal-doc-section h2 {
  position: relative;
}
.legal-anchor-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  vertical-align: middle;
  line-height: 1;
}
.legal-doc-section h2:hover .legal-anchor-copy,
.legal-anchor-copy:focus-visible {
  opacity: 1;
}
.legal-anchor-copy:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.legal-anchor-copy.copied {
  color: #16a34a;
  border-color: #16a34a;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   12. Dark mode overrides
   -------------------------------------------------------------------------- */
html[data-theme="dark"] .doc-note,
html[data-theme="dark"] .doc-accent {
  background: var(--bg-tertiary);
}

html[data-theme="dark"] .doc-important {
  background: rgba(239, 68, 68, 0.06);
}

html[data-theme="dark"] .footer-credits a {
  border-bottom: 1px dashed rgba(73, 80, 87, 0.4);
}

html[data-theme="dark"] .footer-credits a:hover {
  color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   13. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .legal-toc-list a,
  .legal-hub-list li a,
  .social-icon { transition: none; }
}

/* --------------------------------------------------------------------------
   14. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .legal-doc-container {
    max-width: 100%;
    padding: 0 20px;
  }
}

@media (max-width: 767px) {
  .legal-page-wrapper { padding-bottom: 48px; }
  .legal-page-title-block { padding: 36px 0 22px; }
  .legal-page-title-block h1 { font-size: 1.7rem; }
  .legal-meta-row { gap: 4px 12px; font-size: 0.78rem; }
  .legal-doc-section h2 { font-size: 1.1rem; }
  .legal-doc-section p { font-size: 0.88rem; }
  .hub-desc { display: none; }

  .footer-content {
    flex-direction: column;
    gap: 30px;
    text-align: center;
  }

  .footer-about,
  .quick-links,
  .connect-with-us,
  .legal-links {
    min-width: auto;
    text-align: center;
  }

  .social-icons {
    justify-content: center;
  }

  .footer-about h3 {
    font-size: 1.6rem;
  }

  .quick-links h3, .connect-with-us h3, .legal-links h3 {
    font-size: 1.3rem;
  }
}

@media (max-width: 479px) {
  .legal-doc-container { padding: 0 16px; }
  .legal-page-title-block h1 { font-size: 1.5rem; }
  .legal-meta-row .meta-sep { display: none; }
}

/* --------------------------------------------------------------------------
   15. Focus visible global
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   16. Print
   -------------------------------------------------------------------------- */
@media print {
  .navbar, footer, .legal-print-btn, .legal-anchor-copy { display: none !important; }
  .legal-page-wrapper { padding-top: 0; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .legal-doc-section h2 { page-break-after: avoid; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .legal-see-also-list a[href]::after,
  .legal-toc-list a[href]::after,
  .legal-breadcrumb-line a[href]::after { content: none; }
}
