/* ============================================================
   Klyxin legal pages (Terms / Privacy) — KLX-038 Slice 1.
   Translated from klyxin-legal.dc.html <style> + inline styles.
   Draft-gated per plan §3: draft banner, per-section placeholder chips,
   non-binding summaries note, sub-processor status = "To confirm".
   ============================================================ */

.legal-page { min-height: 100dvh; background: var(--bg); color: var(--text); }

/* ---------- Hero band ---------- */
.legal-hero { position: relative; overflow: hidden; background: var(--grad-beam-soft); margin: calc(var(--space-4) + 84px) var(--space-4) var(--space-4); border-radius: clamp(18px, 2.5vw, 28px); }
.legal-hero-beam { position: absolute; inset-inline: 0; inset-block-end: 0; height: 3px; background: var(--grad-beam); z-index: 2; }
.legal-hero-field { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.75; }
.legal-hero-inner { position: relative; z-index: 1; max-width: var(--container); margin-inline: auto; padding: var(--space-8) var(--space-5) var(--space-7); }
/* KLX-088 follow-up: line-height reads the display token, not a hard-coded 1.1.
   1.1 was TIGHTER than the Latin display step and carried no script-aware value at
   all, on the h1 of the two documents most likely to grow a longer title.
   What actually moves, measured, not assumed:
     Arabic - «الشروط والأحكام» and «سياسة الخصوصية» are single-line at 320/360/768/
       1200, so there is no line boundary to measure. The single line box still grows
       (36px x 1.1 -> 36px x 1.45), which costs 13 to 25px of page height depending on
       document and width (isolating this rule: /legal/?doc=terms +13/+13/+17/+20 at
       320/360/768/1200, ?doc=privacy +25/+13/+17/+20).
     English - "Terms of Service" DOES wrap to two lines at 320 and 360px. Blank
       screen rows between the two lines, at the column where they come closest:
       12 -> 14. Page height +4px at 320/360px, +3px at 768/1200px.
   So this one is not a no-op in either locale. It is small, and it removes the last
   hard-coded leading on an h1 anywhere in this stylesheet set. */
.legal-title { font-family: var(--font-serif); font-size: var(--fs-h1); font-weight: var(--fw-semibold); color: var(--text); margin: 0 0 var(--space-3); line-height: var(--lh-tight); letter-spacing: -0.01em; }
.legal-descriptor { color: var(--text-muted); font-size: var(--fs-body-lg); margin: 0 0 var(--space-4); max-width: 60ch; }
.legal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.legal-updated { font-size: var(--fs-small); color: var(--text-muted); }
.legal-updated-label { color: var(--brand-strong); font-weight: var(--fw-semibold); }
.legal-updated time { font-feature-settings: "tnum" 1; }
.legal-crosswrap { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-small); }
.legal-crosslabel { color: var(--text-subtle); }
.legal-cross-btn { color: var(--brand-strong); font-weight: var(--fw-semibold); background: transparent; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ---------- Body container + draft banner ---------- */
.legal-container { max-width: var(--container); margin-inline: auto; padding: var(--space-6) var(--space-5) var(--space-9); }
.legal-draft { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border-inline-start: 4px solid var(--warning); border-radius: var(--radius-card); margin-block-end: var(--space-7); }
.legal-draft svg { flex: 0 0 auto; margin-block-start: 2px; }
.legal-draft p { margin: 0; color: var(--text); font-size: var(--fs-body); font-weight: var(--fw-semibold); line-height: var(--lh-body); }

/* ---------- Two-column layout (sticky rail + body) ---------- */
/* minmax(0, 1fr), never a bare 1fr: see the note on .tier-grid in pricing.css.
   The body column holds nowrap .legal-status pills and long Latin permalinks. */
.legal-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
@media (min-width: 1024px) { .legal-body { grid-template-columns: 264px minmax(0, 1fr); gap: var(--space-8); } }
.legal-rail { display: none; }
@media (min-width: 1024px) { .legal-rail { display: block; position: sticky; top: 88px; align-self: start; max-height: calc(100dvh - 108px); overflow-y: auto; } }
.legal-rail .klx-eyebrow { margin-block-end: var(--space-3); }
.legal-toc { list-style: none; margin: 0; padding: 0; }
.legal-toc li { margin-block-end: 2px; }
.legal-toc a { display: flex; gap: var(--space-2); align-items: baseline; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); text-decoration: none; font-size: var(--fs-small); line-height: 1.4; border-inline-start: 2px solid transparent; color: var(--text-muted); transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }
.legal-toc a[aria-current="true"] { color: var(--brand-strong); font-weight: var(--fw-semibold); background: var(--brand-050); border-inline-start-color: var(--brand); }
.legal-toc .toc-num { font-feature-settings: "tnum" 1; min-width: 1.6em; display: inline-block; }

.legal-details { display: block; margin-block-end: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: 0 var(--space-4); }
@media (min-width: 1024px) { .legal-details { display: none; } }
.legal-details summary { padding: var(--space-4) 0; font-weight: var(--fw-semibold); color: var(--text); cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.legal-details summary::-webkit-details-marker { display: none; }
.legal-details ol { list-style: none; margin: 0; padding: 0 0 var(--space-4); }
.legal-details a { display: flex; gap: var(--space-2); padding: var(--space-2) 0; color: var(--text-muted); text-decoration: none; font-size: var(--fs-small); }
.legal-details .toc-num { font-feature-settings: "tnum" 1; }

/* Dark-mode AA: brand TEXT accents use the lighter --brand on dark surfaces. */
[data-theme="dark"] .legal-updated-label,
[data-theme="dark"] .legal-cross-btn,
[data-theme="dark"] .legal-callout-label,
[data-theme="dark"] .legal-permalink,
[data-theme="dark"] .legal-h-num,
[data-theme="dark"] .legal-toc a[aria-current="true"] { color: var(--brand); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .legal-updated-label,
  :root:not([data-theme="light"]) .legal-cross-btn,
  :root:not([data-theme="light"]) .legal-callout-label,
  :root:not([data-theme="light"]) .legal-permalink,
  :root:not([data-theme="light"]) .legal-h-num,
  :root:not([data-theme="light"]) .legal-toc a[aria-current="true"] { color: var(--brand); }
}

/* ---------- Section body ---------- */
.legal-summaries-note { max-width: 72ch; color: var(--text-muted); font-size: var(--fs-small); font-style: normal; padding: var(--space-3) var(--space-4); background: var(--surface-2); border-radius: var(--radius-sm); margin: 0 0 var(--space-7); }
.legal-section { scroll-margin-block-start: 96px; margin-block-end: var(--space-8); max-width: 72ch; }
.legal-h { display: flex; align-items: baseline; gap: var(--space-3); margin-block-end: var(--space-4); }
.legal-h-num { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--brand-strong); font-feature-settings: "tnum" 1; flex: 0 0 auto; }
.legal-h-title { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--text); margin: 0; line-height: var(--lh-heading); }
.legal-permalink { opacity: 0; text-decoration: none; color: var(--brand-strong); transition: opacity var(--dur) var(--ease-out); }
.legal-h:hover .legal-permalink, .legal-permalink:focus-visible { opacity: 1; }
.legal-callout { padding: var(--space-4) var(--space-5); background: var(--brand-050); border-inline-start: 3px solid var(--brand); border-radius: var(--radius-card); margin-block-end: var(--space-5); }
.legal-callout-label { display: block; font-size: var(--fs-caption); font-weight: var(--fw-bold); color: var(--brand-strong); text-transform: none; margin-block-end: var(--space-1); }
.legal-callout p { margin: 0; color: var(--text); line-height: var(--lh-body); }
.legal-para { margin: 0 0 var(--space-4); color: var(--text-muted); line-height: var(--lh-body); }

.legal-table-wrap { overflow-x: auto; margin-block: var(--space-4); }
.legal-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.legal-table th { text-align: start; padding: var(--space-3); border-block-end: 1px solid var(--border-strong); color: var(--text); font-weight: var(--fw-semibold); }
.legal-table td { padding: var(--space-3); border-block-end: 1px solid var(--border); color: var(--text-muted); }
.legal-table td.legal-td-provider { color: var(--text); font-weight: var(--fw-semibold); }
.legal-status { display: inline-block; padding: 3px 10px; background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--text); border-radius: var(--radius-sm); font-size: var(--fs-caption); font-weight: var(--fw-semibold); white-space: nowrap; }

.legal-chip { display: inline-block; padding: 5px 12px; background: color-mix(in srgb, var(--warning) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); color: var(--text); border-radius: var(--radius-sm); font-size: var(--fs-caption); font-weight: var(--fw-semibold); font-family: var(--font-mono); }
.legal-contact-cta { display: inline-flex; align-items: center; gap: var(--space-2); margin-block-start: var(--space-2); height: 48px; padding-inline: var(--space-5); background: var(--brand); color: var(--on-brand); border-radius: var(--radius-pill); text-decoration: none; font-size: var(--fs-body); font-weight: var(--fw-semibold); white-space: nowrap; }
.legal-contact-cta:hover { color: var(--on-brand); background: var(--brand-strong); }
/* Dark-mode AA: white text needs the deeper brand fill (dark --brand #7C97FF is too light). */
[data-theme="dark"] .legal-contact-cta { background: var(--brand-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .legal-contact-cta { background: var(--brand-strong); } }
.legal-contact-cta span { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.legal-crosslink-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-block-start: var(--space-6); border-block-start: 1px solid var(--border); font-size: var(--fs-small); color: var(--text-muted); }

/* ---------- Print (clean ink-on-white legal document) ---------- */
.print-only { display: none; }
@media print {
  [data-print-hide] { display: none !important; }
  .legal-body { display: block; }
  .legal-rail { display: block !important; position: static !important; max-height: none; overflow: visible; margin-block-end: var(--space-6); }
  .legal-details { display: none !important; }
  .print-only { display: block !important; }
  .legal-permalink { display: none !important; }
  .legal-section { break-inside: avoid; }
  .legal-callout { break-inside: avoid; }
}
