/* ==========================================================================
   Documentation — aocyber.ai/docs
   --------------------------------------------------------------------------
   Loaded after main.css, on docs pages only. Every value here resolves a token
   already defined in main.css :root — no new palette, no second type system.
   If you find yourself typing a hex value in this file, it belongs in main.css
   as a token instead.

   main.css already ships .prose for rendered markdown (headings, paragraphs,
   lists, links, strong, hr). It does NOT cover code, tables or blockquotes,
   which is most of what a docs page is made of — those are added under
   .docs-body below rather than by forking .prose.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Shell — sidebar | article | contents
   -------------------------------------------------------------------------- */
.docs-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 200px;
  gap: var(--space-3xl);
  max-width: 1440px;
  margin-inline: auto;
  padding: var(--space-3xl) var(--space-lg) var(--space-4xl);
  align-items: start;
}

/* Docs home has no sidebar — let the cards use the full measure. */
.docs-shell--wide { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }

.docs-shell__side {
  position: sticky;
  top: 96px; /* clears the sticky nav */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.docs-shell__main { min-width: 0; } /* lets long code blocks scroll, not stretch */

.docs-shell__toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* --------------------------------------------------------------------------
   2. Sidebar
   -------------------------------------------------------------------------- */
/* Mobile disclosure. The <details> ships without `open`, so it is collapsed by
   default; above 860px the summary is hidden and the nav is force-revealed,
   which is why the desktop sidebar never needs a click. */
.docs-disclosure__summary {
  cursor: pointer;
  list-style: none;
  padding: 10px var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-md);
}

.docs-disclosure__summary::-webkit-details-marker { display: none; }
.docs-disclosure__summary::after { content: " ▾"; color: var(--gold-text); }
.docs-disclosure[open] > .docs-disclosure__summary::after { content: " ▴"; }

@media (min-width: 861px) {
  .docs-disclosure__summary { display: none; }
  /* Override the UA rule that hides non-summary children of a closed details. */
  .docs-disclosure:not([open]) > .docs-sidebar { display: block; }
}

.docs-sidebar__product {
  display: block;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.docs-sidebar__product-name {
  display: block;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.docs-sidebar__product-tagline {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.docs-nav { list-style: none; margin: 0; padding: 0; }

.docs-nav__group { margin-bottom: var(--space-lg); }

.docs-nav__group-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: var(--space-sm);
  transition: color var(--duration) var(--ease-out);
}

.docs-nav__group-title:hover,
.docs-nav__group-title.is-current { color: var(--gold-text); }

.docs-nav__list { list-style: none; margin: 0; padding: 0; }

.docs-nav__link {
  display: block;
  padding: 6px 0 6px var(--space-md);
  border-left: 2px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out);
}

.docs-nav__link:hover { color: var(--text); border-left-color: var(--gold-40); }

.docs-nav__link.is-current {
  color: var(--gold-text);
  border-left-color: var(--gold);
  font-weight: 600;
}

.docs-sidebar__switch {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.docs-sidebar__switch-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.docs-sidebar__switch-link {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
}

.docs-sidebar__switch-link:hover { color: var(--gold-text); }

/* --------------------------------------------------------------------------
   3. Search
   -------------------------------------------------------------------------- */
.docs-search { position: relative; margin-bottom: var(--space-xl); }

.docs-search__input {
  width: 100%;
  padding: 10px var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color var(--duration) var(--ease-out);
}

.docs-search__input::placeholder { color: var(--text-muted); }
.docs-search__input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-15);
}

.docs-search__panel {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-docs);
}

.docs-search__hit {
  display: block;
  padding: 10px var(--space-md);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.docs-search__hit:last-child { border-bottom: none; }

.docs-search__hit:hover,
.docs-search__hit[aria-selected="true"] { background: var(--gold-15); }

.docs-search__hit-section {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.docs-search__hit-title { display: block; font-size: 14px; color: var(--text); }

.docs-search__empty {
  padding: var(--space-md);
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   4. Breadcrumbs + page header
   -------------------------------------------------------------------------- */
.docs-crumbs { margin-bottom: var(--space-lg); }

.docs-crumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.docs-crumbs__item + .docs-crumbs__item::before {
  content: "/";
  margin-right: var(--space-sm);
  color: var(--border);
}

.docs-crumbs__item a { color: var(--text-muted); text-decoration: none; }
.docs-crumbs__item a:hover { color: var(--gold-text); }
.docs-crumbs__item--current { color: var(--text-secondary); }

.docs-header { margin-bottom: var(--space-2xl); }

.docs-header__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-text);
  margin-bottom: var(--space-sm);
}

.docs-header__title {
  font-size: clamp(30px, 2.4vw + 20px, 44px);
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.docs-header__standfirst {
  color: var(--text-secondary);
  font-size: clamp(16px, 0.6vw + 14px, 19px);
  line-height: 1.6;
  max-width: 60ch;
  margin: 0;
}

/* --------------------------------------------------------------------------
   5. Body — what .prose does not cover
   -------------------------------------------------------------------------- */
.docs-body { max-width: 76ch; }

.docs-body h2 {
  font-size: clamp(22px, 1vw + 18px, 28px);
  padding-top: var(--space-md);
  scroll-margin-top: 96px; /* anchor links clear the sticky nav */
}

.docs-body h3 {
  font-size: clamp(18px, 0.6vw + 15px, 21px);
  scroll-margin-top: 96px;
}

.docs-body h4 { font-size: 16px; margin-top: var(--space-lg); scroll-margin-top: 96px; }

/* Inline code */
.docs-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.12em 0.4em;
  color: var(--gold-text);
  word-break: break-word;
}

/* Fenced blocks — the highlighter emits .highlight > pre > code */
.docs-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  overflow-x: auto;
  margin-block: var(--space-lg);
  font-size: 13.5px;
  line-height: 1.6;
}

.docs-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  word-break: normal;
}

.docs-body .highlight { margin-block: var(--space-lg); }
.docs-body .highlight pre { margin-block: 0; }

/* Tables — wide reference tables must scroll inside their own box rather than
   forcing the page to scroll horizontally.

   The scroll box is the WRAPPER (layouts/_default/_markup/render-table.html),
   not the table. The table itself stays `display: table` so its columns size
   to their content; making the table the scroll box meant `display: block`,
   which collapses column sizing, and it carried `white-space: nowrap` so no
   cell could ever wrap. Together those made every prose cell one long line —
   a table that was always far wider than the page and never used the room it
   had (#490). Cells wrap now, so most of these tables need no scrolling at
   all; the wrapper is the safety net for the genuinely wide ones. */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-block: var(--space-lg);
  /* Nothing to focus visibly unless the box actually scrolls. */
  scrollbar-width: thin;
}

.table-scroll:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* The wrapper owns the vertical rhythm. An overflow box is its own block
   formatting context, so a margin on the table inside would stack on top of
   the wrapper's rather than collapse into it — blog tables set one. */
.table-scroll > table { margin-block: 0; }

.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.docs-body table th,
.docs-body table td {
  border: 1px solid var(--border);
  padding: 8px var(--space-md);
  text-align: left;
  vertical-align: top;
}

.docs-body table th {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.docs-body table td { color: var(--text-secondary); }
.docs-body table tr:nth-child(even) td { background: var(--stripe); }

/* Blockquote — the brand's pull-quote device, reused for callouts. */
.docs-body blockquote {
  border-left: 3px solid var(--gold);
  background: var(--surface);
  padding: var(--space-md) var(--space-lg);
  margin-block: var(--space-lg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.docs-body blockquote p { margin-bottom: var(--space-sm); }
.docs-body blockquote p:last-child { margin-bottom: 0; }

.docs-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------
   6. Cards (section hubs)
   -------------------------------------------------------------------------- */
.docs-group { margin-bottom: var(--space-3xl); }

.docs-group__title { font-size: 20px; margin-bottom: var(--space-xs); }
.docs-group__title a { text-decoration: none; color: var(--text); }
.docs-group__title a:hover { color: var(--gold-text); }

.docs-group__desc {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: var(--space-lg);
  max-width: 60ch;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}

.docs-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}

.docs-card:hover { border-color: var(--gold-40); transform: translateY(-2px); }

.docs-card__title { font-weight: 700; color: var(--text); }
.docs-card__desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.docs-card--product { padding: var(--space-xl); }
.docs-card--product .docs-card__title { font-size: 22px; }

.docs-card__cta {
  margin-top: var(--space-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-text);
}

.docs-cards--products { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.docs-empty { color: var(--text-muted); font-style: italic; }

/* Coming-soon badge — the brand's uppercase micro-label, boxed. Inline-block so
   it sits on the title's baseline without stretching the line box. */
.docs-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: var(--space-sm);
  padding: 3px 8px;
  border: 1px solid var(--gold-40);
  border-radius: var(--radius-full);
  background: var(--gold-15);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.4;
  color: var(--gold-text);
  white-space: nowrap;
}

.docs-badge--sm {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 0.1em;
}

/* A product still in preparation reads as available-but-quieter, not disabled —
   the card stays a working link to the placeholder page. */
.docs-card__cta--muted { color: var(--text-muted); }
.docs-card--product.is-coming-soon { border-style: dashed; }
.docs-card--product.is-coming-soon:hover { border-color: var(--gold-40); }

/* --------------------------------------------------------------------------
   7. Pager + contents rail
   -------------------------------------------------------------------------- */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-3xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.docs-pager__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  max-width: 48%;
  transition: border-color var(--duration) var(--ease-out);
}

.docs-pager__link:hover { border-color: var(--gold-40); }
.docs-pager__link--next { text-align: right; margin-left: auto; }

.docs-pager__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.docs-pager__title { color: var(--gold-text); font-weight: 600; font-size: 14px; }

.docs-toc__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.docs-toc nav ul { list-style: none; margin: 0; padding: 0; }
.docs-toc nav ul ul { padding-left: var(--space-md); }

.docs-toc nav li { margin-bottom: 6px; }

.docs-toc nav a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.4;
  display: block;
}

.docs-toc nav a:hover { color: var(--gold-text); }

/* --------------------------------------------------------------------------
   8. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  /* Contents rail is the first thing to go — the sidebar is load-bearing. */
  .docs-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-shell__toc { display: none; }
}

@media (max-width: 860px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-xl);
    padding-top: var(--space-xl);
  }

  /* Un-stick the sidebar and let it sit above the article, so the page reads
     top-to-bottom on a phone instead of trapping nav in a scroll region. */
  .docs-shell__side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
  }

  .docs-body { max-width: none; }
  .docs-pager { flex-direction: column; }
  .docs-pager__link { max-width: none; }
  .docs-pager__link--next { text-align: left; margin-left: 0; }
}
