/* Corgi Bank documentation. Plain and quiet: neutral surfaces, one accent kept for links and what is
   required, dark code panels in both themes. No decoration that does not carry information. */
:root {
  --ground: #fcfbfa; --raised: #ffffff; --sunken: #f5f3f1; --ink: #1c1917; --soft: #44403c; --muted: #78716c; --faint: #a8a29e;
  --line: #e9e5e1; --line-strong: #d9d3cd; --accent: #ff5c00; --accent-ink: #c2410c;
  --code-ground: #191614; --code-raised: #231f1c; --code-line: #322d29; --code-ink: #ece7e2; --code-dim: #9c938b;
  --get: #0f766e; --get-wash: #e6f4f2; --post: #1d4ed8; --post-wash: #e8eefc; --patch: #a16207; --patch-wash: #fbf3dc;
  --delete: #b91c1c; --delete-wash: #fdeaea; --object: #6d28d9; --object-wash: #f1eafd;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --top: 57px; --side: 292px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ground: #100e0d; --raised: #171513; --sunken: #1c1917; --ink: #f3efeb; --soft: #d6d0ca; --muted: #a39b93; --faint: #6f6861;
  --line: #27231f; --line-strong: #38332e; --accent-ink: #ff8a47;
  --code-ground: #0b0a09; --code-raised: #151311; --code-line: #26221f;
  --get: #5eead4; --get-wash: #0f2a27; --post: #93b4ff; --post-wash: #141f3d; --patch: #fcd34d; --patch-wash: #2e2510;
  --delete: #fca5a5; --delete-wash: #351616; --object: #c4b5fd; --object-wash: #231a3b;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --ground: #100e0d; --raised: #171513; --sunken: #1c1917; --ink: #f3efeb; --soft: #d6d0ca; --muted: #a39b93; --faint: #6f6861;
  --line: #27231f; --line-strong: #38332e; --accent-ink: #ff8a47;
  --code-ground: #0b0a09; --code-raised: #151311; --code-line: #26221f;
  --get: #5eead4; --get-wash: #0f2a27; --post: #93b4ff; --post-wash: #141f3d; --patch: #fcd34d; --patch-wash: #2e2510;
  --delete: #fca5a5; --delete-wash: #351616; --object: #c4b5fd; --object-wash: #231a3b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code, pre, kbd { font-family: var(--mono); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--ground); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--ground); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; width: calc(var(--side) - 20px); flex-shrink: 0; }
.brand .word { font-weight: 650; letter-spacing: -.015em; font-size: 16px; }
.brand .sub { color: var(--muted); font-size: 13.5px; padding-left: 10px; border-left: 1px solid var(--line-strong); }
.search-button { flex: 1; max-width: 560px; margin: 0 auto; height: 36px; display: flex; align-items: center; gap: 9px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--raised); color: var(--muted); cursor: pointer; font-size: 14px; text-align: left; }
.search-button:hover { border-color: var(--faint); }
.search-button span { flex: 1; }
kbd { font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--sunken); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-link { font-size: 13.5px; color: var(--soft); text-decoration: none; padding: 6px 10px; border-radius: 7px; }
.top-link:hover { background: var(--sunken); }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; color: var(--soft); }
.icon-button:hover { background: var(--sunken); }
.menu { display: none; }

/* ---- frame ---- */
.frame { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; overscroll-behavior: contain; padding: 18px 12px 48px;
  border-right: 1px solid var(--line); font-size: 14px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.side h2 { margin: 24px 10px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.side h2:first-child { margin-top: 2px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a, .side button.fold { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5.5px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--soft); text-decoration: none; text-align: left; cursor: pointer; line-height: 1.35; }
.side a:hover, .side button.fold:hover { background: var(--sunken); color: var(--ink); }
.side a[aria-current="page"] { background: var(--sunken); color: var(--ink); font-weight: 600; }
.side button.fold { font-weight: 550; color: var(--ink); }
.side button.fold::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; flex-shrink: 0; }
.side button.fold[aria-expanded="true"]::after { transform: rotate(45deg); }
.side .count { margin-left: auto; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 400; }
.side button.fold:has(.count)::after { margin-left: 8px; }
.side ul ul { margin: 2px 0 6px 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.side ul ul a { font-size: 13.5px; padding: 4.5px 10px; align-items: baseline; }
.side ul ul a > span.t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side .m { font: 600 9.5px/1 var(--mono); letter-spacing: .02em; width: 34px; flex-shrink: 0; }
.m.get, .method.get { color: var(--get); } .m.post, .method.post { color: var(--post); }
.m.patch, .m.put, .method.patch, .method.put { color: var(--patch); } .m.delete, .method.delete { color: var(--delete); }
.m.object, .method.object { color: var(--object); }

/* ---- content ---- */
main { display: grid; gap: 56px; padding: 40px clamp(20px, 4vw, 56px) 96px; min-width: 0; }
main.with-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); }
main.no-aside { grid-template-columns: minmax(0, 880px); }
main[data-kind="home"], main[data-kind="index"] { grid-template-columns: minmax(0, 1040px); }
article { min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--ink); }
.crumbs span[aria-hidden] { color: var(--faint); }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; margin: 0 0 14px; text-wrap: balance; }
h2 { font-size: 18px; letter-spacing: -.01em; font-weight: 620; margin: 0 0 4px; }
h3 { font-size: 15px; font-weight: 620; margin: 28px 0 8px; }
section { margin-top: 44px; }
p { margin: 0 0 12px; }
article p, article li { max-width: 72ch; }
article a:not(.tile):not(.entry):not(.card) { color: var(--accent-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); text-underline-offset: 3px; }
article a:not(.tile):not(.entry):not(.card):hover { text-decoration-color: currentColor; }
.lede { color: var(--soft); font-size: 16.5px; line-height: 1.6; }
.lede p:last-child { margin-bottom: 0; }
:not(pre) > code { font-size: .86em; padding: 1.5px 5px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
article ul, article ol { padding-left: 20px; margin: 0 0 12px; }
article li { margin-bottom: 4px; }

.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; }
.endpoint > code { font-size: 14.5px; background: none; border: 0; padding: 0; color: var(--ink); white-space: normal; word-break: break-all; }
.method { font: 650 11px/1 var(--mono); letter-spacing: .03em; padding: 5px 8px; border-radius: 6px; }
.method.get { background: var(--get-wash); } .method.post { background: var(--post-wash); }
.method.patch, .method.put { background: var(--patch-wash); } .method.delete { background: var(--delete-wash); } .method.object { background: var(--object-wash); }
.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 2px 9px; }

/* attributes */
.attrs { border-top: 1px solid var(--line); margin-top: 12px; }
.attr { padding: 14px 0; border-bottom: 1px solid var(--line); }
.attr-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.attr-name { font-size: 13.5px !important; font-weight: 600; background: none !important; border: 0 !important; padding: 0 !important; color: var(--ink); }
.attr-type { font-size: 12.5px; color: var(--muted); }
.need { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.need.required { color: var(--accent-ink); font-weight: 600; }
.attr-body { margin-top: 4px; color: var(--soft); font-size: 14.5px; }
.attr-body p { margin: 0 0 6px; } .attr-body p:last-child { margin-bottom: 0; }
.facts { font-size: 13px; color: var(--muted); }
details.children { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
details.children > summary { cursor: pointer; padding: 8px 12px; font-size: 13px; color: var(--soft); list-style: none; display: flex; align-items: center; gap: 8px; }
details.children > summary::-webkit-details-marker { display: none; }
details.children > summary::before { content: "+"; font-family: var(--mono); color: var(--faint); width: 10px; }
details.children[open] > summary::before { content: "−"; }
details.children[open] > summary { border-bottom: 1px solid var(--line); }
details.children .attrs { border-top: 0; margin: 0; padding: 0 12px; }
details.children .attr:last-child { border-bottom: 0; }
.returns { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.status { font: 600 12px/1 var(--mono); padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--soft); background: var(--raised); }
.status.ok { color: var(--get); border-color: color-mix(in srgb, var(--get) 35%, transparent); background: var(--get-wash); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* resource overview + tiles */
.entries { margin-top: 28px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--raised); }
.entry { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry:hover { background: var(--sunken); }
.entry .method { width: 62px; text-align: center; flex-shrink: 0; margin-top: 2px; }
.entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-text strong { font-weight: 600; }
.entry-text span { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.entry-text code { background: none; border: 0; padding: 0; color: var(--muted); white-space: normal; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.tile, .card { display: flex; flex-direction: column; gap: 4px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); text-decoration: none; }
.tile:hover, .card:hover { border-color: var(--faint); }
.tile strong, .card strong { font-weight: 620; letter-spacing: -.005em; }
.tile span, .card span { color: var(--muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile em { font-style: normal; font-size: 12px; color: var(--faint); margin-top: auto; padding-top: 6px; }

/* home */
.hero .lede { max-width: 64ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); margin: 10px 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--soft); }
tr:last-child td { border-bottom: 0; }

/* ---- code panels ---- */
.examples { position: sticky; top: calc(var(--top) + 24px); align-self: start; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - var(--top) - 48px); min-width: 0; }
.code-card { background: var(--code-ground); color: var(--code-ink); border: 1px solid var(--code-line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.examples .code-card { flex: 0 1 auto; }
.examples .code-card:first-child:not(:last-child) { max-height: 46%; flex-shrink: 0; }
.code-head { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; background: var(--code-raised); border-bottom: 1px solid var(--code-line); font-size: 12.5px; color: var(--code-dim); font-weight: 550; }
.card-note { font: 600 11px/1 var(--mono); color: #5eead4; }
.copy { margin-left: auto; font-size: 11.5px; color: var(--code-dim); background: none; border: 1px solid var(--code-line); border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.copy:hover { color: var(--code-ink); border-color: #4a433d; }
pre { margin: 0; padding: 14px 16px; overflow: auto; font-size: 12.5px; line-height: 1.65; tab-size: 2; scrollbar-width: thin; scrollbar-color: #3a342f transparent; }
pre code { white-space: pre; }
article pre { background: var(--code-ground); color: var(--code-ink); border: 1px solid var(--code-line); border-radius: 8px; margin: 12px 0 16px; }
.k { color: #e7dfd7; } .s { color: #fdba74; } .n { color: #93c5fd; } .b { color: #c4b5fd; } .c { color: #fff; font-weight: 600; }
.endpoints { display: flex; flex-direction: column; padding: 8px; overflow: auto; }
.endpoints a { display: flex; gap: 10px; padding: 6px 8px; border-radius: 7px; text-decoration: none; font: 12.5px/1.5 var(--mono); color: var(--code-ink); overflow-wrap: anywhere; }
.endpoints a:hover { background: var(--code-raised); }
.endpoints .m { width: 48px; flex-shrink: 0; font-weight: 650; font-size: 11px; line-height: 1.7; }
.endpoints .m.get { color: #5eead4; } .endpoints .m.post { color: #93b4ff; } .endpoints .m.patch, .endpoints .m.put { color: #fcd34d; } .endpoints .m.delete { color: #fca5a5; }

/* ---- search palette ---- */
.palette { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--raised); color: var(--ink); box-shadow: 0 24px 80px rgba(0, 0, 0, .35); overflow: hidden; }
.palette::backdrop { background: rgba(12, 10, 9, .45); backdrop-filter: blur(2px); }
.palette input { width: 100%; border: 0; outline: 0; background: none; color: inherit; font: inherit; font-size: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 440px); overflow-y: auto; }
.palette li { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: 7px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--sunken); }
.palette li strong { font-weight: 560; }
.palette li small { color: var(--muted); font: 12px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette li em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--faint); white-space: nowrap; }
.palette .empty { color: var(--muted); padding: 18px 12px; cursor: default; }
.palette-hint { margin: 0; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; }
.palette-hint kbd { margin-right: 2px; }

/* ---- narrow ---- */
.scrim { position: fixed; inset: 0; background: rgba(12, 10, 9, .45); z-index: 45; }
@media (max-width: 1180px) {
  main.with-aside { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .examples { position: static; max-height: none; }
  .code-card pre { max-height: 420px; }
}
@media (max-width: 860px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .menu { display: grid; }
  .brand { width: auto; } .brand .sub { display: none; }
  .search-button span, .search-button kbd, .top-link { display: none; }
  .search-button { flex: 0 0 auto; width: 36px; padding: 0; justify-content: center; margin: 0 0 0 auto; }
  .top-actions { margin-left: 0; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); height: 100vh; z-index: 50; background: var(--ground); transform: translateX(-102%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .3); }
  main { padding: 28px 16px 72px; }
  h1 { font-size: 26px; }
  .palette li { flex-wrap: wrap; gap: 2px 10px; }
  .palette li small { order: 3; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
