/* ---- klinr.xyz/docs: the page CSS of the docs pages only (the landing never loads it). The kit's tokens, type,
   buttons, nav and footer stay as they are; this adds the reading layout: the page head, the sidebar, the article
   and the pieces inside it (steps, the timeline, tables, code). ---- */

/* a docs page reads top to bottom, so its two sections are as tall as their content (like the landing's hero, on
   Alex's ask), not the kit's one screen each */
main.docs > section.hero.docs-hero { height: auto; min-height: 0; padding: calc(var(--nav) + 72px) 0 var(--s-7); }
main.docs > section.hero.docs-hero > .wrap { height: auto; display: block; }
main.docs > section.docs-page { height: auto; min-height: 0; padding: var(--s-5) 0 var(--s-9); display: block; }
main.docs > section.docs-page > .wrap { height: auto; display: grid; }

.docs-hero__text { max-width: 860px; }
.docs-hero h1 { font-size: clamp(36px, 2.6vw + 26px, 64px); line-height: 1.04; letter-spacing: var(--display-tracking-xl, -0.04em); }
.docs-hero .hero__lead { margin-top: var(--s-5); font-size: var(--t-lead); line-height: 1.5; max-width: 60ch; color: var(--ink); }
.docs-crumb { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s-5); font: 500 var(--t-label)/1 var(--font-mono); color: var(--muted); }
.docs-crumb a { color: #0a5fb4; }
.docs-crumb a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- the grid: sidebar on columns 1-3, the article from column 4 to the right line ---- */
.docs-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
.docs-side { grid-column: 1 / span 3; display: grid; gap: var(--s-6); padding-top: var(--s-2); }
.docs-side__label { font: 500 var(--t-label)/1.4 var(--font-text); color: var(--muted); margin-bottom: var(--s-2); }
.docs-side ul { display: grid; gap: 2px; }
.docs-side a { display: flex; align-items: center; min-height: 36px; padding: 6px 0;
  font-size: 15px; font-weight: 500; color: var(--muted); transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.docs-side a:hover { color: var(--ink); }
.docs-side a[aria-current="page"] { color: var(--ink); text-decoration: underline 2px var(--action); text-underline-offset: 6px; }
.docs-menu { display: none; }
.docs-body { grid-column: 4 / -1; min-width: 0; }

@media (max-width: 1023px) {
  .docs-side { display: none; }
  .docs-menu { display: block; grid-column: 1 / -1; margin-bottom: var(--s-7); border: 1px solid var(--line-strong); border-radius: 10px; background: var(--p-surface); }
  .docs-menu summary { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; }
  .docs-menu summary::-webkit-details-marker { display: none; }
  .docs-menu summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid var(--ink); border-bottom: 1.6px solid var(--ink); transform: rotate(45deg) translateY(-2px); transition: transform var(--dur) var(--ease); }
  .docs-menu[open] summary::after { transform: rotate(225deg) translateY(-2px); }
  .docs-menu__label { font: 500 var(--t-label)/1 var(--font-text); color: var(--muted); }
  .docs-menu__now { font-weight: 500; }
  .docs-menu ul { display: grid; padding: 4px 8px 8px; border-top: 1px solid var(--line); }
  .docs-menu a { display: flex; align-items: center; min-height: 44px; padding: 0 8px; border-radius: 8px; font-weight: 500; color: var(--muted); }
  .docs-menu a:hover { color: var(--ink); background: rgb(14 20 32 / .045); }
  .docs-menu a[aria-current="page"] { color: var(--ink); background: rgb(8 116 220 / .08); }
  .docs-body { grid-column: 1 / -1; }
}

/* ---- the article: one idea per section, short lines ---- */
.docs-body > section { padding-top: var(--s-7); scroll-margin-top: calc(var(--nav) + 16px); }
.docs-body > section:first-child { padding-top: 0; }
.docs-body > section + section { margin-top: var(--s-7); border-top: 1px solid var(--line); }
.docs-body h2 { font-size: clamp(26px, .76vw + 23px, 34px); line-height: 1.15; margin-bottom: var(--s-4); }
.docs-body h3 { font-family: var(--font-text); font-weight: 500; font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; margin: var(--s-6) 0 var(--s-3); }
.docs-body p, .docs-body li { font-size: 17px; line-height: 1.65; color: var(--ink); }
.docs-body p { max-width: 68ch; }
.docs-body p + p, .docs-body p + ul, .docs-body p + ol, .docs-body ul + p, .docs-body ol + p,
.docs-body p + .d-scroll, .docs-body .d-scroll + p, .docs-body p + .code, .docs-body .code + p, .docs-body .code + .code { margin-top: var(--s-4); }
.docs-body a:not([class]) { color: #0a5fb4; text-decoration: underline; text-decoration-color: rgb(8 116 220 / .35); text-underline-offset: 3px; transition: text-decoration-color var(--dur) var(--ease); }
.docs-body a:not([class]):hover { text-decoration-color: currentColor; }
.docs-body .bullets { display: grid; gap: var(--s-2); max-width: 68ch; }
.docs-body .bullets > li { position: relative; padding-left: 22px; }
.docs-body .bullets > li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--action); }
.docs-body .numbered { display: grid; gap: var(--s-3); max-width: 68ch; counter-reset: n; }
.docs-body .numbered > li { position: relative; padding-left: 36px; counter-increment: n; }
.docs-body .numbered > li::before { content: counter(n); position: absolute; left: 0; top: .2em; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  font: 500 13px/1 var(--font-mono); color: var(--action); background: rgb(8 116 220 / .09); }
.docs-body strong { font-weight: 500; }
.docs-body :not(pre) > code { font: 400 .9em/1 var(--font-mono); padding: 2px 6px; border-radius: 5px; background: rgb(14 20 32 / .06); overflow-wrap: anywhere; }

/* a note: the one thing on a section that must not be missed */
.note { max-width: 68ch; margin-top: var(--s-5); padding: 4px 0 4px 18px; border-left: 2px solid var(--action); }
.note p { font-size: 16px; }

/* ---- the lifecycle: who does what, in order, on one rail ---- */
.flow { display: grid; margin-top: var(--s-6); counter-reset: f; }
.flow > li { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: var(--s-5); padding-bottom: var(--s-6); counter-increment: f; }
.flow > li::before { content: counter(f); grid-row: 1 / span 3; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; position: relative; z-index: 1;
  font: 500 15px/1 var(--font-mono); color: #fff; background-color: #2f95ff; background-image: linear-gradient(#5cb2ff 0%, #2f95ff 55%, #0a84f5 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .38), 0 1px 2px rgb(0 0 0 / .25); text-shadow: 0 1px 1px rgb(0 40 100 / .45); }
.flow > li::after { content: ""; position: absolute; left: 19.5px; top: 40px; bottom: 0; width: 1px; background: var(--line-strong); }
.flow > li:last-child { padding-bottom: 0; }
.flow > li:last-child::after { display: none; }
.flow h3 { margin: 6px 0 0; font-size: 20px; }
.flow .who { justify-self: start; margin-top: 6px; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px;
  font: 500 13px/1 var(--font-mono); color: #0a5fb4; background: #e6f1fd; }
.flow p { margin-top: var(--s-2); }

/* ---- the timeline: the windows in order, each segment named with its length ---- */
.phases { display: grid; grid-template-columns: 1.3fr 1.8fr 1.3fr 1.3fr 1.5fr; margin-top: var(--s-6); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--p-surface); }
.phases > li { display: grid; align-content: start; gap: 6px; padding: 16px 14px 18px; border-left: 1px solid var(--line); position: relative; }
.phases > li:first-child { border-left: 0; }
.phases > li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--bar, #cfe4fa); }
.phases > li:nth-child(2) { --bar: #5cb2ff; }
.phases > li:nth-child(4) { --bar: #2f95ff; }
.phases > li:nth-child(5) { --bar: #0a84f5; }
.phases b { font-weight: 500; font-size: 15px; line-height: 1.3; }
.phases span { font: 400 13px/1.4 var(--font-mono); color: var(--muted); }
@media (max-width: 767px) {
  .phases { grid-template-columns: 1fr; }
  .phases > li { border-left: 0; border-top: 1px solid var(--line); padding-left: 20px; }
  .phases > li:first-child { border-top: 0; }
  .phases > li::before { right: auto; bottom: 0; width: 4px; height: auto; }
}

/* ---- facts: label over value, two or four across ---- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-6); }
.facts > div { display: grid; align-content: start; gap: 6px; padding-top: 14px; border-top: 2px solid var(--ink); }
.facts dt { font: 500 var(--t-label)/1.4 var(--font-text); color: var(--muted); }
.facts dd { margin: 0; font-size: 17px; line-height: 1.4; }
@media (max-width: 1279px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-5); } }

/* ---- link rows: where to go next ---- */
.linkrows { display: grid; margin-top: var(--s-5); }
.docs-body .linkrows a { color: var(--ink); text-decoration: none; }
.linkrows > li { border-bottom: 1px solid var(--line); }
.linkrows a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s-5); padding: 18px 0; }
.linkrows b { font-weight: 500; font-size: 18px; }
.linkrows small { display: block; grid-column: 1; margin-top: 4px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.linkrows a::after { content: "\2192"; grid-column: 2; grid-row: 1 / span 2; color: var(--action); font-size: 18px; transition: transform var(--dur) var(--ease); }
.linkrows a:hover b { color: #0a5fb4; }
.linkrows a:hover::after { transform: translateX(3px); }

/* ---- two columns of short lists (who it is for, and who it is not for) ---- */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-5); }
.pair > div { padding: 20px 22px; border-radius: 10px; background: var(--p-surface); border: 1px solid var(--line); }
.pair h3 { margin-top: 0; }
@media (max-width: 767px) { .pair { grid-template-columns: 1fr; } }

/* ---- tables (errors, limits, endpoints): scroll inside their own box on a phone, never the page ---- */
.d-scroll { overflow-x: auto; margin-top: var(--s-5); border: 1px solid var(--line); border-radius: 10px; background: var(--p-surface); }
.d-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.d-table th { text-align: left; font: 500 var(--t-label)/1.4 var(--font-text); color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.d-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.d-table tr:last-child td { border-bottom: 0; }
.d-table td:first-child { white-space: nowrap; }
.d-table code { font: 400 14px/1.5 var(--font-mono); }
.d-table .m { display: inline-block; min-width: 44px; font: 500 13px/1 var(--font-mono); color: #0a5fb4; }

/* ---- code: a dark block with its language named above; scrolls inside itself ---- */
.code { margin-top: var(--s-5); border-radius: 10px; overflow: hidden; background: var(--p-inv-bg); color: #e6ebf3; }
.code__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 8px 0 16px; border-bottom: 1px solid rgb(255 255 255 / .08); }
.code__lang { font: 500 13px/1 var(--font-mono); color: #a9b2c0; }
.code pre { margin: 0; padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 14px/1.65 var(--font-mono); tab-size: 2; }
.code pre:focus-visible { outline: 2px solid #5fb0ff; outline-offset: -2px; }
.code .c { color: #8f9aab; }
.code .s { color: #9fd6ff; }
.code .k { color: #ffcf8a; }

/* the prompt to copy: one line and its button */
.prompt-box .code__bar { height: 52px; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 8px; cursor: pointer;
  font: 500 14px/1 var(--font-text); color: #fff; background: rgb(255 255 255 / .1); transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.copy-btn:hover { background: rgb(255 255 255 / .18); }
.copy-btn:active { transform: scale(.97); }
.copy-btn:focus-visible { outline: 2px solid #5fb0ff; outline-offset: 2px; }
.copy-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn .done { display: none; color: #6fd39a; }
.prompt-box.is-copied .copy-btn .idle { display: none; }
.prompt-box.is-copied .copy-btn .done { display: block; }
.prompt-box pre { font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-box .caret { color: #5fb0ff; margin-right: .6ch; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- glossary: term and meaning in one row each ---- */
.terms { display: grid; margin-top: var(--s-5); max-width: 820px; }
.terms > div { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: var(--s-5); padding: 14px 0; border-bottom: 1px solid var(--line); }
.terms dt { font-weight: 500; font-size: 17px; line-height: 1.5; }
.terms dd { margin: 0; font-size: 16px; line-height: 1.6; }
@media (max-width: 639px) { .terms > div { grid-template-columns: 1fr; row-gap: 4px; } }

/* ---- FAQ: open answers (system.md: no accordion) ---- */
.qa { display: grid; margin-top: var(--s-5); max-width: 820px; }
.qa > div { padding: 18px 0; border-bottom: 1px solid var(--line); }
.qa h3 { margin: 0 0 var(--s-2); font-size: 18px; }

/* ---- previous / next ---- */
.docs-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-9); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.docs-pager a { display: grid; gap: 4px; padding: 16px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--p-surface); font-weight: 500; font-size: 17px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.docs-pager a span { font: 500 var(--t-label)/1.4 var(--font-text); color: var(--muted); }
.docs-pager a:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.docs-pager__next { grid-column: 2; text-align: right; }
@media (max-width: 639px) { .docs-pager { grid-template-columns: 1fr; } .docs-pager__next { grid-column: 1; } .docs-pager > span:empty { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .docs-pager a, .linkrows a::after, .copy-btn, .docs-side a { transition: none; }
  .docs-pager a:hover { transform: none; }
}
.d-table td:not(:last-child) code { white-space: nowrap; }
@media (max-width: 639px) { .d-table td, .d-table td code { white-space: normal; overflow-wrap: anywhere; } .d-table th, .d-table td { padding: 10px 12px; } }
