/* BraddCorp Tools. Self-contained: system fonts, no external requests. */
:root {
  --bg: #f7f8fb; --surface: #ffffff; --surface-2: #f0f2f8; --border: #dfe3ee; --text: #161a2b; --muted: #5a6280;
  --accent: #4f46e5; --accent-2: #0ea5a4; --accent-ink: #ffffff; --ok: #0f9d58; --err: #d93a4a; --warn: #b7791f;
  --term-bg: #0f1424; --term-bar: #1a2038; --term-text: #d6dcf2; --term-dim: #8089ab; --term-border: #262e4d;
  --tk-key: #8fb4ff; --tk-str: #8be0b5; --tk-num: #f2b880; --tk-kw: #d6a2ff; --tk-com: #7d86a8; --tk-var: #f0a0c0; --tk-flag: #9ad7e8;
  --shadow: 0 1px 2px rgba(20, 24, 50, .06), 0 8px 24px rgba(20, 24, 50, .06);
  --radius: 14px; --wrap: 1180px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0b0e1a; --surface: #12172a; --surface-2: #181e36; --border: #262e4d; --text: #e8ebf8; --muted: #98a1c4; --accent: #8b8bff; --accent-2: #2dd4bf; --accent-ink: #0b0e1a; --ok: #4ade80; --err: #ff6b7a; --warn: #f5c35c; --term-bg: #080b16; --term-bar: #11172b; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0b0e1a; --surface: #12172a; --surface-2: #181e36; --border: #262e4d; --text: #e8ebf8; --muted: #98a1c4; --accent: #8b8bff; --accent-2: #2dd4bf; --accent-ink: #0b0e1a; --ok: #4ade80; --err: #ff6b7a; --warn: #f5c35c; --term-bg: #080b16; --term-bar: #11172b; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
code { font: .88em var(--mono); background: var(--surface-2); border: 1px solid var(--border); padding: .08em .38em; border-radius: 6px; overflow-wrap: anywhere; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 0; }
h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle { margin-left: 6px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); }
.js .theme-toggle { display: grid; } 
html:not(.js) .theme-toggle { display: none; }
.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; } :root[data-theme="dark"] .ico-moon { display: inline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ico-sun { display: none; } :root:not([data-theme="light"]) .ico-moon { display: inline; } }

/* buttons, pills */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 11px; font-weight: 600; text-decoration: none; border: 1px solid transparent; font-size: .97rem; line-height: 1.2; }
.btn-sm { padding: 8px 13px; font-size: .88rem; border-radius: 9px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.pill { display: inline-block; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.pill-ghost { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.pill-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--accent); margin-bottom: 14px; }
.eyebrow a { color: inherit; text-decoration: none; }

/* hero */
.hero { padding: 64px 0 40px; background: radial-gradient(900px 340px at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%); border-bottom: 1px solid var(--border); }
.hero-home { padding: 88px 0 56px; }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 62ch; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* terminal */
.term { background: var(--term-bg); color: var(--term-text); border: 1px solid var(--term-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: 16px 0 8px; }
.term-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--term-bar); border-bottom: 1px solid var(--term-border); }
.dots { display: inline-flex; gap: 6px; } .dots i { width: 10px; height: 10px; border-radius: 50%; background: #444c6e; display: block; }
.dots i:nth-child(1) { background: #ff5f57; } .dots i:nth-child(2) { background: #febc2e; } .dots i:nth-child(3) { background: #28c840; }
.term-title { font: .78rem var(--mono); color: var(--term-dim); }
.term pre { margin: 0; padding: 12px 16px 16px; overflow-x: auto; font: .8rem/1.6 var(--mono); tab-size: 2; }
.term pre code { background: none; border: 0; padding: 0; font: inherit; overflow-wrap: normal; color: inherit; }
.step { border-top: 1px solid var(--term-border); position: relative; }
.step:first-of-type { border-top: 0; }
.step .who { margin: 12px 0 0 16px; }
.who { display: inline-block; font: 600 .72rem var(--mono); padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.who.c1 { color: #7cc4ff; } .who.c2 { color: #7be3b0; } .who.c3 { color: #ffc27a; } .who.c4 { color: #e29bff; }
.prompt { color: var(--accent-2); font-weight: 700; }
.dim { color: var(--term-dim); }
.st-ok { color: #5bdc94; font-weight: 700; } .st-err { color: #ff7f8e; font-weight: 700; }
.tk-key { color: var(--tk-key); } .tk-str { color: var(--tk-str); } .tk-num { color: var(--tk-num); } .tk-kw { color: var(--tk-kw); } .tk-com { color: var(--tk-com); font-style: italic; } .tk-var { color: var(--tk-var); } .tk-flag { color: var(--tk-flag); }
.cmdline { display: block; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 2px; }
.hero-term { margin: 0; }
.hero-lines { padding: 14px 16px 18px; font: .78rem/1.65 var(--mono); display: flex; flex-direction: column; gap: 4px; }
.hero-lines .l { display: block; white-space: pre-wrap; overflow-wrap: anywhere; opacity: 0; animation: reveal .5s ease forwards; }
.hero-lines .l:nth-child(1) { animation-delay: .2s; } .hero-lines .l:nth-child(2) { animation-delay: .9s; } .hero-lines .l:nth-child(3) { animation-delay: 1.6s; }
.hero-lines .l:nth-child(4) { animation-delay: 2.3s; } .hero-lines .l:nth-child(5) { animation-delay: 3s; } .hero-lines .l:nth-child(6) { animation-delay: 3.7s; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* sections, cards */
.section { padding: 56px 0; } .section-alt { background: var(--surface); border-top: 1px solid var(--border); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); position: relative; }
.card h3 { margin-bottom: .3em; }
.tool-card { display: flex; flex-direction: column; gap: 6px; transition: transform .15s ease, border-color .15s ease; }
.tool-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.tool-card .card-top { display: flex; gap: 8px; margin-bottom: 4px; }
.tool-card h3 { font-size: 1.35rem; font-family: var(--mono); letter-spacing: -.02em; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.tagline { color: var(--accent); font-weight: 600; margin: 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 4px 0 8px; }
.tags li { font-size: .78rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; background: var(--surface-2); }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; position: relative; z-index: 1; }
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0; }
.cols .card { box-shadow: none; padding: 18px; } .cols .card p { margin: 0; color: var(--muted); font-size: .95rem; }
.callout { border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; padding: 14px 18px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* docs layout */
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 64px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
.toc-h { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 14px; color: var(--muted); text-decoration: none; font-size: .92rem; border-left: 2px solid transparent; margin-left: -1px; }
.toc a:hover { color: var(--text); } .toc a[aria-current] { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.doc { min-width: 0; }
.doc section { padding-bottom: 48px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc section:last-child { border-bottom: 0; }
.doc h2 { padding-top: 8px; } .doc h3 { margin-top: 1.8em; }
.doc ul.checks { padding-left: 1.2em; } .doc ul.checks li { margin-bottom: .4em; }

/* features */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-top: 18px; }
.feature { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.feature h3 { font-size: 1rem; margin: 0 0 4px; } .feature p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.feature-ico { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.feature-ico .ico { width: 20px; height: 20px; }

/* tabs */
.tablist { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); margin: 18px 0 0; }
.tab { font: 600 .9rem var(--sans); padding: 10px 14px; border: 1px solid transparent; border-bottom: 0; background: none; color: var(--muted); border-radius: 10px 10px 0 0; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--accent); background: var(--surface); border-color: var(--border); }
.tabpanel { padding-top: 18px; }
.tabpanel[hidden] { display: none; }
html:not(.js) .tabpanel[hidden] { display: block; }
html:not(.js) .tablist { display: none; }
html:not(.js) .tabpanel { border-top: 1px dashed var(--border); margin-top: 18px; }
.js .panel-title { display: none; }

/* code */
.code { margin: 12px 0 18px; position: relative; }
.code figcaption { font: .75rem var(--mono); color: var(--term-dim); background: var(--term-bar); border: 1px solid var(--term-border); border-bottom: 0; border-radius: 10px 10px 0 0; padding: 6px 14px; }
.code pre { padding-right: 64px !important; margin: 0; background: var(--term-bg); color: var(--term-text); border: 1px solid var(--term-border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font: .8rem/1.6 var(--mono); }
.code figcaption + pre { border-radius: 0 0 10px 10px; }
.code pre code { background: none; border: 0; padding: 0; font: inherit; overflow-wrap: normal; color: inherit; }
.copy { position: absolute; right: 8px; top: 8px; z-index: 2; font: 600 .72rem var(--sans); color: var(--term-text); background: var(--term-bar); border: 1px solid var(--term-border); padding: 4px 10px; border-radius: 7px; cursor: pointer; opacity: .85; }
.code figcaption ~ .copy { top: 38px; }
.copy:hover { opacity: 1; }
.plain { white-space: pre-wrap; font: .88rem var(--mono); background: var(--surface-2); border: 1px solid var(--border); padding: 12px; border-radius: 10px; }

/* steps */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 20px 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 8px 54px; margin-bottom: 18px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.steps > li::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: -10px; width: 2px; background: var(--border); }
.steps > li:last-child::after { display: none; }
.steps h4 { font-size: 1.05rem; margin-top: 4px; }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr:last-child td { border-bottom: 0; } td code { white-space: nowrap; }

/* architecture */
.arch-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.arch { width: 100%; min-width: 640px; height: auto; display: block; font-family: var(--sans); }
.sv-box { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; }
.sv-worker { fill: color-mix(in srgb, var(--accent) 7%, transparent); stroke: color-mix(in srgb, var(--accent) 50%, var(--border)); stroke-width: 1.5; stroke-dasharray: 6 5; }
.sv-inner { fill: var(--surface); }
.sv-data { fill: color-mix(in srgb, var(--accent-2) 12%, var(--surface)); stroke: var(--accent-2); }
.sv-ops { stroke-dasharray: 5 4; }
.sv-title { fill: var(--text); font-size: 18px; font-weight: 700; } .sv-sm { font-size: 15px; }
.sv-sub { fill: var(--muted); font-size: 14px; } .sv-xs { font-size: 12.500px; }
.sv-cap { fill: var(--accent); font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sv-label { fill: var(--muted); font-size: 12.500px; }
.sv-step { fill: var(--accent); font-size: 15px; font-weight: 800; }
.sv-line { stroke: var(--muted); stroke-width: 2; fill: none; } .sv-dash { stroke-dasharray: 5 4; }
.sv-arrowhead { fill: var(--muted); }

/* limits, changelog */
.limits { display: grid; gap: 10px; }
.limit { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 16px; }
.limit summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style-position: outside; }
.limit[open] summary { color: var(--accent); }
.limit p { color: var(--muted); }
.changelog { border-left: 2px solid var(--border); margin: 12px 0 18px 6px; padding-left: 22px; }
.cl-day { position: relative; margin-bottom: 18px; }
.cl-day::before { content: ""; position: absolute; left: -29px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.cl-date { font: 700 .95rem var(--mono); margin-bottom: 8px; }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cl-list li { display: flex; gap: 12px; align-items: baseline; }
.sha { font: .8rem var(--mono); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px; text-decoration: none; flex: none; }

/* footer */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; }
.foot { display: grid; gap: 10px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-links a { color: var(--text); }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
  .toc ol { display: flex; flex-wrap: wrap; border: 0; gap: 4px 6px; }
  .toc a { border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; margin: 0; font-size: .85rem; }
  .toc a[aria-current] { border-color: var(--accent); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav a:not(:first-child) { display: none; } .nav a:nth-child(2) { display: none; }
  .hero { padding: 40px 0 28px; } .hero-home { padding: 56px 0 36px; }
  .steps > li { padding-left: 44px; } .steps > li::before { width: 28px; height: 28px; font-size: .85rem; }
  .steps > li::after { left: 13px; top: 32px; }
  .grid { grid-template-columns: 1fr; }
  .term pre, .code pre { font-size: .74rem; }
  .tab { padding: 8px 10px; font-size: .84rem; }
  .cl-list li { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-lines .l { animation: none; opacity: 1; }
  .tool-card { transition: none; }
}
@media print { .topbar, .toc, .copy, .theme-toggle { display: none; } .term, .code pre { border: 1px solid #999; } }
