/* Legal pages — same Pulse shell chrome as the home app */

:root,
html[data-theme="light"] {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface2: #fbfaf7;
  --border: #e8e6e1;
  --text: #1a1b1e;
  --muted: #6b6e76;
  --accent: #ff4b3e;
  --ink: #14213d;
  --hover: #f4f2ed;
  --font: "Inter", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #121214;
  --surface: #1c1c1f;
  --surface2: #212124;
  --border: #2a2a2e;
  --text: #f2f2f0;
  --muted: #9a9aa0;
  --accent: #ff5a4d;
  --ink: #5b8def;
  --hover: #26262a;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1c1c1f;
    --surface2: #212124;
    --border: #2a2a2e;
    --text: #f2f2f0;
    --muted: #9a9aa0;
    --accent: #ff5a4d;
    --ink: #5b8def;
    --hover: #26262a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
}

.brand span {
  color: var(--accent);
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.muted {
  color: var(--muted);
}

/* ===== App shell (mirrors .htd) ===== */
.legal-app {
  height: 100%;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

.legal-sidebar {
  flex: 0 0 auto;
  width: 248px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  gap: 8px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 12px;
  min-height: 0;
  scrollbar-width: thin;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  margin-bottom: 1px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.nav-btn:hover {
  background: var(--hover);
}

.nav-btn.is-active {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.nav-section {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 10px;
}

.legal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.legal-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.btn-back:hover {
  background: var(--hover);
}

.legal-topbar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.legal-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.legal-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 40px 60px;
}

.legal-article h1 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin: 0 0 8px;
  text-wrap: pretty;
}

.legal-article .meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 28px;
}

.legal-article h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 28px 0 10px;
}

.legal-article p,
.legal-article ul {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  text-wrap: pretty;
}

.legal-article ul {
  padding-left: 1.2em;
}

.legal-article li {
  margin-bottom: 6px;
}

.legal-article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.legal-article a:hover {
  color: var(--accent);
}

.legal-foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.legal-foot a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.legal-foot a:hover {
  color: var(--ink);
}

/* Mobile header (hidden on desktop) */
.legal-m-header {
  display: none;
}

.legal-m-nav {
  display: none;
}

@media (max-width: 860px) {
  .legal-app {
    flex-direction: column;
  }

  .legal-sidebar {
    display: none;
  }

  .legal-m-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }

  .legal-m-header .brand {
    font-size: 20px;
  }

  .legal-topbar {
    display: none;
  }

  .legal-m-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 10px 16px 4px;
    scrollbar-width: none;
  }

  .legal-m-nav::-webkit-scrollbar {
    display: none;
  }

  .legal-m-nav a {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 20px;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
  }

  .legal-m-nav a.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
    font-weight: 600;
  }

  .legal-article {
    padding: 18px 16px 48px;
  }

  .legal-article h1 {
    font-size: 29px;
  }

  .legal-article p,
  .legal-article ul {
    font-size: 16px;
    line-height: 1.65;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
  }

  .icon-btn:hover {
    background: var(--hover);
  }
}
