/* ──────────────────────────────────────────────────────────────────────────
   Lekhpal Pro — legal pages
   Mirrors the app's palette (ui/theme/Color.kt): white surfaces, navy as the
   only accent, a hueless black ramp for text and borders. Cards are drawn by
   a visible hairline, not a shadow. Dark values are the app's DarkColors.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --navy: #16365C;
  --navy-ink: #0A192F;
  --navy-overlay: rgba(22, 54, 92, 0.08);
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --sunken: #FAFAFA;
  --chip: #F4F4F5;
  --text: #0A0A0B;
  --text-2: #52525B;
  --muted: #71717A;
  --on-navy: #FFFFFF;
  --on-navy-muted: rgba(255, 255, 255, 0.72);
  --on-navy-border: rgba(255, 255, 255, 0.16);
  --border: #E4E4E7;
  --divider: #D4D4D8;
  --error: #C02626;
  --error-surface: #FDF3F3;
  --danger-fill: #C02626;
  --logo-dot: #1D4FD1;

  --radius: 16px;
  --radius-sm: 12px;
  --gutter: 16px;
  --topbar: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #4A7ABE;
    --navy-ink: #0F1620;
    --navy-overlay: rgba(74, 122, 190, 0.16);
    --bg: #0E1116;
    --surface: #161B22;
    --sunken: #12171E;
    --chip: #232A33;
    --text: #ECEEF1;
    --text-2: #AEB4BE;
    --muted: #8A909B;
    --border: #2A313B;
    --divider: #363E49;
    --error: #F0625E;
    --error-surface: #2A1618;
  --danger-fill: #CF3333;
    --logo-dot: #4A7ABE;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --navy: #4A7ABE;
  --navy-ink: #0F1620;
  --navy-overlay: rgba(74, 122, 190, 0.16);
  --bg: #0E1116;
  --surface: #161B22;
  --sunken: #12171E;
  --chip: #232A33;
  --text: #ECEEF1;
  --text-2: #AEB4BE;
  --muted: #8A909B;
  --border: #2A313B;
  --divider: #363E49;
  --error: #F0625E;
  --error-surface: #2A1618;
  --danger-fill: #CF3333;
  --logo-dot: #4A7ABE;
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (min-width: 640px) {
  body { font-size: 16px; }
}

a {
  color: var(--navy);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
  border-radius: 6px;
}

p { margin: 0 0 12px; }
strong { font-weight: 600; }

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar .wrap {
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.brand svg { width: 30px; height: 30px; flex: none; }

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.topbar-link svg { width: 16px; height: 16px; color: var(--navy); }

/* ── Hero (the app's navy membership-card surface) ────────────────────────── */

.hero {
  margin: 16px 0 20px;
  padding: 24px 20px;
  background: var(--navy-ink);
  border: 1px solid var(--on-navy-border);
  border-radius: var(--radius);
  color: var(--on-navy);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--on-navy-muted);
}

.hero h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.hero .lede {
  margin: 10px 0 0;
  color: var(--on-navy-muted);
  font-size: 14px;
}

.hero .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--on-navy-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--on-navy-muted);
}

@media (min-width: 640px) {
  .hero { padding: 32px 28px; margin-top: 24px; }
  .hero h1 { font-size: 32px; }
}

/* ── Cards, TOC, sections ─────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 24px;
}

.toc summary::-webkit-details-marker { display: none; }

.toc summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}

.toc[open] summary::after { transform: rotate(-135deg) translateY(-1px); }

.toc ol {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  counter-reset: toc;
}

.toc li { counter-increment: toc; border-top: 1px solid var(--border); }

.toc li a {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
}

.toc li a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--navy);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section {
  padding: 24px 0 8px;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--topbar) + 12px);
}

.section:first-of-type { border-top: 0; padding-top: 8px; }

.section h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
}

.section h2 .num {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.section h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.section p, .section li { color: var(--text-2); }
.section strong { color: var(--text); }

.bullets {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.bullets li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.68em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--navy);
}

/* ── Callouts ─────────────────────────────────────────────────────────────── */

.callout {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin: 4px 0 16px;
  background: var(--navy-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.callout .icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--navy);
}

.callout .icon svg { width: 18px; height: 18px; }
.callout p { margin: 0; color: var(--text); font-size: 14px; }
.callout p + p { margin-top: 6px; }

.callout.danger { background: var(--error-surface); }
.callout.danger .icon { color: var(--error); }

/* Summary card at the top of a policy */
.summary h2 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.summary ul { margin: 0; }
.summary li { color: var(--text); }

/* ── Data rows (stack cleanly at phone width; no tables to scroll) ─────────── */

.rows {
  list-style: none;
  margin: 4px 0 16px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rows li {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.rows li:first-child { border-top: 0; }

.rows .title {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.rows .detail { display: block; color: var(--text-2); font-size: 14px; }

.rows .tag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

/* ── Steps (delete account) ───────────────────────────────────────────────── */

.steps {
  list-style: none;
  margin: 4px 0 16px;
  padding: 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 48px;
  color: var(--text-2);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
}

.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15.5px;
  top: 34px;
  bottom: 2px;
  width: 1px;
  background: var(--divider);
}

.steps li strong { color: var(--text); }

.kbd {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: var(--sunken);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--text);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--navy); color: #FFFFFF; }
.btn-danger { background: var(--danger-fill); color: #FFFFFF; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--divider); }

@media (min-width: 640px) {
  .btn { width: auto; }
}

.btn-row { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }

@media (min-width: 640px) {
  .btn-row { flex-direction: row; flex-wrap: wrap; }
}

/* ── Hub (index) ──────────────────────────────────────────────────────────── */

.hub {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .hub { grid-template-columns: 1fr 1fr; }
}

.hub a {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
  transition: border-color 0.15s ease;
}

.hub a:hover { border-color: var(--divider); }
.hub a:active { background: var(--navy-overlay); }

.chip {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--navy);
}

.chip svg { width: 22px; height: 22px; }
.chip.danger { background: var(--error-surface); color: var(--error); }

.hub .text { flex: 1; min-width: 0; }
.hub .text strong { display: block; font-size: 15px; font-weight: 600; }
.hub .text span { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.hub .chev { flex: none; width: 18px; height: 18px; color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  margin-top: 24px;
  padding: 24px 0 calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--sunken);
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.footer nav a[aria-current="page"] {
  border-color: var(--navy);
  color: var(--navy);
}

.footer p { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
