/* ==========================================================================
   Chrysalis Labs · policy pages + 404 · v1.0 · 6 Oct 2026 · local prototype, not live.
   Routes: /research-use-only/ /shipping/ /refund/ /terms/ /privacy/ /404.html (/404/)
   Load after the foundation and the kit:
     <link rel="stylesheet" href="/directions/shared/base.css">
     <link rel="stylesheet" href="/kit/site.css">
     <link rel="stylesheet" href="/kit/policy.css">
   Adds only what the kit lacks: draft version line, drawn clause hairlines, clause rhythm,
   a no-JS fallback for the contents well, the "Other policies" band, the 404 head, print.
   Prefix p- (page group "policies"); kit classes stay k-, foundation classes cl-.
   WordPress: page.php → template-parts/prose-page.php (.pol scope) and 404.php.
   ========================================================================== */

/* ---------- 1. Page header: draft pill + last-updated line ---------- */
.p-version { align-items: center; gap: 8px 14px; margin-top: 24px; }
.p-version .k-version { margin: 0; }
.p-policy .k-head__lede { max-width: 52ch; }

/* ---------- 2. Clause rhythm ----------
   The kit draws a CSS border between clauses; here a .rule span (motion.js data-rule) draws the same
   hairline as it scrolls in. With JS off or reduced motion the span is simply a static 1px rule. */
.p-policy .k-policy__body { padding-top: 6px; }
.p-policy .k-clause + .k-clause { margin-top: 2.2em; padding-top: 0; border-top: 0; }
.p-clause__rule { margin-bottom: 2.2em; }
.p-policy .k-clause > * + * { margin-top: 1em; }
.p-policy .k-clause > h2 { margin-top: 0; }
.p-policy .k-clause > h2 + * { margin-top: .75em; }
.p-policy .k-clause h2 { font-weight: 400; }
.p-policy .k-clause__n { padding-top: .2em; letter-spacing: .08em; }
.p-policy .k-clause .k-fine { color: var(--fg-2); }
.p-policy .k-clause .k-table-wrap { margin-block: 1.1em 1.2em; }
.p-policy .k-clause .k-table th[scope="row"] { color: var(--fg); max-width: 34ch; }
.p-clause__cta { margin-top: .5em !important; }
.p-clause__cta .link { margin-left: -1px; }
/* the clause a contents link points to: a quiet number tint, no movement */
.p-policy .k-clause:target .k-clause__n { color: var(--fg); }

/* ---------- 3. Contents well ----------
   Markup ships <details open>; an inline snippet right after the nav closes it on phones before
   first paint. Without JS it stays open everywhere and the desktop summary stays a working toggle. */
.p-policy .k-toc summary { padding-top: 2px; }
.p-policy .k-toc li a { text-decoration: none; }   /* base underlines plain links in lists; the rail marks state instead */
@media (min-width: 900px) {
  html:not(.k-js) .k-toc summary { pointer-events: auto; cursor: pointer; }
  html:not(.k-js) .k-toc summary .i { display: inline-block; }
  .p-policy .k-toc details { padding-bottom: 12px; }
}
@media (max-width: 899.98px) {
  .p-policy .k-policy { row-gap: 40px; }
  .p-policy .k-clause + .k-clause { margin-top: 1.8em; }
  .p-clause__rule { margin-bottom: 1.8em; }
}

/* ---------- 4. Closing panel: "Other policies" (and the 404 formats) ----------
   A 24px mist panel (data-tone = fixed island) on the white page, so policy pages never crossfade
   their theme; white link cards inside, no ring. */
.p-panel { padding: clamp(20px, 3.4vw, 48px); }
.p-panel__head { display: grid; gap: 10px; margin-bottom: clamp(20px, 2.6vw, 36px); }
.p-panel__title { font-weight: 400; }
.p-more .k-linkcards { --k-cols: 4; }
.p-more .k-linkcard--plain { min-height: 92px; }
.p-more__fine { margin-top: clamp(28px, 3vw, 48px); }

/* ---------- 5. 404 ---------- */
.p-404__head .k-head__grid { margin-top: clamp(24px, 4.5vw, 80px); padding-bottom: clamp(56px, 6vw, 112px); }
.p-404__head .k-head__title { max-width: 14ch; }
.p-404__search { margin-top: clamp(28px, 3vw, 40px); max-width: 560px; }
.p-404__actions { margin-top: 24px; }
.p-404__formats .k-linkcard__t { font-weight: 500; }
@media (max-width: 599.98px) {   /* phones: three stacked cards, so shorter tiles keep the page calm */
  .p-404__formats .k-linkcard { --k-media-ratio: 16 / 10 !important; }
}

/* ---------- 6. Print (policies are often printed or saved as PDF) ---------- */
@media print {
  .cl-skip, .cl-gate, .cl-bar, .cl-header, .k-crumbs, .k-toc, .p-more, .cl-footer, .p-clause__cta { display: none !important; }
  html, body, .k-sec, .k-head { background: #fff !important; color: #000 !important; }
  .k-sec { padding-block: 0 !important; }
  .k-policy > .k-policy__body { grid-column: 1 / -1 !important; }
  .k-prose { max-width: none; font-size: 10.5pt; }
  .k-head__grid { border-bottom: 0; padding-bottom: 12pt; }
  .k-clause { break-inside: avoid-page; }
  .p-clause__rule { transform: none !important; }
}
