/* Ferrite site: one stylesheet, system fonts, light and dark from prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #fffaf6;
  --surface: #ffffff;
  --surface-2: #fbf1e9;
  --border: #ead8ca;
  --text: #22140d;
  --muted: #65503f;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #fde6d4;
  --on-accent: #ffffff;
  --code-bg: #2a1a12;
  --code-text: #f8ece3;
  --shadow: 0 1px 2px rgb(60 30 10 / 6%), 0 8px 24px rgb(60 30 10 / 8%);
  --glow: radial-gradient(60rem 28rem at 70% -8rem, rgb(242 106 27 / 14%), transparent 70%);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --wrap: 72rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0907;
    --surface: #170f0b;
    --surface-2: #1f140e;
    --border: #3a2519;
    --text: #f6ebe3;
    --muted: #c4ab99;
    --accent: #ff8a3d;
    --accent-strong: #ffc46b;
    --accent-soft: #3a1d0e;
    --on-accent: #1a0c05;
    --code-bg: #0a0605;
    --code-text: #f8ece3;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
    --glow: radial-gradient(60rem 30rem at 70% -8rem, rgb(242 106 27 / 22%), transparent 70%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--glow), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font: 17px/1.6 var(--sans);
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08em 0.36em;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: auto; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a:hover { color: var(--text); }
@media (max-width: 560px) { .nav { margin-left: 0; width: 100%; gap: 2px 16px; } }

/* hero */
.hero { padding: clamp(36px, 6vw, 72px) 0 28px; }
.eyebrow { font: 600 0.8rem/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.3rem, 1.5rem + 4vw, 4.2rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 18px; }
.hero h1 .grad {
  background: linear-gradient(95deg, var(--accent-strong), var(--accent) 60%, #d1265e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); color: var(--muted); max-width: 46rem; }
.lead strong { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px;
  font-weight: 650; text-decoration: none; border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: linear-gradient(95deg, #ffb347, #f26a1b); color: #1a0c05; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); color: #1a0c05; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.tags li { font: 500 0.82rem/1 var(--mono); padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); }

.banner { margin: 34px 0 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); background: #120a07; }
.banner img { margin: 0 auto; }

.note {
  margin: 28px 0 0; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); background: var(--surface); color: var(--muted);
}
.note strong { color: var(--text); }

/* sections */
section { padding: clamp(40px, 6vw, 72px) 0 0; }
section > .wrap > p.intro { color: var(--muted); max-width: 48rem; margin-bottom: 28px; }
.kicker { font: 600 0.78rem/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

.why { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .why { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }

/* compile pipeline */
.pipeline { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 0 0 30px; padding: 0; list-style: none; }
.pipeline li {
  flex: 1 1 10rem; min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); position: relative;
}
.pipeline li b { display: block; font: 650 0.92rem/1.3 var(--mono); color: var(--text); }
.pipeline li span { display: block; font-size: 0.86rem; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.pipeline li + li::before {
  content: ""; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px; background: var(--accent);
}
@media (max-width: 640px) {
  .pipeline { flex-direction: column; }
  .pipeline li { flex-basis: auto; }
  .pipeline li + li::before { left: 22px; top: -10px; width: 2px; height: 10px; }
}

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card {
  padding: 20px 20px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0;
}
.card h3 { display: flex; align-items: baseline; gap: 10px; }
.card h3 .n { font: 700 0.78rem/1 var(--mono); color: var(--accent); }
.card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.6em; }
.card p:last-child { margin-bottom: 0; }

/* numbers */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); margin: 0 0 28px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat .v { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); line-height: 1.1; }
.stat .v small { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat .k { color: var(--muted); font-size: 0.9rem; margin-top: 6px; line-height: 1.35; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 24px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; }
th.num { text-align: right; }

.figure { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #120a07; box-shadow: var(--shadow); }
.figure img { margin: 0 auto; }
.caption { color: var(--muted); font-size: 0.9rem; margin: -12px 0 24px; }

ul.plain { padding-left: 1.2em; margin: 0 0 1em; }
ul.plain li { margin: 0.3em 0; }
.muted { color: var(--muted); }

/* quickstart */
pre {
  margin: 0 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--code-bg); color: var(--code-text);
  overflow-x: auto; line-height: 1.5; border: 1px solid var(--border); max-width: 100%;
}
pre .c { color: #c9a58c; }
.two-col { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); margin-top: 18px; }
@media (min-width: 860px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* credits */
.credits { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); margin: 0 0 22px; padding: 0; list-style: none; }
.credits li { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.credits li.first { border-color: var(--accent); background: linear-gradient(var(--surface), var(--surface)) padding-box; box-shadow: var(--shadow); }
.credits b { display: block; margin-bottom: 4px; }
.credits span { color: var(--muted); font-size: 0.93rem; }

.site-footer { margin-top: clamp(48px, 7vw, 88px); border-top: 1px solid var(--border); padding: 26px 0 40px; color: var(--muted); font-size: 0.92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-left: auto; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.note + p { margin-top: 18px; }
