/* =============================================================================
   FastSaverAPI "Graphite" — monochrome, editorial, calm.
   Ink is the accent; there is no brand hue. The dark theme follows the OS,
   so the whole site needs zero JavaScript.
   ========================================================================== */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2-variations');
  font-weight: 100 800;
  font-display: swap;
  font-style: normal;
}

:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --text: #14151a;
  --muted: #5c5e66;
  --border: #e6e7ea;
  --accent: #14151a;
  --accent-hover: #000000;
  --on-accent: #ffffff;
  --success: #12a150;

  --code-key: #2563eb;
  --code-str: #15803d;
  --code-lit: #9333ea;
  --code-num: #c2410c;

  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(22, 24, 29, 0.06);
  --shadow: 0 6px 24px -8px rgba(22, 24, 29, 0.14);

  --wide: 1080px;
  --read: 720px;
  --pad: 1.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0c;
    --surface: #151518;
    --surface-2: #202024;
    --text: #f5f5f6;
    --muted: #a2a2ab;
    --border: #2a2a2f;
    --accent: #f5f5f6;
    --accent-hover: #ffffff;
    --on-accent: #0a0a0c;
    --success: #4ade80;

    --code-key: #7cc4ff;
    --code-str: #84e39b;
    --code-lit: #d8b4fe;
    --code-num: #fdba74;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 28px -8px rgba(0, 0, 0, 0.55);
  }
}

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}
p, ul, ol { margin: 0 0 1rem; }
code, pre { font-family: var(--font-mono); }
a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--text) 30%, transparent);
  transition: text-decoration-color 120ms var(--ease);
}
a:hover { text-decoration-color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 0.6rem 1rem; border-radius: 0 0 var(--radius) 0; text-decoration: none;
}
.skip:focus { left: 0; }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.mono-label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted);
}

/* ---- Domain-change bar ---------------------------------------------------- */
.moved-bar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}
.moved-bar p {
  margin: 0 auto;
  max-width: var(--wide);
  padding: 0.55rem var(--pad);
  text-align: center;
  color: var(--muted);
}
.moved-bar strong { color: var(--text); font-weight: 600; }
.moved-bar code { font-size: 0.94em; }

/* ---- Header --------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--wide); margin-inline: auto;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.7rem var(--pad);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.brand .mark { width: 20px; height: 20px; color: var(--accent); }
.brand .word {
  font-family: var(--font-display); font-weight: 700; font-size: 1.08rem;
  letter-spacing: -0.02em; color: var(--text);
}
.nav-links { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: 0.9rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.2rem;
}
.nav-links a:hover { color: var(--text); }
.nav-links .ext { font-size: 0.75em; opacity: 0.7; }
.nav-cta { flex-shrink: 0; }

@media (max-width: 780px) {
  .nav-inner { flex-wrap: wrap; row-gap: 0.5rem; }
  .nav-links { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; gap: 0.9rem; }
  .nav-cta { margin-left: auto; }
}

/* ---- Layout --------------------------------------------------------------- */
main { display: block; }
.crumbs { max-width: var(--wide); margin: 1.25rem auto 0; padding-inline: var(--pad); }
.crumbs ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
}
.crumbs li + li::before { content: '/'; margin-right: 0.4rem; opacity: 0.5; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

.page { max-width: var(--wide); margin-inline: auto; padding: 2.5rem var(--pad) 4rem; }
.page-head { max-width: var(--read); margin-bottom: 2.5rem; }
.page-head h1 { font-size: clamp(2rem, 5.2vw, 3rem); }
.lede { font-size: 1.15rem; color: var(--muted); margin: 1rem 0 0; max-width: 62ch; }
.meta { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); margin: 1rem 0 0; }

.page > section { margin-top: 3.5rem; }
.page > section > h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin-bottom: 1rem; }
.page > section > h2 + p, .page > section > .kicker + h2 + p { margin-top: 0; }
.page section p, .page section ul, .page section ol { max-width: var(--read); }
.page h3 { font-size: 1.15rem; margin: 2rem 0 0.6rem; }
.page section > p:first-of-type { color: var(--text); }

.bullets { padding-left: 1.15rem; }
.bullets li { margin-bottom: 0.5rem; }
.bullets li::marker { color: var(--muted); }

/* Hero: only the home page uses it. */
.hero { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.05fr 1fr; gap: 3rem; } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.6rem; }
.hero-note { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-top: 1.1rem; }
.hero-note b { color: var(--text); font-weight: 600; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem;
  padding: 0.7rem 1.15rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

/* ---- Cards ---------------------------------------------------------------- */
.grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.35rem; box-shadow: var(--shadow-sm);
  position: relative;
  /* Flex column purely so the kicker can be lifted above the heading. It sits
     after the <h3> in the DOM so that plain-text and Markdown renderings keep
     it inside its own card instead of trailing the previous one. */
  display: flex; flex-direction: column;
}
.card h3 { font-size: 1.03rem; margin: 0 0 0.45rem; }
.card p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.card .kicker { order: -1; margin-bottom: 0.5rem; }
.card-link { text-decoration: none; padding-right: 2.4rem; transition: border-color 120ms var(--ease); }
.card-link:hover { border-color: color-mix(in srgb, var(--border) 35%, var(--text)); }
.card-go { position: absolute; right: 1.2rem; top: 1.3rem; color: var(--muted); }
.card-link:hover .card-go { color: var(--text); }

/* ---- Facts strip ---------------------------------------------------------- */
.facts {
  display: grid; gap: 0; margin: 1.5rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
}
.facts > div { padding: 1rem 1.15rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
/* Caption directly under a facts strip — quieter than body copy. */
.after-facts { margin-top: 0.9rem; font-size: 0.92rem; color: var(--muted); max-width: var(--read); }
.facts dt {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem;
}
.facts dd { margin: 0; font-weight: 600; font-size: 0.98rem; overflow-wrap: anywhere; }
.facts dd code { font-size: 0.82em; background: none; border: 0; padding: 0; }
.after-facts { margin-top: 1.25rem; }

/* ---- Code ----------------------------------------------------------------- */
.code {
  margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.code-head { padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.code pre { margin: 0; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.83rem; line-height: 1.65; }
.code code { color: var(--text); }
.t-key { color: var(--code-key); }
.t-str { color: var(--code-str); }
.t-lit { color: var(--code-lit); }
.t-num { color: var(--code-num); }
.t-p { color: var(--muted); }

p code, li code, td code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0.08em 0.34em; border-radius: 6px; font-size: 0.86em;
}

/* ---- API call block ------------------------------------------------------- */
.call {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; margin-top: 1.5rem;
}
.call-head {
  display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.call-path { font-size: 0.88rem; font-weight: 500; }
.call-note { margin-left: auto; }
.call-body { padding: 0.4rem 1rem 1rem; }
.call-body .code { margin: 1rem 0 0; }
.method {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.16rem 0.5rem; border-radius: var(--radius-sm);
  color: var(--code-str); background: color-mix(in srgb, var(--code-str) 15%, transparent);
}
.method-post { color: var(--code-key); background: color-mix(in srgb, var(--code-key) 15%, transparent); }

/* ---- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; background: var(--surface); }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--surface-2);
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ---- FAQ (details/summary, no JS) ----------------------------------------- */
.faq { margin-top: 1.5rem; max-width: var(--read); }
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 0.6rem;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 0.9rem 1.1rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; margin-left: auto; color: var(--muted);
  font-family: var(--font-mono); font-size: 1.1rem; line-height: 1;
}
.faq details[open] summary::after { content: '–'; }
.faq summary h3 { font-size: 0.98rem; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; margin: 0; }
.faq-a { padding: 0 1.1rem 1rem; color: var(--muted); font-size: 0.94rem; }
.faq-a p:last-child { margin-bottom: 0; }

/* ---- CTA ------------------------------------------------------------------ */
.cta {
  margin-top: 4rem; text-align: center; padding: 2.75rem 1.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
.cta h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); }
.cta p { color: var(--muted); max-width: 52ch; margin: 0.9rem auto 0; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; margin-top: 1.6rem; }

/* ---- Related -------------------------------------------------------------- */
.related { margin-top: 3.5rem; }
.related h2 { font-size: 1.15rem; margin-bottom: 0.9rem; }
.related ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); max-width: none; }
.related li {
  display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap;
  padding: 0.7rem 0; border-bottom: 1px solid var(--border);
}
.related li a { font-weight: 600; text-decoration: none; }
.related li a:hover { text-decoration: underline; }
.related li span { color: var(--muted); font-size: 0.88rem; }

/* ---- Footer --------------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); margin-top: 2rem; padding: 2.5rem var(--pad) 2rem; }
.footer-inner {
  max-width: var(--wide); margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between;
}
.footer-brand { max-width: 34ch; }
.footer-brand p { color: var(--muted); font-size: 0.88rem; margin: 0.7rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; align-content: flex-start; }
.footer-links a { color: var(--muted); font-size: 0.88rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.legal {
  max-width: var(--wide); margin: 2rem auto 0; padding-top: 1.25rem;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 0.76rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
