/* docs.css — the documentation shell for usertrust.
 *
 * ONE canonical stylesheet, linked by every docs page. The marketing page keeps
 * its CSS inline because it is one file; the docs are 22 files and inlining
 * would make 22 copies of the same rules — the mirror problem, where a fix
 * lands in one place and silently misses the rest. This requires the site's CSP
 * to allow `style-src 'self'`, which apps/usertrust-site/vercel.json sets.
 *
 * NO LIVE LATTICE HERE, deliberately. The field is the marketing surface's
 * subject; on a page of reference prose it is a legibility fight you re-fight
 * in every paragraph, and it spends GPU on a page people keep open in a tab for
 * an hour. Docs get the lattice's OWN static degrade — the net-fallback
 * gradient — so the two properties still read as one family without the cost.
 */

/* The five faces the kit ships. Declared here, not only on the marketing page:
   --sans names 'Usertools Sans' first, and without these blocks it could never
   load — 21 pages rendered in the fallback with nothing failing. The font
   names are FIXED (not content-hashed), so the site serves them with a 300 s
   revalidating cache (`immutable` is only for content-hashed kit names, see
   apps/usertrust-site/vercel.json). ?v= is a cache-busting tag kept for
   browsers and intermediaries that held the old year-long copy; bump it when a
   font file is regenerated, see fonts/make-loop-glyph.py. */
@font-face{font-family:'Usertools Sans';src:url('/kit/fonts/UsertoolsSans-Regular.woff2?v=1') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:'Usertools Sans';src:url('/kit/fonts/UsertoolsSans-Medium.woff2?v=1') format('woff2');font-weight:500;font-display:swap}
@font-face{font-family:'Usertools Sans';src:url('/kit/fonts/UsertoolsSans-Bold.woff2?v=1') format('woff2');font-weight:700;font-display:swap}
@font-face{font-family:'JetBrains Mono';src:url('/kit/fonts/JetBrainsMono-Regular.woff2?v=1') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:'JetBrains Mono';src:url('/kit/fonts/JetBrainsMono-Medium.woff2?v=1') format('woff2');font-weight:500;font-display:swap}
:root{
  color-scheme:dark;
  --ink:#FFFFFF; --body:#9A9AA2; --line:rgba(255,255,255,.11);
  --page:#08080A; --line-quiet:rgba(255,255,255,.06);
  --gold:#E8B54B; --gold-lo:#B98C2E; --silver:#C8CCD4; --silver-lo:#7E8490;
  --sans:'Usertools Sans','Geist Variable',-apple-system,BlinkMacSystemFont,sans-serif;
  --mono:'JetBrains Mono',ui-monospace,'SF Mono',SFMono-Regular,Menlo,monospace;
  --nav-h:64px;
}
*{margin:0;padding:0;box-sizing:border-box}
html{background:var(--page);overflow-x:clip;scroll-behavior:smooth}
body{
  background:var(--page);color:var(--body);font-family:var(--sans);
  font-size:15px;line-height:1.68;-webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  /* the lattice's static degrade, fixed so it does not scroll with the prose */
  background-image:
    radial-gradient(120% 70% at 50% -8%, rgba(232,181,75,.055) 0%, rgba(232,181,75,0) 60%),
    radial-gradient(90% 60% at 8% 102%, rgba(200,204,212,.035) 0%, rgba(200,204,212,0) 64%);
  background-attachment:fixed;
}
a{color:inherit;text-decoration:none}

/* ── the bar ─────────────────────────────────────────────────────────────── */
.bar{position:sticky;top:0;z-index:20;height:var(--nav-h);
     display:flex;align-items:center;gap:22px;padding:0 22px;
     background:rgba(8,8,10,.82);backdrop-filter:blur(14px) saturate(120%);
     -webkit-backdrop-filter:blur(14px) saturate(120%);
     border-bottom:1px solid var(--line-quiet)}
/* the mark, cloned from the marketing nav — same recipe, not matched by eye */
.brand{display:inline-flex;align-items:center;gap:9px}
.brand .mark{width:24px;height:24px;border-radius:6.5px;background:var(--gold);color:#08080A;
             display:grid;place-items:center;
             font:700 17px/1 'Usertools Sans',system-ui,sans-serif;letter-spacing:-.045em;
             -webkit-text-stroke:.7px currentColor;paint-order:stroke fill}
.brand .word{font-size:15px;font-weight:500;color:var(--ink);letter-spacing:-.01em}
.brand .in{font:400 12px/1 var(--mono);color:var(--silver-lo);letter-spacing:.1em;
           text-transform:uppercase;padding-left:11px;margin-left:2px;
           border-left:1px solid var(--line)}
.bar .sp{margin-left:auto}
.bar a.lnk{font-size:13.5px;color:var(--body)}
.bar a.lnk:hover{color:var(--ink)}
/* on a phone the two links are 44px targets; the negative margin keeps the look and the spacing */
@media(max-width:899px){.bar a.lnk{padding:11px 10px;margin:0 -10px}}

/* ── the frame: sidebar · prose · on-page contents ───────────────────────── */
.frame{display:grid;grid-template-columns:1fr;gap:0;
       max-width:1440px;margin:0 auto;padding:0 22px}
@media(min-width:900px){
  .frame{grid-template-columns:236px minmax(0,1fr);gap:44px}
}
@media(min-width:1280px){
  /* the third column only appears when it does not squeeze the prose */
  .frame{grid-template-columns:236px minmax(0,1fr) 186px;gap:52px}
}

/* ── sidebar ─────────────────────────────────────────────────────────────── */
/* Below 900px the sidebar column is gone; the SAME tree is rendered a second
   time inside a native <details> at the top of the frame (generated from one
   NAV source, so it is not a mirror), closed by default, no JavaScript. */
.side{display:none}
.side-m{display:block;margin:16px 0 0;border:1px solid var(--line);border-radius:10px;
        padding:0 14px;background:rgba(18,18,21,.6)}
.side-m>summary{cursor:pointer;list-style:none;padding:17px 0;
        font:500 10.5px/1 var(--mono);letter-spacing:.16em;text-transform:uppercase;
        color:var(--silver-lo)}
.side-m>summary::-webkit-details-marker{display:none}
.side-m>summary::after{content:'+';float:right;font-size:14px;line-height:10px}
.side-m[open]>summary{color:var(--ink)}
.side-m[open]>summary::after{content:'\2013'}
.side-m nav{padding:2px 0 16px;font-size:14px}
@media(min-width:900px){.side-m{display:none}}
@media(min-width:900px){
  .side{display:block;position:sticky;top:var(--nav-h);align-self:start;
        max-height:calc(100vh - var(--nav-h));overflow-y:auto;
        padding:34px 0 60px;font-size:14px}
}
.side-m nav .grp,.side .grp{margin-top:22px}
.side-m nav .grp:first-child,.side .grp:first-child{margin-top:0}
.side-m nav .grp > b,.side .grp > b{display:block;margin-bottom:9px;
               font:500 10.5px/1 var(--mono);letter-spacing:.16em;
               text-transform:uppercase;color:var(--silver-lo);font-weight:400}
.side-m nav a,.side a{display:block;padding:5px 12px;margin-left:-12px;border-radius:7px;
        color:var(--body);line-height:1.45}
/* the phone list is a touch list: rows are 44px; the desktop column keeps its tight rows */
@media(max-width:899px){.side-m nav a{padding:12px}}
.side-m nav a:hover,.side a:hover{color:var(--ink);background:rgba(255,255,255,.04)}
/* current page: a gold rule rather than a filled pill — the sidebar is a list
   of places, and a block of colour reads as a button */
.side-m nav a[aria-current="page"],.side a[aria-current="page"]{color:var(--ink);font-weight:500;
        box-shadow:inset 2px 0 0 var(--gold);background:rgba(232,181,75,.055)}

/* ── prose ───────────────────────────────────────────────────────────────── */
.doc{padding:34px 0 90px;min-width:0}
.doc .eyebrow{font:500 11px/1 var(--mono);letter-spacing:.15em;text-transform:uppercase;
              color:var(--silver-lo);margin-bottom:12px}
.doc h1{font-size:clamp(1.8rem,3vw,2.35rem);font-weight:700;color:var(--ink);
        letter-spacing:-.016em;line-height:1.12;text-wrap:balance}
.doc .sub{margin-top:12px;font-size:1.02rem;color:var(--body);max-width:64ch}
/* Prose measure is capped near 72ch. Reference text is read line after line for
   a long time, and a full-width line makes the eye lose its place on the return
   sweep — the one thing a docs page cannot afford. */
.doc p,.doc ul,.doc ol,.doc .note{max-width:72ch}
.doc h2{margin:44px 0 0;font-size:1.32rem;font-weight:600;color:var(--ink);
        letter-spacing:-.01em;scroll-margin-top:calc(var(--nav-h) + 18px)}
.doc h3{margin:30px 0 0;font-size:1.05rem;font-weight:600;color:var(--ink);
        scroll-margin-top:calc(var(--nav-h) + 18px)}
/* a hairline under h2 only — it separates sections without ruling the page */
.doc h2{padding-bottom:10px;border-bottom:1px solid var(--line-quiet)}
.doc p{margin-top:14px}
.doc ul,.doc ol{margin-top:14px;padding-left:20px}
.doc li{margin-top:7px}
.doc li::marker{color:var(--silver-lo)}
.doc strong{color:var(--ink);font-weight:500}
.doc a.ref{color:var(--gold);border-bottom:1px solid rgba(232,181,75,.34)}
.doc a.ref:hover{border-bottom-color:var(--gold)}
/* inline code — a token, not a box */
.doc :not(pre) > code{font:400 .875em/1.5 var(--mono);color:var(--silver);
        background:rgba(255,255,255,.055);border:1px solid var(--line-quiet);
        border-radius:5px;padding:1px 5px;overflow-wrap:anywhere}

/* ── code blocks: the marketing site's terminal, same grammar ────────────── */
.term{margin-top:18px;border:1px solid var(--line);border-radius:12px;
      background:rgba(18,18,21,.72);overflow:hidden}
.term .bar2{display:flex;align-items:center;gap:10px;height:34px;padding:0 14px;
            border-bottom:1px solid var(--line-quiet);
            font:400 11px/1 var(--mono);letter-spacing:.12em;text-transform:uppercase;
            color:var(--silver-lo)}
.term .bar2 b{color:var(--silver);font-weight:400;letter-spacing:.06em;text-transform:none}
.term .bar2 .sp{margin-left:auto}
/* wraps rather than scrolls — a code window that hides the end of its own
   lines behind a drag is a worse reference than a wrapped one */
.term pre{margin:0;padding:15px 18px 15px 16px;
          white-space:pre-wrap;overflow-wrap:break-word;overflow-x:hidden;
          font:400 12.8px/1.72 var(--mono);color:rgba(255,255,255,.82)}
.k{color:var(--body)}      /* keywords, keys, punctuation */
.s{color:var(--silver)}    /* strings */
.n{color:#FFFFFF;font-weight:500}   /* numbers — the money */
.b{color:var(--gold);font-weight:500}  /* booleans, settled, the accent */
.c{color:var(--silver-lo)} /* comments step back, and stay readable: 5:1 on the window */

/* ── callout ─────────────────────────────────────────────────────────────── */
.note{margin-top:20px;border:1px solid var(--line);border-left:2px solid var(--silver-lo);
      background:rgba(255,255,255,.028);border-radius:10px;padding:14px 16px;
      font-size:14.2px}
.note > b{display:block;margin-bottom:5px;font:500 10.5px/1 var(--mono);
          letter-spacing:.15em;text-transform:uppercase;color:var(--silver-lo)}
.note.warn{border-left-color:var(--gold);background:rgba(232,181,75,.05)}
.note.warn > b{color:var(--gold)}
.note p:first-of-type{margin-top:0}

/* ── card grid ───────────────────────────────────────────────────────────── */
.cards{display:grid;grid-template-columns:1fr;gap:12px;margin-top:20px}
@media(min-width:720px){.cards{grid-template-columns:1fr 1fr}}
.card{display:block;border:1px solid var(--line);border-radius:12px;padding:15px 17px;
      background:rgba(255,255,255,.022);transition:border-color .16s,background .16s}
.card:hover{border-color:rgba(232,181,75,.4);background:rgba(232,181,75,.04)}
.card b{display:block;color:var(--ink);font-weight:500;font-size:14.8px}
.card span{display:block;margin-top:4px;font-size:13.4px;color:var(--body);line-height:1.55}

/* ── tables ──────────────────────────────────────────────────────────────── */
.tw{margin-top:20px;overflow-x:auto;overscroll-behavior-x:contain;
    border:1px solid var(--line);border-radius:12px;
    /* a shadow on each edge that still has content to scroll to: the cover layers scroll with the
       content (local) and hide the shadow when that edge is reached */
    background:
      linear-gradient(to right,var(--page) 30%,transparent) left,
      linear-gradient(to left,var(--page) 30%,transparent) right,
      radial-gradient(farthest-side at 0 50%,rgba(255,255,255,.16),transparent) left,
      radial-gradient(farthest-side at 100% 50%,rgba(255,255,255,.16),transparent) right;
    background-repeat:no-repeat;background-size:40px 100%,40px 100%,14px 100%,14px 100%;
    background-attachment:local,local,scroll,scroll}
.doc table{border-collapse:collapse;width:100%;font-size:13.6px;min-width:460px}
.doc th{text-align:left;padding:10px 14px;color:var(--silver-lo);font-weight:400;
        font:400 10.5px/1.5 var(--mono);letter-spacing:.13em;text-transform:uppercase;
        border-bottom:1px solid var(--line)}
.doc td{padding:10px 14px;border-top:1px solid var(--line-quiet);vertical-align:top}
/* code in a cell wraps at its spaces and never inside a word, at every width: an identifier is not split where the table
   could simply scroll; only the first column (the name being defined) stays on one line */
.doc td code{white-space:normal;overflow-wrap:normal}
.doc td:first-child code{white-space:nowrap}
/* On a phone a table may be narrower than 460px and its cells are a little tighter. The prose column keeps a
   readable measure (about 28 characters a line): when that makes the table wider than the screen, the table's
   own box scrolls sideways, with the edge shadows as the cue, and the page never does. */
@media(max-width:719px){
  .doc table{min-width:0}
  .doc th,.doc td{padding-inline:10px}
  .doc th{white-space:nowrap}   /* a header is never split inside a word; the box scrolls instead */
  .doc td:nth-child(2):last-child{min-width:12em}
  .doc td:nth-child(3):last-child{min-width:15em}
}

/* ── on-page contents ────────────────────────────────────────────────────── */
.toc{display:none}
@media(min-width:1280px){
  .toc{display:block;position:sticky;top:var(--nav-h);align-self:start;
       padding:34px 0 60px;font-size:13px;line-height:1.5}
}
.toc b{display:block;margin-bottom:10px;font:500 10.5px/1 var(--mono);
       letter-spacing:.16em;text-transform:uppercase;color:var(--silver-lo);font-weight:400}
.toc a{display:block;padding:5px 0 5px 12px;color:var(--body);
       border-left:1px solid var(--line-quiet)}
.toc a:hover{color:var(--ink)}
.toc a.on{color:var(--ink);border-left-color:var(--gold)}

/* ── pager ───────────────────────────────────────────────────────────────── */
.pager{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:54px}
.pager a{border:1px solid var(--line);border-radius:12px;padding:13px 16px}
.pager a:hover{border-color:rgba(232,181,75,.4)}
.pager span{display:block;font:400 10.5px/1 var(--mono);letter-spacing:.14em;
            text-transform:uppercase;color:var(--silver-lo);margin-bottom:5px}
.pager b{color:var(--ink);font-weight:500;font-size:14.6px}
.pager .next{text-align:right}
.pager .none{border:0;pointer-events:none}

@media print{
  :root{--ink:#16161e;--body:#4a4a55;--page:#f2efe6;--line:rgba(22,22,30,.22)}
  *{print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .bar,.side,.toc,.pager{display:none}
  .k{color:var(--silver)}
  .c{color:var(--silver);font-style:italic}  /* on the printed dark window: 5:1 */
  body{background:#f2efe6;background-image:none}
  .frame{grid-template-columns:1fr;max-width:none}
}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation:none!important;transition-duration:.01ms!important}
}
