/* Gin docs (/docs/). Loads after styles.css and pages.css and reuses their tokens; light and dark come from those tokens. */

.docs-page code, .docs-page pre, .flow text { font-variant-ligatures: none; }

.docs-page .page-head { max-width: 720px; }
.docs-page .dek code { font-size: .86em; background: var(--sunk); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.docs-page .page-head .cmd { margin-top: 14px; }

.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 8px; }
@media (min-width: 1040px) { .docs { grid-template-columns: 196px minmax(0, 1fr); gap: 64px; } }

/* on this page */
.toc { margin: 32px 0 0; }
.toc-h { font: 500 12.5px/1 var(--mono); color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 14.5px; text-decoration: none; color: var(--ink-2); }
.toc a:hover { border-color: var(--ink); color: var(--ink); }
@media (min-width: 1040px) {
  .toc { position: sticky; top: 88px; align-self: start; margin-top: 64px; }
  .toc ol { flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
  .toc a { min-height: 32px; padding: 0 0 0 14px; margin-left: -1px; border: 0; border-left: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
  .toc a:hover { color: var(--ink); }
  .toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--juniper); font-weight: 500; }
}

/* sections */
.docs-body { min-width: 0; max-width: 780px; }
.dsec { padding: 56px 0 0; scroll-margin-top: 72px; }
.dsec + .dsec { margin-top: 56px; border-top: 1px solid var(--line); }
.dsec h2 { font-size: clamp(28px, 3.2vw, 38px); max-width: none; margin: 0 0 14px; display: flex; align-items: baseline; gap: 14px; }
.dsec h2 .n { font: 500 13px/1 var(--mono); color: var(--juniper); letter-spacing: .02em; flex: none; }
.dsec > p, .install-text p { color: var(--ink-2); max-width: 66ch; }
.dsec p { margin: 0 0 14px; }
.dsec h3.sub { font-size: 19px; margin: 36px 0 10px; scroll-margin-top: 80px; }
.dsec h4 { font: 600 15px/1.3 var(--sans); margin: 24px 0 0; }
.dsec code { font-size: .86em; background: var(--sunk); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.dsec a { color: var(--juniper); }
.dsec a:hover { color: var(--juniper-ink); }
.dsec .note { font-size: 15px; color: var(--muted); }
.dsec .never { margin-top: 18px; }

.points { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.points li { position: relative; padding-left: 22px; color: var(--ink-2); line-height: 1.55; }
.points li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--juniper); }
.points b { color: var(--ink); font-weight: 600; }

/* code blocks */
.code { margin: 18px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.code figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 6px 0 16px; border-bottom: 1px solid var(--line); background: var(--sunk); font: 500 12.5px/1.4 var(--mono); color: var(--muted); }
.code figcaption code { background: none; border: 0; padding: 0; font-size: inherit; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 500 13.5px/1.7 var(--mono); color: var(--ink); tab-size: 2; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; border-radius: 0; overflow-wrap: normal; }
.code .add { display: inline-block; min-width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; background: var(--tonic-soft); box-shadow: inset 3px 0 var(--tonic); }
.code .k { color: var(--juniper); }
.code .s { color: var(--tonic); }
.code .c { color: var(--muted); font-style: italic; }
.code .num { color: var(--warn); }
.copy { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--muted); font: 500 12.5px/1 var(--sans); cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--line-2); background: var(--card); }
.copy.done { color: var(--tonic); }
@media (max-width: 520px) { .code pre { font-size: 12.5px; padding: 12px 14px; } .code .add { min-width: calc(100% + 28px); margin: 0 -14px; padding: 0 14px; } }

/* tables */
.docs-page .tbl-wrap { margin: 12px 0 0; }
.docs-page .tbl th, .docs-page .tbl td { padding: 10px 14px; }
.docs-page .tbl tbody th { white-space: nowrap; font-size: 14.5px; }
.docs-page .tbl code { display: inline; font: 500 12.5px/1.5 var(--mono); color: var(--ink); background: var(--sunk); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; margin: 0; overflow-wrap: anywhere; }
.docs-page .tbl td { color: var(--ink-2); }
.tbl.reads tbody th { width: 9.5em; }
.tbl.event tbody th { width: 18em; white-space: normal; }
.tbl.event tbody th code { margin: 0 2px 2px 0; display: inline-block; }
.tbl.ref td:nth-child(2) { white-space: nowrap; font-size: 14px; }
@media (max-width: 640px) {
  .docs-page .tbl th, .docs-page .tbl td { padding: 9px 12px; font-size: 14px; }
  .tbl.reads, .tbl.reads tbody, .tbl.reads tr, .tbl.reads th, .tbl.reads td,
  .tbl.event, .tbl.event tbody, .tbl.event tr, .tbl.event th, .tbl.event td { display: block; width: auto; }
  .tbl.reads thead, .tbl.event thead { display: none; }
  .tbl.reads tr, .tbl.event tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl.reads tbody tr:last-child, .tbl.event tbody tr:last-child { border-bottom: 0; }
  .tbl.reads tbody th, .tbl.reads td, .tbl.event tbody th, .tbl.event td { border: 0; padding: 0 12px; }
  .tbl.reads tbody th { font: 500 12.5px/1.6 var(--mono); color: var(--muted); }
  .tbl.event tbody th { width: auto; padding-bottom: 4px; }
  .tbl.event tbody th code { margin-bottom: 0; }
  .tbl.ref thead { display: none; }
  .tbl.ref, .tbl.ref tbody, .tbl.ref tr { display: block; }
  .tbl.ref tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tbl.ref tbody tr:last-child { border-bottom: 0; }
  .tbl.ref th, .tbl.ref td { padding: 0; border: 0; }
  .tbl.ref td:nth-child(2) { color: var(--muted); font-size: 13px; text-align: right; }
  .tbl.ref td:nth-child(2)::before { content: "default "; font: 400 12px var(--mono); }
  .tbl.ref td:nth-child(3) { grid-column: 1 / -1; }
  .tbl.ref td.nd { visibility: hidden; }
}

/* tabs */
.tabs { margin: 24px 0 0; }
.tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tablist::-webkit-scrollbar { display: none; }
.tablist[hidden] { display: none; }
[role="tab"] { flex: none; min-height: 44px; padding: 0 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 500 15px/1 var(--sans); cursor: pointer; white-space: nowrap; border-radius: 6px 6px 0 0; }
[role="tab"]:hover { color: var(--ink); }
[role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--juniper); }
[role="tab"]:focus-visible { outline-offset: -2px; }
.tabpanel { padding: 18px 0 0; }
.tabpanel:focus-visible { outline-offset: 6px; }
.tabpanel[hidden] { display: none; }
.tabpanel > p { color: var(--ink-2); margin: 0; }
.js .tp-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tp-h { font-size: 19px; margin: 8px 0 8px; }
.tabpanel + .tabpanel .tp-h { margin-top: 40px; }
@media (prefers-reduced-motion: no-preference) {
  .js .tabpanel:not([hidden]) { animation: tp-in .18s ease-out; }
  @keyframes tp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

/* install: diagram + steps */
.install { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin: 24px 0 0; }
@media (min-width: 860px) { .install { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 36px; align-items: start; } }
.flow { margin: 0; max-width: 420px; }
.flow svg { width: 100%; height: auto; }
.steps { list-style: decimal; margin: 0; padding: 0 0 0 22px; display: grid; gap: 12px; }
.steps li { color: var(--ink-2); line-height: 1.55; padding-left: 4px; }
.steps li::marker { font: 500 13px var(--mono); color: var(--juniper); }
.steps b { color: var(--ink); font-weight: 600; }
.install-text h3.sub { margin-top: 28px; }

.fl-box { fill: var(--card); stroke: var(--line-2); stroke-width: 1; }
.fl-term { fill: var(--ink); }
.fl-you { fill: var(--sunk); stroke: var(--line-2); stroke-dasharray: 4 3; }
.fl-gin { fill: var(--juniper-soft); stroke: var(--juniper); stroke-width: 1.25; }
.fl-chip { fill: var(--sunk); stroke: var(--line-2); }
.fl-ar { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.fl-dash { stroke-dasharray: 5 4; stroke: var(--juniper); }
.fl-head { fill: var(--muted); }
.fl-cmd { fill: var(--paper); font: 500 15px var(--mono); }
.fl-pr { fill: color-mix(in srgb, var(--paper) 55%, var(--ink)); }
.fl-ts { fill: color-mix(in srgb, var(--paper) 72%, var(--ink)); font: 400 13px var(--sans); }
.fl-s { fill: var(--muted); font: 500 12px var(--mono); }
.fl-t { fill: var(--ink); font: 600 15px var(--sans); }
.fl-g { fill: var(--juniper); font: 650 16px var(--sans); }
.fl-q { fill: var(--ink); font: 500 14px var(--sans); }
.fl-x { fill: var(--ink-2); font: 400 14px var(--sans); }
.fl-c { fill: var(--ink); font: 500 12.5px var(--mono); }
.fl-cm { fill: var(--ink); font: 500 12px var(--mono); }
.fl-step circle { fill: var(--juniper-soft); stroke: var(--juniper); }
.fl-l { fill: var(--juniper); font: 600 11.5px var(--mono); }

/* reference */
.ref-list { margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.ref-list > div { display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr); gap: 4px 20px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ref-list > div:first-child { border-top: 0; }
.ref-list dt { margin: 0; }
.ref-list dt code { background: none; border: 0; padding: 0; font-size: 13.5px; color: var(--ink); font-weight: 500; }
.ref-list dd { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
@media (max-width: 720px) { .ref-list > div { grid-template-columns: minmax(0, 1fr); } }

/* ---------- round trip per router: the response Gin reads → the event it posts ---------- */
.trip { margin-top: 6px; }
.trip-step { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0 0; color: var(--ink-2); }
.trip-n { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 600 12px/1 var(--mono); margin-top: 1px; }
.trip-step + .code { margin-top: 10px; }
.code mark.f { background: rgba(51, 70, 211, .1); color: inherit; border-radius: 4px; padding: 1px 2px; box-shadow: inset 0 -1px rgba(51, 70, 211, .35); }
.code mark.f::after { content: attr(data-f); display: inline-grid; place-items: center; min-width: 15px; height: 15px; margin-left: 4px; padding: 0 3px; border-radius: 8px; background: var(--juniper); color: #fff; font: 600 10px/1 var(--mono); vertical-align: 2px; }
.trip-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 18px; font-size: 14px; color: var(--ink-2); }
.trip-legend li { display: flex; gap: 8px; align-items: baseline; }
.pin { flex: none; display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--juniper); color: #fff; font: 600 10.5px/1 var(--mono); }
.trip-note { margin: 14px 0 0; font-size: 14.5px; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .code mark.f { background: rgba(123, 140, 255, .16); box-shadow: inset 0 -1px rgba(123, 140, 255, .45); } }
.returns { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; color: var(--ink-2); }
.returns li::marker { font: 600 13px var(--mono); color: var(--juniper); }
