/* ===========================================================================
   Northwest Falls: legal pages
   Long-form reading. Wide margins, generous line height, a table of contents
   that follows you down the page. People land here worried about something
   specific, so the priority is finding the clause fast.
   =========================================================================== */

.lg {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-16);
  max-width: 1060px;
  margin-inline: auto;
  padding: var(--space-16) var(--space-6) var(--space-24);
}

/* --- Table of contents ---------------------------------------------------- */

.lg__toc {
  position: sticky;
  top: var(--space-8);
  align-self: start;
  max-height: calc(100vh - var(--space-16));
  overflow-y: auto;
}

/* Every document is reached from the index, so every document needs a way
   back to it. Its absence was why these pages felt like dead ends. */
.lg__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.lg__back:hover { color: var(--text-primary); }
.lg__back i { font-size: 11px; }

.lg__toc-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-quaternary);
  margin-bottom: var(--space-4);
}

.lg__toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.lg__toc-link {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.4;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.lg__toc-link:hover { color: var(--text-primary); background: var(--surface-2); }
.lg__toc-link.is-active {
  color: var(--text-primary);
  border-left-color: var(--accent);
  background: var(--accent-tint);
}

/* --- Document ------------------------------------------------------------- */

.lg__doc { min-width: 0; }

.lg__head { margin-bottom: var(--space-12); padding-bottom: var(--space-8); border-bottom: 1px solid var(--border-subtle); }
.lg__title { font-size: var(--text-3xl); letter-spacing: -0.03em; }
.lg__meta { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-tertiary); }

/* Plain-language summary above the legal text. Not a substitute for the
   clauses, and says so, but most people only read this box. */
.lg__summary {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--accent-tint);
  border: 1px solid var(--accent-border);
}
.lg__summary-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.lg__summary p { font-size: var(--text-sm); line-height: 1.65; color: var(--text-secondary); }
.lg__summary p + p { margin-top: var(--space-2); }

.lg__doc h2 {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  /* Offset for the sticky header when jumping to an anchor. */
  scroll-margin-top: var(--space-8);
}
.lg__doc h2:first-of-type { margin-top: 0; }

.lg__doc h3 {
  font-size: var(--text-md);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.lg__doc p,
.lg__doc li {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
}
.lg__doc p { margin-bottom: var(--space-4); }

.lg__doc ul, .lg__doc ol { margin: 0 0 var(--space-5); padding-left: var(--space-6); }
.lg__doc li { margin-bottom: var(--space-2); }

.lg__doc strong { color: var(--text-primary); font-weight: 600; }
.lg__doc a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.lg__doc a:hover { text-decoration-color: currentColor; }

.lg__doc code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-primary);
}

.lg__doc ol { counter-reset: lg; list-style: none; padding-left: 0; }
.lg__doc ol > li {
  counter-increment: lg;
  position: relative;
  padding-left: var(--space-8);
}
.lg__doc ol > li::before {
  content: counter(lg);
  position: absolute;
  left: 0; top: 0.15em;
  width: 20px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-quaternary);
}

.lg__doc table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}
.lg__doc th, .lg__doc td {
  text-align: left;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.lg__doc th { color: var(--text-primary); font-weight: 600; }
.lg__doc td { color: var(--text-secondary); }

/* Tables of sub-processors and retention periods overflow on a phone. Scroll
   the table, never the page. */
.lg__table-wrap { overflow-x: auto; margin-bottom: var(--space-6); }
.lg__table-wrap table { margin-bottom: 0; min-width: 480px; }

.lg__note {
  padding: var(--space-4) var(--space-5);
  border-left: 2px solid var(--border-strong);
  background: var(--surface-1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: var(--space-5);
}
.lg__note p { margin-bottom: 0; font-size: var(--text-sm); }

/* --- Index page -----------------------------------------------------------
   Same hairline grid as the marketing site, so arriving here from a footer
   link does not feel like leaving the product.
   --------------------------------------------------------------------------- */

.lg-index { max-width: 880px; margin-inline: auto; padding: var(--space-16) var(--space-6) var(--space-24); }

.lg-index__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-16);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.lg-index__brand img { width: 24px; height: 24px; object-fit: contain; }

.lg-index__title {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: var(--weight-display);
  line-height: 1.03;
  letter-spacing: -0.04em;
}
.lg-index__lede {
  margin-top: var(--space-5);
  max-width: 52ch;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.65;
}

.lg-index__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: var(--space-12);
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-10) var(--space-6) var(--space-6);
  background: var(--bg);
  transition: background var(--dur-fast) var(--ease-out);
}
.lg-card:hover { background: var(--surface-2); }
.lg-card__title { font-size: var(--text-base); font-weight: 600; letter-spacing: -0.02em; }
.lg-card__desc { font-size: var(--text-sm); color: var(--text-tertiary); line-height: 1.55; }

.lg-card__arrow {
  position: absolute;
  top: var(--space-6); right: var(--space-6);
  font-size: 11px;
  color: var(--text-quaternary);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.lg-card:hover .lg-card__arrow { opacity: 1; transform: none; }

.lg-index__foot {
  margin-top: var(--space-10);
  font-size: var(--text-sm);
  color: var(--text-quaternary);
}
.lg-index__foot a { color: var(--text-tertiary); text-decoration: underline; text-underline-offset: 3px; }
.lg-index__foot a:hover { color: var(--text-primary); }

/* --- Legal footer (this site does not use the injected one) --------------- */

.lg-foot {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-8) var(--space-6);
}
.lg-foot__inner {
  max-width: 1060px;
  margin-inline: auto;
  display: flex;
  gap: var(--space-6);
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--text-quaternary);
  line-height: 1.7;
}
.lg-foot a { color: var(--text-tertiary); }
.lg-foot a:hover { color: var(--text-primary); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .lg { grid-template-columns: 1fr; gap: var(--space-8); padding-top: var(--space-10); }
  .lg__toc {
    position: static;
    max-height: none;
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
  }
  .lg__toc-list { flex-direction: row; flex-wrap: wrap; gap: var(--space-2); }
  .lg__toc-link { border-left: none; border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); }
  .lg__toc-link.is-active { border-color: var(--accent-border); }
  .lg__title { font-size: var(--text-2xl); }
  .lg__back { margin-bottom: var(--space-5); }
}

@media (max-width: 640px) {
  .lg-index { padding-top: var(--space-10); }
  .lg-index__brand { margin-bottom: var(--space-10); }
  .lg-index__grid { grid-template-columns: 1fr; }
}
