/* V Mitra legal + policy pages.
   One stylesheet for privacy, terms, disclaimer, cancellation-refund,
   payment-policy, shipping and contact-us. Each of those used to carry its
   own copy of this block, which is how three of them drifted apart. Token
   names match frontend/src/styles.css so the public pages and the app read
   as one system; see DESIGN.md. */

:root {
  color-scheme: light dark;

  /* Surface */
  --bg: #f7f8fc;
  --panel: #ffffff;
  --panel-soft: #f1f3fa;
  --border: #e6e9f2;

  /* Text */
  --text: #0f172a;
  --prose: #1f2937;       /* long-form body ink, a shade softer than --text */
  --text-soft: #475569;
  --link: #4f46e5;

  /* Brand */
  --primary: #4f46e5;
  --primary-soft: rgba(79, 70, 229, 0.10);
  --primary-tint: #eef2ff;

  /* Callout: caution */
  --warn: #dc2626;
  --warn-ink: #b91c1c;
  --warn-tint: #fef2f2;

  /* Radius, from the app scale */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;

  /* Long-form measure. Tables, the contents list and the card grid opt out. */
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --panel: #151d36;
    --panel-soft: #1d2644;
    --border: #2e3a5e;

    --text: #f1f5f9;
    --prose: #dbe2ec;
    --text-soft: #a9b6cc;
    /* The indigo primary does not clear 4.5:1 on midnight, so links take a
       light step off the same ramp. The brand hue is unchanged. */
    --link: #a5a0f2;

    --primary-soft: rgba(165, 160, 242, 0.16);
    --primary-tint: #1b2247;

    --warn: #f87171;
    --warn-ink: #fca5a5;
    --warn-tint: #2a1618;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

/* ── Header ─────────────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* Intrinsic ratio of logo.png (2514x646), so the header does not reflow
   once the image lands. */
header img {
  height: 36px;
  width: auto;
  aspect-ratio: 2514 / 646;
  display: block;
}

header a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

/* The back link is the only tap target up here, so give it a real one. */
header a:not(:has(img)) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
}

header a:not(:has(img)):hover { text-decoration: underline; }

/* ── Type ───────────────────────────────────────────────────────── */

h1 {
  font-size: 32px;
  line-height: 1.2;
  margin: 36px 0 8px;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
  margin: 32px 0 8px;
  text-wrap: balance;
}

h3 {
  font-size: 15px;
  line-height: 1.35;
  margin: 20px 0 6px;
  text-wrap: balance;
}

/* Anchored sections land clear of the top of the viewport instead of flush
   against it, so the heading you jumped to is actually readable. */
h2[id], h3[id] { scroll-margin-top: 24px; }

p, li { color: var(--prose); }
p { text-wrap: pretty; }

h1, h2, h3, p, ul, ol, .box { max-width: var(--measure); }

ul, ol { padding-left: 20px; }
li { margin: 4px 0; }

.meta {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 32px;
}

code {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 0.92em;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 5px;
}

/* ── Links ──────────────────────────────────────────────────────── */

a { color: var(--link); }

/* One focus treatment across every page, matching the app's focus ring. */
a:focus-visible,
summary:focus-visible {
  outline: none;
  border-radius: var(--r-xs);
  box-shadow: 0 0 0 4px var(--primary-soft), 0 0 0 1px var(--link);
}

/* ── Contents list ──────────────────────────────────────────────── */

.toc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-size: 14px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 24px;
  max-width: none;
}

.toc li {
  margin: 2px 0;
  break-inside: avoid;
}

/* Two columns of long section titles are unreadable on a phone. */
@media (max-width: 640px) {
  .toc ol { columns: 1; }
  .toc li { margin: 6px 0; }
}

/* ── Callouts ───────────────────────────────────────────────────── */

/* A full hairline and a tint, not a side stripe. */
.box {
  background: var(--primary-tint);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 18px;
  margin: 20px 0;
}

.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box p { max-width: none; }

.box.warn {
  background: var(--warn-tint);
  border-color: var(--warn);
}

.box.warn strong { color: var(--warn-ink); }

@media (prefers-color-scheme: dark) {
  .box { border-color: color-mix(in srgb, var(--link) 32%, transparent); }
}

/* ── Tables ─────────────────────────────────────────────────────── */

.tbl {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--r-sm);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 14px;
  background: var(--panel);
}

th, td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  max-width: none;
  color: var(--prose);
}

th {
  background: var(--panel-soft);
  font-weight: 600;
  color: var(--text);
}

/* ── Source / card lists ────────────────────────────────────────── */

.sources {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
  max-width: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card p { margin: 0; font-size: 16px; max-width: none; }

/* ── Footer ─────────────────────────────────────────────────────── */

footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 13px;
  /* Opens up the tap area on the run of policy links without breaking the
     sentence they sit in. */
  line-height: 2.4;
}

/* ── Motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Print ──────────────────────────────────────────────────────── */

@media print {
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  header a:not(:has(img)) { display: none; }
  .tbl { overflow: visible; }
  table { min-width: 0; }
  h2, h3 { break-after: avoid; }
  tr, .box { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}
