/* siftp.org: one stylesheet, system fonts, no JavaScript. */
:root {
  --bg: #ffffff;
  --bg-2: #f5f8f7;
  --surface: #fbfcfc;
  --fg: #111418;
  --muted: #59606b;
  --faint: #868d97;
  --line: #e3e7ea;
  --code-bg: #f3f5f6;
  --accent: #0b8462;
  --accent-soft: #e6f3ee;
  /* Chart marks (validated: lightness band, CVD, 3:1 on --surface) */
  --bar: #0b8462;
  --bar-ctx: #8b929c;
  --header-bg: rgba(255, 255, 255, 0.82);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e11;
    --bg-2: #0e1216;
    --surface: #12161b;
    --fg: #e6e9ec;
    --muted: #a0a8b3;
    --faint: #6f7782;
    --line: #222830;
    --code-bg: #141920;
    --accent: #4fd1a1;
    --accent-soft: #10241c;
    --bar: #19aa70;
    --bar-ctx: #5f6873;
    --header-bg: rgba(11, 14, 17, 0.8);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--fg); color: var(--bg); padding: 6px 10px; border-radius: 4px;
}
.skip:focus { left: 8px; z-index: 10; }

/* Top bar and footer */
.bar {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .bar { height: 56px; }
.mark {
  font: 700 20px/1 var(--mono);
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.mark::before { content: "▸"; color: var(--accent); margin-right: 6px; font-size: 0.8em; }
.primary { display: flex; gap: 22px; font-size: 15px; }
.primary a { color: var(--muted); text-decoration: none; }
.primary a:hover { color: var(--fg); }
.foot { border-top: 1px solid var(--line); margin-top: 64px; }
.foot .bar {
  min-height: 64px; padding-top: 12px; padding-bottom: 12px;
  font-size: 14px; color: var(--faint); flex-wrap: wrap;
}
.foot a { color: var(--muted); }

.banner {
  max-width: 76rem; margin: 16px auto 0; padding: 10px 14px;
  background: var(--accent-soft); border-radius: 6px; font-size: 15px;
}

/* Layout */
.content { min-width: 0; }
.content.wide { max-width: 50rem; margin: 0 auto; padding: 40px 24px 0; }
.doc {
  max-width: 76rem;
  margin: 0 auto;
  padding: 32px 24px 0;
  display: grid;
  grid-template-columns: 15rem minmax(0, 46rem);
  gap: 56px;
}
.side { position: sticky; top: 80px; align-self: start; font-size: 14.5px; }
.side-h {
  margin: 0 0 6px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint);
}
.side ul { list-style: none; margin: 0 0 22px; padding: 0; }
.side li { margin: 0; }
.side a {
  display: block; padding: 3px 0 3px 12px; margin-left: -12px;
  color: var(--muted); text-decoration: none; border-left: 2px solid transparent;
}
.side a:hover { color: var(--fg); }
.side a[aria-current="page"] { color: var(--fg); font-weight: 600; border-left-color: var(--accent); }
.side .toc { margin: 2px 0 8px; }
.side .toc a { padding-left: 24px; font-size: 13.5px; }

/* Type */
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: 2.1rem; margin: 0 0 18px; }
h2 { font-size: 1.35rem; margin: 44px 0 12px; padding-top: 4px; }
h3 { font-size: 1.08rem; margin: 30px 0 8px; }
h2 .anchor, h3 .anchor { color: inherit; text-decoration: none; }
h2 .anchor:hover::after, h3 .anchor:hover::after { content: " #"; color: var(--faint); }
p, ul, ol { margin: 0 0 16px; }
li { margin-bottom: 4px; }
li > ul, li > ol { margin: 4px 0 0; }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
blockquote {
  margin: 0 0 16px; padding: 10px 16px;
  border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--fg);
}
blockquote p { margin: 0; }

/* Code */
code {
  font: 0.87em/1 var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.12em 0.32em;
}
pre {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
pre code {
  font-size: 13.5px; line-height: 1.6;
  background: none; border: 0; padding: 0;
}

/* Tables */
.table { overflow-x: auto; margin: 0 0 22px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td {
  text-align: left; vertical-align: top;
  padding: 7px 14px 7px 0; border-bottom: 1px solid var(--line);
}
th { font-weight: 600; color: var(--muted); font-size: 13.5px; border-bottom-color: var(--fg); }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
td code, th code { white-space: nowrap; }

/* Home: the hero is dark in both color schemes */
.home .top {
  --header-bg: rgba(6, 9, 11, 0.78);
  border-bottom-color: rgba(255, 255, 255, 0.07);
}
.home .top .mark { color: #eef3f1; }
.home .top .mark::before { color: #4fd1a1; }
.home .top .primary a { color: #a7b0ba; }
.home .top .primary a:hover { color: #ffffff; }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 24px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #e6ebef;
  background:
    radial-gradient(58rem 30rem at 12% -12%, rgba(25, 170, 112, 0.30), transparent 62%),
    radial-gradient(44rem 26rem at 95% 0%, rgba(56, 189, 248, 0.14), transparent 60%),
    #06090b;
  padding: 88px 0 56px;
  margin-top: -57px;            /* sit under the translucent header */
  padding-top: calc(88px + 57px);
}
.hero::before {                 /* faint grid, fading out toward the edges */
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 80%);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 48px;
  align-items: center;
}
.wordmark {
  font: 800 clamp(3.4rem, 9vw, 6.2rem)/0.95 var(--mono);
  letter-spacing: -0.05em;
  margin: 0 0 20px;
  background: linear-gradient(100deg, #f2fff9 10%, #4fd1a1 55%, #38bdf8 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { font-size: 1.22rem; line-height: 1.55; color: #b8c2cc; max-width: 34rem; margin-bottom: 28px; }
.lead code { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); color: #e6ebef; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.btn {
  display: inline-flex; align-items: center;
  padding: 11px 18px; border-radius: 10px;
  font-weight: 600; font-size: 15px; text-decoration: none;
  color: #e6ebef; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.28); }
.btn.primary { background: #4fd1a1; border-color: #4fd1a1; color: #03150e; }
.btn.primary:hover { background: #6fe0b6; border-color: #6fe0b6; }
.built-by { display: flex; align-items: center; gap: 10px; margin: 26px 0 0; font-size: 13px; color: #8d97a3; }
.built-by a { display: inline-flex; opacity: 0.85; transition: opacity 0.15s; }
.built-by a:hover { opacity: 1; }
.built-by img { display: block; height: 16px; width: auto; }

.term {
  border-radius: 14px;
  background: rgba(12, 16, 20, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(79, 209, 161, 0.06);
  overflow: hidden;
}
.term-bar { display: flex; gap: 7px; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.term pre { margin: 0; background: none; border: 0; border-radius: 0; padding: 18px 20px 20px; }
.term pre code { color: #e6ebef; font-size: 13.5px; line-height: 1.85; }
.term .p { color: #4fd1a1; user-select: none; }
.term .c { color: #6f7b88; }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
}
.tile {
  padding: 18px 20px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.tile p { margin: 0; }
.tile-label { font-size: 13.5px; color: #98a3ae; }
.tile-value { font-size: 2.5rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; color: #ffffff; margin: 6px 0 4px !important; }
.tile-unit { font-size: 0.95rem; font-weight: 500; letter-spacing: 0; color: #98a3ae; }
.tile-note { font-size: 13.5px; color: #4fd1a1; }

.home-sec { padding: 72px 0 32px; }
.home-sec.alt { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-bottom: 56px; }
.home-sec h2 { font-size: 2rem; letter-spacing: -0.03em; margin: 0 0 14px; }
.home-sec > .wrap > p { max-width: 46rem; color: var(--muted); }
.home-sec pre { max-width: 52rem; }
.home-sec pre code, .term pre code { white-space: pre-wrap; overflow-wrap: anywhere; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}
.card {
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card h3 { margin: 0 0 8px; font: 650 15px/1.3 var(--mono); color: var(--accent); letter-spacing: 0; }
.card p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }

/* Bar charts: one metric each, siftp emphasised, the others gray */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: 14px;
  margin: 26px 0 18px;
}
.chart {
  margin: 0;
  padding: 18px 20px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.chart figcaption { margin-bottom: 10px; }
.chart-title { display: block; font-weight: 600; font-size: 15px; }
.chart-unit { display: block; font-size: 13px; color: var(--faint); }
.brow {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 26px;
}
.brow + .brow { margin-top: 4px; }
.bar-name { font-size: 13.5px; color: var(--muted); }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-fill {
  flex: none;
  height: 16px;
  width: calc((100% - 4.5rem) * var(--f));
  min-width: 2px;
  background: var(--bar-ctx);
  border-radius: 0 4px 4px 0;
}
.bar-val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-siftp .bar-name, .is-siftp .bar-val { color: var(--fg); font-weight: 600; }
.is-siftp .bar-fill { background: var(--bar); }

.table-view { margin: 0 0 18px; }
.table-view summary { cursor: pointer; color: var(--accent); font-size: 14.5px; margin-bottom: 10px; }
.table-view .table { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; }

/* Small screens */
@media (max-width: 960px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 16px; }
  .side { position: static; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .side ul { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-bottom: 12px; }
  .side a { padding: 2px 0; margin: 0; border: 0; }
  .side a[aria-current="page"] { color: var(--accent); }
  .side .toc { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .bar, .doc, .content.wide, .wrap { padding-left: 16px; padding-right: 16px; }
  .primary { gap: 14px; font-size: 14px; }
  h1 { font-size: 1.7rem; }
  .hero { padding-bottom: 40px; padding-top: calc(56px + 57px); }
  .tiles { gap: 10px; margin-top: 40px; }
  .tile { padding: 14px 14px 12px; }
  .tile-value { font-size: 1.9rem; }
  .term pre code { font-size: 12.5px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .home-sec { padding-top: 52px; }
  .home-sec h2 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
