/* legal-gate.css — Terms/DPA acceptance modal.
   Premium, minimal, editorial. Theme-aware (reads --bg-color/--text-color/--border-color).
   The scrim blocks the app; mandatory steps cannot be dismissed. */

.lg-scrim {
  position: fixed;
  inset: 0;
  z-index: 6000;                 /* above app chrome, below nothing else */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px 24px;
  background: rgba(10, 10, 12, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.lg-scrim.is-open { opacity: 1; }

.lg-modal {
  --lg-fg: var(--text-color, #111);
  --lg-bg: var(--bg-color, #fff);
  --lg-line: var(--border-color, rgba(0, 0, 0, 0.10));
  --lg-muted: color-mix(in srgb, var(--lg-fg) 52%, transparent);
  --lg-faint: color-mix(in srgb, var(--lg-fg) 8%, transparent);
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--lg-bg);
  color: var(--lg-fg);
  border: 1px solid var(--lg-line);
  border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease, max-width 0.4s ease;
}
.lg-scrim.is-open .lg-modal { transform: none; opacity: 1; }
.lg-modal.is-wide { max-width: 920px; }        /* when plain-English column is shown */

/* ── header ──────────────────────────────────────────────────────────── */
.lg-head {
  padding: 26px 30px 18px;
  border-bottom: 1px solid var(--lg-line);
  flex-shrink: 0;
}
.lg-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}
.lg-meta { font-size: 12px; color: var(--lg-muted); margin: 6px 0 0; }
.lg-intro { font-size: 14px; line-height: 1.5; color: var(--lg-muted); margin: 12px 0 0; }

/* step dots (Terms → DPA) — sit above the title */
.lg-steps { display: flex; gap: 6px; margin: 0 0 14px; }
.lg-step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lg-faint); transition: background 0.3s; }
.lg-step-dot.is-active { background: var(--lg-fg); }
.lg-step-dot.is-done { background: color-mix(in srgb, var(--lg-fg) 40%, transparent); }

/* plain-English switch, right side of the header */
.lg-plain-toggle {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--lg-muted);
  cursor: pointer;
  user-select: none;
}
.lg-switch {
  position: relative; width: 34px; height: 20px; border-radius: 999px;
  background: var(--lg-faint); border: 1px solid var(--lg-line); transition: background 0.25s;
  flex-shrink: 0;
}
.lg-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--lg-fg); opacity: 0.6; transition: transform 0.25s, opacity 0.25s;
}
.lg-plain-toggle.is-on .lg-switch { background: color-mix(in srgb, var(--lg-fg) 20%, transparent); }
.lg-plain-toggle.is-on .lg-switch::after { transform: translateX(14px); opacity: 1; }

/* ── document body ───────────────────────────────────────────────────── */
.lg-doc {
  position: relative;
  overflow-y: auto;
  padding: 22px 30px 26px;
  flex: 1 1 auto;
  scroll-behavior: smooth;
}
.lg-section { padding: 16px 0; border-bottom: 1px solid var(--lg-faint); }
.lg-section:last-child { border-bottom: none; }
.lg-section-heading { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 10px; }

.lg-cols { display: block; }
.lg-legal { font-size: 13.5px; line-height: 1.65; color: color-mix(in srgb, var(--lg-fg) 82%, transparent); }
.lg-legal p { margin: 0 0 10px; }
.lg-legal p:last-child { margin-bottom: 0; }
.lg-legal ul { margin: 6px 0; padding-left: 20px; }

/* Plain-English column — hidden until the toggle is on. Its heading mirrors the legal
   heading (same size/weight) but muted, so it reads as a companion title, not a label. */
.lg-plain-heading {
  display: none;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 10px;
  color: var(--lg-muted);
}
.lg-plain {
  display: none;
  font-size: 13px;
  line-height: 1.6;
  color: var(--lg-muted);
}

/* plain-English ON: two columns on wide screens, stacked+tinted on narrow.
   One shared grid places [legal heading | plain heading] on row 1 and the two
   bodies on row 2, so headings align and each body starts on the same line. */
@media (min-width: 720px) {
  .lg-modal.is-plain .lg-plain-heading,
  .lg-modal.is-plain .lg-plain { display: block; }
  .lg-modal.is-plain .lg-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 26px;
    row-gap: 0;
    align-items: start;
  }
  .lg-modal.is-plain .lg-plain-heading,
  .lg-modal.is-plain .lg-plain {
    padding-left: 22px; border-left: 1px solid var(--lg-line);
  }
}
@media (max-width: 719.98px) {
  /* Narrow: plain heading + body stack under the legal text as one tinted block. */
  .lg-modal.is-plain .lg-plain-heading,
  .lg-modal.is-plain .lg-plain { display: block; }
  .lg-modal.is-plain .lg-plain-heading {
    margin: 12px 0 0; padding: 12px 14px 0;
    background: var(--lg-faint); border-radius: 10px 10px 0 0;
  }
  .lg-modal.is-plain .lg-plain {
    margin: 0 0 0; padding: 4px 14px 12px; border-radius: 0 0 10px 10px;
    background: var(--lg-faint);
  }
}

/* fade the bottom edge so there's always a hint of more to read */
.lg-doc-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--lg-bg));
  opacity: 1; transition: opacity 0.3s;
}
.lg-doc.is-at-end + .lg-doc-fade { opacity: 0; }

/* ── footer / actions ────────────────────────────────────────────────── */
.lg-foot {
  padding: 16px 30px 20px;
  border-top: 1px solid var(--lg-line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.lg-read-hint {
  font-size: 12px; color: var(--lg-muted); display: inline-flex; align-items: center; gap: 7px;
  transition: opacity 0.3s;
}
.lg-read-hint.is-hidden { opacity: 0; pointer-events: none; }
.lg-foot-spacer { flex: 1 1 auto; }

.lg-btn {
  appearance: none; border: 1px solid var(--lg-line); background: transparent; color: var(--lg-fg);
  font-size: 13.5px; font-weight: 600; padding: 11px 20px; border-radius: 999px; cursor: pointer;
  transition: background 0.18s, border-color 0.18s, opacity 0.18s, transform 0.08s;
  white-space: nowrap;
}
.lg-btn:hover { background: var(--lg-faint); }
.lg-btn:active { transform: scale(0.98); }
.lg-btn-ghost { border-color: transparent; color: var(--lg-muted); padding-left: 8px; padding-right: 8px; }
.lg-btn-ghost:hover { color: var(--lg-fg); background: transparent; }
.lg-btn-primary {
  background: var(--lg-fg); color: var(--lg-bg); border-color: var(--lg-fg); font-weight: 700;
}
.lg-btn-primary:hover { background: color-mix(in srgb, var(--lg-fg) 88%, var(--lg-bg)); }
.lg-btn-primary[disabled] {
  opacity: 0.32; cursor: not-allowed; pointer-events: none;
}
.lg-btn .spin { display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: lg-spin 0.6s linear infinite;
  vertical-align: -2px; margin-right: 7px; }
@keyframes lg-spin { to { transform: rotate(360deg); } }

.lg-email-note { font-size: 11.5px; color: var(--lg-muted); width: 100%; margin: -2px 0 0; }

@media (max-width: 560px) {
  .lg-head { padding: 22px 20px 16px; }
  .lg-doc { padding: 18px 20px 22px; }
  .lg-foot { padding: 14px 20px 18px; }
  .lg-title { font-size: 22px; }
  .lg-doc-fade, .lg-modal.is-plain .lg-plain { }
}

@media (prefers-reduced-motion: reduce) {
  .lg-scrim, .lg-modal, .lg-doc { transition: none; }
  .lg-btn .spin { animation-duration: 1.2s; }
}
