/* readfetch.com — one stylesheet for every page. The first block is the original
   single-page sheet, values unchanged; page rules follow. */
  :root {
    --paper: #0d0e11;
    --paper-2: #15171c;
    --ink: #f2eee7;
    --ink-2: #cfc8bd;
    --muted: #948d84;
    --rule: rgba(242, 238, 231, .12);
    --rule-strong: rgba(242, 238, 231, .24);
    --accent: #c8ff4d;
    --accent-soft: rgba(200, 255, 77, .07);
    --ok: #6ee7ff;
    --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { color: inherit; }
  .skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 20; }
  .skip:focus { left: 1rem; }
  .wrap { width: min(1140px, calc(100% - 2.5rem)); margin: 0 auto; }
  .mono { font-family: var(--mono); }

  /* header */
  header.site { position: sticky; top: 0; z-index: 10; background: rgba(13, 14, 17, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); }
  .nav { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .85rem 0; }
  .brand { display: inline-flex; align-items: center; gap: .55rem; font: 600 1.15rem/1 var(--serif); letter-spacing: -.02em; text-decoration: none; }
  .brand img { display: block; width: 26px; height: 26px; border-radius: 7px; }
  .brand em { font: 500 .82rem/1 var(--mono); font-style: normal; color: var(--muted); margin-left: .15rem; }
  .nav-links { display: flex; gap: 1.35rem; align-items: center; font-size: .86rem; }
  .nav-links a { color: var(--muted); text-decoration: none; }
  .nav-links a:hover { color: var(--ink); }
  .tag { font: .72rem var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--rule-strong); border-radius: 999px; padding: .25rem .6rem; color: var(--ink); }
  .tag i { font-style: normal; color: var(--accent); }

  main { padding: 3.5rem 0 1rem; }

  /* hero */
  .hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: start; }
  .eyebrow { display: inline-flex; align-items: center; gap: .5rem; font: 500 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 1.1rem; }
  .eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: var(--accent); }
  h1 { margin: 0; font: 600 clamp(2.6rem, 5.4vw, 4.3rem)/1.02 var(--serif); letter-spacing: -.035em; }
  h1 em { font-style: italic; color: var(--accent); }
  .lede { max-width: 34rem; margin: 1.35rem 0 0; color: var(--ink-2); font-size: 1.06rem; }
  .actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.7rem 0 0; }
  .btn { display: inline-flex; align-items: center; gap: .45rem; padding: .7rem 1.05rem; border-radius: 2px; border: 1px solid var(--rule-strong); text-decoration: none; font-size: .9rem; font-weight: 550; transition: background .15s ease, color .15s ease, border-color .15s ease; }
  .btn:hover { border-color: var(--ink); }
  .btn.primary { background: var(--accent); color: #0b0f06; border-color: var(--accent); }
  .btn.primary:hover { background: #d7ff74; border-color: #d7ff74; }
  .btn small { font: .78rem var(--mono); opacity: .7; }

  /* the receipt card */
  .receipt { border: 1px solid var(--rule-strong); background: var(--paper-2); box-shadow: 10px 10px 0 rgba(0, 0, 0, .35); }
  .receipt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .7rem .9rem; border-bottom: 1px dashed var(--rule-strong); font: .74rem var(--mono); color: var(--muted); }
  .receipt-body { padding: .9rem 1rem 1rem; font: .78rem/1.75 var(--mono); color: var(--ink-2); }
  .receipt-body .req { color: var(--ink); font-weight: 600; }
  .receipt-body .arrow { color: var(--accent); }
  .receipt-body .dim { color: var(--muted); }
  .receipt-body .ok { color: var(--ok); }
  .receipt-body ul { list-style: none; margin: .1rem 0 .55rem; padding: 0 0 0 .1rem; }
  .receipt-body li { display: flex; gap: .8rem; }
  .receipt-body li span:first-child { color: var(--muted); min-width: 6.4rem; }
  .receipt-foot { border-top: 1px dashed var(--rule-strong); padding: .55rem .9rem; font: .7rem var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; }
  .copy { background: transparent; border: 1px solid var(--rule-strong); color: var(--muted); font: .7rem var(--mono); padding: .25rem .5rem; border-radius: 2px; cursor: pointer; }
  .copy:hover { color: var(--ink); border-color: var(--ink); }

  /* facts strip */
  .facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 3.2rem 0 0; padding: 0; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); list-style: none; }
  .facts li { padding: 1rem 1.1rem; border-left: 1px solid var(--rule); }
  .facts li:first-child { border-left: 0; padding-left: 0; }
  .facts b { display: block; font: 600 1.5rem/1.2 var(--serif); letter-spacing: -.02em; }
  .facts span { font: .74rem var(--mono); color: var(--muted); letter-spacing: .02em; }

  /* sections */
  section { margin-top: 4.5rem; scroll-margin-top: 5rem; }
  .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--rule-strong); padding-bottom: .55rem; margin-bottom: 1.6rem; }
  /* one hairline per boundary: a framed array directly under a heading already draws
     its own top edge, so the heading drops its rule instead of stacking a second line
     25px above it. Prose, notes, Q&A and the ladder keep it — nothing below repeats it. */
  .sec-head:has(+ :is(.facts, .grid, .cols-2, .links, .routes, .table-wrap, .block, .split, ul.linklist:not(:empty))) { border-bottom: 0; }
  h2 { margin: 0; font: 600 1.7rem/1.1 var(--serif); letter-spacing: -.025em; }
  .sec-head p { margin: 0; color: var(--muted); font-size: .88rem; max-width: 34rem; text-align: right; text-wrap: balance; }
  h3 { margin: 0; font: 600 .95rem/1.3 var(--mono); letter-spacing: -.01em; }
  .sub { margin: 0 0 1.4rem; color: var(--muted); font-size: .93rem; }

  /* service cards (generated) */
  .grid + .grid { border-top: 0; }
  .grid { display: grid; gap: 0; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .card { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 1.15rem 1.2rem 1.25rem; background: transparent; transition: background .15s ease; text-decoration: none; color: inherit; display: block; }
  .card:hover { background: var(--accent-soft); }
  .card:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .card h3 { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
  .method { font: 600 .7rem var(--mono); letter-spacing: .08em; color: var(--accent); }
  .card p { margin: .6rem 0 0; color: var(--ink-2); font-size: .87rem; line-height: 1.55; }
  .card ul { margin: .85rem 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; }
  .chip { font: .68rem var(--mono); color: var(--muted); border: 1px solid var(--rule); border-radius: 2px; padding: .12rem .4rem; }
  .chip.cost { color: var(--ink); border-color: var(--rule-strong); background: rgba(255, 255, 255, .04); }
  .chip.free { color: var(--ok); border-color: rgba(29, 107, 69, .4); }

  /* pricing + decision */
  .split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
  .ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
  .ledger th { text-align: left; font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 0 .5rem; border-bottom: 1px solid var(--rule-strong); }
  .ledger th:last-child, .ledger td:last-child { text-align: right; }
  .ledger td { padding: .55rem 0; border-bottom: 1px dotted var(--rule-strong); }
  .ledger td:first-child { padding-right: 1rem; }
  .ledger td.price { font: .88rem var(--mono); white-space: nowrap; }
  .ledger tr:hover td { background: var(--accent-soft); }
  .note { margin-top: 1rem; font-size: .78rem; color: var(--muted); border-left: 2px solid var(--accent); padding-left: .7rem; }
  .ladder { counter-reset: step; margin: 0; padding: 0; list-style: none; }
  .ladder li { counter-increment: step; display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .8rem; align-items: baseline; padding: .62rem 0; border-bottom: 1px solid var(--rule); font-size: .89rem; }
  .ladder li::before { content: counter(step); font: .72rem var(--mono); color: var(--muted); }
  .ladder b { font-weight: 550; }
  .ladder code { font: .78rem var(--mono); color: var(--accent); white-space: nowrap; }

  /* trust */
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .cols-2 .card h3 { font: 600 .8rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

  /* agent links */
  .links { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .link { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; font: .78rem var(--mono); color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
  .link:hover { background: var(--accent-soft); }
  .link span { color: var(--muted); flex: 0 0 auto; font-family: var(--sans); font-size: .78rem; }

  footer { margin-top: 4.5rem; border-top: 1px solid var(--rule-strong); padding: 1.3rem 0 2.5rem; color: var(--muted); font-size: .78rem; }
  footer .row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
  code.inline { font-family: var(--mono); font-size: .86em; color: var(--ink); background: var(--paper-2); padding: .08rem .32rem; border-radius: 2px; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  @media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; gap: 2rem; }
    .grid, .cols-2, .links { grid-template-columns: 1fr 1fr; }
    .split { grid-template-columns: 1fr; gap: 2rem; }
    .facts { grid-template-columns: 1fr 1fr; }
    .facts:not(.tight) li:nth-child(3) { border-left: 0; padding-left: 0; }
  }
  @media (max-width: 640px) {
    .grid, .cols-2, .links { grid-template-columns: 1fr; }
    .facts { grid-template-columns: 1fr; }
    .facts li { border-left: 0; padding-left: 0; }
    .sec-head { flex-direction: column; align-items: flex-start; gap: .3rem; }
    .sec-head p { text-align: left; }
    main { padding-top: 2.4rem; }
  }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  /* ---- secondary pages: shared shell ---- */
  .page-head { max-width: 48rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule-strong); }
  .page-head h1 { font-size: clamp(1.9rem, 3.7vw, 2.9rem); }
  .page-head .lede { margin-top: .9rem; }
  .crumbs { display: flex; flex-wrap: wrap; gap: .45rem; font: .72rem var(--mono); color: var(--muted); margin: 0 0 1.5rem; padding: 0; list-style: none; overflow-wrap: anywhere; }
  .crumbs li { display: flex; gap: .45rem; min-width: 0; }
  .crumbs li + li::before { content: "/"; color: var(--muted); opacity: .5; }
  .crumbs a { color: var(--muted); text-decoration: none; }
  .crumbs a:hover { color: var(--ink); }
  .crumbs [aria-current] { color: var(--ink-2); }

  /* endpoint title: method over path. `h1.` outranks `.page-head h1`, which would
     otherwise hand the path the larger content-page size and break it mid-word. */
  h1.ep-title { font: 600 clamp(1.5rem, 3.2vw, 2.2rem)/1.25 var(--mono); letter-spacing: -.02em; overflow-wrap: anywhere; }
  .ep-title .method { display: block; margin-bottom: .5rem; font-size: .58em; letter-spacing: .1em; color: var(--accent); }
  .chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .95rem 0 0; padding: 0; list-style: none; }
  .facts.tight { margin-top: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  /* a long value (a timeout range) must not push its label out of line with the others */
  .facts.tight li { display: flex; flex-direction: column; justify-content: flex-end; }

  /* prose */
  .prose { max-width: 44rem; color: var(--ink-2); font-size: .95rem; }
  .prose p { margin: 0 0 .9rem; }
  .prose p:last-child { margin-bottom: 0; }
  .prose h3 { margin: 1.6rem 0 .45rem; color: var(--ink); }
  .prose ul, .prose ol { margin: 0 0 .9rem; padding-left: 1.15rem; }
  .prose li { margin: .2rem 0; }
  .prose strong { color: var(--ink); font-weight: 600; }
  .prose a, .qa .a a, .note a, .sub a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: .2rem; }
  .prose a:hover, .qa .a a:hover, .note a:hover, .sub a:hover { text-decoration-color: var(--accent); }

  .note { max-width: 44rem; }
  .kicker { margin: 0 0 1.4rem; font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

  /* tables */
  .table-wrap { overflow-x: auto; border: 1px solid var(--rule); }
  table.spec { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 33rem; }
  table.spec th { text-align: left; font: 500 .68rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: .65rem .8rem; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
  table.spec td { padding: .65rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-2); }
  table.spec tr:last-child td { border-bottom: 0; }
  table.spec tbody td:first-child { color: var(--ink); font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
  /* the default column of a field table is the only mono third column; a prose third
     column (returns, what to do) must wrap */
  #params table.spec tbody td:nth-child(3) { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
  table.spec .req { margin-left: .3rem; padding: .05rem .3rem; border: 1px solid var(--rule); border-radius: 2px; font: .58rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); vertical-align: .1em; }
  table.spec tr:hover td { background: var(--accent-soft); }
  table.spec .unit { color: var(--muted); }
  .table-wrap + .prose { margin-top: 1.3rem; }

  /* code blocks */
  .block { border: 1px solid var(--rule-strong); background: var(--paper-2); margin: 0 0 1.1rem; min-width: 0; }
  .block-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem .7rem .45rem .9rem; border-bottom: 1px solid var(--rule); font: .7rem var(--mono); color: var(--muted); }
  .block-head b { font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
  .block pre { margin: 0; padding: .85rem 1rem 1rem; overflow-x: auto; font: .76rem/1.7 var(--mono); color: var(--ink-2); tab-size: 2; }
  .block pre:focus-visible { outline-offset: -3px; }
  /* a lead-in sentence and the block it introduces get the same gap as a table and its notes */
  .prose + .block, .prose + .table-wrap, .block + .prose { margin-top: 1.3rem; }

  /* docs layout */
  .doc { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 3rem; align-items: start; margin-top: 4.5rem; }
  .doc-body { min-width: 0; }
  .toc { position: sticky; top: 5rem; font: .78rem/1.9 var(--mono); }
  .toc p { margin: 0 0 .5rem; font: 500 .66rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .toc ol { margin: 0; padding: 0; list-style: none; }
  .toc a { display: block; padding: .1rem 0 .1rem .7rem; border-left: 1px solid var(--rule); color: var(--muted); text-decoration: none; }
  .toc a:hover { color: var(--ink); border-color: var(--accent); }
  .doc-body > section:first-child { margin-top: 0; }

  /* cards: the title is the link to the endpoint page */
  .card h3 a { color: inherit; text-decoration: none; }
  .card h3 a:hover, .card h3 a:focus-visible { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .25rem; }

  /* list of endpoint links ({{RELATED}}) */
  ul.linklist { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  ul.linklist li { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  ul.linklist a { display: block; padding: .7rem .9rem; font: .78rem var(--mono); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
  ul.linklist a:hover { background: var(--accent-soft); }

  /* an odd number of links closes the grid instead of leaving a hole */
  @media (min-width: 641px) {
    .links > .link:last-child:nth-child(odd) { grid-column: span 2; }
  }

  /* a group with a single endpoint has no neighbours: an empty bordered box is not a list */
  ul.linklist:empty { display: none; }
  section:has(> ul.linklist:empty) > .sec-head > p { display: none; }

  /* routing cards */
  .routes { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); counter-reset: route; }
  .route { position: relative; display: block; padding: 1.15rem 1.2rem 1.3rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; transition: background .15s ease; }
  .route:hover { background: var(--accent-soft); }
  .route::before { counter-increment: route; content: counter(route, decimal-leading-zero); position: absolute; top: 1.05rem; right: 1.1rem; font: .68rem var(--mono); color: var(--muted); }
  .route b { display: block; padding-right: 2rem; font: 600 1.1rem/1.25 var(--serif); letter-spacing: -.015em; }
  .route code { display: inline-block; margin: .5rem 0 .35rem; font: .78rem var(--mono); color: var(--accent); }
  .route span { display: block; color: var(--muted); font-size: .84rem; line-height: 1.5; }

  /* faq */
  .qa { border-bottom: 1px solid var(--rule); }
  .qa summary { display: flex; gap: .9rem; align-items: baseline; padding: .95rem 0; cursor: pointer; list-style: none; font: 600 1.02rem/1.4 var(--serif); letter-spacing: -.01em; }
  .qa summary::-webkit-details-marker { display: none; }
  .qa summary::before { content: "+"; flex: 0 0 .8rem; font: .95rem var(--mono); color: var(--accent); }
  .qa[open] summary::before { content: "\2013"; }
  .qa summary:hover { color: var(--accent); }
  .qa .a { max-width: 44rem; padding: 0 0 1.15rem 1.7rem; color: var(--ink-2); font-size: .92rem; }
  .qa .a p { margin: 0 0 .7rem; }
  .qa .a p:last-child { margin-bottom: 0; }
  .qa .a ul { margin: .2rem 0 .7rem; padding-left: 1.15rem; }

  /* footer */
  footer .foot { display: grid; gap: .9rem; }
  .foot-links { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; }
  .foot-links a { color: var(--muted); text-decoration: none; }
  .foot-links a:hover { color: var(--ink); }
  .foot-note { margin: 0; font-size: .74rem; line-height: 1.5; max-width: 48rem; }

  /* nav: keep every page reachable, including on a phone. One row at every width —
     the link strip scrolls sideways instead of wrapping, so the sticky header stays
     short enough never to cover an anchored heading. */
  .nav { flex-wrap: nowrap; gap: 1.25rem; }
  .brand { flex: 0 0 auto; }
  .nav-links { margin-left: auto; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 2px 0; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a, .nav-links .tag { flex: 0 0 auto; white-space: nowrap; }
  .nav-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .35rem; }

  /* below this width the strip scrolls: the fade is what says "there is more", and the
     trailing padding keeps the last link clear of it once the strip is scrolled home */
  @media (max-width: 880px) {
    .nav-links { padding-right: 2.5rem; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); }
  }

  @media (max-width: 980px) {
    .doc { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
    .toc { position: static; border: 1px solid var(--rule); padding: .8rem 1rem; }
  }
  @media (max-width: 640px) {
    .routes { grid-template-columns: 1fr; }
    .facts.tight { grid-template-columns: 1fr; }
    ul.linklist { grid-template-columns: 1fr; }
    .ladder li { grid-template-columns: 1.6rem 1fr; row-gap: .15rem; }
    .ladder code { grid-column: 2; }
    .page-head .lede { font-size: 1rem; }
  }
