/* Quick start: documentation layout (sticky TOC + article). Page-specific; shared styles live in site.css. */

/* ---------- Layout ---------- */
.docs { padding-block: clamp(48px, 6vw, 88px) var(--section); }
.docs__layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.docs__toc { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain; }
.docs__article { min-width: 0; }

/* ---------- Table of contents ---------- */
.toc__summary { display: none; list-style: none; }
.toc__summary::-webkit-details-marker { display: none; }
.toc__title { margin-bottom: 14px; }
.toc__list { list-style: none; border-left: 1px solid var(--line-strong); }
.toc__list a {
  position: relative; display: flex; gap: 12px; align-items: baseline; padding: 7px 12px 7px 16px;
  font-size: .93rem; font-weight: 500; line-height: 1.3; color: var(--text-2); text-decoration: none; transition: color .15s, background .15s;
}
.toc__list a span { font-family: var(--mono); font-size: .7rem; letter-spacing: .04em; color: var(--text-2); }
.toc__list a::before { content: ""; position: absolute; left: -2px; top: 6px; bottom: 6px; width: 3px; background: var(--crimson); transform: scaleY(0); transition: transform .2s var(--ease); }
.toc__list a:hover { color: var(--text); }
.toc__list a[aria-current="true"] { color: var(--text); font-weight: 700; }
.toc__list a[aria-current="true"]::before { transform: scaleY(1); }
.toc__list a[aria-current="true"] span { color: var(--crimson); }
.toc__manual { display: inline-block; margin: 20px 0 0 17px; font-size: .86rem; font-weight: 700; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.toc__manual:hover { color: var(--crimson); }

@media (max-width: 980px) {
  .docs { padding-top: 0; }
  .docs__layout { grid-template-columns: 1fr; gap: 0; }
  /* Compact jump menu that sticks under the site header */
  .docs__toc { position: sticky; top: calc(var(--bar-height) + 1px); z-index: 20; max-height: none; overflow: visible; margin-inline: calc(-1 * var(--gutter)); }
  .toc { background: var(--white); border-bottom: 1px solid var(--line-strong); }
  .toc__summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 8px var(--gutter); cursor: pointer; }
  .toc__summary::after { content: ""; flex: none; width: 8px; height: 8px; border: solid var(--text); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
  .toc[open] .toc__summary::after { transform: translateY(2px) rotate(225deg); }
  .toc__current { margin-left: auto; font-weight: 700; font-size: .95rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toc__nav { position: absolute; left: 0; right: 0; top: 100%; max-height: min(64vh, 480px); overflow-y: auto; padding: 8px var(--gutter) 20px; background: var(--white); border-bottom: 1px solid var(--line-strong); box-shadow: 0 24px 40px -24px rgba(10, 18, 24, .45); }
  .toc__title { display: none; }
  .toc__list a { padding-block: 11px; font-size: 1rem; }
  .no-js .toc__nav { position: static; box-shadow: none; max-height: none; }
  .doc-section, .cmd-entry[id] { scroll-margin-top: 56px; }
}

/* ---------- Sections ---------- */
.doc-section { padding-block: clamp(40px, 5vw, 64px); border-top: 1px solid var(--line-strong); }
.doc-section:first-child { border-top: 0; padding-top: 0; }
.doc-head { margin-bottom: 28px; }
.doc-no { margin: 0 0 14px; font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; color: var(--crimson); }
.doc-head .h-display { font-size: clamp(1.9rem, 3.4vw, 2.75rem); }
.doc-sub { margin: 40px 0 12px; font-size: 1.25rem; font-weight: 800; font-variation-settings: "wdth" 112; line-height: 1.15; }
.doc-text { max-width: 68ch; color: var(--text-2); }
.doc-text strong, .doc-aside strong { color: var(--text); font-weight: 600; }
.doc-section .prose { max-width: 68ch; }
.doc-section p a, .doc-section li a { text-underline-offset: 3px; text-decoration-color: rgba(166, 3, 33, .5); }
.doc-section p a:hover, .doc-section li a:hover { color: var(--crimson); }
.doc-aside { max-width: 68ch; margin: 28px 0 0; color: var(--text-2); font-size: .95rem; }
.docs-video { margin-bottom: 8px; }
.docs-video img { object-position: top left; }

/* ---------- Figures ---------- */
.docs-fig { width: 100%; max-width: var(--w, 640px); margin: 24px 0 0; }
.docs-fig .window { box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 40px -28px rgba(4, 20, 30, .6), 0 0 0 1px rgba(10, 18, 24, .5); }
.docs-fig .window img { background: #fff; }
.docs-fig .figure-caption { align-items: baseline; }
.docs-fig .figure-caption kbd { font-size: .95em; }
.fig-row { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: flex-start; }
.fig-row .docs-fig { flex: 0 1 var(--w, 640px); }
.cmd-entry .docs-fig { margin-top: 18px; }

/* ---------- Command entries ---------- */
.cmd-entry { position: relative; margin-top: 8px; padding: 26px 0 8px 26px; border-left: 1px solid var(--line-strong); }
.cmd-entry::before { content: ""; position: absolute; left: -4px; top: 34px; width: 7px; height: 7px; background: var(--crimson); }
.cmd-entry > p { max-width: 68ch; margin: 0 0 12px; color: var(--text-2); }
.cmd-entry > p kbd { color: var(--navy); }
.cmd-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; margin: 0 0 12px; font-size: 1rem; line-height: 1.3; }
.cmd-title kbd { padding: .14em .6em .18em; font-size: 1.12rem; font-weight: 600; background: var(--white); border-color: rgba(3, 50, 75, .32); }
.cmd-title > span { margin-left: 6px; font-family: var(--mono); font-size: .76rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.cmd-title__plain { margin: 0 !important; font-family: var(--font) !important; font-size: 1.3rem !important; font-weight: 800 !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--text) !important; font-variation-settings: "wdth" 112; }

/* Option list (CURVEARRAY) */
.optlist { margin: 22px 0 0; max-width: 72ch; border-top: 1px solid var(--line); }
.optlist > div { display: grid; grid-template-columns: 11rem 1fr; gap: 4px 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.optlist dt { font-family: var(--mono); font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--text); }
.optlist dd { margin: 0; color: var(--text-2); font-size: .97rem; }
.optlist em { font-style: normal; font-weight: 600; color: var(--text); }
@media (max-width: 600px) { .optlist > div { grid-template-columns: 1fr; } .cmd-entry { padding-left: 18px; } }

/* Plain numbered list (short procedures) */
.plain-steps { max-width: 68ch; margin: 24px 0 14px; padding: 0; list-style: none; counter-reset: ps; }
.plain-steps li { position: relative; padding: 0 0 12px 40px; color: var(--text-2); counter-increment: ps; }
.plain-steps li::before { content: counter(ps); position: absolute; left: 0; top: 2px; width: 26px; height: 26px; display: grid; place-items: center; font-family: var(--mono); font-size: .76rem; font-weight: 600; color: var(--crimson); border: 1px solid var(--crimson); border-radius: 3px; }

/* SCBEDIT walkthrough */
.steps { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: step; }
.step { position: relative; padding: 0 0 36px 64px; counter-increment: step; }
.step::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 44px; height: 44px; display: grid; place-items: center; font-family: var(--mono); font-size: .95rem; font-weight: 600; color: #fff; background: var(--navy); border-radius: 3px; }
.step::after { content: ""; position: absolute; left: 21px; top: 54px; bottom: 10px; width: 1px; background: var(--line-strong); }
.step:last-child { padding-bottom: 8px; }
.step:last-child::after { display: none; }
.step__title { margin: 8px 0 8px; font-size: 1.2rem; font-weight: 800; font-variation-settings: "wdth" 110; line-height: 1.2; }
.step > p { max-width: 62ch; margin: 0 0 4px; color: var(--text-2); }
.step strong { color: var(--text); font-weight: 600; }
@media (max-width: 600px) { .step { padding-left: 52px; } .step::before { width: 36px; height: 36px; font-size: .85rem; } .step::after { left: 17px; top: 46px; } }

/* ---------- Callouts ---------- */
.callout { max-width: 68ch; margin: 22px 0 8px; padding: 16px 20px 6px; background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: 0 var(--radius) var(--radius) 0; }
.callout__label { margin: 0 0 6px; font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); }
.callout p:not(.callout__label) { margin: 0 0 12px; color: var(--text); font-size: .97rem; }
.callout--warn { border-left-color: var(--crimson); background: #fbf2f3; }
.callout--warn .callout__label { color: var(--crimson); }
.callout--info { margin-top: 12px; }

/* ---------- Key tables ---------- */
.table-scroll { margin-top: 8px; overflow-x: auto; }
.keytable { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line-strong); font-size: .96rem; }
.keytable th, .keytable td { padding: 13px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.keytable thead th { font-family: var(--mono); font-size: .7rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-inv-2); background: var(--ink); border-bottom: 0; }
.keytable tbody th { width: 11.5rem; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.keytable tbody th kbd { font-weight: 600; }
.keytable td { color: var(--text-2); }
.keytable td:nth-child(2) { width: 8.5rem; font-weight: 600; color: var(--text); }
.keytable td kbd { white-space: nowrap; }
.keytable tbody tr:last-child th, .keytable tbody tr:last-child td { border-bottom: 0; }
.keytable tbody tr:hover { background: rgba(3, 50, 75, .035); }
.keytable--shortcuts td { color: var(--text); }
.keytable--shortcuts tbody th { width: 14rem; }
@media (max-width: 640px) {
  .keytable th, .keytable td { padding: 11px 12px; font-size: .92rem; }
  .keytable tbody th { width: 6.5rem; white-space: normal; }
  .keytable td:nth-child(2) { width: 4.8rem; }
  .keytable--shortcuts tbody th { width: 7.5rem; }
}

/* ---------- Chip list (scaffolding) ---------- */
.chiplist { max-width: 68ch; margin: 4px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.chiplist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 11px 0; color: var(--text-2); border-bottom: 1px solid var(--line); }
.chiplist small { font-size: .88rem; color: var(--text-2); }
.chiplist small::before { content: "— "; }

.doc-text--example { margin-top: 28px; }
.docs-fig .figure-caption > span { min-width: 0; }

.keytable--shortcuts thead th:first-child { width: 14rem; }
@media (max-width: 640px) { .keytable--shortcuts thead th:first-child { width: 7.5rem; } }

/* Library key table: stack rows on phones (key + option on one line, action below) */
@media (max-width: 640px) {
  .keytable:not(.keytable--shortcuts) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .keytable:not(.keytable--shortcuts), .keytable:not(.keytable--shortcuts) tbody { display: block; }
  .keytable:not(.keytable--shortcuts) tr { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .keytable:not(.keytable--shortcuts) tbody tr:last-child { border-bottom: 0; }
  .keytable:not(.keytable--shortcuts) tbody th, .keytable:not(.keytable--shortcuts) td { display: block; width: auto !important; padding: 0; border: 0; }
  .keytable:not(.keytable--shortcuts) td:nth-child(3) { grid-column: 1 / -1; margin-top: 6px; }
}

/* Mobile: the sticky TOC sits directly above the first section, so give it room */
@media (max-width: 980px) { .docs__article .doc-section:first-child { padding-top: 28px; } }

.docs-fig.w-300 { --w: 300px; }
.docs-fig.w-345 { --w: 345px; }
.docs-fig.w-347 { --w: 347px; }
.docs-fig.w-489 { --w: 489px; }
.docs-fig.w-503 { --w: 503px; }
.docs-fig.w-547 { --w: 547px; }
.docs-fig.w-616 { --w: 616px; }
.toc__summary .label { white-space: nowrap; flex: none; }
@media (min-width: 720px) { .fig-row { flex-wrap: nowrap; } .fig-row .docs-fig { min-width: 0; } }
@media (max-width: 980px) { .no-js .docs__toc { position: static; } }
