/* Help area /docs/ (render-vtt-docs.mjs). Builds on the tokens and chrome of vtt.css:
   one calm reading column, a quiet sidebar, pictures that open larger on demand. */

.vtt-docs main { padding-block: var(--space-4) var(--space-6); }
.docs-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout: sidebar + reading column (max 760 px). */
.docs-shell { display: grid; grid-template-columns: 260px minmax(0, 760px); gap: var(--space-5); align-items: start; }
.docs-article { min-width: 0; }
.docs-hub { max-width: 1080px; }

/* Sidebar */
.docs-nav { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding-right: 8px; font-size: 14px; scrollbar-width: thin; }
.docs-nav .docs-nav-toggle > summary { display: none; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: var(--radius-s); color: var(--muted); text-decoration: none; line-height: 1.35; }
.docs-nav a:hover { background: var(--surface-2); color: var(--ink); }
.docs-nav a[aria-current="page"] { background: var(--surface-3); color: var(--ink); font-weight: 600; }
.docs-nav-top { margin-bottom: 12px !important; }
.docs-nav-label { margin: 16px 0 4px; }
.docs-nav-label a { color: var(--ink); font-weight: 600; }
.docs-nav-groups details summary { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 6px 10px; border-radius: var(--radius-s); color: var(--subtle); cursor: pointer; list-style: none; }
.docs-nav-groups details summary::-webkit-details-marker { display: none; }
.docs-nav-groups details summary::after { content: '+'; color: var(--dim); font-family: var(--mono); }
.docs-nav-groups details[open] > summary::after { content: '−'; }
.docs-nav-groups details summary:hover { color: var(--ink); background: var(--surface-2); }
.docs-nav-groups details ul { padding-left: 10px; border-left: 1px solid var(--hairline); margin: 2px 0 6px 10px; }

/* Breadcrumb, headings, text */
.docs-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 var(--space-3); padding: 0; list-style: none; color: var(--dim); font: 500 12px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.docs-breadcrumb li:not(:last-child)::after { content: '/'; margin-left: 8px; color: var(--divider); }
.docs-breadcrumb li { font: inherit; }
.docs-breadcrumb a { color: var(--subtle); text-decoration: none; }
.docs-breadcrumb a:hover { color: var(--ink); }
.docs-head { margin-bottom: var(--space-4); }
.docs-head h1, .docs-hub-head h1 { margin: 0; font: 600 clamp(36px, 5vw, 56px)/1.04 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.docs-lead { max-width: 640px; margin: 18px 0 0; color: var(--muted); font-size: 19px; line-height: 1.55; text-wrap: pretty; }
.docs-article h2 { margin: var(--space-5) 0 14px; font: 600 clamp(24px, 2.6vw, 30px)/1.2 var(--display); letter-spacing: -.02em; }
.docs-article h3 { margin: 28px 0 8px; font: 600 18px/1.35 var(--font); }
:where(.docs-article) :where(p, li, dd) { font-size: 17px; line-height: 1.7; text-wrap: pretty; }
:where(.docs-article) p { margin: 0 0 14px; }
.docs-article :where(a:not(.docs-zoom)) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--divider); text-underline-offset: 3px; }
.docs-article :where(a:not(.docs-zoom)):hover { text-decoration-color: currentColor; }
.docs-article strong { color: var(--ink); font-weight: 600; }
.docs-article code, .docs-article kbd { padding: 1px 6px; border: 1px solid var(--divider); border-radius: 6px; background: var(--surface-2); font: 500 .88em/1.4 var(--mono); white-space: nowrap; }
.docs-meta-line { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 18px; color: var(--subtle); font: 500 13px/1.5 var(--mono); }
.docs-meta-line a { color: var(--muted); }

/* Steps with pictures */
.docs-steps { counter-reset: step; margin: 0; padding: 0; list-style: none; }
.docs-steps > li { position: relative; counter-increment: step; padding: 0 0 var(--space-4) 52px; }
.docs-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--berry-deep); color: #fff; font: 600 15px/1 var(--font); }
.docs-steps > li > p { margin-bottom: 14px; }
.docs-manual-steps { padding-left: 1.3em; }
.docs-manual-steps li { margin-bottom: 10px; padding-left: 4px; }
.docs-figure { margin: 0; }
.docs-figure img { display: block; max-width: 100%; height: auto; border-radius: 10px; box-shadow: var(--shot-shadow); background: var(--surface-1); }
.docs-figure figcaption { margin-top: 10px; color: var(--subtle); font-size: 14px; line-height: 1.5; }
.docs-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.docs-pair figcaption { grid-column: 1 / -1; }
.docs-pair-stack { grid-template-columns: minmax(0, 1fr); justify-items: start; }
.docs-pair img { width: 100%; }
.docs-pair-stack img { width: auto; }
.docs-zoom { display: block; border-radius: 10px; cursor: zoom-in; }
.docs-zoom:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.docs-clip { margin: 0 0 var(--space-4); }
.docs-clip-label { margin: 0 0 10px !important; color: var(--accent); font: 500 11px/1.5 var(--mono) !important; letter-spacing: .14em; text-transform: uppercase; }
.docs-clip-frame { border-radius: 12px; overflow: hidden; box-shadow: var(--shot-shadow); background: var(--surface-1); }
.docs-clip figcaption { margin-top: 10px; color: var(--subtle); font-size: 14px; line-height: 1.5; }
.docs-tip { margin: 0 0 var(--space-3); padding: 16px 20px; border-left: 3px solid var(--amber); border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--surface-2); }
.docs-tip > strong { display: block; margin-bottom: 4px; color: var(--amber); font: 500 11px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.docs-tip p { margin: 0; }
.docs-result { padding: 16px 20px; border-radius: var(--radius-s); background: var(--surface-1); border: 1px solid var(--hairline); }
.docs-credit { margin-top: var(--space-3) !important; color: var(--dim); font-size: 13px !important; line-height: 1.5 !important; }
.docs-credit a { color: var(--subtle) !important; }

/* Pager, more, foot */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: var(--space-4); }
.docs-pager a { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--divider); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color var(--fast), background-color var(--fast); }
.docs-pager a:hover { border-color: var(--line); background: var(--surface-1); }
.docs-pager span { color: var(--subtle); font: 500 11px/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.docs-pager strong { font-size: 16px; line-height: 1.35; }
.docs-pager-next { text-align: right; grid-column: 2; }
.docs-more-block ul, .docs-next-steps ul { padding-left: 1.2em; }
.docs-article-foot { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--hairline); color: var(--dim); }
.docs-article-foot p { font-size: 14px !important; margin: 0 0 6px !important; }

/* Lists of guides and topics */
.docs-guide-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.docs-guide-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 14px 18px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface-1); transition: border-color var(--fast); }
.docs-guide-list li:hover { border-color: var(--divider); }
.docs-guide-list a { display: grid; gap: 4px; color: inherit !important; text-decoration: none !important; }
.docs-guide-list a strong { font-size: 17px; line-height: 1.35; }
.docs-guide-list a span { color: var(--subtle); font-size: 15px; line-height: 1.5; }
.docs-guide-list .docs-meta { color: var(--dim); font: 500 12px/1.5 var(--mono); white-space: nowrap; }
.docs-guide-group { scroll-margin-top: 96px; }
.docs-stages { margin: 0; padding: 0; list-style: none; counter-reset: stage; }
.docs-stages > li { counter-increment: stage; padding-bottom: var(--space-4); }
.docs-stages h2::before { content: counter(stage, decimal-leading-zero); margin-right: 14px; color: var(--accent); font: 500 14px/1 var(--mono); letter-spacing: .1em; vertical-align: middle; }
.docs-stage-link { font-weight: 600; }
.docs-toc { margin: 0 0 var(--space-4); padding: 16px 20px; border: 1px solid var(--hairline); border-radius: var(--radius); }
.docs-toc p { margin: 0 0 6px !important; color: var(--subtle); font: 500 11px/1.5 var(--mono) !important; letter-spacing: .14em; text-transform: uppercase; }
.docs-toc ol { margin: 0; padding-left: 1.2em; }
.docs-toc li { font-size: 15px !important; line-height: 1.6 !important; }

/* Questions and glossary */
.docs-jump ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.docs-jump a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border: 1px solid var(--divider); border-radius: 999px; color: var(--muted) !important; font-size: 14px; text-decoration: none !important; }
.docs-jump a:hover { color: var(--ink) !important; border-color: var(--line); }
.docs-faq-group { scroll-margin-top: 96px; }
.docs-question { border-bottom: 1px solid var(--hairline); scroll-margin-top: 96px; }
.docs-question summary { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; font-size: 17px; font-weight: 600; line-height: 1.45; cursor: pointer; list-style: none; }
.docs-question summary::-webkit-details-marker { display: none; }
.docs-question summary::after { content: '+'; flex: none; color: var(--dim); font: 500 18px/1.3 var(--mono); }
.docs-question[open] summary::after { content: '−'; }
.docs-question summary:hover { color: var(--ink); }
.docs-answer { padding-bottom: 14px; color: var(--muted); }
.docs-answer-link { font-size: 15px !important; }
.docs-glossary { margin: 0; }
.docs-glossary dt { margin-top: 28px; font: 600 19px/1.35 var(--font); scroll-margin-top: 96px; }
.docs-glossary dd { margin: 6px 0 0; color: var(--muted); }
.docs-glossary dd p { margin: 0 0 6px; }
.docs-atlas dt { margin-top: 22px; font-weight: 600; font-size: 17px; scroll-margin-top: 96px; }
.docs-atlas dd { margin: 4px 0 0; color: var(--muted); }
.docs-table-scroll { overflow-x: auto; }
.docs-shortcuts { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; }
.docs-col-action { width: 50%; }
.docs-shortcuts th, .docs-shortcuts td { overflow-wrap: normal; word-break: normal; }
.docs-shortcuts th, .docs-shortcuts td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.docs-shortcuts thead th { color: var(--subtle); font: 500 11px/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.docs-shortcuts tbody th { font-weight: 500; }
.docs-article :target { scroll-margin-top: 96px; }

/* Hub */
.docs-hub-head { max-width: 760px; margin: 0 0 var(--space-5); }
.docs-hub-head .vtt-eyebrow { margin-bottom: 16px; }
.docs-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.docs-card { border: 1px solid var(--divider); border-radius: var(--radius); background: var(--surface-1); transition: border-color var(--fast); }
.docs-card:hover { border-color: var(--line); }
.docs-card > a, .docs-card-plain { display: grid; gap: 8px; align-content: start; height: 100%; padding: 20px; color: var(--ink); text-decoration: none; }
.docs-card strong { font: 600 19px/1.3 var(--display); }
.docs-card span { color: var(--subtle); font-size: 15px; line-height: 1.5; }
.docs-card-links { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.docs-card-links a { color: var(--muted); font-size: 15px; text-decoration: underline; text-decoration-color: var(--divider); text-underline-offset: 3px; }
.docs-card-links a:hover { color: var(--ink); }
.docs-hub h2 { margin: 0 0 var(--space-3); font: 600 clamp(24px, 2.6vw, 30px)/1.2 var(--display); letter-spacing: -.02em; }
.docs-hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.docs-hub-group h3 { margin: 0 0 8px; color: var(--subtle); font: 500 12px/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.docs-hub-group ul, .docs-hub-questions ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.docs-hub-group a, .docs-hub-questions a { color: var(--ink); font-size: 16px; line-height: 1.45; text-decoration: underline; text-decoration-color: var(--divider); text-underline-offset: 3px; }
.docs-hub-group a:hover, .docs-hub-questions a:hover { text-decoration-color: currentColor; }
.docs-hub-group .docs-more { display: inline-flex; align-items: center; min-height: 44px; color: var(--subtle); font-size: 14px; text-decoration: none; }
.docs-hub-group a, .docs-hub-questions a, .docs-card-links a { display: inline-flex; align-items: center; min-height: 32px; }
.docs-hub-groups { margin-bottom: var(--space-5); }

/* Search */
.docs-search { position: relative; display: flex; gap: 8px; margin: 0 0 16px; }
.docs-search input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px; border: 1px solid var(--control-line); border-radius: var(--radius-s); background: var(--surface-1); color: var(--ink); font: 400 15px/1.4 var(--font); }
.docs-search input::placeholder { color: var(--dim); }
.docs-search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.docs-search button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--divider); border-radius: var(--radius-s); background: var(--surface-2); color: var(--ink); font: 600 14px/1 var(--font); cursor: pointer; }
.docs-search-big { margin-top: var(--space-3); }
.docs-search-big input { min-height: 56px; font-size: 18px; padding-inline: 18px; }
.docs-search-big button { min-height: 56px; padding-inline: 22px; font-size: 16px; }
.docs-search-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 520px); overflow: auto; padding: 6px; border: 1px solid var(--divider); border-radius: var(--radius); background: var(--surface); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .8); }
.docs-search-panel[hidden], .docs-search-results[hidden], .docs-search-empty[hidden] { display: none; }
.docs-search-results [role="option"] { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; cursor: pointer; }
.docs-search-results [role="option"][aria-selected="true"], .docs-search-results [role="option"]:hover { background: var(--surface-3); }
.docs-search-results small { color: var(--accent); font: 500 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.docs-search-results strong { font-size: 15px; line-height: 1.35; }
.docs-search-results span { color: var(--subtle); font-size: 13px; line-height: 1.45; }
.docs-search-empty { margin: 0; padding: 10px 12px; color: var(--subtle); font-size: 14px; }
.docs-nav .docs-search { margin: 0 0 14px; }
.docs-nav .docs-search input { min-height: 40px; font-size: 14px; }
.docs-nav .docs-search button { min-height: 40px; padding-inline: 12px; font-size: 13px; }

/* Picture dialog */
.docs-lightbox { width: min(96vw, 1800px); max-height: 94vh; padding: 0; border: 0; border-radius: 12px; background: var(--bg); box-shadow: 0 40px 120px rgb(0 0 0 / .9); }
.docs-lightbox::backdrop { background: rgb(5 4 3 / .86); }
.docs-lightbox img { display: block; width: 100%; height: auto; max-height: 94vh; object-fit: contain; }
.docs-lightbox form { position: fixed; z-index: 1; top: 12px; right: 12px; }
.docs-lightbox-close { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: rgb(11 9 7 / .85); color: var(--ink); font: 600 14px/1 var(--font); cursor: pointer; }

.docs-toc-side { display: none; }
@media (min-width: 1280px) {
  .docs-shell-toc { grid-template-columns: 240px minmax(0, 760px) 200px; gap: var(--space-4); }
  .docs-toc-side { position: sticky; top: 96px; display: block; max-height: calc(100vh - 120px); overflow: auto; font-size: 13px; }
  .docs-toc-side p { margin: 0 0 8px; color: var(--subtle); font: 500 11px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
  .docs-toc-side ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
  .docs-toc-side a { display: block; padding: 4px 8px; border-left: 1px solid var(--hairline); color: var(--subtle); text-decoration: none; line-height: 1.4; }
  .docs-toc-side a:hover { color: var(--ink); border-left-color: var(--line); }
}
@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .docs-nav { position: static; max-height: none; padding: 0; }
  .docs-nav .docs-nav-toggle > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 12px 16px; border: 1px solid var(--divider); border-radius: var(--radius-s); color: var(--ink); font-weight: 600; cursor: pointer; list-style: none; }
  .docs-nav .docs-nav-toggle > summary::-webkit-details-marker { display: none; }
  .docs-nav .docs-nav-toggle > summary::after { content: '+'; font-family: var(--mono); color: var(--dim); }
  .docs-nav .docs-nav-toggle[open] > summary::after { content: '−'; }
  .docs-nav-body { padding: 12px 4px 4px; }
  .docs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .docs-lightbox { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; overflow: auto; }
  .docs-lightbox img { max-width: none; max-height: none; object-fit: initial; }
}
@media (max-width: 640px) {
  .docs-cards, .docs-hub-grid { grid-template-columns: minmax(0, 1fr); }
  .docs-pair-wide { grid-template-columns: minmax(0, 1fr); }
  .docs-pair-wide img { width: auto; }
  .docs-shortcuts, .docs-shortcuts tbody { display: block; }
  .docs-shortcuts colgroup, .docs-shortcuts thead { display: none; }
  .docs-shortcuts tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
  .docs-shortcuts th, .docs-shortcuts td { padding: 0; border: 0; }
  .docs-shortcuts tbody th { grid-column: 1 / -1; }
  .docs-shortcuts td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--subtle); font: 500 11px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
  .docs-steps > li { padding-left: 0; padding-top: 46px; }
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-pager-next { grid-column: 1; text-align: left; }
  .docs-guide-list li { grid-template-columns: minmax(0, 1fr); }
  .docs-lead { font-size: 17px; }
  .docs-search-big { flex-direction: column; }
}
@media print {
  .docs-nav, .docs-search, .docs-pager, .docs-lightbox, .docs-clip { display: none !important; }
  .docs-shell { display: block; }
}
