:root {
  --bdq-brand: #155799;
  --bdq-brand-2: #159957;
  --bdq-link: #0969da;
  --bdq-border: #d0d7de;
  --bdq-muted: #586069;
  --bdq-bg-soft: #f6f8fa;
  --bdq-bg-soft-2: rgba(129, 139, 152, 0.12);
  --bdq-review: #c0392b;
  --bdq-text: #24292f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--bdq-text);
  background: #fff;
}

.page-header {
  color: #fff;
  background-color: var(--bdq-brand);
  background-image: linear-gradient(120deg, var(--bdq-brand), var(--bdq-brand-2));
  padding: 1.5rem 1rem;
}

.page-header-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.site-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.site-logo {
  width: 200px;
  height: 84px;
  display: block;
}

.page-header-text {
  min-width: 0;
}

.project-name {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.project-name-link {
  color: #fff;
  text-decoration: none;
}

.project-name-link:hover {
  text-decoration: underline;
}

.project-tagline {
  margin: 0.5rem 0 0 0;
  max-width: 60rem;
  opacity: 0.95;
  font-size: 1.05rem;
}

.main-content {
  margin: 0;
  padding: 2rem 1rem 4rem 1rem;
}
.site-logo-print { display: none; }

.doc-header {
  margin-bottom: 1.5rem;
}

.review-banner {
  display: inline-block;
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--bdq-review);
  border-radius: 0.35rem;
  /* Left border adds a shape indicator so draft status is not
     conveyed by colour alone (WCAG 1.4.1).                   */
  border-left: 4px solid rgba(0, 0, 0, 0.30);
}

.doc-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.doc-sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.back-to-top {
  margin: 0 0 8px 0; font-size: 0.82em;
}
.back-to-top a {
  color: var(--bdq-link); text-decoration: none;
}
.back-to-top a:hover {
  text-decoration: underline;
}


.page-toc {
  padding: 1rem;
  border: 1px solid var(--bdq-border);
  border-radius: 0.5rem;
  background: var(--bdq-bg-soft);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.page-toc h2 {
  margin-top: 0;
  font-size: 1rem;
}

.page-toc ul {
  margin: 0;
  padding-left: 1.1rem;
}

.page-toc li {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* .toc-h2 — class present on all h2-level TOC entries for forward
   compatibility with the toc-h3 path.  No visual override is needed
   since the base .page-toc li style applies.
   To enable h3 entries: uncomment the .page-toc li.toc-h3 rule below
   and make the matching changes in build_toc_html() in render_site.py
   and in the toc.js dynamic-build fallback simultaneously.           */

.page-toc li.toc-h3 {
  margin-left: 0.75rem;
  font-size: 0.95rem;
}

.page-toc a {
  color: var(--bdq-link);
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-toc a:hover {
  text-decoration: underline;
}

.toc-empty {
  color: var(--bdq-muted);
  font-size: 0.95rem;
  margin: 0;
}

.doc-content {
  min-width: 0;
}

.doc-content img {
  max-width: 100%;
  height: auto;
}

.doc-content table {
  display: block;
  width: 100%;
  overflow: auto;
  border-collapse: collapse;
}

.doc-content th,
.doc-content td {
  border: 1px solid var(--bdq-border);
  padding: 0.4rem 0.6rem;
  vertical-align: top;
}

.doc-content th {
  background: var(--bdq-bg-soft);
  font-weight: 700;
  text-align: center;
}

.doc-content pre {
  padding: 1rem;
  overflow: auto;
  background: var(--bdq-bg-soft);
  border-radius: 0.4rem;
}

.doc-content code {
  padding: 0.1rem 0.3rem;
  background: var(--bdq-bg-soft-2);
  border-radius: 0.25rem;
}

.doc-content pre code,
.doc-content .highlight code {
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.doc-content a {
  color: var(--bdq-link);
  text-decoration: none;
}

.doc-content a:hover {
  text-decoration: underline;
}

.site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem 1rem;
  color: var(--bdq-muted);
  border-top: 1px solid var(--bdq-border);
}

.sidebar-context {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--bdq-border);
  border-radius: 0.5rem;
  background: var(--bdq-bg-soft);
}

.sidebar-context h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.sidebar-context-links {
  margin: 0;
  padding-left: 1.1rem;
}

.sidebar-context-links li {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar-context-links a {
  color: var(--bdq-link);
  text-decoration: none;
}

.sidebar-context-links a:hover {
  text-decoration: underline;
}

/* Sidebar toggle button — hidden on desktop; the max-width:960px
   media query below overrides this to display:flex on narrow screens. */
.sidebar-toggle {
  display: none;
}

@media (max-width: 960px) {
  .doc-shell {
    grid-template-columns: 1fr;
  }

  .doc-sidebar {
    position: static;
    order: -1;
  }

  .page-toc {
    max-height: none;
  }

  /* Show the toggle button on narrow screens */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bdq-bg-soft);
    border: 1px solid var(--bdq-border);
    border-radius: 0.4rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--bdq-text);
    cursor: pointer;
    text-align: left;
    margin-bottom: 0.5rem;
  }

  .sidebar-toggle:hover {
    background: var(--bdq-bg-soft-2);
  }

  /*
    Sidebar content collapsed by default on mobile.
    JS adds .is-open on toggle; the <noscript> rule in page.html
    forces display:block so content is always reachable without JS.
  */
  #sidebar-inner {
    display: none;
  }

  #sidebar-inner.is-open {
    display: block;
  }

  .project-name {
    font-size: 1.6rem;
  }

  .page-header-inner {
    align-items: flex-start;
  }

  .site-logo {
    width: 100px;
    height: 42px;
    margin-top: 0.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Accessibility utilities
   ═══════════════════════════════════════════════════════════════ */

/*
  Skip link: visually off-screen until keyboard-focused, then
  slides to the top-left corner of the viewport.
  No underline by default; underline on hover consistent with
  the site-wide link convention.
*/
.skip-link {
  position: absolute;
  left: -9999px;
  top: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: #000;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 0.3rem 0.3rem;
  white-space: nowrap;
}

.skip-link:focus {
  left: 0;
}

.skip-link:hover {
  text-decoration: underline;
}

/*
  The skip link moves programmatic focus to <main id="main-content"
  tabindex="-1">.  Suppress the focus ring on that container — a
  :focus-visible outline on <main> would draw a large rectangle
  around the entire content area, which is visually jarring.
*/
#main-content:focus,
#main-content:focus-visible {
  outline: none;
}

/*
  Screen-reader-only utility — hides content visually while keeping
  it in the accessibility tree.  Used for the sidebar toggle button label.
*/
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/*
  Keyboard focus indicator.
  :focus-visible targets keyboard navigation only, leaving mouse
  clicks unaffected (WCAG 2.4.7, 2.4.11).
  Because body links are not underlined, this ring is the primary
  non-colour cue for keyboard users.
*/
:focus-visible {
  outline: 3px solid var(--bdq-brand);
  outline-offset: 2px;
  border-radius: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/*
  Scroll margin — small breathing room above anchor targets
  when the browser jumps to a heading.
*/
h1, h2, h3, h4, h5, h6 {
  scroll-margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   Print
   ═══════════════════════════════════════════════════════════════ */

@media print {

  /* ── Hide navigation and interactive chrome ── */
  .doc-sidebar,
  .sidebar-toggle,
  .back-to-top    { display: none !important; }

  /* ── Strip the decorative gradient from the site header ── */
  .page-header {
    background-image: none;
    background-color: #fff;
    color: #000;
    border-bottom: 1pt solid #000;
    padding: 0.5rem 0;
  }

  /* switch out the all white logo that works on the gradient background for one that shows up on print with the gradient removed */
  .site-logo-screen { display: none; }
  .site-logo-print  { display: block; }

  .project-name-link,
  .project-tagline  { color: #000 !important; }

  /* ── Expand content to full page width ── */
  .main-content {
    max-width: 100% !important;
    margin:    0    !important;
    padding:   0    !important;
  }

  .doc-shell,
  .doc-content {
    display:   block !important;
    max-width: 100%  !important;
    padding:   0     !important;
    margin:    0     !important;
  }

  /* ── Restore native table layout so content is not clipped by the
     overflow:auto rule that enables horizontal scrolling on screen ── */
  .doc-content table {
    display:  table   !important;
    overflow: visible !important;
    width:    100%    !important;
  }

  /* ── Print-friendly typography ── */
  body {
    font-size:   11pt;
    line-height: 1.5;
    color:       #000;
    background:  #fff;
  }

  /*
    Review banner: strip colour so it prints legibly on monochrome
    printers; border-left preserves the shape indicator.
    No display override — the QRG page has its own
    display:none !important in its inline <style> which continues
    to win that cascade battle without interference from this rule.
  */
  .review-banner {
    background:  none           !important;
    color:       #000           !important;
    border:      1pt solid #000 !important;
    border-left: 4pt solid #000 !important;
    padding:     4pt 6pt;
    margin-bottom: 12pt;
  }

  /*
    Show destination URLs after external links.
    href^="http" matches both http:// and https:// URLs — a
    separate https selector would be redundant since https starts
    with http.
    Because links are not underlined in screen style, printing the
    URL is especially important for usability of printed copies.
  */
  .doc-content a[href^="http"]::after {
    content:       " <" attr(href) ">";
    font-size:     0.8em;
    overflow-wrap: break-word;
    color:         #444;
    font-weight:   normal;
  }

  /* Suppress URL annotation for same-page anchor links */
  .doc-content a[href^="#"]::after { content: none; }

  /* ── Prevent page breaks inside block content ── */
  pre,
  .highlight,
  table,
  figure,
  blockquote {
    break-inside:      avoid;   /* modern */
    page-break-inside: avoid;   /* legacy */
  }

  h1, h2, h3, h4, h5, h6 {
    break-after:       avoid;   /* modern */
    page-break-after:  avoid;   /* legacy */
    break-inside:      avoid;   /* modern */
    page-break-inside: avoid;   /* legacy */
  }

  /* ── Wrap code rather than overflowing the paper margin.
     overflow-wrap:break-word breaks only when a token genuinely
     exceeds the line width, preserving readability better than
     word-break:break-all which breaks at any character boundary. ── */
  pre,
  code {
    white-space:   pre-wrap;
    overflow-wrap: break-word;
  }

  /* ── Alias anchors serve no purpose in print ── */
  .anchor-target { display: none; }

  /* ── Footer: keep attribution visible but compact ── */
  .site-footer {
    border-top: 1pt solid #000;
    padding:    6pt 0 0 0;
    color:      #000;
    font-size:  9pt;
  }
}
