/*
 * BuzzRelay Documentation
 * -----------------------
 * Structure and proportions mirror the OverRider docs section so both products
 * read the same way; every colour and font comes from BuzzRelay's own tokens in
 * site.css (--green, --ink, --line, --font-head) rather than OverRider's blues.
 *
 * The site's dark theme is scoped to the home page (see the DARK THEME block in
 * site.css), so docs pages always get the light token values and need no
 * force-light overrides.
 */

.docs-shell,
.docs-hub,
.docs-hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------------------------------------------------------------- Hero --- */

.docs-hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  padding: 56px 0 64px;
}

.docs-hero h1 {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 12px 0 10px;
  color: #fff;
}

.docs-hero-sub {
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.88);
  margin: 0 0 26px;
}

.docs-hero-search { position: relative; max-width: 520px; }

.docs-hero-search svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--muted); pointer-events: none;
}

.docs-hero-search input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 30, 46, 0.16);
}

.docs-hero-search input:focus {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

/* --------------------------------------------------------- Breadcrumbs --- */

.docs-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 0.875rem; margin-bottom: 20px; color: var(--muted);
}
.docs-breadcrumb a { color: var(--muted); text-decoration: none; }
.docs-breadcrumb a:hover { color: var(--green); text-decoration: underline; }
.docs-crumb-sep { opacity: 0.5; }
.docs-crumb-current { color: var(--ink); font-weight: 600; }

.docs-breadcrumb-light,
.docs-breadcrumb-light a,
.docs-breadcrumb-light .docs-crumb-current { color: rgba(255, 255, 255, 0.85); }
.docs-breadcrumb-light a:hover { color: #fff; }
.docs-breadcrumb-light .docs-crumb-current { color: #fff; }

/* ------------------------------------------------------------ Hub list --- */

.docs-hub { padding-top: 44px; padding-bottom: 72px; }
.docs-list { max-width: 780px; }

.docs-group + .docs-group {
  margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line);
}

.docs-group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.docs-group-head h2 {
  font-family: var(--font-head);
  font-size: 1.05rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; margin: 0;
}
.docs-group-head h2 a { color: var(--ink); text-decoration: none; }
.docs-group-head h2 a:hover { color: var(--green); }

.docs-group-desc {
  font-size: 0.9rem; color: var(--ink-soft); margin: 6px 0 4px; line-height: 1.55;
}

.docs-list-items { list-style: none; margin: 12px 0 0; padding: 0; }
.docs-list-items li + li { border-top: 1px solid var(--line); }

.docs-list-link {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 4px; margin: 0 -4px;
  border-radius: 8px; text-decoration: none;
  transition: background 0.14s ease;
}
.docs-list-link:hover { background: var(--bg-soft); }

.docs-list-arrow {
  flex: none; width: 16px; height: 16px; margin-top: 3px;
  color: #c3cfd9; transition: transform 0.14s ease, color 0.14s ease;
}
.docs-list-link:hover .docs-list-arrow { color: var(--green); transform: translateX(2px); }

.docs-list-text { min-width: 0; }
.docs-list-title { display: block; font-size: 0.98rem; font-weight: 650; color: var(--ink); }
.docs-list-link:hover .docs-list-title { color: var(--green); }
.docs-list-desc {
  display: block; font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); margin-top: 2px;
}

.docs-empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }
.docs-hub-back { max-width: 780px; margin: 32px 0 0; }
.docs-hub-back a { color: var(--muted); font-size: 0.9rem; }
.docs-hub-back a:hover { color: var(--green); }

/* -------------------------------------------------------- Article shell --- */

.docs-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 80px;
}

/* Lets overflow-x children shrink instead of widening the grid. */
.docs-main { min-width: 0; }

/* ------------------------------------------------------------- Sidebar --- */

.docs-sidebar {
  position: sticky; top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  /* overflow-y:auto clips anything drawn outside the padding box, which would
     flatten the search input's focus ring — the padding gives it room. */
  padding: 5px 8px 5px 5px;
  scrollbar-width: thin;
}

.docs-search-wrap { position: relative; margin-bottom: 20px; }
.docs-search:focus-visible, .docs-search:focus { outline-offset: 0; }

.docs-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}

.docs-search {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.875rem; font-family: inherit;
  background: var(--bg-soft); color: var(--ink);
}
.docs-search:focus {
  outline: none; border-color: var(--green); background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.14);
}

.docs-nav-group + .docs-nav-group { margin-top: 26px; }

.docs-nav-title {
  padding-left: 14px;   /* 12px link padding + 2px link border = aligned text */
  font-family: var(--font-head);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin: 0 0 8px;
}

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

.docs-nav-link {
  display: block; box-sizing: border-box;
  /* No negative margin: the sidebar is an overflow-y:auto scroll container, so
     anything pushed outside its padding box gets clipped square. */
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.9rem; line-height: 1.45;
  color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid transparent;
}
.docs-nav-link:hover { color: var(--ink); background: var(--bg-soft); }
.docs-nav-link.is-current {
  color: var(--green-dark); background: var(--bg-tint);
  font-weight: 650; border-left-color: var(--green);
}

.docs-nav-empty { font-size: 0.85rem; color: var(--ink-soft); padding: 8px 0; }

.docs-sidebar-toggle {
  display: none; align-items: center; gap: 10px;
  width: 100%; padding: 12px 16px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  color: var(--ink); cursor: pointer;
}
.docs-sidebar-toggle svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------- Article --- */

.docs-article { min-width: 0; }

.docs-title {
  font-family: var(--font-head);
  font-size: clamp(1.75rem, 3.4vw, 2.4rem);
  font-weight: 800; line-height: 1.2; letter-spacing: -0.02em;
  color: var(--ink); margin: 0 0 24px;
}

/* The quotable answer block. */
.docs-short-answer {
  border: 1px solid #bfe6dc;
  border-left: 4px solid var(--green);
  background: var(--bg-tint);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 0 0 34px;
}
.docs-short-label {
  display: block;
  font-family: var(--font-head);
  font-size: 0.7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--green-dark); margin-bottom: 6px;
}
.docs-short-answer p { margin: 0; font-size: 1.02rem; line-height: 1.65; color: #10362f; }

.docs-content { font-size: 1rem; line-height: 1.75; color: var(--ink-soft); }
.docs-content > * + * { margin-top: 1.15em; }

.docs-content h2 {
  font-family: var(--font-head);
  font-size: 1.5rem; font-weight: 750; line-height: 1.3; letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 2.4em; padding-top: 1.1em;
  border-top: 1px solid var(--line);
}
.docs-content h3 {
  font-family: var(--font-head);
  font-size: 1.16rem; font-weight: 700; color: var(--ink); margin-top: 1.9em;
}
.docs-content h4 {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700; color: var(--ink); margin-top: 1.6em;
}

.docs-content a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.docs-content a:hover { color: var(--green-dark); }

.docs-content ul, .docs-content ol { padding-left: 1.4em; }
.docs-content li + li { margin-top: 0.45em; }
.docs-content strong { color: var(--ink); font-weight: 650; }

.docs-content code {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: 0.12em 0.4em;
  color: var(--ink); word-break: break-word;
}

.docs-content pre {
  background: var(--ink); color: #e2ecf1;
  border-radius: var(--radius-sm); padding: 18px 20px;
  overflow-x: auto; font-size: 0.86rem; line-height: 1.6;
}
.docs-content pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }

/* Tables scroll inside their own container; the page never scrolls sideways. */
.docs-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.docs-content table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: #fff; }
.docs-table-wrap table { border: none; }

.docs-content th, .docs-content td {
  text-align: left; padding: 11px 16px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.docs-content th {
  background: var(--bg-soft); font-weight: 700; font-size: 0.83rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft); white-space: nowrap;
}
.docs-content tbody tr:last-child td { border-bottom: none; }

/* Callouts */
.docs-note, .docs-warning, .docs-tip {
  border-radius: var(--radius-sm); padding: 16px 20px;
  border-left: 4px solid; font-size: 0.95rem; line-height: 1.65;
}
.docs-note { background: #eef7fb; border-color: #0ea5e9; color: #0c4a6e; }
.docs-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.docs-tip { background: var(--bg-tint); border-color: var(--green-2); color: #10362f; }

.docs-note p:first-child, .docs-warning p:first-child, .docs-tip p:first-child { margin-top: 0; }
.docs-note p:last-child, .docs-warning p:last-child, .docs-tip p:last-child { margin-bottom: 0; }

.docs-content blockquote {
  border-left: 3px solid var(--line); padding-left: 18px;
  color: var(--ink-soft); font-style: italic;
}

/* ---------------------------------------------------- Related / footer --- */

.docs-related {
  margin-top: 3em; padding: 22px 24px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.docs-related h2 {
  font-family: var(--font-head);
  font-size: 0.98rem; font-weight: 700; margin: 0 0 12px; color: var(--ink);
}
.docs-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.docs-related a { color: var(--green); font-size: 0.92rem; text-decoration: none; }
.docs-related a:hover { text-decoration: underline; }

.docs-updated { margin-top: 2.4em; font-size: 0.85rem; color: var(--muted); }

.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.docs-pager-link {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.docs-pager-link:hover { border-color: var(--green); background: var(--bg-tint); }
.docs-pager-next { text-align: right; }
.docs-pager-dir {
  font-size: 0.76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.docs-pager-title { font-size: 0.95rem; font-weight: 650; color: var(--green); line-height: 1.4; }

.docs-help {
  margin-top: 32px; padding: 18px 22px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 0.92rem; color: var(--ink-soft);
}
.docs-help p { margin: 0; }
.docs-help a { color: var(--green); }

/* ------------------------------------------------------------- Figures --- */

.docs-content figure { margin: 1.8em 0; }
.docs-content figure img, .docs-content img {
  display: block; width: 100%; height: auto; max-width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft);
}
.docs-content figcaption {
  margin-top: 10px; font-size: 0.83rem; line-height: 1.55;
  color: var(--ink-soft); text-align: center;
}

/* ---------------------------------------------------------- Responsive --- */

@media (max-width: 980px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; }
  .docs-sidebar-toggle { display: flex; }
  .docs-sidebar {
    position: static; max-height: none; overflow: visible;
    display: none; margin-bottom: 32px; padding: 20px;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  }
  .docs-sidebar.is-open { display: block; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { text-align: left; }
}

@media (max-width: 600px) {
  .docs-hero { padding: 36px 0 44px; }
  .docs-content th, .docs-content td { padding: 9px 12px; }
}

/* Print: drop the chrome, keep the article. */
@media print {
  .docs-sidebar, .docs-sidebar-toggle, .docs-pager, .docs-help, .docs-hero-search {
    display: none !important;
  }
  .docs-shell { grid-template-columns: 1fr; }
}
