/* ==========================================================================
   Kaariger — legal pages (privacy, terms, delete account)
   Loaded after site.css. Small additions only; every colour is a token
   from site.css.
   ========================================================================== */

/* Header band ------------------------------------------------------------- */
.legal-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(36px, 6vw, 72px) clamp(32px, 5vw, 56px);
  background:
    radial-gradient(640px 300px at 92% -10%, rgba(42, 148, 96, .14), transparent 70%),
    linear-gradient(180deg, var(--green-50) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.legal-hero .wrap { position: relative; }
.legal-hero h1 { margin-top: 28px; font-size: clamp(2.2rem, 4.6vw, 3.4rem); max-width: 18ch; }
.legal-hero .lead { margin-top: 14px; max-width: 56ch; }
.legal-mark {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: clamp(110px, 12vw, 160px); opacity: .07;
  pointer-events: none; user-select: none;
}
@media (max-width: 760px) { .legal-mark { display: none; } }

/* Switch between the three legal documents */
.legal-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.legal-tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: .92rem; font-weight: 700; text-decoration: none;
  transition: background .2s, border-color .2s, color .2s;
}
.legal-tabs a:hover { background: var(--green-50); border-color: var(--green-200); color: var(--green-800); }
.legal-tabs a[aria-current="page"] { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.legal-tabs svg { width: 16px; height: 16px; flex-shrink: 0; }

.legal-meta {
  list-style: none; padding: 0; margin-top: 26px;
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  color: var(--muted); font-size: .92rem; font-weight: 600;
}
.legal-meta li { display: inline-flex; align-items: center; gap: 8px; }
.legal-meta svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--green-700); }
.legal-meta time { color: var(--ink); font-weight: 750; }

/* Body --------------------------------------------------------------------- */
.legal-body { padding-block: clamp(40px, 6vw, 80px) clamp(72px, 10vw, 128px); }
.legal-doc { max-width: 68ch; }
.legal-intro { font-size: 1.08rem; color: var(--ink-2); }

/* Sticky contents (desktop) */
.toc { max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; overscroll-behavior: contain; }
.toc-title { margin-bottom: 12px; font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line-2); }
.toc li a {
  display: flex; gap: 10px; padding: 7px 0 7px 16px; margin-left: -1px;
  border-left: 2px solid transparent; line-height: 1.35; transition: color .2s, border-color .2s;
}
.toc li a:hover { border-left-color: var(--green-500); }
.toc .n, .toc-mobile .n { min-width: 1.5em; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--green-700); }
@media (pointer: coarse) { .toc li a { min-height: 44px; align-items: center; } }

/* Contents (phones and tablets) — native <details>, no script */
.toc-mobile { display: none; margin: 0 0 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
@media (max-width: 900px) { .toc-mobile { display: block; } }
.toc-mobile summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 54px; padding: 0 18px; font-weight: 750; color: var(--ink);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: ""; width: 9px; height: 9px; margin-top: -4px; flex-shrink: 0;
  border-right: 2px solid var(--green-700); border-bottom: 2px solid var(--green-700);
  transform: rotate(45deg); transition: transform .2s var(--ease), margin .2s;
}
.toc-mobile[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.prose .toc-mobile ol { list-style: none; margin: 0; padding: 6px 8px 10px; border-top: 1px solid var(--line); }
.prose .toc-mobile li + li { margin-top: 0; }
.prose .toc-mobile a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; text-decoration: none;
}
.prose .toc-mobile a:hover { background: var(--green-50); color: var(--green-800); }

/* Section headings: number + a brief highlight when jumped to */
.prose h2 .n { color: var(--green-700); margin-right: .3em; font-variant-numeric: tabular-nums; }
.prose h2[id] { border-radius: 8px; }
.prose h2:target { animation: legal-flash 2.2s var(--ease) 1; }
@keyframes legal-flash {
  0%, 35% { background: var(--green-100); box-shadow: 0 0 0 10px var(--green-100); }
  100% { background: transparent; box-shadow: 0 0 0 10px transparent; }
}

/* "At a glance" summary */
.legal-summary {
  margin: 28px 0 0; padding: clamp(20px, 3vw, 28px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.prose .legal-summary h2 { margin: 0 0 16px; font-size: 1.08rem; letter-spacing: -0.01em; }
.prose .legal-summary .checks { padding: 0; margin: 0; gap: 12px; }
.prose .legal-summary .checks li + li { margin-top: 0; }
.legal-fineprint { font-size: .88rem; color: var(--muted); }
.prose .legal-summary .legal-fineprint { margin: 18px 0 0; }

/* Lists that use the design system's check bullets inside prose */
.prose ul.checks { padding: 0; }
.prose .checks li + li { margin-top: 0; }

/* Callouts */
.prose .notice { margin: 0 0 1.4em; align-items: flex-start; }
.prose .notice .icon-tile { width: 42px; height: 42px; border-radius: 12px; margin: 0; }
.prose .notice .icon-tile svg { width: 21px; height: 21px; }
.prose .notice p { margin: 0; }
.prose .notice p + p { margin-top: .5em; }

/* Numbered steps */
.prose ol.legal-steps { list-style: none; padding: 0; margin: 0 0 1.4em; display: grid; gap: 10px; counter-reset: legal-step; }
.prose .legal-steps li {
  counter-increment: legal-step; display: flex; align-items: flex-start; gap: 14px; margin: 0;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.prose .legal-steps li::before {
  content: counter(legal-step); flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; margin-top: -2px;
  background: var(--green-700); color: #fff; font-weight: 800; font-size: .95rem;
  box-shadow: 0 0 0 4px var(--green-100);
}
.legal-steps .hint { display: block; margin-top: 4px; font-size: .9rem; color: var(--muted); }
.legal-steps .hint .urdu { color: var(--ink-2); font-size: 1rem; }

/* Fee table */
.legal-table {
  width: 100%; margin: 0 0 1.4em; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: .97rem;
}
.legal-table th, .legal-table td { padding: 14px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.legal-table tr:last-child > * { border-bottom: 0; }
.legal-table thead th { background: var(--bg-2); color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.legal-table tbody th { font-weight: 600; color: var(--ink-2); }
.legal-table td { font-weight: 750; color: var(--ink); }
@media (max-width: 480px) { .legal-table th, .legal-table td { padding: 12px 14px; } }

/* Worked commission example */
.legal-example {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0 0 1.4em;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.legal-example > div { padding: 14px 16px; background: var(--surface); }
.legal-example dt { font-size: .8rem; font-weight: 650; color: var(--muted); }
.legal-example dd { margin: 2px 0 0; font-size: 1.18rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.legal-example .keep { background: var(--purple-50); }
.legal-example .keep dd { color: var(--purple-700); }
@media (max-width: 460px) { .legal-example { grid-template-columns: minmax(0, 1fr); } }

/* Buttons inside prose keep their own colours */
.prose a.btn { text-decoration: none; font-weight: 750; }
.prose a.btn-primary, .prose a.btn-whatsapp { color: #fff; }
.prose a.btn-ghost { color: var(--ink); }
.legal-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 1.4em; }

/* "Which applies to you?" choices (delete page) */
.legal-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 28px 0 0; }
@media (max-width: 760px) { .legal-choices { grid-template-columns: minmax(0, 1fr); } }
.prose .legal-choices a {
  display: block; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font-weight: 400; text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.prose .legal-choices a:hover { border-color: var(--green-200); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.legal-choices .icon-tile { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 12px; }
.legal-choices .icon-tile svg { width: 20px; height: 20px; }
.legal-choices strong { display: block; font-weight: 750; line-height: 1.3; }
.legal-choices .d { display: block; margin-top: 4px; font-size: .9rem; line-height: 1.45; color: var(--muted); }

/* Contact panel */
.prose ul.legal-contact {
  list-style: none; padding: 0; margin: 4px 0 1.4em;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.prose .legal-contact li + li { margin-top: 0; border-top: 1px solid var(--line); }
.prose .legal-contact a {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 18px;
  color: var(--ink); font-weight: 750; text-decoration: none; transition: background .2s;
}
.prose .legal-contact a:hover { background: var(--green-50); }
.legal-contact .ci { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--green-100); color: var(--green-700); }
.legal-contact .ci svg { width: 20px; height: 20px; }
.legal-contact .ct { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.legal-contact .ct small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.legal-contact .go { width: 18px; height: 18px; margin-left: auto; flex-shrink: 0; color: var(--muted); }

/* Other legal documents */
.legal-related { margin-top: clamp(48px, 7vw, 80px); padding-top: 32px; border-top: 1px solid var(--line); }
.prose .legal-related h3 { margin: 0 0 16px; font-size: 1.05rem; letter-spacing: -0.01em; }
.legal-related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .legal-related-grid { grid-template-columns: minmax(0, 1fr); } }
.prose .legal-related-grid a {
  display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font-weight: 400; text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.prose .legal-related-grid a:hover { border-color: var(--green-200); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.legal-related-grid .icon-tile { width: 40px; height: 40px; border-radius: 12px; margin: 0; }
.legal-related-grid .icon-tile svg { width: 20px; height: 20px; }
.legal-related-grid strong { display: block; font-weight: 750; line-height: 1.3; }
.legal-related-grid .d { display: block; margin-top: 3px; font-size: .92rem; line-height: 1.45; color: var(--muted); }
