/* ============ LEGAL identity ============
     Shared POLICY DOCUMENT layout across Privacy/Terms/Cookies/Accessibility.
     Visual signature:
     - Ruled paper feel: light horizontal baseline grid
     - Mono § section numbers (§ 1.2.3) hanging in the margin
     - Sticky TOC sidebar; current section highlighted on scroll
     - "Plain English" callouts in the OPPOSITE margin (right)
     - Doc-stamp header: title, last-updated, effective-date, revision number
     - Version history table at the bottom
     - Sibling-policy footer (Privacy ↔ Terms ↔ Cookies ↔ Accessibility)
   */

  .crumb { padding: 20px 0 0; font-size: 13px; color: var(--fg-mute); display: flex; gap: 10px; align-items: center; }
  .crumb a { color: var(--fg-mute); }
  .crumb a:hover { color: var(--accent); }
  .crumb .sep { opacity: 0.4; }

  /* ---- DOC HEADER ---- */
  .doc-head { padding: 40px 0 48px; border-bottom: 4px double var(--border-strong); }
  .doc-stamp {
    font-family: "Geist Mono", monospace; font-size: 11px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--fg-mute);
    display: flex; gap: 28px; flex-wrap: wrap;
    padding-bottom: 18px; margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
  }
  .doc-stamp b { color: var(--fg); font-weight: 500; }
  .doc-stamp .ds-id { display: inline-flex; align-items: center; gap: 8px; }
  .doc-stamp .ds-id::before { content: ""; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }

  .doc-title {
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: end;
  }
  @media (max-width: 980px) { .doc-title { grid-template-columns: 1fr; } }
  .doc-title h1 {
    font-size: clamp(40px, 5.8vw, 80px); line-height: 0.95;
    letter-spacing: -0.035em; font-weight: 600;
    margin: 0; max-width: 14ch;
  }
  .doc-title h1 em { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; color: var(--accent); }
  .doc-title .lede { font-size: 17px; color: var(--fg-dim); line-height: 1.55; max-width: 50ch; }
  .doc-title .lede strong { color: var(--fg); font-weight: 500; }

  /* ---- SIBLING POLICY NAV ---- */
  .sib-nav {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-elev);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
    margin-top: 36px; overflow: hidden;
  }
  @media (max-width: 760px) { .sib-nav { grid-template-columns: repeat(2, 1fr); } }
  .sib-nav a {
    padding: 16px 20px;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 4px;
    transition: 120ms ease;
  }
  .sib-nav a:last-child { border-right: 0; }
  @media (max-width: 760px) {
    .sib-nav a { border-bottom: 1px solid var(--border); }
    .sib-nav a:nth-child(2n) { border-right: 0; }
    .sib-nav a:nth-last-child(-n+2) { border-bottom: 0; }
  }
  .sib-nav a:hover { background: var(--bg-card); }
  .sib-nav a.current { background: var(--bg-card); }
  .sib-nav a.current .sib-id { color: var(--accent); }
  .sib-nav .sib-id { font-family: "Geist Mono", monospace; font-size: 10.5px; color: var(--fg-mute); letter-spacing: 0.1em; text-transform: uppercase; }
  .sib-nav .sib-name { font-size: 15px; font-weight: 500; letter-spacing: -0.005em; }

  /* ---- BODY: TOC sidebar · prose · plain-english margin ---- */
  .doc-body {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 240px;
    gap: 56px;
    padding: 64px 0 96px;
    align-items: start;
  }
  @media (max-width: 1080px) { .doc-body { grid-template-columns: 200px 1fr; gap: 36px; } .doc-body .margin-pe { display: none; } }
  @media (max-width: 760px) { .doc-body { grid-template-columns: 1fr; } .doc-body .toc { display: none; } }

  /* TOC */
  .toc {
    position: sticky; top: 92px; align-self: start;
    padding-right: 8px;
    border-right: 1px solid var(--border);
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
  .toc h6 {
    margin: 0 0 14px; font-family: "Geist Mono", monospace;
    font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--fg-mute);
  }
  .toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
  .toc li { counter-increment: toc; }
  .toc a {
    display: grid; grid-template-columns: 28px 1fr; gap: 8px;
    padding: 7px 0; font-size: 13.5px; color: var(--fg-dim);
    border-top: 1px dashed var(--border);
    transition: 120ms ease;
  }
  .toc a::before {
    content: counter(toc, decimal-leading-zero);
    font-family: "Geist Mono", monospace; font-size: 11px;
    color: var(--fg-mute); letter-spacing: 0.05em;
  }
  .toc a:hover { color: var(--accent); }
  .toc a.active { color: var(--accent); font-weight: 500; }
  .toc a.active::before { color: var(--accent); }
  .toc li:first-child a { border-top: 0; padding-top: 2px; }

  .toc-foot {
    margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
    font-family: "Geist Mono", monospace; font-size: 11px;
    color: var(--fg-mute); letter-spacing: 0.06em;
  }
  .toc-foot a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .toc-foot .row { padding: 4px 0; }

  /* PROSE */
  .prose {
    font-size: 16px; line-height: 1.7; color: var(--fg);
    /* faint ruled baseline grid (subtle) */
    background-image: linear-gradient(to bottom, transparent calc(1.7em - 1px), color-mix(in oklch, var(--border) 35%, transparent) calc(1.7em - 1px), color-mix(in oklch, var(--border) 35%, transparent) 1.7em);
    background-size: 100% 1.7em;
    background-position: 0 calc(1.7em - 1px);
  }
  .prose h2 {
    position: relative;
    margin: 56px 0 14px;
    font-size: 26px; letter-spacing: -0.015em; font-weight: 500;
    line-height: 1.2;
    padding-top: 22px;
    border-top: 1px solid var(--border-strong);
    background: var(--bg); /* sit over the ruled bg */
  }
  .prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
  .prose h2 .sec-num {
    position: absolute; left: -90px; top: 24px;
    font-family: "Geist Mono", monospace; font-size: 12px;
    letter-spacing: 0.08em; color: var(--accent);
    padding: 2px 8px; border: 1px solid var(--accent);
    border-radius: 4px; white-space: nowrap;
  }
  @media (max-width: 1080px) {
    .prose h2 .sec-num { position: static; display: inline-block; margin-right: 12px; margin-bottom: 6px; }
  }
  .prose h3 {
    margin: 32px 0 8px; font-size: 17px; font-weight: 500; letter-spacing: -0.005em;
    background: var(--bg);
  }
  .prose h3 .sub-num {
    font-family: "Geist Mono", monospace; font-size: 11px;
    color: var(--fg-mute); margin-right: 10px; letter-spacing: 0.05em;
  }
  .prose p { margin: 0 0 14px; max-width: 64ch; background: var(--bg); }
  .prose p strong { font-weight: 500; color: var(--fg); background: color-mix(in oklch, var(--accent) 10%, transparent); padding: 0 3px; }
  .prose ul, .prose ol { margin: 4px 0 14px; padding-left: 24px; max-width: 64ch; }
  .prose li { margin-bottom: 6px; background: var(--bg); padding-left: 4px; }
  .prose li::marker { color: var(--fg-mute); font-family: "Geist Mono", monospace; font-size: 12px; }
  .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .prose a:hover { text-decoration-thickness: 2px; }

  .prose .inline-key {
    display: inline-block; padding: 1px 8px; border-radius: 4px;
    background: var(--bg-elev); border: 1px solid var(--border);
    font-family: "Geist Mono", monospace; font-size: 12px; color: var(--fg-dim);
  }

  /* Data table inside prose (used in Privacy/Cookies) */
  .data-table {
    width: 100%; border-collapse: collapse;
    margin: 18px 0 28px; font-size: 13.5px;
    background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  }
  .data-table th, .data-table td {
    text-align: left; padding: 12px 14px;
    border-bottom: 1px solid var(--border); vertical-align: top;
  }
  .data-table thead th {
    background: var(--bg-elev); color: var(--fg-mute);
    font-family: "Geist Mono", monospace; font-size: 10.5px;
    letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500;
  }
  .data-table tr:last-child td { border-bottom: 0; }
  .data-table td.cat { font-family: "Geist Mono", monospace; font-size: 11.5px; color: var(--accent); white-space: nowrap; }
  .data-table td.ret { font-family: "Geist Mono", monospace; font-size: 12px; color: var(--fg-dim); white-space: nowrap; }

  /* PLAIN ENGLISH margin callouts */
  .margin-pe {
    position: relative;
  }
  .pe {
    position: sticky; top: 92px;
    border-left: 3px solid var(--accent);
    padding: 8px 0 8px 16px;
    margin-bottom: 28px;
  }
  /* the "Plain English" callouts are anchored manually next to specific sections,
     not all sticky — instead inline-positioned in flow with the relevant section number */
  .pe-list { display: flex; flex-direction: column; gap: 80px; padding-top: 0; }
  .pe-item {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 14px;
  }
  .pe-item .pe-kicker {
    font-family: "Geist Mono", monospace; font-size: 10px;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
    margin-bottom: 6px;
  }
  .pe-item .pe-text {
    font-family: "Instrument Serif", serif; font-style: italic;
    font-size: 17px; line-height: 1.35; color: var(--fg);
  }

  /* ---- VERSION HISTORY ---- */
  .vh {
    margin-top: 56px; padding-top: 36px; border-top: 4px double var(--border-strong);
  }
  .vh h2 { font-size: 22px; font-weight: 500; letter-spacing: -0.012em; margin: 0 0 22px; }
  .vh table {
    width: 100%; border-collapse: collapse;
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    background: var(--bg-elev); font-size: 13px;
  }
  .vh th, .vh td {
    text-align: left; padding: 12px 14px;
    border-bottom: 1px solid var(--border); vertical-align: top;
  }
  .vh thead th {
    background: var(--bg-card); font-family: "Geist Mono", monospace;
    font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--fg-mute); font-weight: 500;
  }
  .vh tr:last-child td { border-bottom: 0; }
  .vh td.ver { font-family: "Geist Mono", monospace; color: var(--accent); font-size: 12px; white-space: nowrap; }
  .vh td.dt { font-family: "Geist Mono", monospace; color: var(--fg-dim); font-size: 12px; white-space: nowrap; }

  /* ---- DOWNLOAD STRIP ---- */
  .dl-strip {
    margin-top: 28px; padding: 18px 22px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-elev);
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  }
  .dl-strip .ico {
    width: 36px; height: 44px; flex-shrink: 0;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: 4px; position: relative;
  }
  .dl-strip .ico::before {
    content: "PDF"; position: absolute; inset: auto 0 4px 0; text-align: center;
    font-family: "Geist Mono", monospace; font-size: 9px; color: var(--accent); letter-spacing: 0.08em;
  }
  .dl-strip .ico::after {
    content: ""; position: absolute; top: 0; right: 0;
    border-top: 10px solid var(--bg);
    border-left: 10px solid var(--border-strong);
  }
  .dl-strip .grow { flex: 1; min-width: 200px; }
  .dl-strip h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 500; }
  .dl-strip p { margin: 0; font-size: 12.5px; color: var(--fg-mute); }
  .dl-strip .dl-meta { font-family: "Geist Mono", monospace; font-size: 11px; color: var(--fg-mute); letter-spacing: 0.06em; }

  /* ---- CONTACT BOX ---- */
  .contact-box {
    margin-top: 28px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: 24px; background: var(--bg);
    display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  }
  @media (max-width: 760px) { .contact-box { grid-template-columns: 1fr; } }
  .contact-box h5 { margin: 0 0 6px; font-family: "Geist Mono", monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
  .contact-box p { margin: 0; font-size: 14px; color: var(--fg-dim); line-height: 1.6; }
  .contact-box address { font-style: normal; font-size: 14px; color: var(--fg); }

body.reading-clean .prose { background-image: none !important; }
  body.hide-pe .margin-pe { display: none !important; }
  body.hide-pe .doc-body { grid-template-columns: 220px 1fr !important; }
  @media (max-width: 1080px) {
    body.hide-pe .doc-body { grid-template-columns: 200px 1fr !important; }
  }
  @media (max-width: 760px) {
    body.hide-pe .doc-body { grid-template-columns: 1fr !important; }
  }
