/* a2p2 site. Hand-written, no build step. Palette and type: brand/brand.md. */
:root {
  --bg: #FAFAF7;
  --surface: #F0EFE9;
  --code-bg: #EDEBE3;
  --ink: #16191C;
  --muted: #4F575E;
  --rule: #D8D6CC;
  --border: #8A9096;
  --accent: #0A6B4D;
  --accent-ink: #FAFAF7;
  --signal: #8A5300;
  --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;
  --measure: 44rem;
  --wide: 70rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1113;
    --surface: #161B1E;
    --code-bg: #1B2125;
    --ink: #E4E7E5;
    --muted: #A3ACB2;
    --rule: #283035;
    --border: #5E676E;
    --accent: #56D3A0;
    --accent-ink: #0E1113;
    --signal: #F0B24A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--bg); padding: 0.5rem 0.75rem; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 40rem) { .wrap { padding: 0 2rem; } }
.prose { max-width: var(--measure); }

/* header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; }
.brand svg { display: block; }
.brand .wordmark { width: 64px; color: var(--ink); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

/* type */
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5.5vw, 3.25rem); margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin: 0 0 1rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol, dl, table, pre, figure { margin: 0 0 1rem; }
.kicker { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); margin: 0 0 0.5rem; letter-spacing: 0.02em; }
.lede { font-size: 1.2rem; color: var(--ink); max-width: 40rem; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }

/* sections */
section { padding: 3.5rem 0; border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }
.hero { padding: 3.5rem 0 2.5rem; }
@media (min-width: 60rem) {
  .hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center; }
}

/* buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.btn { display: inline-block; padding: 0.65rem 1.1rem; border-radius: 8px; font-weight: 600; text-decoration: none; border: 2px solid var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { color: var(--accent); }
.btn:hover { text-decoration: underline; }

.meta { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin: 0; }
.note { border-left: 3px solid var(--signal); padding: 0.25rem 0 0.25rem 1rem; color: var(--muted); }

/* code blocks with optional copy button */
.code { position: relative; margin: 0 0 1rem; }
pre { background: var(--code-bg); border: 1px solid var(--rule); border-radius: 8px; padding: 0.9rem 1rem; overflow-x: auto; line-height: 1.5; font-size: 0.88rem; }
.code pre { margin: 0; padding-right: 4.5rem; }
.copy { position: absolute; top: 0.45rem; right: 0.45rem; font: 600 0.78rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.55rem; cursor: pointer; }
.copy:hover { border-color: var(--ink); }
.prompt { color: var(--muted); user-select: none; }

.placeholder { border: 2px dashed var(--signal); border-radius: 8px; padding: 0.9rem 1rem; font-family: var(--mono); font-size: 0.9rem; color: var(--signal); margin: 0 0 1rem; }

/* demo */
.demo { margin: 0; }
.demo img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--rule); background: #0E1113; aspect-ratio: 16 / 10; object-fit: contain; }
.demo figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

/* diagram */
.diagram { display: block; margin: 1.5rem 0 0.5rem; font-family: var(--mono); }
.diagram-narrow { display: none; max-width: 22rem; }
@media (max-width: 40rem) { .diagram-wide { display: none; } .diagram-narrow { display: block; } }
.d-box { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.d-pill { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.d-daemon { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.d-db { fill: none; stroke: var(--signal); stroke-width: 2; }
.d-mcp { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.d-link { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.d-head { fill: var(--accent); }
.d-t { fill: var(--ink); font-size: 13px; }
.d-strong { font-weight: 700; }
.d-cap { fill: var(--muted); font-size: 13px; }
.d-small { fill: var(--muted); font-size: 12.5px; }
.d-acc { fill: var(--accent); }

/* grids and cards */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); padding: 0; list-style: none; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.1rem 1.2rem; }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.limits li { margin-bottom: 0.5rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--rule); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 0; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); }
tr:last-child > * { border-bottom: 0; }
thead th { background: var(--surface); font-size: 0.85rem; }
tbody th { font-weight: 600; }
.compare-table { min-width: 44rem; }

/* faq */
details { border-bottom: 1px solid var(--rule); padding: 0.75rem 0; max-width: var(--measure); }
summary { cursor: pointer; font-weight: 600; }
details > :not(summary) { margin-top: 0.6rem; }

/* footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; font-size: 0.92rem; color: var(--muted); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0 0 0.75rem; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .site-nav, .copy, .actions { display: none; } }

/* a section whose wrap is also a prose column stays left-aligned with the rest */
.wrap.prose { max-width: var(--wide); }
.wrap.prose > * { max-width: var(--measure); }
.hero .demo { margin-top: 2rem; }
@media (min-width: 60rem) { .hero .demo { margin-top: 0; } }
caption { text-align: left; padding: 0.6rem 0.8rem; }
dd { margin: 0.2rem 0 1rem; }
dt { margin-top: 0.5rem; }
