/* ---------- Docs pages (page-specific; styles.css has the shared design system) ---------- */

.docs-hero { padding-bottom: clamp(1.5rem, 3vw, 2.2rem); }
.docs-hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); font-weight: 800; max-width: 22ch; }
.docs-meta { margin-top: 1rem; color: var(--mute); font-size: .95rem; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.docs-actions { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: .6rem; }

.docs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
@media (min-width: 1024px) {
  .docs-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; }
}

/* Table of contents: sticky sidebar on desktop, collapsible <details> on small screens */
.toc { font-size: .95rem; }
.toc details { background: var(--white); border: 1px solid var(--line); border-radius: 10px; }
.toc summary {
  cursor: pointer; font-weight: 650; padding: .7rem 1rem; min-height: 44px;
  display: flex; align-items: center; list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; margin-left: auto; font-family: var(--mono); color: var(--mute); }
.toc details[open] summary::after { content: "\2212"; }
.toc ol { list-style: none; margin: 0; padding: 0 .6rem .7rem; }
.toc li a {
  display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .2rem .4rem;
  color: var(--ink-2); text-decoration: none; border-radius: 6px; line-height: 1.3;
}
.toc li a:hover, .toc li a[aria-current="true"] { color: var(--ink); background: var(--paper); }
.toc .n { font-family: var(--mono); font-size: .82rem; color: var(--brass-ink); min-width: 1.4em; }
@media (min-width: 1024px) {
  .toc { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
  .toc details { background: transparent; border: none; }
  .toc summary { pointer-events: none; padding-left: .4rem; }
  .toc summary::after { display: none; }
  .toc ol { padding: 0; }
}

/* Body */
.doc { min-width: 0; max-width: 78ch; }
.doc > section { padding-top: 2.4rem; border-top: 1px solid var(--line); margin-top: 2.4rem; scroll-margin-top: 1rem; }
.doc > section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.doc h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.doc h2 .step {
  font-family: var(--mono); font-size: .9rem; font-weight: 500; color: var(--paper); background: var(--ink);
  border-radius: 999px; padding: .15rem .6rem; flex: none;
}
.doc h3 { margin-top: 1.8rem; font-size: 1.15rem; scroll-margin-top: 1rem; }
.doc p, .doc li { color: var(--ink-2); overflow-wrap: anywhere; }
.doc p { margin: .8rem 0 0; }
.doc ul, .doc ol { padding-left: 1.3em; margin: .8rem 0 0; display: grid; gap: .45rem; }
.doc code {
  font-family: var(--mono); font-size: .88em; background: var(--white); border: 1px solid var(--line);
  border-radius: 4px; padding: .05em .3em; overflow-wrap: anywhere;
}
.doc blockquote { margin: 1rem 0 0; padding: .8rem 1rem; border-left: 3px solid var(--brass); background: var(--white); border-radius: 0 8px 8px 0; color: var(--ink-2); }

.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600;
  border-radius: 999px; padding: .2rem .65rem; border: 1px solid var(--line); background: var(--white); color: var(--ink-2);
  line-height: 1.4;
}
.badge.who-sap { border-color: #9BBFBB; background: #E3EFED; color: #1F4F4B; }
.badge.who-idp { border-color: #C9B6DB; background: #F1EAF7; color: #4A2F66; }
.badge.who-q { border-color: #DCC59A; background: #F7EEDC; color: var(--brass-ink); }
.badge.who-biz { border-color: #B9C6D3; background: #E9EFF5; color: #2B4257; }
.badge.time { font-family: var(--mono); font-weight: 500; }
.badge.status-live { border-color: #9BBFBB; color: #1F4F4B; }
.badge.status-roll { border-color: #E2B4AD; background: #FBEDEA; color: var(--red); }
.badge.status-road { border-color: var(--line); color: var(--mute); }

.status-note { margin-top: 1rem; padding: .8rem 1rem; border: 1px dashed #E2B4AD; border-radius: 8px; background: #FDF6F4; color: var(--ink-2); }

/* Tables */
.table-scroll { overflow-x: auto; margin-top: 1rem; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table-scroll th, .table-scroll td { text-align: left; vertical-align: top; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.table-scroll th { background: var(--paper); font-weight: 650; color: var(--ink); }
.table-scroll tr:last-child td { border-bottom: none; }
.table-scroll td code { white-space: normal; }
.table-scroll.wide table { min-width: 640px; }

/* Code blocks with copy button */
.code { position: relative; margin-top: 1rem; }
.code pre {
  margin: 0; background: var(--ink); color: var(--paper); border-radius: 8px; padding: 1rem 1rem; padding-right: 5.2rem;
  overflow-x: auto; font-family: var(--mono); font-size: .84rem; line-height: 1.5; -webkit-overflow-scrolling: touch;
}
.code pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.copy-btn {
  position: absolute; top: .45rem; right: .45rem; min-height: 44px; min-width: 64px; padding: 0 .8rem;
  font: 600 .8rem var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.copy-btn:hover { background: var(--white); }
.copy-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
html:not(.js) .copy-btn { display: none; }
pre.diagram { padding-right: 1rem; font-size: .78rem; }

.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { position: relative; padding-left: 1.8rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .25em; width: 1.05em; height: 1.05em; border: 2px solid var(--ink-2); border-radius: 3px; }

.doc .footnote { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--mute); }

/* Print: IT saves the guide as a PDF */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .site-head, .site-foot, .skip, .toc, .docs-actions, .copy-btn, .joint { display: none !important; }
  .docs-layout { display: block; }
  .doc { max-width: none; }
  .doc > section { break-inside: auto; }
  .doc h2, .doc h3 { break-after: avoid; }
  .table-scroll, .code pre, .status-note, blockquote { break-inside: avoid; }
  .table-scroll { overflow: visible; border-color: #999; }
  .table-scroll.wide table { min-width: 0; }
  .code pre { background: #f4f4f4; color: #000; border: 1px solid #999; white-space: pre-wrap; overflow: visible; padding-right: 1rem; }
  .doc a { color: #000; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #444; overflow-wrap: anywhere; }
  .badge { border-color: #999 !important; background: #fff !important; color: #000 !important; }
}
