/* ── LEGAL PAGE STYLES ──────────────────────────── */
/* Shared between privacy.html and terms.html       */
/* Set --accent on <body> to theme per page          */

/* ── LAYOUT ────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: clamp(220px, 20vw, 300px) 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────── */
.toc {
  position: sticky;
  top: 73px;
  height: calc(100vh - 73px);
  overflow-y: auto;
  padding: 52px clamp(16px, 2vw, 32px) 52px clamp(24px, 4vw, 56px);
  scrollbar-width: none;
  border-right: 1px solid var(--border);
  animation: fadeIn 0.5s ease both;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}
.toc::-webkit-scrollbar {
  display: none;
}

.toc-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
  padding: 0;
  line-height: 10px;
  height: 10px;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-item {
  margin-bottom: 2px;
}
.toc-link {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 400;
  padding: 7px 12px 7px 0;
  transition: color 0.18s;
  line-height: 1.4;
  position: relative;
  white-space: normal;
}
.toc-link::before {
  content: '';
  position: absolute;
  left: calc(-1 * clamp(24px, 4vw, 56px));
  width: 2px;
  top: 0;
  bottom: 0;
  background: transparent;
  transition: background 0.18s;
}
.toc-link:hover {
  color: var(--text-muted);
}
.toc-link.active {
  color: var(--accent);
  font-weight: 500;
}
.toc-link.active::before {
  background: var(--accent);
}
.toc-number {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}
.toc-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.toc-meta {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
  font-style: italic;
}
.toc-date {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toc-date-dot {
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

/* ── CONTENT ───────────────────────────────────── */
.content {
  padding: 52px clamp(24px, 5vw, 80px) 100px clamp(32px, 4vw, 64px);
  animation: fadeUp 0.55s 0.1s ease both;
  max-width: 900px;
}

/* ── DOCUMENT HEADER ───────────────────────────── */
.doc-header {
  margin-bottom: 56px;
}
.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}
.doc-eyebrow-dot {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}
.doc-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(38px, 5vw, 60px);
  letter-spacing: -2px;
  line-height: 0.95;
  color: var(--text);
  margin-bottom: 20px;
}
.doc-title .accent {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.doc-meta-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-faint);
}
.doc-meta-label {
  color: var(--text-dim);
  font-weight: 500;
}
.doc-meta-sep {
  width: 3px;
  height: 3px;
  background: var(--text-faint);
  border-radius: 50%;
}

/* ── SUMMARY ───────────────────────────────────── */
.doc-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 16px 16px 0;
  padding: 20px 24px;
  margin-bottom: 48px;
}
.doc-summary-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}
.doc-summary-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  font-weight: 300;
}

/* ── SECTIONS ──────────────────────────────────── */
.doc-section {
  margin-bottom: 56px;
}
.section-anchor {
  display: block;
  position: relative;
  top: -100px;
  visibility: hidden;
}
.section-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.section-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--accent);
  min-width: 28px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* ── PROSE ──────────────────────────────────────── */
.doc-p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.85;
  font-weight: 300;
  margin-bottom: 16px;
}
.doc-p:last-child {
  margin-bottom: 0;
}
.doc-p strong {
  color: var(--text-muted);
  font-weight: 500;
}
.doc-p a {
  color: var(--accent);
  text-decoration: none;
}
.doc-p a:hover {
  text-decoration: underline;
}

.doc-sub {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text);
  margin: 28px 0 10px;
}

/* ── CLAUSE CARDS ──────────────────────────────── */
.clause-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}
.clause {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.2s;
}
.clause:hover {
  border-color: var(--border-2);
}
.clause-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-top: 1px;
}
.ci-red {
  background: rgba(255, 61, 113, 0.1);
}
.ci-orange {
  background: rgba(255, 107, 74, 0.1);
}
.ci-green {
  background: rgba(46, 204, 113, 0.1);
}
.ci-blue {
  background: rgba(74, 158, 255, 0.1);
}
.ci-purple {
  background: rgba(160, 120, 255, 0.1);
}
.clause-body {
  flex: 1;
}
.clause-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}
.clause-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  font-weight: 300;
}

/* ── LIST ──────────────────────────────────────── */
.doc-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.doc-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  font-weight: 300;
}
.doc-list li::before {
  content: '';
  width: 4px;
  height: 4px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 8px;
}

/* ── WARNING ───────────────────────────────────── */
.doc-warning {
  background: rgba(255, 61, 113, 0.05);
  border: 1px solid rgba(255, 61, 113, 0.15);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.doc-warning-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.doc-warning-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  font-weight: 300;
}
.doc-warning-text strong {
  color: var(--red);
  font-weight: 500;
}

/* ── FOOTER RULE ───────────────────────────────── */
.doc-footer-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0 32px;
}
.doc-footer-note {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.7;
  font-style: italic;
}

/* ── READING PROGRESS ──────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  height: 2px;
  width: 0%;
  background: var(--grad);
  transition: width 0.1s linear;
}

/* ── MOBILE TOC ───────────────────────────────── */
.mobile-toc-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 80px;
  z-index: 110;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, transform 0.15s;
}
.mobile-toc-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.mobile-toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mobile-toc-overlay.open {
  opacity: 1;
}

.mobile-toc-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface-2);
  border-top: 1px solid var(--border-2);
  border-radius: 20px 20px 0 0;
  padding: 24px 28px 36px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-toc-overlay.open .mobile-toc-panel {
  transform: translateY(0);
}

.mobile-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mobile-toc-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.3px;
}
.mobile-toc-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}
.mobile-toc-close:hover {
  border-color: var(--border-2);
}

.mobile-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-toc-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
}
.mobile-toc-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}
.mobile-toc-link.active {
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  font-weight: 500;
}
.mobile-toc-num {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 20px;
}
.mobile-toc-link.active .mobile-toc-num {
  color: var(--accent);
}

/* ── BACK TO TOP ──────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 110;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, border-color 0.2s;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  border-color: var(--accent);
}

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 900px) {
  .page-wrap {
    grid-template-columns: 1fr;
  }
  .toc {
    display: none;
  }
  .content {
    padding: 40px 24px 80px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .doc-title {
    font-size: clamp(28px, 6vw, 38px);
  }
  .mobile-toc-toggle {
    display: flex;
  }
  .mobile-toc-overlay {
    display: block;
    pointer-events: none;
  }
  .mobile-toc-overlay.open {
    pointer-events: auto;
  }
}

/* ── PRINT ────────────────────────────────────── */
@media print {
  body::before,
  nav,
  footer,
  .toc,
  #reading-progress,
  .mobile-toc-toggle,
  .mobile-toc-overlay,
  .back-to-top {
    display: none !important;
  }

  .page-wrap {
    display: block;
  }

  .content {
    padding: 0;
    max-width: 100%;
  }

  body {
    background: white;
    color: #1a1a1a;
  }

  .doc-title,
  .doc-title .accent,
  .section-title,
  .doc-sub,
  .clause-title,
  .right-chip-title,
  .right-title,
  .tp-name {
    color: #1a1a1a !important;
    -webkit-text-fill-color: #1a1a1a !important;
    background: none !important;
  }

  .section-num {
    color: #666 !important;
    -webkit-text-fill-color: #666 !important;
    background: none !important;
  }

  .doc-p,
  .clause-text,
  .doc-list li,
  .doc-summary-body,
  .right-chip-body,
  .right-desc,
  .tp-desc,
  .doc-warning-text,
  .doc-note-text,
  .doc-highlight-text,
  .ballot-text-body {
    color: #333 !important;
  }

  .doc-eyebrow,
  .doc-summary,
  .clause,
  .doc-warning,
  .doc-note,
  .doc-highlight,
  .age-callout,
  .ballot-callout,
  .right-chip,
  .right-row,
  .tp-card,
  .retention-row {
    border-color: #ccc !important;
    background: #f8f8f8 !important;
  }

  .data-table {
    border-color: #ccc !important;
  }
  .data-table th {
    background: #eee !important;
    color: #333 !important;
    border-color: #ccc !important;
  }
  .data-table td {
    color: #333 !important;
    border-color: #ddd !important;
  }

  .doc-meta-item,
  .doc-meta-label,
  .toc-date,
  .doc-footer-note {
    color: #666 !important;
  }

  .doc-section {
    break-inside: avoid;
  }

  a {
    color: #1a1a1a !important;
    text-decoration: underline !important;
  }

  .retention-note {
    display: table-cell !important;
  }
}
