/*
 * CoLateral - standalone legal page styling (Privacy Policy, Terms of Service).
 * -------------------------------------------------------------------------
 * Sleek, minimalist document layout that paints with the shared theme
 * vocabulary (--bg, --s0/--s1, --tx/--tx2/--tx3, --blue, --bd/--bd2) so the
 * page follows whichever theme the user picked on the dashboard - including
 * the light theme. Fallbacks reproduce the default CoLateral Dark palette
 * for the case where no theme block is active.
 *
 * Pair with:
 *   <link rel="stylesheet" href="src/styles/themes.css" />
 *   <script src="src/scripts/apply-theme.js"></script>
 * -------------------------------------------------------------------------
 */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg, #eef2f7);
  color: var(--tx, #182130);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue-ink, #005a9e); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Cinematic background layers (same stack as the home page hero and
   tools.html), repainted with the shared theme vocabulary so the glow
   and dot grid follow light themes too. --------------------------------- */
.legal-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background: var(--bg, #eef2f7);
}
/* canvas dot grid overlay (matches the project canvas feel) */
.legal-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--tx2, #42597a) 18%, transparent) 1px, transparent 1.5px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 50% 38%, rgba(0, 0, 0, .9), transparent 82%);
  -webkit-mask-image: radial-gradient(circle at 50% 38%, rgba(0, 0, 0, .9), transparent 82%);
  opacity: 0;
  animation: legal-grid-in 2.4s ease forwards .2s;
}
@keyframes legal-grid-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .legal-bg:before, .legal-grid { animation: none; }
  .legal-grid { opacity: 1; }
}

/* Top bar --------------------------------------------------------------- */
.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg, #eef2f7);
  border-bottom: 1px solid var(--bd, rgba(15, 23, 42, .10));
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--tx, #182130);
  font-size: 17px;
}
.legal-brand:hover { text-decoration: none; }
.legal-brand span { color: var(--blue, #0078d4); }
.legal-brand svg { width: 26px; height: 26px; }

.legal-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--blue,#0078d4);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--blue, #0078d4) 24%, transparent);
  color: var(--on-blue, #fff);
  font-size: 13px;
  font-weight: 780;
  line-height: 1;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}

.legal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.legal-actions .legal-back:not(.legal-primary) {
  border-color: var(--bd, rgba(15, 23, 42, .10));
  background: transparent;
  box-shadow: none;
  color: var(--tx, #182130);
}
.legal-back svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.legal-back:hover {
  text-decoration: none;
  color: var(--on-blue, #fff);
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--blue, #0078d4) 30%, transparent);
}
.legal-back:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue, #0078d4) 38%, transparent);
  outline-offset: 3px;
}
.legal-back:active {
  filter: brightness(.98);
  transform: translateY(0);
}

/* Document -------------------------------------------------------------- */
.legal-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

.legal-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue-ink, #005a9e);
  margin-bottom: 14px;
}

.legal-doc h1 {
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 850;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--tx, #182130);
}

.legal-meta {
  font-size: 13px;
  color: var(--tx3, #5f7691);
  margin: 0 0 8px;
}

.legal-lede {
  font-size: 17px;
  color: var(--tx2, #42597a);
  margin: 8px 0 0;
  max-width: 62ch;
  text-align: justify;
  hyphens: auto;
}

.legal-rule {
  height: 1px;
  border: 0;
  background: var(--bd, rgba(15, 23, 42, .10));
  margin: 34px 0 0;
}

.legal-doc h2 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.01em;
  color: var(--tx, #182130);
  margin: 40px 0 12px;
  scroll-margin-top: 84px;
}

.legal-doc h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.005em;
  color: var(--tx, #182130);
  margin: 26px 0 10px;
  scroll-margin-top: 84px;
}

.legal-doc p,
.legal-doc li {
  font-size: 15.5px;
  color: var(--tx2, #42597a);
  margin: 0 0 14px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.legal-doc .legal-meta { text-align: left; hyphens: none; }

.legal-doc strong { color: var(--tx, #182130); font-weight: 650; }

.legal-doc ul {
  margin: 0 0 14px;
  padding-left: 22px;
}
.legal-doc li { margin-bottom: 8px; }
.legal-doc li::marker { color: var(--blue, #0078d4); }

/* Conspicuous clauses (warranty disclaimer, liability cap). Tinted with the
   theme accent rather than a surface colour, so the block never renders as a
   flat white card on the light palette. */
.legal-doc .legal-legalese {
  position: relative;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--tx, #182130);
  background: color-mix(in srgb, var(--blue, #0078d4) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue, #0078d4) 26%, transparent);
  border-left: 3px solid var(--blue, #0078d4);
  border-radius: 4px 12px 12px 4px;
  padding: 16px 18px;
  margin: 0 0 14px;
}

.legal-doc .legal-legalese[data-label]:before {
  content: attr(data-label);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue-ink, #005a9e);
  margin-bottom: 8px;
}

.legal-doc .legal-legalese p,
.legal-doc .legal-legalese li {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  margin: 0 0 10px;
}
.legal-doc .legal-legalese ul { margin: 0; }
.legal-doc .legal-legalese > :last-child,
.legal-doc .legal-legalese li:last-child { margin-bottom: 0; }

/* Footer ---------------------------------------------------------------- */
.legal-footer {
  border-top: 1px solid var(--bd, rgba(15, 23, 42, .10));
  padding: 26px 24px;
  text-align: center;
}
.legal-footer p {
  margin: 0;
  font-size: 13px;
  color: var(--tx3, #5f7691);
}
.legal-footer a { margin: 0 8px; font-weight: 600; }

@media (max-width: 560px) {
  .legal-topbar {
    align-items: flex-start;
    padding: 12px 16px;
  }
  .legal-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .legal-back {
    min-height: 36px;
    padding: 7px 9px;
  }
  .legal-doc { padding: 40px 18px 72px; }
  /* narrow measures make justified text open up rivers - fall back to ragged right */
  .legal-doc p,
  .legal-doc li,
  .legal-lede { text-align: left; }
}
