/* ─────────────────────────────────────────────────────────────
   Legal Pages — Design System compliant
   Terms of Service, Privacy Policy, SMS Consent.
   Fixed header + scrollable content + fixed footer layout.
───────────────────────────────────────────────────────────── */
@import url("design-system/ds_tokens.31e0c782ea01.css");

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* ── Shell ─────────────────────────────────────────────────── */
body {
  font-family: var(--mm-font);
  background: var(--mm-bg-app);
  color: var(--mm-text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ────────────────────────────────────────────────── */
.legal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--mm-surface);
  border-bottom: 1px solid var(--mm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--mm-s-3) var(--mm-s-6);
  height: 64px;
}

.legal-header-logo {
  height: 40px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.legal-header-back {
  display: inline-flex;
  align-items: center;
  gap: var(--mm-s-2);
  font-size: var(--mm-text-sm);
  font-weight: 500;
  color: var(--mm-text-secondary);
  text-decoration: none;
  padding: var(--mm-s-1) var(--mm-s-3);
  border-radius: var(--mm-r-md);
  transition: color var(--mm-t-fast), background var(--mm-t-fast);
}
.legal-header-back:hover {
  color: var(--mm-brand-600);
  background: var(--mm-surface-soft);
}
.legal-header-back svg { flex-shrink: 0; }

/* ── Main scrollable area ──────────────────────────────────── */
main {
  flex: 1;
  margin-top: 64px;
  margin-bottom: 56px;
  overflow-y: auto;
  padding: var(--mm-s-6) var(--mm-s-4);
}

/* ── Content container ─────────────────────────────────────── */
.legal-content {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  background: var(--mm-surface);
  border-radius: var(--mm-r-xl);
  box-shadow: var(--mm-shadow-md);
  padding: var(--mm-s-7) var(--mm-s-7);
}

/* ── Typography ────────────────────────────────────────────── */
.legal-content h1 {
  font-size: var(--mm-text-2xl);
  font-weight: 700;
  color: var(--mm-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--mm-s-1);
}

.legal-effective-date {
  font-size: var(--mm-text-sm);
  color: var(--mm-text-muted);
  margin-bottom: var(--mm-s-6);
  padding-bottom: var(--mm-s-5);
  border-bottom: 1px solid var(--mm-border);
}

.legal-content h2 {
  font-size: var(--mm-text-lg);
  font-weight: 600;
  color: var(--mm-text-primary);
  margin-top: var(--mm-s-6);
  margin-bottom: var(--mm-s-3);
}

.legal-content p {
  font-size: var(--mm-text-base);
  color: var(--mm-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--mm-s-3);
}

.legal-content ul {
  padding-left: var(--mm-s-5);
  margin-bottom: var(--mm-s-4);
  display: flex;
  flex-direction: column;
  gap: var(--mm-s-2);
}

.legal-content li {
  font-size: var(--mm-text-base);
  color: var(--mm-text-secondary);
  line-height: 1.65;
}

.legal-content a {
  color: var(--mm-brand-600);
  text-decoration: none;
  font-weight: 500;
}
.legal-content a:hover { text-decoration: underline; }

.legal-content strong {
  color: var(--mm-text-primary);
  font-weight: 600;
}

/* ── Footer ────────────────────────────────────────────────── */
.legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--mm-surface);
  border-top: 1px solid var(--mm-border);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--mm-s-4);
  padding: 0 var(--mm-s-6);
}

.legal-footer p {
  font-size: var(--mm-text-xs);
  color: var(--mm-text-muted);
}

.legal-footer-links {
  display: flex;
  align-items: center;
  gap: var(--mm-s-3);
}
.legal-footer-links a {
  font-size: var(--mm-text-xs);
  color: var(--mm-text-muted);
  text-decoration: none;
}
.legal-footer-links a:hover { color: var(--mm-text-secondary); text-decoration: underline; }
.legal-footer-links span { color: var(--mm-border); font-size: var(--mm-text-xs); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .legal-header { padding: var(--mm-s-3) var(--mm-s-4); }

  main { padding: var(--mm-s-4) var(--mm-s-3); }

  .legal-content {
    border-radius: var(--mm-r-lg);
    padding: var(--mm-s-5) var(--mm-s-4);
  }

  .legal-content h1  { font-size: var(--mm-text-xl); }
  .legal-content h2  { font-size: var(--mm-text-base); }
  .legal-content p,
  .legal-content li  { font-size: var(--mm-text-sm); }

  .legal-footer { gap: var(--mm-s-3); }
  .legal-footer-links { display: none; }
}

@supports (-webkit-touch-callout: none) {
  main { margin-bottom: max(56px, calc(56px + env(safe-area-inset-bottom))); }
  .legal-footer { padding-bottom: env(safe-area-inset-bottom); height: auto; min-height: 56px; }
}
