/* Purifai — the page is set as a reading document on purpose.
   The product recovers readable text from hostile input, so the site
   demonstrates readable text rather than asserting it. */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('/fonts/source-serif-4-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fbf9f5;
  --ink: #21201c;
  --muted: #6b6862;
  --rule: #e2ddd3;
  --slab: #f3efe7;
  --accent: #9a3b1e;
  --out: #1f5c3d;

  --serif: 'Source Serif 4', ui-serif, Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161513;
    --ink: #e9e5dd;
    --muted: #9d988e;
    --rule: #2e2c28;
    --slab: #1e1d1a;
    --accent: #e08e6b;
    --out: #7cc39a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: clamp(1.5rem, 4vw, 3rem) 1.5rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.1875rem);
  line-height: 1.65;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
}

/* ---- sticky bar ----
   The bar is --bar tall; every anchor target carries a matching
   scroll-margin-top so `#install` doesn't land underneath it. */

:root {
  --bar: 3.25rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  margin: calc(-1 * clamp(1.5rem, 4vw, 3rem)) -1.5rem 2.5rem;
  /* Masthead rule, not a SaaS hairline: `double` renders two lines from one
     declaration, the newspaper device this page's register calls for. */
  border-bottom: 3px double var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
}

@supports not (backdrop-filter: blur(1px)) {
  .topbar {
    background: var(--paper);
  }
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex: none;
}

/* Small-caps serif, not mono — the mono-link row is the SaaS-nav tell, and
   this page's voice is editorial. */
.topbar nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-family: var(--serif);
  font-size: 0.9375rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar nav::-webkit-scrollbar {
  display: none;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.topbar nav a:hover {
  color: var(--ink);
}

:target,
h2[id] {
  scroll-margin-top: calc(var(--bar) + 1rem);
}

/* ---- masthead ---- */

.masthead {
  margin-bottom: 3.5rem;
}

h1 {
  font-size: clamp(2.75rem, 2rem + 3vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 0.75rem;
}

.lede {
  font-size: 1.35em;
  line-height: 1.35;
  font-weight: 400;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.sub {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta span + span {
  position: relative;
}

.meta span + span::before {
  content: '·';
  position: absolute;
  left: -0.75rem;
}

/* ---- structure ---- */

section {
  margin-bottom: 3.25rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0 0 0.9rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
}

em {
  font-style: italic;
}

strong {
  font-weight: 600;
}

.note {
  font-size: 0.9375em;
  color: var(--muted);
  margin-bottom: 0;
}

/* ---- code ---- */

pre,
code {
  font-family: var(--mono);
  font-variant-numeric: lining-nums tabular-nums;
}

code {
  font-size: 0.855em;
  background: var(--slab);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--slab);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

pre .k {
  color: var(--accent);
}
pre .s {
  color: var(--out);
}
pre .c {
  color: var(--muted);
  font-style: italic;
}

/* ---- before / after ---- */

.compare {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 44rem) {
  .compare {
    grid-template-columns: 1fr 1fr;
  }
}

.compare pre {
  margin: 0;
  height: 100%;
}

.compare .out {
  border-color: color-mix(in srgb, var(--out) 40%, var(--rule));
}

.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

/* ---- the safety callout ----
   Bracketed by rules rather than carrying a left stripe: the thick
   asymmetric edge-border is a recognisable templated-card device, and this
   section is an editorial aside, not a card. */

.callout {
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  padding: 0 0 1.5rem;
}

.callout h2 {
  border-top: none;
  padding-top: 1.5rem;
  color: var(--accent);
}

/* ---- table ---- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.9375em;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- api list ---- */

dl {
  margin: 0;
}

dt {
  margin-bottom: 0.3rem;
}

dt code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

dd {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.9375em;
}

/* ---- links & footer ---- */

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-color: currentColor;
}

footer {
  border-top: 1px solid var(--rule);
  padding-top: 1.75rem;
  color: var(--muted);
  font-size: 0.875em;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
