/* QuietForge API. Dark theme; the tokens block is shared (copied) with QuietForge 3D and the Portal. */
:root {
  color-scheme: dark;
  --bg: #0b0d12; --bg-2: #0f1219; --surface: #141821; --surface-2: #1a1f2b; --surface-3: #222836;
  --line: #252c3a; --line-2: #343d4f;
  --ink: #eef1f6; --ink-2: #c9cfda; --muted: #9ba4b4;
  --accent: #ff8a2a; --accent-hi: #ffb347; --accent-lo: #ff5f1f;
  --grad: linear-gradient(135deg, #ffc061 0%, #ff8a2a 48%, #ff5a1f 100%);
  --cool: #5fd6f5; --cool-2: #8b9dff; --ok: #34d6b0; --warn: #ffc061; --bad: #ff7b7b;
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -20px rgba(0,0,0,.7);
  --glow: 0 0 0 1px rgba(255,138,42,.35), 0 10px 40px -10px rgba(255,110,30,.45);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.6 var(--sans); color: var(--ink-2); background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 78% -8%, rgba(255,122,26,.13), transparent 62%),
    radial-gradient(900px 480px at -12% 6%, rgba(95,214,245,.07), transparent 60%);
  background-repeat: no-repeat; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 4.5vw, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 750; margin-top: 2.2em; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--cool); text-decoration: none; transition: color .15s; }
a:hover { color: #9be6fa; text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--ink); }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line);
       border-radius: 6px; padding: .08em .4em; color: #ffd29a; overflow-wrap: anywhere; }
::selection { background: rgba(255,138,42,.35); color: #fff; }
:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; border-radius: 6px; }

/* Header */
.bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: .5rem 1rem;
       justify-content: space-between; align-items: center; padding: .7rem max(1.25rem, calc((100% - 69.5rem) / 2));
       background: rgba(11,13,18,.72); backdrop-filter: saturate(160%) blur(14px);
       -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 750;
         font-size: 1.12rem; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; filter: drop-shadow(0 4px 12px rgba(255,110,30,.35)); }
.brand .sub { font-size: .68rem; font-weight: 800; letter-spacing: .08em; padding: .18rem .45rem; border-radius: 999px;
              color: #1b0e04; background: var(--grad); }
nav { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; font-size: .95rem; }
nav a, nav button.link { color: var(--ink-2); }
nav a:hover, nav button.link:hover { color: var(--ink); text-decoration: none; }
nav .pill { padding: .28rem .7rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); }
nav .pill strong { font-variant-numeric: tabular-nums; }

/* Layout */
main { width: 100%; max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; flex: 1; }
.narrow { max-width: 46rem; }
section { scroll-margin-top: 5rem; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding: 1.6rem 1.25rem 2rem;
         text-align: center; background: rgba(11,13,18,.6); }
footer a { color: var(--ink-2); }
footer .foot-brand { display: flex; justify-content: center; align-items: center; gap: .4rem; color: var(--ink);
                     font-weight: 700; margin-bottom: .5rem; }
footer .foot-brand svg { width: 18px; height: 18px; }

/* Buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 650; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  padding: .7rem 1.25rem; border-radius: 999px; border: 1px solid transparent; color: #1b0e04;
  background: var(--grad); box-shadow: 0 8px 24px -10px rgba(255,110,30,.7), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .18s, background-color .18s; }
button:hover, .button:hover { color: #1b0e04; text-decoration: none; transform: translateY(-1px); filter: brightness(1.06);
  box-shadow: 0 14px 34px -12px rgba(255,110,30,.85), inset 0 1px 0 rgba(255,255,255,.4); }
button:active, .button:active { transform: translateY(0); }
.button.ghost { color: var(--ink); background: rgba(255,255,255,.03); border-color: var(--line-2); box-shadow: none; }
.button.ghost:hover { color: var(--ink); border-color: var(--cool); background: rgba(95,214,245,.08); filter: none; }
.button.small, nav .button { padding: .42rem .95rem; font-size: .9rem; }
button.link { background: none; border: 0; padding: 0; box-shadow: none; color: var(--cool); font-weight: inherit; }
button.link:hover { transform: none; filter: none; box-shadow: none; text-decoration: underline; }
button:disabled, button:disabled:hover { cursor: not-allowed; transform: none; filter: grayscale(.85) brightness(.7);
  box-shadow: none; opacity: .6; }
form.inline { display: inline; }

/* Forms */
.stack { display: grid; gap: 1rem; max-width: 30rem; }
label { color: var(--ink-2); font-size: .95rem; }
.stack label:not(.check):not(.tier) { display: grid; gap: .4rem; }
input, textarea, select { font: inherit; color: var(--ink); }
.stack input:not([type=checkbox]):not([type=radio]), .stack textarea {
  width: 100%; padding: .7rem .85rem; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s, background-color .15s; }
.stack input:hover, .stack textarea:hover { border-color: #48536a; }
.stack input:focus, .stack textarea:focus { outline: none; border-color: var(--cool); background: #0d1118;
  box-shadow: 0 0 0 4px rgba(95,214,245,.16); }
input[type=file] { padding: .55rem !important; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; color: var(--ink); background: var(--surface-3);
  border: 1px solid var(--line-2); border-radius: 999px; padding: .4rem .9rem; margin-right: .8rem; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; margin: 0; flex: none; }
.check { display: flex !important; gap: .6rem; align-items: center; }
.stack button { justify-self: start; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { color: var(--ink); font-weight: 650; margin-bottom: .55rem; padding: 0; }

/* Notices */
.notice, .error { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-sm);
  border: 1px solid rgba(52,214,176,.35); background: rgba(52,214,176,.08); color: #c9f5ea; margin: 0 0 1.2rem; }
.notice::before, .error::before { content: ""; flex: none; width: .5rem; height: .5rem; margin-top: .55rem; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 10px currentColor; }
.notice.intake, .notice.payments { border-color: rgba(255,192,97,.4); background: rgba(255,192,97,.08); color: #ffe0ad; }
.error { border-color: rgba(255,123,123,.4); background: rgba(255,123,123,.08); color: #ffd0d0; }
.notice p { margin: 0; }

/* Cards, tables */
.card { background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 40%), var(--surface);
        border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
     font-weight: 650; background: var(--surface-2); }
th, td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,.015); }
tbody tr:hover td { background: rgba(255,255,255,.035); }
td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
tr.blocked { color: var(--muted); }
.small, small { color: var(--muted); font-size: .88rem; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .8rem;
         font-weight: 650; color: var(--ink-2); background: rgba(255,255,255,.04); border: 1px solid var(--line-2); }
.badge .dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.eyebrow { color: var(--accent-hi); font-size: .78rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Hero */
.hero { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center;
        padding: 3.5rem 0 3rem; }
.hero::before { content: ""; position: absolute; inset: -3rem 0 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(60% 70% at 50% 30%, #000, transparent 75%);
  mask-image: radial-gradient(60% 70% at 50% 30%, #000, transparent 75%); }
.hero h1 { font-size: clamp(2.5rem, 5.6vw, 4.1rem); line-height: 1.02; letter-spacing: -.04em; margin: .9rem 0 1.1rem; }

.hero h1 .grad-text { white-space: nowrap; }
.hero .lede { font-size: clamp(1.05rem, 1.8vw, 1.22rem); color: var(--ink-2); max-width: 34rem; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }
.cta .button { padding: .85rem 1.5rem; font-size: 1.02rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1.6rem; color: var(--muted); font-size: .9rem; }
.hero-meta span::before { content: "✓"; color: var(--ok); margin-right: .4rem; font-weight: 800; }

/* Sections */
.section-head { max-width: 40rem; margin: 4.5rem 0 1.6rem; }
.section-head h2 { margin: .4rem 0 .5rem; font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
.section-head p { color: var(--muted); margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.step { position: relative; padding: 1.5rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
        transition: border-color .2s, transform .2s var(--ease); }
.step:hover { border-color: var(--line-2); transform: translateY(-2px); }
.step .ico { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 12px; margin-bottom: 1rem;
             background: rgba(255,138,42,.1); border: 1px solid rgba(255,138,42,.3); color: var(--accent-hi); }
.step .ico svg { width: 1.4rem; height: 1.4rem; }
.step .num { position: absolute; top: 1.2rem; right: 1.3rem; font: 700 .8rem var(--mono); color: var(--muted); }
.step h3 { margin-bottom: .35rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Auth */
.auth { max-width: 27rem; margin: 2.5rem auto; }
.auth .card { padding: 2rem; }
.auth h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.auth .sub { color: var(--muted); margin-bottom: 1.5rem; }
.auth .stack { max-width: none; }
.auth .stack button { justify-self: stretch; }
.auth .alt { text-align: center; margin: 1.2rem 0 0; color: var(--muted); }

/* Account */
.balance-card { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.balance-card .label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 650; }
.balance-card .amount { font-size: clamp(2.4rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.balance-card .amount strong { color: inherit; }
.packs { display: flex; gap: .6rem; flex-wrap: wrap; margin: .2rem 0 .8rem; }
.packs button { min-width: 6.5rem; font-variant-numeric: tabular-nums; }

/* Prose (terms) */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.25rem; margin-top: 2em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--accent); }

/* API hero code card */
.hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.3rem); hyphens: manual; }
.hero h1 .grad-text { white-space: normal; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.feature { padding: 1.4rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.feature h3 { margin: .7rem 0 .3rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.feature .tag { font: 700 .72rem var(--mono); letter-spacing: .06em; color: var(--cool); text-transform: uppercase; }

/* Code */
.code { position: relative; margin: 1rem 0 1.4rem; border-radius: var(--r); border: 1px solid var(--line-2); overflow: hidden;
        background: #0a0c11; box-shadow: var(--shadow); }
.code-head { display: flex; align-items: center; gap: .4rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line);
             background: var(--surface); font: 600 .75rem var(--mono); color: var(--muted); letter-spacing: .04em; }
.code-head i { width: .55rem; height: .55rem; border-radius: 50%; background: #ff6b5e; opacity: .8; }
.code-head i + i { background: #ffc061; }
.code-head i + i + i { background: #34d6b0; margin-right: .5rem; }
pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; font: .86rem/1.7 var(--mono); color: #d6dce8; tab-size: 4; }
pre .k { color: #c59bff; } pre .s { color: #ffc27a; } pre .f { color: var(--cool); } pre .c { color: #7d8799; font-style: italic; }
pre .n { color: #8fe3c6; }
.hero .code { margin: 0; border-radius: var(--r-lg); box-shadow: var(--shadow), 0 40px 120px -40px rgba(255,110,30,.45); }
.hero .code pre { font-size: .82rem; padding: 1.2rem 1.3rem; }

/* Docs */
.docs { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 3rem; margin-top: 3rem; align-items: start; }
.toc { position: sticky; top: 5.5rem; display: grid; gap: .15rem; font-size: .92rem; }
.toc b { color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .5rem; }
.toc a { color: var(--ink-2); padding: .35rem .7rem; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--ink); border-left-color: var(--accent); text-decoration: none; background: rgba(255,255,255,.02); }
.doc-body { max-width: 50rem; }
.doc-body > section:first-child h2 { margin-top: 0; }
.doc-body h2 { padding-top: .2rem; }
.endpoints { display: grid; gap: .7rem; }
.ep { padding: 1rem 1.1rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.ep-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; margin-bottom: .4rem; }
.ep-line code { background: none; border: 0; padding: 0; color: var(--ink); font-size: .92rem; font-weight: 600; }
.ep p { margin: 0; font-size: .95rem; }
.method { font: 800 .7rem var(--mono); letter-spacing: .06em; padding: .22rem .5rem; border-radius: 6px; }
.method.post { color: #1b0e04; background: var(--grad); }
.method.get { color: #04211b; background: var(--ok); }
.callout { padding: .9rem 1.1rem; border-radius: var(--r-sm); border: 1px solid rgba(95,214,245,.3); border-left-width: 3px;
           background: rgba(95,214,245,.06); font-size: .95rem; }
.price-pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-weight: 750; color: #1b0e04;
              background: var(--grad); font-variant-numeric: tabular-nums; margin-right: .3rem; }
td code { white-space: nowrap; }
.newkey { border-color: rgba(255,192,97,.45); background: rgba(255,192,97,.06); color: var(--ink-2); display: block; }
.newkey::before { display: none; }
.newkey p { margin: 0 0 .6rem; }
.newkey code { display: inline-block; margin-top: .2rem; font-size: .9rem; color: var(--ink); word-break: break-all; }
.state { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 650;
         border: 1px solid var(--line-2); color: var(--muted); }
.state.on { color: var(--ok); border-color: rgba(52,214,176,.4); background: rgba(52,214,176,.08); }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2.2rem; padding-top: 2rem; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: .4rem; }
  .toc b { width: 100%; margin: 0; }
  .toc a { border: 1px solid var(--line-2); border-radius: 999px; padding: .25rem .75rem; }
  .features { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  main { padding: 1.4rem 1rem 2.5rem; }
  .bar { padding: .6rem 1rem; }
  nav { gap: .3rem .75rem; font-size: .9rem; }
  .card { padding: 1.15rem; }
  .cta .button { flex: 1 1 auto; }
  th, td { padding: .6rem .7rem; }
  .section-head { margin-top: 3.2rem; }
  .auth { margin-top: 1rem; }
  pre { font-size: .8rem; }
  .hero h1 { font-size: 1.95rem; }
  td code { white-space: normal; word-break: break-all; }
  .price-pill { display: table; margin: 0 0 .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
