/* Docs page — same tokens and Inter stack as styles.css */

.docs-page {
  overflow-x: hidden;
}

.docs-skip {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 200;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--brand-white);
  font-weight: 600;
  transform: translateY(-160%);
}

.docs-skip:focus,
.docs-skip:focus-visible {
  transform: translateY(0);
  color: var(--brand-white);
  outline: 2px solid var(--brand-white);
  outline-offset: 2px;
}

.docs-page .nav-link[aria-current="page"] {
  color: var(--text-main);
  font-weight: 600;
}

.docs-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.docs-shell {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 32px 72px;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.docs-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.docs-toc-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
}

.docs-toc-toggle:hover {
  border-color: var(--color-primary);
}

.docs-toc-toggle[aria-expanded="true"] {
  background: var(--bg-card);
  border-color: var(--color-primary);
}

.docs-search {
  flex: 1 1 auto;
  min-width: 0;
}

.docs-search-input {
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font: inherit;
  font-size: 0.95rem;
}

.docs-search-input::placeholder {
  color: var(--text-subtle);
}

.docs-search-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.docs-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.docs-toc-backdrop {
  display: none;
}

.docs-toc {
  min-width: 0;
}

.docs-toc-title,
.docs-otp-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.docs-toc-group {
  margin-bottom: 16px;
}

.docs-toc-section {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0;
}

.docs-toc-section:hover {
  color: var(--text-main);
}

.docs-toc-articles {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.docs-toc-link,
.docs-otp-link {
  display: block;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.docs-toc-link:hover,
.docs-otp-link:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.docs-toc-link[aria-current="true"],
.docs-otp-link[aria-current="true"] {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

.docs-content {
  min-width: 0;
  max-width: 760px;
}

.docs-hero {
  margin-bottom: 36px;
}

.docs-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 12px;
}

.docs-lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 8px;
}

.docs-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.docs-empty {
  padding: 18px 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-muted);
  margin-bottom: 24px;
}

.docs-section {
  margin-bottom: 48px;
  scroll-margin-top: 96px;
}

.docs-section > h2 {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.docs-section-intro {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.docs-article {
  margin: 0 0 36px;
  padding-bottom: 8px;
  scroll-margin-top: 96px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.docs-article h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px;
}

.docs-copy {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  min-height: 32px;
}

.docs-copy:hover {
  border-color: var(--color-primary);
  color: var(--text-main);
}

.docs-content p {
  margin: 0 0 0.9em;
  color: var(--text-main);
  line-height: 1.7;
}

.docs-content ol,
.docs-content ul {
  margin: 0 0 1em;
  padding-left: 1.35em;
  color: var(--text-main);
}

.docs-content li + li {
  margin-top: 0.4em;
}

.docs-content li::marker {
  color: var(--text-muted);
}

.docs-content kbd {
  display: inline-block;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  font-size: 0.82em;
  font-weight: 650;
  line-height: 1.2;
  padding: 0.12em 0.42em;
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-main);
  white-space: nowrap;
}

.docs-content b {
  font-weight: 700;
  color: var(--text-main);
}

.docs-callout {
  margin: 0 0 1.1em;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.docs-callout-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: var(--text-main);
}

.docs-callout-body {
  margin: 0;
  color: var(--text-main);
}

.docs-callout-tip {
  background: var(--tip-surface);
  border-left: 3px solid var(--tip-line);
}

.docs-callout-note {
  background: var(--note-surface);
  border-left: 3px solid var(--note-line);
}

.docs-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 0 0 1.1em;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  color: var(--text-main);
}

.docs-table th {
  background: var(--bg-subtle);
  font-weight: 700;
}

.docs-table tbody tr:last-child th,
.docs-table tbody tr:last-child td {
  border-bottom: none;
}

.docs-figure {
  margin: 0 0 1.25em;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.docs-zoom {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  color: inherit;
}

.docs-zoom img {
  /* Small crops (a card, a dialog) keep their own size (max-width set from the file) instead of
     being blown up blurry; width stays 100% so a lazy image keeps its box before it loads. */
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.docs-figure figcaption {
  padding: 10px 14px 12px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.docs-otp {
  display: none;
  min-width: 0;
}

.docs-otp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-lightbox {
  width: min(96vw, 1600px);
  max-height: 92vh;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 12px 12px 16px;
}

.docs-lightbox::backdrop {
  background: var(--lightbox-backdrop);
}

.docs-lightbox-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.docs-lightbox-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 1.35rem;
  line-height: 1;
}

.docs-lightbox-close:hover {
  border-color: var(--color-primary);
}

.docs-lightbox img {
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: var(--bg-page);
}

.docs-lightbox-caption {
  margin: 10px 4px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

@media (min-width: 901px) {
  .docs-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 36px;
  }

  .docs-toc {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    padding-right: 8px;
    transform: none;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (min-width: 1200px) {
  .docs-layout {
    grid-template-columns: 240px minmax(0, 760px) 210px;
    justify-content: space-between;
  }

  .docs-otp {
    display: block;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
  }
}

.docs-toc-float { display: none; }
.docs-toc-float[hidden] { display: none; }

@media print {
  .docs-toc-float { display: none !important; }
}

.docs-toc-close { display: none; }

/* Q-575: the phone TOC panel, its backdrop and the edge arrow start at the bottom of the sticky site header
   (.top in v4.css: 77 px from 861 px, 65 px at <= 860 px). */
:root { --docs-drawer-top: 77px; }
@media (max-width: 860px) { :root { --docs-drawer-top: 65px; } }

@media (max-width: 900px) {
  .docs-toc-float:not([hidden]) {
    display: inline-flex;
    position: fixed;
    left: 0;
    top: calc(var(--docs-drawer-top) + 20px);
    z-index: 30;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--line-2);
    border-left: 0;
    border-radius: 0 12px 12px 0;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 4px 16px var(--shadow);
    cursor: pointer;
    touch-action: manipulation;
  }
  .docs-toc-float:focus-visible { outline: 2px solid var(--blue); outline-offset: -4px; }
  .docs-toc-float svg { width: 20px; height: 20px; }
  .docs-toc-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .docs-toc-header .docs-toc-title { margin: 0; }
  .docs-toc-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-surface); color: var(--text-main); font-size: 24px; cursor: pointer; }
  .docs-toc-close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
  .docs-toc-toggle {
    display: inline-flex;
  }

  .docs-toc-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: var(--docs-drawer-top) 0 0 0;
    background: var(--toc-backdrop);
    z-index: 80;
  }

  .docs-toc {
    position: fixed;
    top: var(--docs-drawer-top);
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(88vw, 320px);
    padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform var(--motion-panel) var(--ease-standard), visibility var(--motion-panel);
  }

  .docs-toc.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    /* visible at once when opening so docs.js can move focus into the panel */
    transition: transform var(--motion-panel) var(--ease-standard), visibility 0s;
  }

  body.docs-toc-open {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .docs-shell {
    padding: 16px 16px 56px;
  }

  .docs-hero h1 {
    font-size: 1.55rem;
  }

  .docs-section > h2 {
    font-size: 1.25rem;
  }
}

@media (max-width: 360px) {
  .docs-shell {
    padding: 12px 12px 48px;
  }

  .docs-toolbar {
    gap: 8px;
  }

  .docs-toc-toggle {
    padding: 8px 12px;
  }

  .docs-content kbd {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-skip,
  .docs-toc,
  .docs-toc-toggle,
  .docs-copy,
  .docs-search-input {
    transition: none;
  }
}
/* S16 — legal pages share the documentation surface and theme. */
.legal-page { min-height: 100vh; color: var(--text-primary, var(--legal-text-fallback)); background: var(--bg-primary, var(--legal-ground-fallback)); }
.legal-topbar { position: sticky; top: 0; z-index: 5; }
.legal-shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 72px; }
.legal-article { padding: clamp(24px, 5vw, 56px); border: 1px solid var(--border, var(--legal-line-fallback)); border-radius: 20px; background: var(--surface, var(--legal-surface-fallback)); }
.legal-article h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.1; }
.legal-kicker { color: var(--legal-accent); font-weight: 700; letter-spacing: .08em; }
.legal-version { margin: 14px 0 36px; color: var(--text-secondary, var(--legal-muted-fallback)); }
.legal-copy h2 { margin: 36px 0 12px; font-size: 1.35rem; }
.legal-copy p, .legal-copy li { line-height: 1.75; }
.legal-copy p { margin: 0 0 14px; }  /* PM 29/09: paragraphs ran together */
.legal-copy ul { padding-left: 1.5rem; }
.legal-copy ul ul { margin-top: .45rem; }
.legal-footer { padding: 0 16px 48px; text-align: center; }
@media (max-width: 640px) { .legal-shell { width: min(100% - 20px, 920px); padding-top: 24px; } }

/* Q585: release history has two columns, including at wide desktop sizes. */
@media (min-width: 1200px) {
  .updates-page .docs-layout { grid-template-columns: 240px minmax(0, 1fr); }
}
.updates-page .updates-includes summary { min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.updates-page .docs-article { overflow-wrap: anywhere; }
