/*
 * Bidirection Docs — the stylesheet.
 *
 * The console's own system, retuned for reading: Archivo for prose, IBM Plex
 * Mono wherever the page names something that exists on screen (a nav path, a
 * control, a DNS value). That split is the point — these articles are about
 * driving an interface, so interface words wear the interface's typeface and
 * prose stays prose.
 *
 * Colour is deliberately restrained: ink on warm paper carries the page, one
 * violet accent marks what you can act on, and the two PRODUCT colours are
 * reserved for the Sales/Support badges, where they carry information rather
 * than decoration. The numbered step spine is the one place the design raises
 * its voice, because a procedure's structure IS its content.
 */

:root {
  --paper: #f3f2f0;
  --surface: #ffffff;
  --sunken: #ecebe8;
  --line: #e2e0dc;
  --line-strong: #cbc8c2;
  --fg: #161614;
  --fg-muted: #5b5a55;
  --fg-subtle: #8a8881;
  --accent: #6a4cd8;
  --accent-soft: #efecfc;
  --sales: #6a4cd8;
  --sales-soft: #efecfc;
  --support: #2f6fe0;
  --support-soft: #e7f0fd;
  --tip: #067a55;
  --tip-soft: #e3f7ef;
  --warn: #9a5b06;
  --warn-soft: #fdf1dc;
  --shadow: 0 1px 2px rgba(22, 22, 20, 0.05), 0 12px 32px -20px rgba(22, 22, 20, 0.22);
  --sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

html.dark {
  --paper: #0f1216;
  --surface: #171a21;
  --sunken: #12151b;
  --line: #262b34;
  --line-strong: #39404c;
  --fg: #e8eaee;
  --fg-muted: #a2a9b5;
  --fg-subtle: #737b8a;
  --accent: #9b8bf7;
  --accent-soft: #241a4d;
  --sales: #9b8bf7;
  --sales-soft: #241a4d;
  --support: #5b9bf5;
  --support-soft: #12233f;
  --tip: #34d399;
  --tip-soft: #0e2a20;
  --warn: #fbbf24;
  --warn-soft: #2a2010;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.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;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  padding: 0.6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 6px 0;
}
.skip:focus {
  left: 0;
}

/* ───────────────────────── top bar ───────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.75rem;
  padding: 0 1.25rem;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: none;
}
/* The real Bidirection mark. It is a dark monochrome asset drawn for light
 * grounds, so the dark theme flips it to white — the same treatment the console
 * gives the logo in its own header. */
.brand__mark {
  width: 1.15rem;
  height: 1.15rem;
  align-self: center;
  display: block;
}
html.dark .brand__mark {
  filter: brightness(0) invert(1);
}
.brand__doc {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fg-subtle);
  letter-spacing: 0;
}
.brand__doc::before {
  content: '/';
  margin-right: 0.45rem;
  color: var(--line-strong);
}

.search {
  position: relative;
  flex: 1;
  max-width: 26rem;
  margin-inline: auto;
}
.search input {
  width: 100%;
  height: 2.25rem;
  padding: 0 2.25rem 0 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}
.search input::placeholder {
  color: var(--fg-subtle);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.search kbd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-subtle);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  pointer-events: none;
}
.search input:focus ~ kbd {
  display: none;
}

.results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 0.3rem;
}
.results a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--fg);
}
.results a:hover,
.results a.is-active {
  background: var(--sunken);
}
.results .r__t {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}
.results .r__s {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--fg-subtle);
  margin-top: 0.1rem;
}
.results .r__none {
  padding: 1.25rem 0.6rem;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.88rem;
}

.top__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}
.top__link {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
}
.top__link:hover {
  color: var(--fg);
}
.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover {
  color: var(--fg);
  border-color: var(--fg-subtle);
}
.icon-btn svg {
  width: 1rem;
  height: 1rem;
}
.icon-btn--menu {
  display: none;
}

/* ───────────────────────── layout ───────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 0;
  max-width: 88rem;
  margin: 0 auto;
  align-items: start;
}

.nav {
  position: sticky;
  top: 3.75rem;
  max-height: calc(100vh - 3.75rem);
  overflow-y: auto;
  padding: 1.75rem 1rem 3rem 1.25rem;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.nav__group + .nav__group {
  margin-top: 1.5rem;
}
.nav__title {
  margin: 0 0 0.5rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg-subtle);
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__link {
  display: block;
  padding: 0.33rem 0.55rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.nav__link:hover {
  color: var(--fg);
  background: var(--sunken);
}
.nav__link.is-current {
  color: var(--fg);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--sunken);
}

/* ───────────────────────── home ───────────────────────── */

.home {
  padding: 3.5rem 2rem 5rem;
  max-width: 62rem;
}
.hero {
  max-width: 44rem;
  padding-bottom: 2.75rem;
  border-bottom: 1px solid var(--line);
}
.hero__eyebrow {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-subtle);
}
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.hero__sub {
  margin: 1rem 0 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--fg-muted);
  max-width: 38rem;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  height: 2.5rem;
  padding: 0 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--fg-subtle);
}
.btn--primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--paper);
}
.btn--primary:hover {
  opacity: 0.9;
}

/* Columns, not a grid. The six sections have wildly different lengths (three
 * articles vs seven), and a grid forces every cell in a row to the tallest —
 * which left a dead half-screen under "Start here". Columns let each section
 * flow to its own height and the shelf stays balanced. */
.cards {
  columns: 16rem;
  column-gap: 2.5rem;
  margin-top: 2.75rem;
}
.card {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 2.25rem;
}
.card h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.card__lede {
  margin: 0.3rem 0 0.9rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.card__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.card__list a {
  display: block;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--fg);
}
.card__list a:hover .card__t {
  color: var(--accent);
}
.card__t {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
}
.card__s {
  display: block;
  font-size: 0.8rem;
  color: var(--fg-subtle);
  line-height: 1.5;
}

.foot-help {
  margin-top: 3.5rem;
  padding: 1.5rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.foot-help h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}
.foot-help p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.92rem;
}

/* ───────────────────────── article ───────────────────────── */

.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 3rem;
  padding: 2.5rem 2rem 6rem;
  align-items: start;
}
.article > article {
  max-width: 44rem;
  min-width: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-subtle);
  margin-bottom: 1rem;
}
.crumbs a {
  color: var(--fg-subtle);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--fg);
}
.crumbs i {
  font-style: normal;
  color: var(--line-strong);
}

.article h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.032em;
  font-weight: 700;
}
.lede {
  margin: 0.75rem 0 0;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--fg-muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

/* The console path an article covers — mono, because it names real screen
 * furniture, and the reader should be able to match it letter for letter. */
.where {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
}
.where i {
  font-style: normal;
  color: var(--fg-subtle);
}

.badge {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.badge--sales {
  color: var(--sales);
  background: var(--sales-soft);
}
.badge--support {
  color: var(--support);
  background: var(--support-soft);
}

.prose {
  margin-top: 1.75rem;
}
.prose > *:first-child {
  margin-top: 0;
}
.prose p {
  margin: 0 0 1.1rem;
  max-width: 68ch;
}
.prose h2 {
  margin: 2.75rem 0 0.9rem;
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  scroll-margin-top: 5rem;
}
.prose h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.05rem;
  letter-spacing: -0.012em;
  scroll-margin-top: 5rem;
}
.prose h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.95rem;
}
.anchor {
  margin-left: 0.4rem;
  font-weight: 400;
  color: var(--line-strong);
  text-decoration: none;
  opacity: 0;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.prose strong {
  font-weight: 600;
  color: var(--fg);
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08em 0.34em;
}
.prose a code {
  color: inherit;
}

.prose ul {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  max-width: 68ch;
}
.prose ul li {
  margin-bottom: 0.4rem;
}
.prose ul li::marker {
  color: var(--fg-subtle);
}

/* The numbered step spine — the one loud element. A procedure's structure is
 * its content, so the sequence is drawn, not implied. */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 1.4rem;
  padding: 0;
  max-width: 68ch;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  padding-bottom: 1.15rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.05rem;
  width: 1.65rem;
  height: 1.65rem;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.steps > li::after {
  content: '';
  position: absolute;
  left: 0.82rem;
  top: 1.75rem;
  bottom: 0.2rem;
  width: 1px;
  background: var(--line-strong);
}
.steps > li:last-child {
  padding-bottom: 0;
}
.steps > li:last-child::after {
  display: none;
}
.steps > li > p:last-child,
.steps > li > ul:last-child,
.steps > li > .table-wrap:last-child,
.steps > li > .code:last-child {
  margin-bottom: 0;
}
.steps ul,
.steps .code,
.steps .callout {
  margin-top: 0.6rem;
}

.callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.6rem;
  margin: 1.4rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--fg-subtle);
  border-radius: 8px;
  background: var(--surface);
  max-width: 68ch;
}
.callout__label {
  grid-column: 1 / -1;
  margin: 0 0 0.25rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.callout__body {
  grid-column: 1 / -1;
  font-size: 0.93rem;
}
/* The source reads "**Note** — the agent holds…", which is a correct sentence
 * in the markdown (and in the search index). Rendering lifts the label into its
 * own line, leaving the body starting mid-sentence in lower case — so the first
 * letter is restored here rather than by contorting the prose. */
.callout__body > p:first-child::first-letter {
  text-transform: capitalize;
}
.callout__body > p:first-child {
  margin-top: 0;
}
.callout__body > *:last-child {
  margin-bottom: 0;
}
.callout--info {
  border-left-color: var(--accent);
  background: color-mix(in oklab, var(--accent-soft) 60%, var(--surface));
}
.callout--info .callout__label {
  color: var(--accent);
}
.callout--tip {
  border-left-color: var(--tip);
  background: color-mix(in oklab, var(--tip-soft) 60%, var(--surface));
}
.callout--tip .callout__label {
  color: var(--tip);
}
.callout--warn {
  border-left-color: var(--warn);
  background: color-mix(in oklab, var(--warn-soft) 60%, var(--surface));
}
.callout--warn .callout__label {
  color: var(--warn);
}

blockquote {
  margin: 1.3rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line-strong);
  color: var(--fg-muted);
}

.code {
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  position: relative;
}
.code code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.45rem;
  right: 0.7rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-subtle);
}

.table-wrap {
  margin: 1.4rem 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  background: var(--sunken);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: 0;
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.related {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.related h2 {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-subtle);
}
.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.related a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.83rem;
  color: var(--fg);
  text-decoration: none;
}
.related a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 48%;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
}
.pager a:hover {
  border-color: var(--accent);
}
.pager span {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-subtle);
}
.pager strong {
  font-size: 0.9rem;
  font-weight: 500;
}
.pager__next {
  margin-left: auto;
  text-align: right;
}

.toc {
  position: sticky;
  top: 5.25rem;
  font-size: 0.83rem;
}
.toc__title {
  margin: 0 0 0.55rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-subtle);
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.toc a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.8rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.45;
}
.toc a:hover {
  color: var(--fg);
}
.toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ───────────────────────── responsive ───────────────────────── */

@media (max-width: 1100px) {
  .article {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .nav {
    display: none;
    position: fixed;
    inset: 3.75rem 0 0 0;
    z-index: 35;
    max-height: none;
    background: var(--paper);
    border-right: 0;
    padding: 1.5rem 1.25rem 4rem;
  }
  .nav.is-open {
    display: block;
  }
  .icon-btn--menu {
    display: grid;
  }
  .top__link {
    display: none;
  }
  .search {
    max-width: none;
  }
  .article,
  .home {
    padding: 2rem 1.15rem 4rem;
  }
  .brand__name {
    display: none;
  }
}

@media (max-width: 560px) {
  .pager {
    flex-direction: column;
  }
  .pager a {
    max-width: none;
  }
  .pager__next {
    text-align: left;
  }
}
