/* =========================================================================
   /docs/ – documentation layout (extends css/site.css)
   ========================================================================= */

.docs { padding-top: 56px; }
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 1024px) {
  .docs-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 48px; }
  .docs-sidebar { position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; overscroll-behavior: contain; }
}

/* ---------- table of contents ---------- */
.docs-sidebar { display: grid; gap: 16px; min-width: 0; }
.docs-toc { padding: 0; }
.docs-toc summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; font-weight: 700; color: var(--ink); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.docs-toc summary::-webkit-details-marker { display: none; }
.docs-toc summary .icon { width: 22px; height: 22px; color: var(--blue); transition: transform 0.2s; }
.docs-toc[open] summary .icon { transform: rotate(180deg); }
.docs-toc nav { padding: 0 12px 16px; }
.docs-toc ul { gap: 2px; }
.docs-toc a { display: block; padding: 7px 10px; border-radius: 10px; font-weight: 600; font-size: 0.93rem; line-height: 1.35; color: var(--text); border-left: 3px solid transparent; }
.docs-toc a.is-main { color: var(--ink); }
.docs-toc a:hover { background: var(--bg-soft); color: var(--blue); }
.docs-toc a.is-active, .docs-toc a[aria-current="true"] { background: var(--blue-soft); color: var(--blue); border-left-color: var(--blue); }
.docs-toc__label { margin: 10px 10px 2px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
@media (min-width: 1024px) {
  .docs-toc summary { cursor: default; pointer-events: none; }
  .docs-toc summary .icon { display: none; }
}

.docs-quicklinks { padding: 18px 20px; }
.docs-quicklinks__title { margin: 0 0 10px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.docs-quicklinks ul { gap: 4px; }
.docs-quicklinks a { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 0.93rem; }
.docs-quicklinks .icon { color: var(--blue); }
@media (max-width: 1023px) { .docs-quicklinks { display: none; } }

/* ---------- content ---------- */
.docs-content { min-width: 0; }
.docs-content > .notice { margin-bottom: 24px; }
.docs-section { padding: 8px 0 40px; }
.docs-section + .docs-section { border-top: 1px solid var(--line); padding-top: 40px; }
.docs-section:last-child { padding-bottom: 0; }
.prose .docs-section h2 { margin-top: 0; font-size: clamp(1.45rem, 2.6vw, 1.8rem); overflow-wrap: anywhere; }
.prose .docs-section h2 .pill { vertical-align: middle; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; margin-left: 6px; padding: 3px 10px; }
.prose .docs-section h3 { font-size: 1.15rem; margin-top: 1.8em; overflow-wrap: anywhere; }
.docs-step { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); margin-bottom: 8px; }
.page-docs .prose a:not(.btn) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.page-docs .prose .docs-figure a { text-decoration: none; }
.docs-steps { padding-left: 1.4em; display: grid; gap: 10px; }
.docs-steps li::marker { color: var(--blue); font-weight: 700; }
.prose kbd { font-family: inherit; font-size: 0.85em; background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0.05em 0.45em; }

/* ---------- code ---------- */
.prose code, .docs-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.86em; background: var(--blue-soft); color: var(--navy); padding: 0.12em 0.4em; border-radius: 6px; overflow-wrap: anywhere;
}
.prose pre {
  margin: 0 0 1.2em; padding: 16px 18px; background: var(--navy); color: #e9ecf8; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 0.88rem; line-height: 1.6; box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; border-radius: 0; overflow-wrap: normal; white-space: pre; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.docs-table { min-width: 620px; font-size: 0.93rem; }
.docs-table th, .docs-table td { padding: 11px 14px; }
.docs-table thead th { position: sticky; top: 0; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.docs-table td:first-child { width: 32%; }
.docs-table td:nth-child(2) { width: 18%; white-space: nowrap; }
.docs-table tbody tr:nth-child(even) { background: #fafbfd; }
.docs-table tbody tr.is-required { background: var(--gold-soft); }
.docs-table tbody tr:last-child td { border-bottom: 0; }
/* phones: each option becomes a small card (name + value on top, description below) – no sideways scrolling */
@media (max-width: 679px) {
  .table-wrap { overflow-x: visible; }
  .docs-table { min-width: 0; }
  .docs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .docs-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .docs-table tbody tr:last-child { border-bottom: 0; }
  .docs-table td { display: block; width: auto !important; padding: 0; border: 0; }
  .docs-table td:nth-child(2) { text-align: right; font-size: 0.85rem; white-space: normal; }
  .docs-table td:nth-child(3) { grid-column: 1 / -1; margin-top: 6px; font-size: 0.92rem; }
}

/* ---------- figures ---------- */
.docs-figure { margin: 8px 0 24px; }
.docs-figure img { display: block; width: auto; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); background: #fff; }
.docs-figure figcaption { margin-top: 8px; font-size: 0.88rem; color: var(--muted); }
.docs-figure--small img { max-width: 420px; }
.docs-figure--icon img { max-width: 160px; border: 0; box-shadow: none; background: transparent; }

/* order-step screenshots (collapsed by default) */
.docs-gallery { margin: 20px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); }
.docs-gallery summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.docs-gallery summary::-webkit-details-marker { display: none; }
.docs-gallery summary .icon { width: 22px; height: 22px; color: var(--blue); transition: transform 0.2s; }
.docs-gallery[open] summary .icon { transform: rotate(180deg); }
.docs-gallery > p { padding: 0 18px; }
.docs-gallery__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 18px 18px; }
.docs-gallery__grid .docs-figure { margin: 0; }
@media (max-width: 679px) { .docs-gallery__grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- video placeholder (click-to-load via site.js) ---------- */
.docs-video { max-width: 640px; margin: 8px 0 24px; background: var(--grad-brand); }
.docs-video::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 220px at 85% 0%, rgba(248, 180, 38, 0.3), transparent 60%), radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px); background-size: auto, 22px 22px; pointer-events: none; }
.docs-video__label { position: absolute; left: 18px; bottom: 16px; right: 18px; color: #fff; font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 0.95rem; pointer-events: none; }
.docs-video__label .icon { color: var(--gold); }

@media (max-width: 679px) {
  .docs { padding-top: 32px; }
  .docs-section + .docs-section { padding-top: 32px; }
  .docs-section { padding-bottom: 32px; }
  .prose pre { font-size: 0.82rem; padding: 14px; }
}
