/* =============================================================================
   KurdiCode 2.0 — legal pages
   /legal (legal-index.php), /legal/<slug>, /terms and /birma/privacy|terms
   (legal.php), /privacy (privacy.php). Loaded after site.css by
   render_head(['css' => ['legal']]); tokens, .prose, .crumbs, .card,
   .icon-tile, .link-arrow, .eyebrow, .page-title/.page-intro come from there.

   COMPONENTS (class → what it is)
   ---------------------------------------------------------------------------
   .legal-main              <main> of every legal page
   .doc-hero                title block: .crumbs and/or .eyebrow, h1.page-title,
                            p.page-intro, .doc-meta (.doc-date, .doc-lang-note)
   .doc-head                a document's own heading block (in the title's
                            language): .eyebrow.doc-label (its group on /legal),
                            h1, .doc-standfirst, .doc-meta
   .doc-print-url           the page's address, printed under the title only
   .doc-layout              the document + its contents column
     .has-toc               a generated "On this page" list exists (≥ 2 sections)
     .has-inline-toc        the document carries its own .legal-toc
   .doc-aside > .doc-toc    "On this page": sticky beside the document from
                            1100px; above it on narrower screens only when the
                            document has no .legal-toc of its own
   .doc-paper               the surface a document sits on (article, tab panel)
   .doc-body.prose          the document itself (sanitised HTML), ~72ch
   .doc-end                 after the document: back link + .legal-contact
   .legal-lead              the index's "where to start" note
   .legal-group(-head)      a titled group of cards on the index
   .legal-cards > li > .legal-card   one document card (.legal-card-top,
                            .legal-app chip, h3 > .stretched-link, .legal-card-text,
                            [.legal-card-apps tags], .legal-card-foot with
                            .legal-card-date + .link-arrow)
   .policy-tabs[data-tabs]  /privacy: .policy-tabs-bar > .policy-tabs-list >
                            a.policy-tab, then section.policy-panel per policy.
                            .is-tabbed is added by tabs.js; without it (no
                            script) the tabs are jump links and every panel shows.

   .doc-back                "Back to all legal documents" (a.link-arrow; nudges backwards)

   Language islands: a document shown in English on a Kurdish or Arabic page carries
   lang="en" dir="ltr" (legal_lang_attrs()); the rules at the end of section 1
   give it Latin type metrics and point arrows by the text they sit in (:dir()).
   Page-level (body.page-legal): no smooth scrolling on arrival at #links, and
   a solid, non-sticky-on-phones header when scripts are off (section 1).
   ============================================================================= */

/* ---------- 1. Page frame ---------- */
/* A stand-in for Inter that takes up the same room, used for the moment before
   the web font arrives (the fonts are requested with display=swap, which
   public-core owns) and if it never does.
   Why: a legal document is long, so the reflow when Inter replaces the system
   face moves everything below it. Arriving at /legal/terms#refunds with
   scripts off, the browser scrolls before the swap and does not always correct
   itself afterwards, which on a phone left the section a screenful below the
   fold. With the same metrics there is almost nothing to correct: measured on
   the Terms at 390px, the document is 6.9% shorter in the plain system face
   and 0.1% shorter in this one. (With scripts, tabs.js also puts the reader
   back on the section once the fonts are in.)
   Only the document's own text: the page frame keeps the site's stack. */
@font-face {
  font-family: "Inter stand-in";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Arial"), local("Liberation Sans");
  size-adjust: 108%;
  ascent-override: 90%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}
/* Arriving at /legal/terms#refunds or /privacy#birma: jump, don't glide. A
   smooth scroll's end point is fixed when it starts, before any remaining
   reflow, so it would stop in the wrong place; an instant jump is put back on
   the section by tabs.js ("arrival") once the fonts are in. Without script the
   browser does not correct it, which is what the stand-in face above is for.
   Links clicked on the page still glide (site.js). */
:root:has(> body.page-legal) { scroll-behavior: auto; }
/* Without script the header never gets .is-scrolled (site.js), so it would stay
   transparent and float over the text as the reader scrolls a long document.
   Give it the scrolled look from the start. (Belongs in site.css for every
   page; kept here, scoped to the legal pages, until it is there.) */
html:not(.js) body.page-legal .site-header {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border-bottom-color: var(--line);
  box-shadow: var(--header-shadow);
}
@media (max-width: 960px) {
  /* …and on phones it also carries the menu links (two rows, as tall as a
     sixth of the screen): let it scroll away with the page instead of
     covering the text and the section a #link lands on. */
  html:not(.js) body.page-legal .site-header { position: relative; }
  html:not(.js):has(> body.page-legal) { scroll-padding-top: 16px; }
}
.legal-main { position: relative; padding-bottom: clamp(48px, 2rem + 4vw, 96px); }
.doc-hero {
  display: grid; justify-items: start; gap: 16px;
  padding-block: clamp(22px, 0.75rem + 2.5vw, 48px) clamp(26px, 1rem + 2vw, 44px);
}
/* The document's own heading block: full width, so an English document on a
   Kurdish or Arabic page starts on the left, above the document itself. */
.doc-head { display: grid; justify-items: start; gap: 16px; justify-self: stretch; }
.doc-hero > :not(.doc-head), .doc-head > * { max-width: 900px; }
.doc-hero .crumbs { margin-bottom: 6px; }
/* The trail's links keep their small look with a 44px-tall touch target (the
   same invisible ::after hit area site.css gives .link-arrow). Nothing
   clickable sits within 11px above or below the trail. */
.doc-hero .crumbs a { position: relative; }
.doc-hero .crumbs a::after { content: ""; position: absolute; inset: -11px -6px; border-radius: inherit; }
.doc-hero .page-title { font-size: clamp(2rem, 1.25rem + 2.5vw, 3.1rem); }
.doc-hero .page-intro { max-width: 64ch; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 4px; }
.doc-date, .doc-lang-note {
  display: inline-flex; align-items: baseline; gap: 9px;
  padding: 8px 14px; border-radius: var(--r-md);
  font-size: var(--fs-sm); line-height: 1.45;
}
.doc-date { background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); }
.doc-date i { color: var(--accent); }
.doc-lang-note { background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--info-line); color: var(--ink); }
.doc-lang-note i { color: var(--accent); }
.doc-print-url { display: none; }

/* An English island inside a Kurdish or Arabic page: Latin metrics, not the
   Arabic-script ones inherited from the page (site.css resets the fonts; these
   reset spacing). */
:root:lang(ckb) .legal-main [lang="en"], :root:lang(ar) .legal-main [lang="en"] {
  line-height: var(--lh-body);
  --tracking-display: -0.032em; --tracking-heading: -0.022em; --tracking-label: 0.02em;
}
:root:lang(ckb) .legal-main .prose[lang="en"], :root:lang(ar) .legal-main .prose[lang="en"],
:root:lang(ckb) .legal-main [lang="en"] .prose, :root:lang(ar) .legal-main [lang="en"] .prose { line-height: 1.75; }
:root:lang(ckb) .legal-main .page-title[lang="en"], :root:lang(ar) .legal-main .page-title[lang="en"],
:root:lang(ckb) .legal-main [lang="en"] .page-title, :root:lang(ar) .legal-main [lang="en"] .page-title { line-height: 1.08; }
/* …and page wording inside that island is Kurdish or Arabic again (both are
   set in the Arabic-script faces). */
.legal-main [lang="en"] [lang="ckb"], .legal-main [lang="en"] [lang="ar"] {
  --font-display: var(--font-kurdish); --font-body: var(--font-kurdish);
  --lh-body: 1.9; --lh-heading: 1.4;
  font-family: var(--font-body);
}
/* site.css mirrors arrows for a whole RTL page. Here an arrow follows the
   direction of the text it actually sits in (:dir()), so it points the right
   way in an English island on a Kurdish or Arabic page, and in Kurdish or
   Arabic wording inside that island. (A browser without :dir() keeps the
   page-wide rule.) */
.legal-main .arrow:dir(ltr), .legal-main .icon-flip:dir(ltr) { transform: none; }
.legal-main .arrow:dir(rtl), .legal-main .icon-flip:dir(rtl) { transform: scaleX(-1); }
.legal-main .link-arrow:hover .arrow:dir(ltr),
.legal-main .card.is-interactive:hover .link-arrow .arrow:dir(ltr) { transform: translateX(3px); }
.legal-main .link-arrow:hover .arrow:dir(rtl),
.legal-main .card.is-interactive:hover .link-arrow .arrow:dir(rtl) { transform: scaleX(-1) translateX(3px); }

/* ---------- 2. Document layout ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.doc-paper {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(22px, 0.5rem + 3.4vw, 56px);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--glass-highlight), inset 0 0 0 1px var(--line), var(--shadow-sm);
}
/* A hairline of the brand gradient along the top edge. */
.doc-paper::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 auto; height: 3px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: linear-gradient(90deg, rgba(1, 181, 255, 0.55), rgba(169, 155, 255, 0.5) 55%, rgba(254, 202, 8, 0.55));
  opacity: 0.75;
}
.doc-body { max-width: 72ch; }
/* The same measure — 72 characters of Inter at the prose size — written as a
   fixed length: a column sized in ch changes width when the web font arrives,
   and a change of width rewraps the whole document and carries every #section
   link with it (section 1). Kurdish and Arabic keep ch, their own measure. */
.doc-body:lang(en) { max-width: 47.9rem; }
/* Without a contents column beside it (narrower than 1100px, or no list at
   all) the paper keeps to the reading width, not the page's; section 2 lifts
   this for the two-column layout. */
.doc-layout, .policy-tabs, .page-privacy .doc-end { max-width: 920px; }

/* "On this page" */
.doc-toc {
  padding: 18px 12px 12px; border-radius: var(--r-lg);
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line);
}
.doc-toc-title {
  margin: 0 0 10px; padding-inline: 12px;
  font: 600 var(--fs-xs)/1.3 var(--font-body); color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.doc-toc-title [lang="ckb"], .doc-toc-title [lang="ar"], :root:lang(ckb) .doc-toc-title, :root:lang(ar) .doc-toc-title { font-size: 0.86rem; }
.doc-toc-list { list-style: none; margin: 0; padding: 0; }
.doc-toc-list a {
  position: relative; display: flex; align-items: center; min-height: 44px; padding: 6px 12px;
  border-radius: var(--r-xs);
  font-size: 0.92rem; line-height: 1.35; color: var(--text);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.doc-toc-list .is-sub a { padding-inline-start: 26px; font-size: 0.87rem; }
.doc-toc-list a:hover { color: var(--ink); background: var(--hover-bg); }
.doc-toc-list a[aria-current] {
  color: var(--accent); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* The bar on the reading side of the current entry (start edge, either direction). */
.doc-toc-list a[aria-current]::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 2px;
  border-radius: 2px; background: var(--accent);
}

@media (max-width: 1099px) {
  /* The document's own list is shown instead (section 3). */
  .doc-layout.has-inline-toc .doc-aside { display: none; }
}
@media (min-width: 1100px) {
  .doc-layout.has-toc { max-width: none; grid-template-columns: minmax(0, 1fr) 272px; column-gap: clamp(32px, 3.5vw, 56px); }
  .doc-layout.has-toc .doc-aside {
    grid-column: 2; grid-row: 1;
    position: sticky; top: calc(var(--header-h) + 20px);
  }
  .doc-layout.has-toc .doc-toc { padding: 4px 0 0; background: none; box-shadow: none; border-radius: 0; }
  .doc-layout.has-toc .doc-toc-title { padding-inline: 14px; }
  .doc-layout.has-toc .doc-toc-list {
    max-height: calc(100vh - var(--header-h) - 96px); max-height: calc(100dvh - var(--header-h) - 96px);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    padding-inline-end: 4px;
    border-inline-start: 1px solid var(--line);
  }
  /* Square on the side that meets the list's rule, round on the other. */
  .doc-layout.has-toc .doc-toc-list a {
    min-height: 36px; padding-block: 8px;
    border-start-start-radius: 0; border-end-start-radius: 0;
  }
  /* The generated list beside the document replaces the document's own. */
  .doc-layout.has-toc.has-inline-toc .doc-body .legal-toc { display: none; }
  .doc-layout.has-toc.has-inline-toc .doc-body > .legal-toc:first-child + * { margin-top: 0; }
}
/* Touch screens keep 44px rows even in the side column. */
@media (min-width: 1100px) and (pointer: coarse) {
  .doc-layout.has-toc .doc-toc-list a { min-height: 44px; }
}

/* ---------- 3. The document ---------- */
/* The Latin document text (a Kurdish or Arabic page's English policy included,
   through :lang()) falls back to the metric-matched face from section 1;
   Kurdish and Arabic text keeps its own stack untouched. */
.doc-body:lang(en) { font-family: "Inter", "Inter stand-in", var(--font-body); }
/* Anchors land just under the sticky header (html already pads by its height). */
.doc-body [id] { scroll-margin-top: 12px; }
.doc-body h2 { font-size: clamp(1.4rem, 1.1rem + 0.9vw, 1.8rem); }
.doc-body h3 {
  font-size: clamp(1.14rem, 1rem + 0.45vw, 1.32rem);
  margin-top: 1.9em; padding-top: 1.2em; border-top: 1px solid var(--line);
}
/* No rule under the top edge, or under the document's own contents box. */
.doc-body > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.doc-body .legal-toc + h3 { margin-top: 1.6em; padding-top: 0; border-top: 0; }
.doc-body h2:target, .doc-body h3:target { color: var(--accent); }
.doc-body :is(p, li) { text-wrap: pretty; }

/* The document's own contents list, written into the text as ul.legal-toc */
.doc-body .legal-toc {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 0; padding: 14px; border-radius: var(--r-lg);
  background: var(--bg-tint); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.9rem;
}
.doc-body .legal-toc li { margin: 0; }
.doc-body .legal-toc li::marker { content: none; }
.doc-body .legal-toc a {
  position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
  border-radius: var(--r-pill); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink); font-weight: 500; line-height: 1.3; text-decoration: none;
  transition: color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.doc-body .legal-toc a::after { content: ""; position: absolute; inset: -2px 0; border-radius: inherit; } /* 44px touch target */
.doc-body .legal-toc a:hover { color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); text-decoration: none; }

/* Callouts carried by stored documents */
.doc-body .legal-note { position: relative; padding: 16px 20px; padding-inline-start: 22px; }
.doc-body .legal-note::before {
  content: ""; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 3px; border-radius: 3px;
  background: var(--accent);
}
.doc-body .legal-note > * + * { margin-top: 0.7em; }
/* "See also: [link] · [link]" — laid out as a line of text (site.css makes it a
   flex row), so each "·" stays beside a link when the row wraps instead of
   becoming a line of its own. The tall line gives the pill links 44px rows. */
.doc-body .legal-switch {
  display: block; margin-top: 2em; padding-top: 1.4em; border-top: 1px solid var(--line);
  font-size: 0.94rem; line-height: 3; color: var(--muted);
}
.doc-body .legal-switch a { display: inline-flex; vertical-align: middle; line-height: 1.3; }
.doc-body .legal-switch i { color: var(--accent); }

/* Buttons written into stored text (e.g. "Read the full Birma Privacy Policy") */
.doc-body a.btn { text-decoration: none; margin-block: 0.4em; white-space: normal; }
.doc-body a.btn:hover { text-decoration: none; }
.doc-body .btn-amber {
  background: var(--grad-warm); color: #1F1300;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(164, 90, 0, 0.35), 0 8px 22px -12px rgba(164, 90, 0, 0.6);
}
.doc-body .btn-amber:hover { color: #1F1300; transform: translateY(-1px); }
.doc-body a.btn:not(.btn-amber):not(.btn-primary):not(.btn-secondary) {
  background: var(--btn-primary-bg); color: var(--btn-primary-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--btn-primary-ring), var(--btn-primary-shadow);
}

/* ---------- 4. After the document ---------- */
.doc-end { display: grid; justify-items: start; gap: 22px; margin-top: clamp(28px, 3vw, 44px); }
.doc-layout > .doc-end { grid-column: 1; margin-top: clamp(8px, 1.5vw, 24px); }
.doc-back i { margin-inline-end: 2px; }
/* A way back nudges backwards (.link-arrow nudges forwards). */
.legal-main .doc-back:hover .arrow:dir(ltr) { transform: translateX(-3px); }
.legal-main .doc-back:hover .arrow:dir(rtl) { transform: scaleX(-1) translateX(-3px); }
.legal-contact {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 20px; border-radius: var(--r-lg);
  background: var(--glass-strong); box-shadow: var(--glass-highlight), inset 0 0 0 1px var(--line);
  font-size: 0.97rem; line-height: 1.6; color: var(--text);
}
.legal-contact a {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  overflow-wrap: anywhere; unicode-bidi: isolate;
}
.legal-contact a:hover { color: var(--accent-strong); }

/* ---------- 5. The index (/legal) ---------- */
.legal-lead {
  display: flex; align-items: flex-start; gap: 14px; max-width: 900px;
  padding: 18px 22px; border-radius: var(--r-lg);
  background: var(--glass-strong); box-shadow: var(--glass-highlight), inset 0 0 0 1px var(--line), var(--shadow-xs);
  font-size: 0.98rem; line-height: 1.7; color: var(--text);
}
.legal-lead .icon-tile { margin-top: 2px; }
.legal-lead a { color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.legal-lead a:hover { color: var(--accent-strong); }
.legal-group { margin-top: clamp(40px, 2rem + 2.5vw, 68px); }
.legal-group-head { display: grid; gap: 8px; margin-bottom: 22px; }
.legal-group-head h2 { font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2rem); }
.legal-group-head p { max-width: 62ch; color: var(--text); }
.legal-cards {
  list-style: none; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.legal-cards > li { display: flex; }
.legal-card {
  flex: 1; display: flex; flex-direction: column; gap: 12px;
  padding: 24px 24px 20px; background: var(--glass-strong);
}
.legal-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.legal-app {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--chip-bg); box-shadow: inset 0 0 0 1px var(--line);
  font: 600 0.78rem/1.3 var(--font-body); color: var(--ink);
}
.legal-app i { color: var(--accent); font-size: 0.9em; }
.legal-card h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
:root:lang(ckb) .legal-card h3, :root:lang(ar) .legal-card h3 { line-height: 1.55; }
:root:lang(ckb) .legal-card[lang="en"] h3, :root:lang(ar) .legal-card[lang="en"] h3 { line-height: 1.3; }
.legal-card h3 a { transition: color var(--dur) var(--ease); }
.legal-card:hover h3 a, .legal-card h3 a:focus-visible { color: var(--accent); }
.legal-card-text { font-size: 0.94rem; line-height: 1.62; color: var(--text); }
.legal-card-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
}
.legal-card-date { display: inline-flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--muted); }
.legal-card-date i { color: var(--accent); }
/* The app names on the /privacy card, between its text and its foot. */
.legal-card-apps { margin-top: 2px; }
.legal-group .legal-card-privacy {
  background:
    radial-gradient(70% 90% at 100% 0%, color-mix(in srgb, var(--brand-lavender) 14%, transparent), transparent 70%),
    radial-gradient(60% 80% at 0% 100%, color-mix(in srgb, var(--brand-cyan) 10%, transparent), transparent 70%),
    var(--glass-strong);
}
.page-legal-index .doc-end { margin-top: clamp(40px, 2rem + 2.5vw, 64px); }

/* ---------- 6. /privacy tabs ---------- */
.policy-tabs-bar { margin-bottom: 22px; }
.policy-tabs-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.policy-tab {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-pill);
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink); font: 600 0.93rem/1.2 var(--font-body); white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.policy-tab i { color: var(--accent); font-size: 0.88em; transition: color var(--dur) var(--ease); }
.policy-tab:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.policy-tab bdi { unicode-bidi: isolate; }

/* Tabs (tabs.js has taken over): one segmented strip that scrolls sideways on
   narrow screens, faded at whichever edge has more tabs behind it. */
.policy-tabs.is-tabbed .policy-tabs-bar {
  --fade-s: 0px; --fade-e: 0px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain;
  padding: 6px; margin: -6px -6px 16px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-s), #000 calc(100% - var(--fade-e)), transparent);
          mask-image: linear-gradient(to right, transparent, #000 var(--fade-s), #000 calc(100% - var(--fade-e)), transparent);
}
/* The start edge is the right one in a right-to-left strip. */
.policy-tabs.is-tabbed .policy-tabs-bar:dir(rtl) {
  -webkit-mask-image: linear-gradient(to left, transparent, #000 var(--fade-s), #000 calc(100% - var(--fade-e)), transparent);
          mask-image: linear-gradient(to left, transparent, #000 var(--fade-s), #000 calc(100% - var(--fade-e)), transparent);
}
.policy-tabs.is-tabbed .policy-tabs-bar::-webkit-scrollbar { display: none; }
.policy-tabs.is-tabbed .policy-tabs-bar[data-more-start] { --fade-s: 48px; }
.policy-tabs.is-tabbed .policy-tabs-bar[data-more-end] { --fade-e: 48px; }
.policy-tabs.is-tabbed .policy-tabs-list {
  flex-wrap: nowrap; gap: 4px; width: max-content;
  padding: 5px; border-radius: var(--r-pill);
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-xs);
}
.policy-tabs.is-tabbed .policy-tab { background: transparent; box-shadow: none; color: var(--text); padding-inline: 16px; }
.policy-tabs.is-tabbed .policy-tab:hover { color: var(--ink); background: var(--hover-bg); }
.policy-tabs.is-tabbed .policy-tab[aria-selected="true"] { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.policy-tabs.is-tabbed .policy-tab[aria-selected="true"] i { color: inherit; }

.policy-panel { scroll-margin-top: 16px; }
/* Arriving at /privacy#<slug>: land with the row of tabs still in view. */
.policy-tabs.is-tabbed .policy-panel { scroll-margin-top: 84px; }
.policy-panel + .policy-panel { margin-top: 28px; }
.policy-tabs.is-tabbed .policy-panel + .policy-panel { margin-top: 0; }
.policy-panel:focus-visible { outline-offset: 4px; border-radius: var(--r-xl); }
.policy-head { display: grid; gap: 12px; padding-bottom: 22px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.policy-head h2 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem); }
:root:lang(ckb) .policy-head h2[lang="en"], :root:lang(ckb) .policy-panel[lang="en"] .policy-head h2,
:root:lang(ar) .policy-head h2[lang="en"], :root:lang(ar) .policy-panel[lang="en"] .policy-head h2 { line-height: 1.2; }
.policy-head .doc-meta { margin-top: 0; }
.policy-permalink { font-size: 0.88rem; }

/* ---------- 7. Phones ---------- */
@media (max-width: 720px) {
  .doc-hero { gap: 12px; }
  /* The page's own title follows right below: the trail only needs the way up. */
  .doc-hero .crumbs li:last-child { display: none; }
  .doc-date, .doc-lang-note { padding: 7px 12px; font-size: 0.84rem; }
  .doc-paper { border-radius: var(--r-lg); }
  .doc-paper::before { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .doc-body { font-size: 1rem; }
  .doc-body .legal-toc { padding: 12px; gap: 6px; }
  .doc-body .legal-toc a { padding-inline: 12px; font-size: 0.86rem; }
  .legal-lead { padding: 16px; gap: 12px; font-size: 0.95rem; }
  .legal-card { padding: 20px 20px 18px; }
  .legal-contact { align-items: flex-start; padding: 14px 16px; font-size: 0.94rem; }
  .policy-head { padding-bottom: 18px; margin-bottom: 20px; }
}

/* ---------- 8. Print: the document alone, black on white ---------- */
@media print {
  @page { margin: 16mm 15mm; }
  /* Light tokens for everything printed here, whatever the screen theme. On
     :root they lose to the system-dark rule (:root:not([data-theme]), set
     when scripts are off), which left headings outside .doc-body white on
     white; set on .legal-main they are inherited by the whole document. */
  .legal-main {
    color-scheme: light;
    --bg: #fff; --bg-tint: #fff; --surface: #fff; --glass-strong: #fff; --chip-bg: #fff;
    --ink: #000; --text: #111; --muted: #444; --accent: #000; --accent-strong: #000;
    --line: #bbb; --line-strong: #999; --info-bg: #fff; --info-line: #999;
    color: #111;
  }
  .site-footer, .crumbs, .eyebrow, .doc-aside, .doc-end, .doc-lang-note, .legal-lead,
  .policy-tabs-bar, .policy-permalink, .legal-card-foot .link-arrow { display: none !important; }
  .legal-main { padding: 0; }
  .doc-hero { padding: 0 0 10pt; gap: 6pt; max-width: none; border-bottom: 1px solid #999; margin-bottom: 14pt; }
  .doc-hero .page-title { font-size: 22pt; line-height: 1.15; color: #000; }
  .doc-hero .page-intro { font-size: 11.5pt; color: #222; max-width: none; }
  .doc-meta { margin: 0; }
  .doc-date { padding: 0; background: none !important; box-shadow: none !important; color: #222; font-size: 10pt; }
  .doc-date i { display: none; }
  .doc-print-url { display: block; font-size: 9pt; color: #444; }
  .doc-layout { display: block; max-width: none; }
  .doc-paper, .policy-panel {
    padding: 0 !important; border-radius: 0; background: #fff !important;
    box-shadow: none !important; border: 0 !important;
  }
  .doc-paper::before { display: none; }
  .policy-tabs:not(.is-tabbed) .policy-panel + .policy-panel { margin-top: 18pt; break-before: page; }
  .policy-head { border-bottom-color: #bbb; padding-bottom: 8pt; margin-bottom: 12pt; }
  .doc-body, .doc-body:lang(en) { max-width: none; }
  .doc-body { font-size: 10.5pt; line-height: 1.5; color: #111; }
  .doc-body :is(h2, h3, h4, strong) { color: #000; }
  .doc-body h3 { border-top-color: #bbb; padding-top: 8pt; margin-top: 14pt; break-after: avoid; }
  .doc-body a { color: #000; }
  /* Web addresses are spelled out after their link (site.css); in-page, on-site
     and email links print as their text alone (it already names them). */
  .doc-body a::after { position: static !important; inset: auto !important; }
  .doc-body a[href^="#"]::after, .doc-body a[href^="/"]::after, .doc-body a[href^="mailto:"]::after,
  .doc-body a[href^="tel:"]::after, .doc-body .legal-toc a::after { content: none !important; }
  .doc-body .legal-switch a {
    display: inline; min-height: 0; padding: 0; border-radius: 0;
    background: none !important; box-shadow: none !important; color: #000; text-decoration: underline;
  }
  .doc-body .legal-toc { display: block !important; padding: 0; background: none; box-shadow: none; font-size: 9.5pt; color: #333; }
  .doc-body .legal-toc li { display: inline; }
  .doc-body .legal-toc li + li::before { content: " · "; }
  .doc-body .legal-toc a { display: inline; min-height: 0; padding: 0; background: none; box-shadow: none; color: #333; font-weight: 400; }
  .doc-body .legal-note { background: none !important; box-shadow: none !important; border: 1px solid #999; }
  .doc-body .legal-note::before { display: none; }
  .doc-body .legal-switch { display: block; line-height: 1.5; }
  .doc-body a.btn { display: inline; min-height: 0; padding: 0; background: none !important; box-shadow: none !important; color: #000; text-decoration: underline; }
  .legal-cards { display: block; }
  .legal-card { box-shadow: none !important; border: 1px solid #bbb; margin-bottom: 10pt; break-inside: avoid; background: #fff !important; }
  .legal-card .stretched-link::before { display: none; }
}
